def dispLoadCaseBeamEl(self, setToDisplay, caption=None, fileName=None, defFScale=0.0): '''Display the loads applied on beam elements and nodes for a given load case :param setToDisplay: set of beam elements to be represented :param caption: caption for the graphic :param fileName: name of the file to plot the graphic. Defaults to None, in that case an screen display is generated :param defFScale: factor to apply to current displacement of nodes so that the display position of each node equals to the initial position plus its displacement multiplied by this factor. (Defaults to 0.0, i.e. display of initial/undeformed shape) ''' qg = QGrph.QuickGraphics() if (not caption): caption = 'load case: ' + self.getDescription( ) + ', set: ' + setToDisplay.name + ', ' + self.unitsLoads qg.dispLoadCaseBeamEl(loadCaseName=self.loadCaseName, setToDisplay=setToDisplay, fUnitConv=self.unitsScaleLoads, elLoadComp=self.compElLoad, elLoadScaleF=self.vectorScaleLoads, nodLoadScaleF=self.vectorScalePointLoads, viewDef=self.cameraParameters, caption=caption, fileName=fileName)
def displayDispRot(self, fName=None): '''Displays load vectors on the set argument. :param setToDisplay: set of elements to be displayed (defaults to total set) :param fileName: full name of the graphic file to generate. Defaults to ` None`, in this case it returns a console output graphic., :param defFScale: factor to apply to current displacement of nodes so that the display position of each node equals to the initial position plus its displacement multiplied by this factor. (Defaults to 0.0, i.e. display of initial/undeformed shape) ''' qg = QGrph.QuickGraphics() for st in self.setsToDispDspRot: for arg in self.listDspRot: if arg[0] == 'u': fcUn = self.unitsScaleDispl unDesc = self.unitsDispl else: fcUn = 1.0 unDesc = '' qg.displayDispRot(itemToDisp=arg, setToDisplay=st, fConvUnits=fcUn, unitDescription=unDesc, viewDef=self.cameraParameters, fileName=fName)
def displayMaxPressures(self, FEcase, combs, caption, fUnitConv, unitDescription, rgMinMax=None, fileName=None): '''Calculate and display the maximum earth pressures (Z direction) obtained from the group of load combinations passed as paremeter. :param FEcase: finite element problem :param combs: load cases to analyze and compare to obtain the maximum pressures. :param caption: caption text to diaplay. :param fUnitConv: factor to apply to results (unit conversion) :param unitDescription: text to display as unit description. :param rgMinMax: range (vmin,vmax) with the maximum and minimum values of the scalar field (if any) to be represented. All the values less than vmin are displayed in blue and those greater than vmax in red (defaults to None) :param fileName: file name (defaults to None -> screen display) ''' #Init max. pressures nodSet = self.foundationSet.getNodes for n in nodSet: n.setProp('maxSoilPressure', -1e10) #Calculate max. pressures for lc in combs: lcs = QGrph.QuickGraphics(FEcase) lcs.solve(loadCaseName=combs[lc].name, loadCaseExpr=combs[lc].expr) reac = self.calcPressures() for n in nodSet: prs = n.getProp('soilPressure')[2] if prs > n.getProp('maxSoilPressure'): n.setProp('maxSoilPressure', prs) #Display max. pressures field = Fields.ExtrapolatedScalarField(name='maxSoilPressure', functionName='getProp', xcSet=self.foundationSet, component=None, fUnitConv=fUnitConv, rgMinMax=rgMinMax) defDisplay = vtk_FE_graphic.RecordDefDisplayEF() field.display(defDisplay, caption=caption + ' ' + unitDescription, fName=fileName)
def displayReactionsOnSets(self, fileName=None, defFScale=0.0): '''displays the reactions as vector on affected nodes :param fileName: name of the file to plot the graphic. Defaults to None, in that case an screen display is generated :param defFScale: factor to apply to current displacement of nodes so that the display position of each node equals to the initial position plus its displacement multiplied by this factor. (Defaults to 0.0, i.e. display of initial/undeformed shape) ''' qg = QGrph.QuickGraphics() for st in self.setsToDispReactions: unDesc = '[m,kN]' scaleFact = self.scaleDispReactions[0] qg.displayReactions(setToDisplay=st, fConvUnits=self.unitsScaleLoads, scaleFactor=scaleFact, unitDescription=unDesc, viewDef=self.cameraParameters, fileName=fileName, defFScale=defFScale)
def displayIntForcDiag(self, itemToDisp, fileName=None, defFScale=0.0): '''displays the component of internal forces as a diagram over lines (i.e. appropiated for beam elements). :param itemToDisp: component of the internal forces ('N', 'Qy' (or 'Vy'), 'Qz' (or 'Vz'), 'My', 'Mz', 'T') to be depicted :param unitDescription: string like '[kN/m] or [kN m/m]' :param fileName: name of the file to plot the graphic. Defaults to None, in that case an screen display is generated :param defFScale: factor to apply to current displacement of nodes so that the display position of each node equals to the initial position plus its displacement multiplied by this factor. (Defaults to 0.0, i.e. display of initial/undeformed shape) ''' qg = QGrph.QuickGraphics() for st in self.setsToDispIntForc: if itemToDisp[0] == 'M': fcUn = self.unitsScaleMom unDesc = self.unitsMom scaleFact = self.scaleDispBeamIntForc[2] else: fcUn = self.unitsScaleForc unDesc = self.unitsForc if itemToDisp[0] == 'N': scaleFact = self.scaleDispBeamIntForc[0] else: scaleFact = self.scaleDispBeamIntForc[1] qg.displayIntForcDiag(itemToDisp=itemToDisp, setToDisplay=st, fConvUnits=self.unitsScaleLoads, scaleFactor=scaleFact, unitDescription=unDesc, viewDef=self.cameraParameters, fileName=fileName, defFScale=defFScale)
# -*- coding: utf-8 -*- import os from postprocess.xcVtk.FE_model import quick_graphics as QGrph execfile('xc_model_data.py') execfile('loadStateData.py') #ordered list of load cases (from those defined in loadStateData.py #or redefined lately) to be displayed: #loadCasesToDisplay= [G2] loadCasesToDisplay = [lcDisplays['SLSQP_1']] #End data for lc in loadCasesToDisplay: lcs = QGrph.QuickGraphics(tourRamps) #solve for load case lcs.solve(loadCaseName=lc.loadCaseName, loadCaseExpr=lc.loadCaseExpr) #Displacements and rotations displays for st in lc.setsToDispDspRot: for arg in lc.listDspRot: if arg[0] == 'u': fcUn = lc.unitsScaleDispl unDesc = lc.unitsDispl else: fcUn = 1.0 unDesc = '' lcs.displayDispRot(itemToDisp=arg, setToDisplay=st, fConvUnits=fcUn, unitDescription=unDesc,
deltaL_strut2= strut2.getLineSegment(True).getLength()-strut2.getLineSegment(False).getLength() deltaL_strut3= strut3.getLineSegment(True).getLength()-strut3.getLineSegment(False).getLength() deltaL_diag1= diag1.getLineSegment(True).getLength()-diag1.getLineSegment(False).getLength() deltaL_diag2= diag2.getLineSegment(True).getLength()-diag2.getLineSegment(False).getLength() deltaL_diag3= diag3.getLineSegment(True).getLength()-diag3.getLineSegment(False).getLength() deltaL_saddTop1= saddTop1.getLineSegment(True).getLength()-saddTop1.getLineSegment(False).getLength() deltaL_saddTop2= saddTop2.getLineSegment(True).getLength()-saddTop2.getLineSegment(False).getLength() deltaL_saddTop3= saddTop3.getLineSegment(True).getLength()-saddTop3.getLineSegment(False).getLength() deltaL_saddBot1= saddBot1.getLineSegment(True).getLength()-saddBot1.getLineSegment(False).getLength() deltaL_saddBot2= saddBot2.getLineSegment(True).getLength()-saddBot2.getLineSegment(False).getLength() deltaL_saddBot3= saddBot3.getLineSegment(True).getLength()-saddBot3.getLineSegment(False).getLength() print "deltaL_strut1", deltaL_strut1 print "deltaL_strut2", deltaL_strut2 print "deltaL_strut3", deltaL_strut3 print "deltaL_diag1", deltaL_diag1 print "deltaL_diag2", deltaL_diag2 print "deltaL_diag3", deltaL_diag3 print "deltaL_saddTop1", deltaL_saddTop1 print "deltaL_saddTop2", deltaL_saddTop2 print "deltaL_saddTop3", deltaL_saddTop3 print "deltaL_saddBot1", deltaL_saddBot1 print "deltaL_saddBot2", deltaL_saddBot2 print "deltaL_saddBot3", deltaL_saddBot3 from postprocess.xcVtk.FE_model import quick_graphics as qg lcs=qg.QuickGraphics(FEcase) lcs.displayDispRot(itemToDisp='uZ') quit()
# -*- coding: utf-8 -*- import os execfile('model_data.py') execfile('loadStateData.py') from postprocess.xcVtk import vtk_graphic_base from postprocess.xcVtk.FE_model import quick_graphics as qg #ordered list of load cases (from those defined in ./loadStateData.py #or redefined lately) to be displayed: loadCasesToDisplay = [Snow] for lc in loadCasesToDisplay: lcs = qg.QuickGraphics(gilamontDock) #solve for load case lcs.solve(loadCaseName=lc.loadCaseName, loadCaseExpr=lc.loadCaseExpr) #Displacements and rotations displays for st in lc.setsToDispDspRot: for arg in lc.listDspRot: lcs.displayDispRot(itemToDisp=arg, setToDisplay=st) #Display internal forces for st in lc.setsToDispIntForc: for arg in lc.listIntForc: lcs.displayIntForc(itemToDisp=arg, setToDisplay=st)
# Phase 1: prestressing of tendon 1 # Solution procedure analisis= predefined_solutions.simple_static_linear(FEcase) analOk= analisis.analyze(1) tendon1Set.aliveElements() mesh.meltAliveNodes("block1") # Reactivate inactive nodes. loadVector=xc.Vector([0,0,-1]) for e in beamSet.getElements: e.vector3dUniformLoadGlobal(loadVector) analOk= analisis.analyze(1) from postprocess.xcVtk.FE_model import quick_graphics as QGrph lcs=QGrph.QuickGraphics(FEcase) lcs.displayDispRot(itemToDisp='uZ',setToDisplay=beamSet,fConvUnits=1e3,unitDescription='beam [mm]. Phase 1: prestressing of tendon 1',viewName="YNeg",hCamFct=1,fileName='twoTendonsUz01.png',defFScale=2e2) lcs.displayIntForcDiag(itemToDisp='Mz',setToDisplay=beamSet,fConvUnits=1e-3,scaleFactor=-2e-2,unitDescription='beam [kNm]. Phase 1: prestressing of tendon 1',viewName="YNeg",hCamFct=1,fileName='twoTendonsMz01.png',defFScale=1) lcs.displayIntForcDiag(itemToDisp='N',setToDisplay=tendon1Set,fConvUnits=1e-3,scaleFactor=1e-2,unitDescription='tendon 1 [kN]. Phase 1: prestressing of tendon 1',viewName="XYZNeg",hCamFct=1,fileName='twoTendons_t1_N01.png',defFScale=1) # Phase 2: self-weight #Add uniform load on beam elems to current load pattern loadVector=xc.Vector([0,0,-Wsw]) for e in beamSet.getElements: e.vector3dUniformLoadGlobal(loadVector) analOk= analisis.analyze(1)
analysis = predefined_solutions.simple_static_linear(test) result = analysis.analyze(1) nodes.calculateNodalReactions(True, 1e-6) n1 = points.get(1).getNode() n2 = points.get(2).getNode() n3 = points.get(3).getNode() n4 = points.get(4).getNode() n5 = points.get(5).getNode() n6 = points.get(6).getNode() print n1.getDisp[0], n1.getDisp[1], n1.getDisp[2] print n4.getDisp[0], n4.getDisp[1], n4.getDisp[2] quit() from postprocess.xcVtk.FE_model import quick_graphics as qg lcs = qg.QuickGraphics(test) lcs.displayDispRot(itemToDisp='uX') quit() # #Newton Raphson # analysis= predefined_solutions.plain_newton_raphson(test) # result= analysis.analyze(10) print n1.getReaction print n4.getDisp quit() Nstep = 10 # apply load in 10 steps DInc = 1. / Nstep # first load increment solu = test.getSoluProc
from postprocess.xcVtk.FE_model import quick_graphics as QGrph execfile('./model_data.py') execfile('./loadStateData.py') #ordered list of load cases (from those defined in ../loadStateData.py #or redefined lately) to be displayed: #loadCasesToDisplay=[G1,G2,QA,QB,QF,QAcc] #loadCasesToDisplay=[ULS_A,ULS_B,ULS_Acc] #loadCasesToDisplay=[tempDown] #loadCasesToDisplay=[brake2] loadCasesToDisplay = [A] #End data for lc in loadCasesToDisplay: lcs = QGrph.QuickGraphics(model) #solve for load case lcs.solve(loadCaseName=lc.loadCaseName, loadCaseExpr=lc.loadCaseExpr) #Displacements and rotations displays for st in lc.setsToDispDspRot: for arg in lc.listDspRot: if arg[0] == 'u': fcUn = lc.unitsScaleDispl unDesc = lc.unitsDispl else: fcUn = 1.0 unDesc = '' lcs.displayDispRot(itemToDisp=arg, setToDisplay=st, fConvUnits=fcUn, unitDescription=unDesc,
def simplLCReports(self, FEproblem, pathGr, texFile, grWdt, capStdTexts): '''Creates the graphics files of displacements and internal forces calculated for a simple load case and insert them in a LaTex file :param FEproblem: finite element problem :param pathGr: directory to place figures (ex: 'text/graphics/loads/') :param texFile: laTex file where to include the graphics (e.g.:'text/report_loads.tex') :param grWdt: width to be applied to graphics :param capStdTexts: dictionary with the standard captions. ''' lcs = QGrph.QuickGraphics(FEproblem) #solve for load case lcs.solve(loadCaseName=self.loadCaseName, loadCaseExpr=self.loadCaseExpr) #Displacements and rotations displays for st in self.setsToDispDspRot: for arg in self.listDspRot: if arg[0] == 'u': fcUn = self.unitsScaleDispl unDesc = self.unitsDispl else: fcUn = 1.0 unDesc = '' grfname = pathGr + self.loadCaseName + st.name + arg lcs.displayDispRot(itemToDisp=arg, setToDisplay=st, fConvUnits=fcUn, unitDescription=unDesc, viewName=self.viewName, hCamFct=self.hCamFct, fileName=grfname + '.jpg') lcs.displayDispRot(itemToDisp=arg, setToDisplay=st, fConvUnits=fcUn, unitDescription=unDesc, viewName=self.viewName, hCamFct=self.hCamFct, fileName=grfname + '.eps') capt = self.loadCaseDescr + '. ' + st.description.capitalize( ) + ', ' + capStdTexts[arg] + ' ' + unDesc insertGrInTex(texFile=texFile, grFileNm=grfname, grWdt=grWdt, capText=capt) #Internal forces displays on sets of «shell» elements for st in self.setsToDispIntForc: for arg in self.listIntForc: if arg[0] == 'M': fcUn = self.unitsScaleMom unDesc = self.unitsMom else: fcUn = self.unitsScaleForc unDesc = self.unitsForc grfname = pathGr + self.loadCaseName + st.name + arg lcs.displayIntForc(itemToDisp=arg, setToDisplay=st, fConvUnits=fcUn, unitDescription=unDesc, viewName=self.viewName, hCamFct=self.hCamFct, fileName=grfname + '.jpg') lcs.displayIntForc(itemToDisp=arg, setToDisplay=st, fConvUnits=fcUn, unitDescription=unDesc, viewName=self.viewName, hCamFct=self.hCamFct, fileName=grfname + '.eps') capt = self.loadCaseDescr + '. ' + st.description.capitalize( ) + ', ' + capStdTexts[arg] + ' ' + unDesc insertGrInTex(texFile=texFile, grFileNm=grfname, grWdt=grWdt, capText=capt) #Internal forces displays on sets of «beam» elements for st in self.setsToDispBeamIntForc: for arg in self.listBeamIntForc: if arg[0] == 'M': fcUn = self.unitsScaleMom unDesc = self.unitsMom scaleFact = self.scaleDispBeamIntForc[2] else: fcUn = self.unitsScaleForc unDesc = self.unitsForc if arg[0] == 'N': scaleFact = self.scaleDispBeamIntForc[0] else: scaleFact = self.scaleDispBeamIntForc[1] grfname = pathGr + self.loadCaseName + st.name + arg lcs.displayIntForcDiag(itemToDisp=arg, setToDisplay=st, fConvUnits=fcUn, scaleFactor=scaleFact, unitDescription=unDesc, viewName=self.viewNameBeams, hCamFct=self.hCamFctBeams, fileName=grfname + '.jpg') lcs.displayIntForcDiag(itemToDisp=arg, setToDisplay=st, fConvUnits=fcUn, scaleFactor=scaleFact, unitDescription=unDesc, viewName=self.viewNameBeams, hCamFct=self.hCamFctBeams, fileName=grfname + '.eps') capt = self.loadCaseDescr + '. ' + st.description.capitalize( ) + ', ' + capStdTexts[arg] + ' ' + unDesc insertGrInTex(texFile=texFile, grFileNm=grfname, grWdt=grWdt, capText=capt) texFile.write('\\clearpage\n') return
def loadReports(self, FEcase, pathGr, texFile, grWdt): '''Creates the graphics files of loads for the load case and insert them in a LaTex file :param FEcase: finite element case :param pathGr: directory to place figures (ex: 'text/graphics/loads/') :param texFile: laTex file where to include the graphics (e.g.:'text/report_loads.tex') :param grWdt: width to be applied to graphics ''' preprocessor = FEcase.getPreprocessor labl = self.loadCaseName for st in self.setsToDispLoads: grfname = pathGr + self.loadCaseName + st.name capt = self.loadCaseDescr + ', ' + st.description + ', ' + self.unitsLoads QGrph.displayLoad(preprocessor=preprocessor, setToDisplay=st, loadCaseNm=self.loadCaseName, unitsScale=self.unitsScaleLoads, vectorScale=self.vectorScaleLoads, multByElemArea=self.multByElemAreaLoads, viewNm=self.viewName, hCamFct=self.hCamFct, caption=capt, fileName=grfname + '.jpg') QGrph.displayLoad(preprocessor=preprocessor, setToDisplay=st, loadCaseNm=self.loadCaseName, unitsScale=self.unitsScaleLoads, vectorScale=self.vectorScaleLoads, multByElemArea=self.multByElemAreaLoads, viewNm=self.viewName, hCamFct=self.hCamFct, caption=capt, fileName=grfname + '.eps') insertGrInTex(texFile=texFile, grFileNm=grfname, grWdt=grWdt, capText=capt, labl=labl) for st in self.setsToDispBeamLoads: grfname = pathGr + self.loadCaseName + st.name capt = self.loadCaseDescr + ', ' + st.description + ', ' + self.unitsLoads lcs = QGrph.QuickGraphics(FEcase) lcs.dispLoadCaseBeamEl(loadCaseName=self.loadCaseName, setToDisplay=st, fUnitConv=self.unitsScaleLoads, elLoadComp=self.compElLoad, elLoadScaleF=self.vectorScaleLoads, nodLoadScaleF=self.vectorScalePointLoads, viewName=self.viewName, hCamFct=self.hCamFct, caption=capt, fileName=grfname + '.jpg') lcs.dispLoadCaseBeamEl(loadCaseName=self.loadCaseName, setToDisplay=st, fUnitConv=self.unitsScaleLoads, elLoadComp=self.compElLoad, elLoadScaleF=self.vectorScaleLoads, nodLoadScaleF=self.vectorScalePointLoads, viewName=self.viewName, hCamFct=self.hCamFct, caption=capt, fileName=grfname + '.eps') insertGrInTex(texFile=texFile, grFileNm=grfname, grWdt=grWdt, capText=capt, labl=labl) return
execfile('fe_model.py') execfile('loadStateData.py') #Graphic output from postprocess.xcVtk import vtk_graphic_base from postprocess.xcVtk.FE_model import vtk_FE_graphic from postprocess.xcVtk import vtk_internal_force_diagram as gde from postprocess.xcVtk import vtk_graphic_base from postprocess.xcVtk.FE_model import quick_graphics as qg lcs = qg.QuickGraphics(deck) #Define the diagram to display: # scaleFactor, unitConversionFactor, element sets and magnitude to display. loadCaseToDisplay = ELUT41 #AT202 #ELUT202 #G1 #lcs.displayNodeValueDiagram('uY',setToDisplay= bridgeSectionSet,fConvUnits=1e3,scaleFactor=-0.05,viewDef= vtk_graphic_base.CameraParameters('ZPos')) lcs.solve(loadCaseName=loadCaseToDisplay.loadCaseName, loadCaseExpr=loadCaseToDisplay.loadCaseExpr) #lcs.displayIntForcDiag('N',deckSet,1e-3,0.01,'(kN)',vtk_graphic_base.CameraParameters('ZPos')) lcs.displayIntForcDiag('Mz', deckSet, 1e-3, -1.0, '(kN m)', vtk_graphic_base.CameraParameters('ZPos')) #lcs.displayIntForcDiag('Qy',deckSet,1e-3,-0.05,'(kN)',vtk_graphic_base.CameraParameters('ZPos'))
execfile('./cantilever_mesh_generation.py') #Graphic output from postprocess.xcVtk import vtk_graphic_base from postprocess.xcVtk.FE_model import vtk_FE_graphic from postprocess.xcVtk import vtk_internal_force_diagram as gde from postprocess.reports import graphical_reports as gr from postprocess.xcVtk.FE_model import quick_graphics as qg lcs = qg.QuickGraphics(feProblem) loadCaseToDisplay = gr.getRecordLoadCaseDispFromLoadPattern(lp0) loadCaseToDisplay.cameraParameters = vtk_graphic_base.CameraParameters( 'Custom') loadCaseToDisplay.cameraParameters.viewUpVc = [0, 1, 0] loadCaseToDisplay.cameraParameters.posCVc = [-100, 100, 100] #Define the diagram to display: # scaleFactor, unitConversionFactor, element sets and magnitude to display. lcs.solve(loadCaseName=loadCaseToDisplay.loadCaseName, loadCaseExpr=loadCaseToDisplay.loadCaseExpr) #lcs.displayIntForcDiag('N',xcTotalSet,1e-3,1,'(kN)',loadCaseToDisplay.cameraParameters) lcs.displayIntForcDiag('Mz', xcTotalSet, 1e-3, -1.0, '(kN m)', loadCaseToDisplay.cameraParameters) #lcs.displayIntForcDiag('Qy',xcTotalSet,1e-3,1,'(kN)',loadCaseToDisplay.cameraParameters)