def display_weld_results(modelSpace,welds2Check,ULS,set2displ=None): '''Calculate limit state ULS and display internal forces in welds. Print the total internal forces for each weld seam. set2displ is the set to display displacements (defaults to None) ''' singlWelds=steel_connection.init_prop_checking_welds(welds2Check) lstWEldSets=[w[0].weldSet for w in singlWelds] oh= output_handler.OutputHandler(modelSpace) # weldsSet=modelSpace.setSum('weldsSet',lstWEldSets) # oh.displayFEMesh(weldsSet) modelSpace.removeAllLoadPatternsFromDomain() modelSpace.addLoadCaseToDomain(ULS) modelSpace.analyze(calculateNodalReactions=True) for w in singlWelds: descr=w[0].descr st=w[0].weldSet if set2displ: oh.displayDispRot('uX',set2displ) oh.displayDispRot('uY',set2displ) oh.displayDispRot('uZ',set2displ) oh.displayIntForcDiag('N',st) oh.displayIntForcDiag('Vy',st) oh.displayIntForcDiag('Vz',st) N=0 Vper=0 Vpar=0 for e in st.elements: N+=e.getN() Vper+=e.getVy() Vpar+=e.getVz() print(descr,' N=',round(N*1e-3),' Vper=',round(Vper*1e-3), ' Vpar=',round(Vpar*1e-3))
def getOutputHandler(self, setToDisplay): ''' Return an output handler from the set argument. NOT a very elegant solution-> to refactor.''' modelSpace= predefined_spaces.getModelSpaceFromPreprocessor(setToDisplay.getPreprocessor) outputHandler= oh.OutputHandler(modelSpace) outputHandler.outputStyle.cameraParameters= self.cameraParameters return outputHandler
def writeLoadReport(self, modelSpace, texFile, cfg): '''Creates the graphics files of loads for the load case and insert them in a LaTex file :param modelSpace: model space object (see predefined_spaces.py). :param texFile: laTex file where to include the graphics (e.g.:'text/report_loads.tex') :param cfg: instance of EnvConfig class with config parameters ''' fullPath = cfg.projectDirTree.getReportLoadsGrPath() rltvPath = cfg.projectDirTree.getRltvReportLoadsGrPath() description = self.getDescription() FEcase = modelSpace.getProblem() outputHandler = output_handler.OutputHandler(modelSpace) modelSpace.removeAllLoadPatternsFromDomain() modelSpace.revertToStart() modelSpace.addNewLoadCaseToDomain(self.loadCaseName, self.loadCaseExpr) # The disctinction between beam elements and the rest of elements # is to deprecate. The idea is to specify the type of output for all # the elements. for st in self.setsToDispLoads: fullgrfname = fullPath + self.loadCaseName + st.name rltvgrfname = rltvPath + self.loadCaseName + st.name capt = self.getCaptionText(setDescr=st.description, unitsDescr=self.unitsLoads) labl = getLabelText(capt) jpegFileName = fullgrfname + '.jpg' #outputHandler.displayLoads(setToDisplay=st,caption= capt,fileName= jpegFileName) # changed 22/06/2020 outputHandler.displayLoadVectors(setToDisplay=st, caption=capt, fileName=jpegFileName) oh.insertGrInTex(texFile=texFile, grFileNm=rltvgrfname, grWdt=cfg.grWidth, capText=capt, labl=labl) for st in self.setsToDispBeamLoads: fullgrfname = fullPath + self.loadCaseName + st.name rltvgrfname = rltvPath + self.loadCaseName + st.name capt = self.getCaptionText(setDescr=st.description, unitsDescr=self.unitsLoads) labl = getLabelText(capt) jpegFileName = fullgrfname + '.jpg' outputHandler.displayLoads( setToDisplay=st, caption=capt, fileName=jpegFileName) # changed 22/06/2020 oh.insertGrInTex(texFile=texFile, grFileNm=rltvgrfname, grWdt=cfg.grWidth, capText=capt, labl=labl)
def writeSimpleLoadCaseReport(self, modelSpace, texFile, cfg): '''Creates the graphics files of displacements and internal forces calculated for a simple load case and insert them in a LaTex file :param modelSpace: model space object (see predefined_spaces.py). :param texFile: laTex file where to include the graphics (e.g.:'text/report_loads.tex') :param cfg: instance of EnvConfig class with config parameters ''' fullPath=cfg.projectDirTree.getReportSimplLCGrPath() rltvPath=cfg.projectDirTree.getRltvReportSimplLCGrPath() outputHandler= output_handler.OutputHandler(modelSpace) #Displacements and rotations displays for st in self.setsToDispDspRot: for arg in self.listDspRot: fullgrfname=fullPath+self.loadCaseName+st.name+arg rltvgrfname=rltvPath+self.loadCaseName+st.name+arg grFileName= fullgrfname+'.png' outputHandler.displayDispRot(itemToDisp=arg,setToDisplay=st,fileName= grFileName) # unitConversionFactor, unDesc= cfg.outputStyle.getUnitParameters(arg) unitConversionFactor, unDesc= cfg.getUnitParameters(arg) # if 'u' in arg: # unDesc=cfg.getDisplacementUnitsDescription() # else: # unDesc=cfg.getRotationUnitsDescription() capt= self.getCaptionText(setDescr= st.description, captTexts= cfg.capTexts[arg], unitsDescr= unDesc) oh.insertGrInTex(texFile=texFile,grFileNm=rltvgrfname,grWdt=cfg.grWidth,capText=capt) # The disctinction between beam elements and the rest of elements # is to deprecate. The idea is to specify the type of output for all # the elements. #Internal forces displays on sets of «shell» elements for st in self.setsToDispIntForc: for arg in self.listIntForc: fullgrfname=fullPath+self.loadCaseName+st.name+arg rltvgrfname=rltvPath+self.loadCaseName+st.name+arg grFileName= fullgrfname+'.png' outputHandler.displayIntForc(itemToDisp=arg,setToDisplay=st,fileName= grFileName,orientScbar=1,titleScbar=None) capt= self.getCaptionText(setDescr= st.description, captTexts= cfg.capTexts[arg], unitsDescr= cfg.getForceUnitsDescription()) oh.insertGrInTex(texFile=texFile,grFileNm=rltvgrfname,grWdt=cfg.grWidth,capText=capt) #Internal forces displays on sets of «beam» elements for st in self.setsToDispBeamIntForc: for arg in self.listBeamIntForc: fullgrfname=fullPath+self.loadCaseName+st.name+arg rltvgrfname=rltvPath+self.loadCaseName+st.name+arg grFileName= fullgrfname+'.png' outputHandler.displayIntForcDiag(itemToDisp=arg,setToDisplay=st,fileName= grFileName,orientScbar=1,titleScbar=None) capt= self.getCaptionText(setDescr= st.description, captTexts= cfg.capTexts[arg], unitsDescr= cfg.getForceUnitsDescription()) oh.insertGrInTex(texFile=texFile,grFileNm=rltvgrfname,grWdt=cfg.grWidth,capText=capt) texFile.write('\\cleardoublepage\n')
nodes = preprocessor.getNodeHandler modelSpace = deck_geometry.DeckGeometry(nodes) xcTotalSet = preprocessor.getSets.getSet('total') execfile('datos_base_xci.py') modelSpace.defineTablero() modelSpace.defineSets() execfile('modelo/materiales_xci.py') modelSpace.genMesh() modelSpace.setConstraints() LTot = modelSpace.getLTot() modelSpace.defineSetsPretensado() modelSpace.mallaTendones(areaCordon) # Graphic stuff. oh = output_handler.OutputHandler(modelSpace) oh.displayBlocks() oh.displayFEMesh() quit() execfile('acciones/define_casos_carga_xci.py') execfile('acciones/parametros_carga_xci.py') execfile('acciones/carga_viga_xci.py') execfile('modelo/genera_malla_losa_sup_xci.py') execfile('acciones/sets_def_cargas_xci.py') execfile('acciones/cargas_puente_xci.py') execfile('modelo/sets_listados_xci.py')
#Data execfile(workingDirectory + 'data.py') # *** GEOMETRIC model (points, lines, surfaces) - SETS *** FEcase = xc.FEProblem() preprocessor = FEcase.getPreprocessor prep = preprocessor #short name nodes = prep.getNodeHandler elements = prep.getElementHandler elements.dimElem = 3 # Problem type modelSpace = predefined_spaces.StructuralMechanics3D(nodes) #Defines the # dimension of the space: nodes by three coordinates (x,y,z) and # six DOF for each node (Ux,Uy,Uz,thetaX,thetaY,thetaZ) out = outHndl.OutputHandler(modelSpace, sty) # coordinates in global X,Y,Z axes for the grid generation xList = [R] #radius coordinate ndiv = 20 incr = 180 / ndiv yList = [i * incr for i in range(ndiv + 1)] #angular coordinate zList = [zBaseCyl, zBaseCyl + height] #level coordinate #auxiliary data lastXpos = len(xList) - 1 lastYpos = len(yList) - 1 lastZpos = len(zList) - 1 # grid model definition gridGeom = gm.GridModel(prep, xList, yList, zList)
## ULS strength analysis. uls_results= wall.performULSAnalysis(strengthULSCombinations) wall.setULSInternalForcesEnvelope(uls_results.internalForces) pth= "./results/" # fsr= open(pth+'verification_results.tex','w') # sr.writeOutput(fsr) # fsr.close() #wall.writeResult(pth) wall.drawSchema(pth) ######################################################### # Graphic stuff. oh= output_handler.OutputHandler(wall.modelSpace) ## Uncomment to display blocks oh.displayBlocks() ## Uncomment to display the mesh #oh.displayFEMesh() ## Uncomment to display the loads #oh.displayLoads() ## Uncomment to display the vertical displacement #oh.displayDispRot(itemToDisp='uX') #oh.displayNodeValueDiagram(itemToDisp='uX') ## Uncomment to display the reactions #oh.displayReactions()
def gen_report_files(modelSpace,genDescr,specDescr,loadCaseNames,reportPath,rltvResPath,grWidth,texfileNm,boltSets2Check=[],welds2Check=[],baseMetal=None,meanShearProc=True): '''Generates the graphics corresponding to loads and displacements for each load case, together with the tex file to include them in a report. :param genDescr: general description :param specDescr: specific description :param loadCaseNames: list of load case names :param reportPath: directory where report is to be generated :param rltvResPath: directory where to place the text file relative to reportPath :param grWidth: with to insert the graphics :param texfileNm: name of the tex file. :param boltSets2Check: list of pairs (bolt set, bolt type) with the set of bolts and bolt material (instance of class astm.BoltFastener) to be analyzed. (Defaults to []) :param welds2Check: welds (instances of classes FilletWeld or multiFilletWeld) to check :param baseMetal: steel of the plate (only used when welds are checked). Defaults to None :paran meanShearProc: if True, each bolt is verified using the mean shear of the set of bolts (defaults to True) ''' oh= output_handler.OutputHandler(modelSpace) resPath=reportPath+rltvResPath if not os.path.isdir(resPath): os.mkdir(resPath) grPath=resPath+'graphics/' if not os.path.isdir(grPath): os.mkdir(grPath) texPath=reportPath+rltvResPath ; grPath=texPath+'graphics/'; rltvGrPath=rltvResPath+'graphics/' # Initialize properties of bolts and welds steel_connection.init_prop_checking_bolts(boltSets2Check) singlWelds=steel_connection.init_prop_checking_welds(welds2Check) # load cases lcNm=[str(ULS) for ULS in loadCaseNames] lcNm.sort() f=open(texPath+texfileNm+'_load_disp.tex','w') cont=0 for ULS in lcNm: txtDescr=genDescr+' '+specDescr+' '+ULS + ': ' modelSpace.removeAllLoadPatternsFromDomain() modelSpace.addLoadCaseToDomain(ULS) #loads captFig=specDescr+' '+ ULS + ': loads [kN]' graphNm=texfileNm+'_'+ULS+'_loads' oh.displayLoads(caption=captFig,fileName=grPath+graphNm+'.jpg') captTxt=txtDescr+ 'loads [kN]' addGraph2Tex(f,rltvGrPath+graphNm,captTxt,grWidth) #displacements result= modelSpace.analyze(calculateNodalReactions= True) graphNm=texfileNm+'_'+ULS+'_uX' oh.displayDispRot(itemToDisp='uX',fileName=grPath+graphNm+'.jpg') captTxt=txtDescr+ 'displacement in global X direction [mm]' addGraph2Tex(f,rltvGrPath+graphNm,captTxt,grWidth) graphNm=texfileNm+'_'+ULS+'_uY' oh.displayDispRot(itemToDisp='uY',fileName=grPath+graphNm+'.jpg') captTxt=txtDescr+ 'displacement in global Y direction [mm]' addGraph2Tex(f,rltvGrPath+graphNm,captTxt,grWidth) graphNm=texfileNm+'_'+ULS+'_uZ' oh.displayDispRot(itemToDisp='uZ',fileName=grPath+graphNm+'.jpg') captTxt=txtDescr+ 'displacement in global Z direction [mm]' addGraph2Tex(f,rltvGrPath+graphNm,captTxt,grWidth) cont+=3 if cont>20: f.write('\\clearpage \n') cont=0 #Bolts checking steel_connection.set_bolt_check_resprop_current_LC(ULS,boltSets2Check,meanShearProc) #Welds checking steel_connection.set_welds_check_resprop_current_LC(ULS,singlWelds,baseMetal) f.close() #print results of bolt checking if len(boltSets2Check)>0: Lres=print_bolt_results(boltSets2Check) f=open(texPath+texfileNm+'_bolts.tex','w') f.writelines(Lres) f.close() #print results of weld checking if len(welds2Check)>0: Lres=print_welds_results(singlWelds) f=open(texPath+texfileNm+'_welds.tex','w') f.writelines(Lres) f.close()
def gen_report_files(modelSpace, genDescr, specDescr, loadCaseNames, reportPath, rltvResPath, grWidth, texfileNm, boltSets2Check=[], welds2Check=[], baseMetal=None, meanShearProc=True, genGrULSs=True, linear=True, warningsFile=None, Phi=0.75): '''Generates the graphics corresponding to loads and displacements for each load case, together with the tex file to include them in a report. :param genDescr: general description :param specDescr: specific description :param loadCaseNames: list of load case names :param reportPath: directory where report is to be generated :param rltvResPath: directory where to place the text file relative to reportPath :param grWidth: with to insert the graphics :param texfileNm: name of the tex file. :param boltSets2Check: list of pairs (bolt set, bolt type) with the set of bolts and bolt material (instance of class astm.BoltFastener) to be analyzed. (Defaults to []) :param welds2Check: welds (instances of classes FilletWeld or multiFilletWeld) to check :param baseMetal: steel of the plate (only used when welds are checked). Defaults to None :param meanShearProc: if True, each bolt is verified using the mean shear of the set of bolts (defaults to True) :param genGrULSs: generate graphics of loads and displacements for all the load cases. (Defaults to True) :param linear: if linear analysis (default) = True, else nonlinear analysis. :param warningsFile: name of the file of warnings (defaults to None) :param Phi: resistance factor (defaults to 0.75) ''' oh = output_handler.OutputHandler(modelSpace) resPath = reportPath + rltvResPath if not os.path.isdir(resPath): os.mkdir(resPath) grPath = resPath + 'graphics/' if not os.path.isdir(grPath): os.mkdir(grPath) texPath = reportPath + rltvResPath grPath = texPath + 'graphics/' rltvGrPath = rltvResPath + 'graphics/' # Initialize properties of bolts and welds steel_connection.init_prop_checking_bolts(boltSets2Check) singlWelds = steel_connection.init_prop_checking_welds(welds2Check) # load cases lcNm = [str(ULS) for ULS in loadCaseNames] lcNm.sort() if genGrULSs: f = open(texPath + texfileNm + '_load_disp.tex', 'w') cont = 0 if linear: # modelSpace.solutionProcedureType= predefined_solutions.simple_static_linear(modelSpace.getProblem()) modelSpace.solutionProcedureType = predefined_solutions.SimpleStaticLinear else: modelSpace.solutionProcedureType = predefined_solutions.PenaltyModifiedNewton( modelSpace.getProblem(), maxNumIter=25, convergenceTestTol=5.0e-2, printFlag=2) for ULS in lcNm: txtDescr = genDescr + ' ' + specDescr + ' ' + ULS + ': ' modelSpace.removeAllLoadPatternsFromDomain() modelSpace.revertToStart() modelSpace.addLoadCaseToDomain(ULS) result = modelSpace.analyze(calculateNodalReactions=True) if genGrULSs: #loads captFig = specDescr + ' ' + ULS + ': loads [kN]' graphNm = texfileNm + '_' + ULS + '_loads' oh.displayLoads(caption=captFig, fileName=grPath + graphNm + '.jpg') captTxt = txtDescr + 'loads [kN]' addGraph2Tex(f, rltvGrPath + graphNm, captTxt, grWidth) #displacements graphNm = texfileNm + '_' + ULS + '_uX' oh.displayDispRot(itemToDisp='uX', fileName=grPath + graphNm + '.jpg') captTxt = txtDescr + 'displacement in global X direction [mm]' addGraph2Tex(f, rltvGrPath + graphNm, captTxt, grWidth) graphNm = texfileNm + '_' + ULS + '_uY' oh.displayDispRot(itemToDisp='uY', fileName=grPath + graphNm + '.jpg') captTxt = txtDescr + 'displacement in global Y direction [mm]' addGraph2Tex(f, rltvGrPath + graphNm, captTxt, grWidth) graphNm = texfileNm + '_' + ULS + '_uZ' oh.displayDispRot(itemToDisp='uZ', fileName=grPath + graphNm + '.jpg') captTxt = txtDescr + 'displacement in global Z direction [mm]' addGraph2Tex(f, rltvGrPath + graphNm, captTxt, grWidth) cont += 3 if cont > 20: f.write('\\clearpage \n') cont = 0 #Bolts checking steel_connection.set_bolt_check_resprop_current_LC( ULS, boltSets2Check, meanShearProc) #Welds checking steel_connection.set_welds_check_resprop_current_LC( ULS, singlWelds, baseMetal, Phi) if genGrULSs: f.close() #generate graphics of internal forces in welds cont = 0 for w in singlWelds: weld = w[0] par = w[1] ULS = par[0] modelSpace.removeAllLoadPatternsFromDomain() modelSpace.addLoadCaseToDomain(ULS) result = modelSpace.analyze(calculateNodalReactions=True) graphNm = texfileNm + 'weld' + str(cont) w[1].append(rltvGrPath + graphNm) oh.displayIntForcDiag('N', weld.weldSet, fileName=grPath + graphNm + '_N.jpg') oh.displayIntForcDiag('Vy', weld.weldSet, fileName=grPath + graphNm + '_Vy.jpg') oh.displayIntForcDiag('Vz', weld.weldSet, fileName=grPath + graphNm + '_Vz.jpg') cont += 1 #print results of bolt checking if len(boltSets2Check) > 0: Lres = print_bolt_results(boltSets2Check) f = open(texPath + texfileNm + '_bolts.tex', 'w') f.writelines(Lres) f.close() #print results of weld checking if len(welds2Check) > 0: Lres = print_welds_results(singlWelds) f = open(texPath + texfileNm + '_welds.tex', 'w') f.writelines(Lres) f.close() if warningsFile: steel_connection.write_check_warnings(warningsFile, boltSets2Check, singlWelds)
def gen_baseplates_vonmises_results( sets2disp, modelSpace, genDescr, specDescr, reportPath, rltvResPath, grWidth, texfileNm, resVMfile='./results/verifications/verifRsl_VonMisesStressULS.py'): '''Generates the graphics corresponding to loads and displacements for each load case, together with the tex file to include them in a report. :param genDescr: general description :param specDescr: specific description :param loadCaseNames: list of load case names :param reportPath: directory where report is to be generated :param rltvResPath: directory where to place the text file relative to reportPath :param grWidth: with to insert the graphics :param texfileNm: name of the tex file. :param resVMfile: file containing results from Von Mises verification (defaults to './results/verifications/verifRsl_VonMisesStressULS.py') ''' preprocessor = modelSpace.preprocessor limitState = lsd.vonMisesStressResistance exec(open(resVMfile).read()) oh = output_handler.OutputHandler(modelSpace) resPath = reportPath + rltvResPath if not os.path.isdir(resPath): os.mkdir(resPath) grPath = resPath + 'graphics/' if not os.path.isdir(grPath): os.mkdir(grPath) texPath = reportPath + rltvResPath grPath = texPath + 'graphics/' rltvGrPath = rltvResPath + 'graphics/' f = open(texPath + texfileNm + '_vonmises.tex', 'w') camD1 = vtk_graphic_base.CameraParameters('+X+Y+Z') #camera dihedral 1 camD3 = vtk_graphic_base.CameraParameters('-X-Y+Z') #camera dihedral 3 txtDescr = 'ULS Von Mises stress check. ' + genDescr + ' ' + specDescr + ' ' for st in sets2disp: setdescr = st.name.replace('Set', ' ') setdescr = setdescr.replace('Gusset', ' ' + 'gusset') setdescr = setdescr.capitalize() oh.setCameraParameters(camD1) graphNm = texfileNm + '_vonmisesStress' + st.name captTxt = txtDescr + setdescr + '. Envelope of Von Misses stress (MPa)' oh.displayField(limitStateLabel=limitState.label, section=None, argument='vm_stress', component=None, setToDisplay=st, fileName=grPath + graphNm + '.jpg') addGraph2Tex(f, rltvGrPath + graphNm, captTxt, grWidth) graphNm = texfileNm + '_vonmisesCF' + st.name captTxt = txtDescr + setdescr + '. Efficiency' oh.displayField(limitStateLabel=limitState.label, section=None, argument='CF', component=None, setToDisplay=st, fileName=grPath + graphNm + '.jpg') addGraph2Tex(f, rltvGrPath + graphNm, captTxt, grWidth) if 'gusset' in st.name.lower(): oh.setCameraParameters(camD3) graphNm = texfileNm + '_vonmisesStress_view2' + st.name captTxt = txtDescr + setdescr + '. Envelope of Von Misses stress (MPa)' oh.displayField(limitStateLabel=limitState.label, section=None, argument='vm_stress', component=None, setToDisplay=st, fileName=grPath + graphNm + '.jpg') addGraph2Tex(f, rltvGrPath + graphNm, captTxt, grWidth) graphNm = texfileNm + '_vonmisesCF_view2' + st.name captTxt = txtDescr + setdescr + '. Efficiency' oh.displayField(limitStateLabel=limitState.label, section=None, argument='CF', component=None, setToDisplay=st, fileName=grPath + graphNm + '.jpg') addGraph2Tex(f, rltvGrPath + graphNm, captTxt, grWidth) f.close()