def check(self,reinfConcreteSections): '''Checking of displacements under frequent loads in serviceability limit states (see self.dumpCombinations). :param reinfConcreteSections: Reinforced concrete sections on each element. ''' lmsg.error('FreqLoadsDisplacementControlLimitStateData.check() not implemented.')
def exportaEsfuerzosShellSet(preprocessor,nmbComb, st, fName): '''Writes a comma separated values file with the element's internal forces.''' errMsg= 'exportaEsfuerzosShellSet deprecated use exportInternalForces' errMsg+= 'with apropriate arguments' lmsg.error(errMsg) elems= st.getElements exportShellInternalForces(nmbComb,elems,fName)
def runChecking(self,outputCfg): '''This method reads, for the elements in setCalc, the internal forces previously calculated and saved in the corresponding file. Using the 'initControlVars' and 'checkSetFromIntForcFile' methods of the controller, the appropiate attributes are assigned to the elements and the associated limit state verification is run. The results are written to a file in order to be displayed or listed. :param outputCfg: instance of class 'verifOutVars' which defines the variables that control the output of the checking (set of elements to be analyzed, append or not the results to the result file [defatults to 'N'], generation or not of list file [defatults to 'N', ...) :param setCalc: set that contains elements to be checked :param appendToResFile: 'Yes','Y','y',.., if results are appended to existing file of results (defaults to 'N') :param listFile: 'Yes','Y','y',.., if latex listing file of results is desired to be generated (defaults to 'N') ''' retval=None if outputCfg.setCalc: prep=outputCfg.setCalc.getPreprocessor intForcCombFileName=self.getInternalForcesFileName() self.controller.initControlVars(outputCfg.setCalc) self.controller.checkSetFromIntForcFile(intForcCombFileName,outputCfg.setCalc) retval=cv.writeControlVarsFromElements(self.controller.limitStateLabel,prep,self.getOutputDataBaseFileName(),outputCfg) else: lmsg.error("Result file hasn't been created, you must specify a valid set of elements") return retval
def dispLoadCaseBeamEl(self,loadCaseName='',setToDisplay=None,fUnitConv=1.0,elLoadComp='transComponent',elLoadScaleF=1.0,nodLoadScaleF=1.0,viewDef= vtk_graphic_base.CameraParameters('XYZPos'),caption='',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 fUnitConv: factor of conversion to be applied to the results (defaults to 1) :param elLoadComp: component of the loads on elements to be depicted [possible components: 'axialComponent', 'transComponent', 'transYComponent', 'transZComponent'] :param elLoadScaleF: factor of scale to apply to the diagram display of element loads (defaults to 1) :param nodLoadScaleF: factor of scale to apply to the vector display of nodal loads (defaults to 1) :param vwDef: camera parameters. :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) ''' if(setToDisplay): self.xcSet= setToDisplay if self.xcSet.color.Norm()==0: self.xcSet.color=xc.Vector([rd.random(),rd.random(),rd.random()]) else: lmsg.warning('QuickGraphics::dispLoadCaseBeamEl; set to display not defined; using previously defined set (total if None).') preprocessor= self.feProblem.getPreprocessor loadPatterns= preprocessor.getLoadHandler.getLoadPatterns loadPatterns.addToDomain(loadCaseName) defDisplay= self.getDisplay(viewDef) grid= defDisplay.setupGrid(self.xcSet) defDisplay.defineMeshScene(None,defFScale,color=self.xcSet.color) orNodalLBar='H' #default orientation of scale bar for nodal loads # auto-scaling parameters LrefModSize=setToDisplay.getBnd(1.0).diagonal.getModulo() #representative length of set size (to auto-scale) diagAux=lld.LinearLoadDiagram(scale=elLoadScaleF,fUnitConv=fUnitConv,loadPatternName=loadCaseName,component=elLoadComp) maxAbs=diagAux.getMaxAbsComp(preprocessor) if maxAbs > 0: elLoadScaleF*=LrefModSize/maxAbs*100 # diagram= lld.LinearLoadDiagram(scale=elLoadScaleF,fUnitConv=fUnitConv,loadPatternName=loadCaseName,component=elLoadComp) diagram.addDiagram(preprocessor) if diagram.isValid(): defDisplay.appendDiagram(diagram) orNodalLBar='V' # nodal loads vField=lvf.LoadVectorField(loadPatternName=loadCaseName,fUnitConv=fUnitConv,scaleFactor=nodLoadScaleF,showPushing= True) # loadPatterns= preprocessor.getLoadHandler.getLoadPatterns lPattern= loadPatterns[loadCaseName] count= 0 if(lPattern): count=vField.dumpNodalLoads(preprocessor,defFScale=defFScale) else: lmsg.error('load pattern: '+ loadCaseName + ' not found.') if count >0: vField.addToDisplay(defDisplay,orientation=orNodalLBar) defDisplay.displayScene(caption=caption,fName=fileName)
def VtkCreaStrArraySetData(setToDraw, entTypeName, attr): '''Creates an array of strings with information associated to the points and cells. Parameters: setToDraw: set of entities to be displayed entTypeName: type of entities to be displayed ("pnts", "lines", "nodes", "elementos") attr: attribute to be stored in the array ''' # Define matrix arr= vtk.vtkStringArray() arr.SetName(attr) container= None if(entTypeName=="pnts"): container= setToDraw.getPoints elif(entTypeName=="lines"): container= setToDraw.getLines elif(entTypeName=="nodes"): container= setToDraw.getNodes elif(entTypeName=="elementos"): container= setToDraw.getElements else: lmsg.error("error: "+entTypeName+" not implemented.") for e in container: tmp= str(getattr(e,attr)) arr.InsertValue(e.getIdx,tmp) return arr
def dumpLoads(self, preprocessor,defFScale, showElementalLoads= True, showNodalLoads= True): ''' Iterate over loads dumping them into the graphic. :param lp: load pattern :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. :param showElementalLoads: if true show loads over elements. :param showNodalLoads: if true show loads over nodes. ''' preprocessor.resetLoadCase() loadPatterns= preprocessor.getLoadHandler.getLoadPatterns loadPatterns.addToDomain(self.lpName) lp= loadPatterns[self.lpName] count= 0 if(lp): numberOfLoads= self.populateLoads(preprocessor,lp) if(numberOfLoads>0): self.data.scaleFactor/= self.getMaxLoad() #Iterate over loaded elements. count+= self.dumpElementalPositions(preprocessor,lp) #Iterate over loaded nodes. count+= self.dumpNodalPositions(preprocessor,lp,defFScale) if(count==0): lmsg.warning('LoadVectorField.dumpLoads: no loads defined.') loadPatterns.removeFromDomain(self.lpName) else: lmsg.error('Load pattern: '+ self.lpName + ' not found.') return count
def set_included_in_orthoPrism(preprocessor,setInit,prismBase,prismAxis,setName): '''reselect from set setInit those elements included in a orthogonal prism defined by a 2D polygon and the direction of its axis. :param preprocessor: preprocessor :param setInit: set of elements to which restrict the search :param prismBase: 2D polygon that defines the n-sided base of the prism. The vertices of the polygon are defined in global coordinates in the following way: - for X-axis-prism: (y,z) - for Y-axis-prism: (x,z) - for Z-axis-prism: (x,y) :param prismAxis: axis of the prism (can be equal to 'X', 'Y', 'Z') :param setName: name of the set to be generated ''' sElIni=setInit.getElements if prismAxis in ['X','x']: elem_inside_prism=[e for e in sElIni if prismBase.In(geom.Pos2d(e.getPosCentroid(True).y,e.getPosCentroid(True).z),0)] elif prismAxis in ['Y','y']: elem_inside_prism=[e for e in sElIni if prismBase.In(geom.Pos2d(e.getPosCentroid(True).x,e.getPosCentroid(True).z),0)] elif prismAxis in ['Z','z']: elem_inside_prism=[e for e in sElIni if prismBase.In(geom.Pos2d(e.getPosCentroid(True).x,e.getPosCentroid(True).y),0)] else: lmsg.error("Wrong prisma axis. Available values: 'X', 'Y', 'Z' \n") s=lstElem_to_set(preprocessor,elem_inside_prism,setName) s.fillDownwards() return s
def VtkDefineElementsActor(self, reprType,field,color=xc.Vector([rd.random(),rd.random(),rd.random()])): ''' Define the actor to display elements :param reprType: type of representation ("points", "wireframe" or "surface") :param field: field to be repreresented :param color: RGB color to represent the elements (defaults to random color) ''' if(field): field.setupOnGrid(self.gridRecord.uGrid) self.gridMapper= vtk.vtkDataSetMapper() self.gridMapper.SetInputData(self.gridRecord.uGrid) if(field): field.setupOnMapper(self.gridMapper) elemActor= vtk.vtkActor() elemActor.SetMapper(self.gridMapper) elemActor.GetProperty().SetColor(color[0],color[1],color[2]) if(reprType=="points"): elemActor.GetProperty().SetRepresentationToPoints() elif(reprType=="wireframe"): elemActor.GetProperty().SetRepresentationToWireFrame() elif(reprType=="surface"): elemActor.GetProperty().SetRepresentationToSurface() else: lmsg.error("Representation type: '"+ reprType+ "' unknown.") self.renderer.AddActor(elemActor) if(field): field.creaColorScaleBar() self.renderer.AddActor2D(field.scalarBar)
def displayElementUniformLoad(self, preprocessor, unifLoad,loadPattern, color, force, fScale): loadPatternName= loadPattern.getProp("dispName") actorName= "flechaU"+loadPatternName+"%04d".format(unifLoad.tag) eleTags= unifLoad.elementTags for tag in eleTags: ele= preprocessor.getElementHandler.getElement(tag) actorName+= "%04d".format(tag) # Tag elemento. lmsg.error('displayElementUniformLoad not implemented.')
def getSectionNamesForElement(self,tagElem): '''Returns the section names for the element which tag is being passed as a parameter.''' if tagElem in self.sectionDistribution.keys(): return self.sectionDistribution[tagElem] else: lmsg.error("element with tag: "+str(tagElem)+" not found.") return None
def getPressure(self,z): '''Return the earth pressure acting on the points at global coordinate z.''' ret_press= 0.0 if(z<self.zGround): ret_press=0.65*self.K*self.gammaSoil*self.H if(z<self.zWater): lmsg.error('pressures under water table not implemented.''') return ret_press
def writeResultTraction(self,outputFile,Nd): famArm= self.tensionRebars concrete= self.concrete AsMin= self.getMinReinfAreaUnderTension()/2 ancrage= famArm.getBasicAnchorageLength(concrete) ng_rebar_def.writeRebars(outputFile,concrete,famArm,AsMin) if(abs(Nd)>0): lmsg.error("ERROR; tension not implemented.")
def generateLoadPattern(self,preprocessor,dictGeomEnt,lPatterns): lmsg.log(' *** '+self.name+' *** ') if(not self.lPattern): self.lPattern= lPatterns.newLoadPattern("default",self.name) lPatterns.currentLoadPattern= self.name self.appendLoadsToLoadPattern(dictGeomEnt,preprocessor.getNodeHandler) else: lmsg.error('Error load pattern: '+ self.name+ ' already generated.') return self.lPattern
def getPlasticSectionModulusY(self): '''Returns the plastic section modulus around Y axis. Computes the plastic section modulus assuming that plastic neutral axis passes through section centroid (which is true whenever the rectangular section is homogeneous). ''' lmsg.error('getPlasticSectionModulusY not implemented.') return 0.0
def getTypeCode(self): if(self.typ=='Free'): return '0' elif(self.typ=='Rigid'): return '1' elif(self.typ=='Flexible'): return '2' else: lmsg.error('ComponentSupportRecord::getTypeCode; error: unknown type: '+ self.typ) return '0'
def getIntForceComponentFromName(self,componentName): if componentName[0] in ['N','M']: return componentName.lower() elif componentName == 'Q1': return 'q13' elif componentName == 'Q2': return 'q23' else: #LCPT I don't like this too much, I prefer let the user make the program to crass. Maybe a Warning? lmsg.error('Item '+str(componentName) +'is not a valid component. Displayable items are: N1, N2, N12, M1, M2, M12, Q1, Q2') return 'N1'
def writeResultCompression(self,outputFile,Nd,AsTrsv): ''' Results for compressed rebars. :param AsTrsv: Rebar area in transverse direction. ''' famArm= self.tensionRebars #Even if they're not in tension... concrete= self.concrete AsMin= 0.2*AsTrsv # 20% of the transversal area. ng_rebar_def.writeRebars(outputFile,concrete,famArm,AsMin) if(abs(Nd)!=0.0): lmsg.error("ERROR; not implemented.")
def getSectionDefinitionsForElement(self,tagElem): '''Returns the section names for the element which tag is being passed as a parameter.''' retval= [] sectionNames= self.getSectionNamesForElement(tagElem) if(sectionNames): for s in sectionNames: retval.append(self.sectionDefinition.mapSections[s]) else: lmsg.error("section names for element with tag: "+str(tagElem)+" not found.") return retval
def __call__(self,arguments): retval= None obj= self args= arguments.split('.') for arg in args: if(hasattr(obj,arg)): obj= getattr(obj,arg) if(hasattr(obj,'__call__')): obj= obj.__call__() else: lmsg.error('argument: '+ arg+' not found') retval= obj return retval
def dumpSurfaceLoads(self, lp, destLoadCase): '''Dump loads over surfaces as free surface loads.''' domain= lp.getDomain preprocessor= lp.getDomain.getPreprocessor eLoadIter= lp.loads.getElementalLoadIter eLoad= eLoadIter.next() loadSets= [] while eLoad: setName= 'surfaceLoadSet'+str(eLoad.tag) surfaceLoadSet= preprocessor.getSets.defSet(setName) surfaceLoadSet.elementalLoad= eLoad elemTags= eLoad.elementTags resultant= eLoad.getResultant(geom.Pos3d(0,0,0),True) #Total force over the elements. totalForce= geom.Vector3d(resultant.x,resultant.y,resultant.z) totalForceModulus= totalForce.getModulo() numberOfLoadedElements= len(elemTags) if(numberOfLoadedElements>1): #It seems there is a bug in totalArea= 0.0 for tag in elemTags: elem= domain.getMesh.getElement(tag) totalArea+= elem.getArea(True) if(elem): surfaceLoadSet.getElements.append(elem) else: lmsg.error('element: '+ str(tag) + ' not found.') surfaceLoadSet.value= totalForceModulus surfaceLoadSet.vDir= [totalForce.x/surfaceLoadSet.value,totalForce.y/surfaceLoadSet.value,totalForce.z/surfaceLoadSet.value] surfaceLoadSet.value/= totalArea elementContours= surfaceLoadSet.getElements.getContours(0.0) if(len(elementContours)>1): lmsg.error('surface load set: '+ setName + ' has more than one contour. Contours others than first are ignored.') surfaceLoadSet.polygon= elementContours[0] surfaceLoadSet.polygon.simplify(.01) #Deletes unnecesary vertices. loadSets.append(surfaceLoadSet) else: elem= domain.getMesh.getElement(elemTags[0]) #Only one element... pLoad= nld.PointForceRecord(destLoadCase, self.pointLoadCounter,elem.getPosCentroid(True),1.0) pLoad.value= totalForceModulus pLoad.vDir= [totalForce.x/pLoad.value,totalForce.y/pLoad.value,totalForce.z/pLoad.value] pLoad.tag= eLoad.tag destLoadCase.loads.punctualLoads.append(pLoad) self.pointLoadCounter+=1 eLoad= eLoadIter.next() for s in loadSets: sLoad= nld.SurfaceLoadRecord(destLoadCase, self.surfaceLoadCounter) sLoad.polygon= s.polygon sLoad.value= s.value sLoad.vDir= s.vDir destLoadCase.loads.surfaceLoads.append(sLoad) self.surfaceLoadCounter+=1
def check(self,elements,nmbComb): ''' Check the shear strength of the RC section. XXX Orientation of the transverse reinforcement is not taken into account. ''' print "Postprocesing combination: ",nmbComb # XXX torsional deformation ingnored. for e in elements: e.getResistingForce() scc= e.getSection() idSection= e.getProp("idSection") section= scc.getProp("datosSecc") self.setSection(section) AsTrsv= section.shReinfY.getAs() alpha= section.shReinfY.angAlphaShReinf theta= section.shReinfY.angThetaConcrStruts VuTmp= section.getRoughVcuEstimation() NTmp= scc.getStressResultantComponent("N") MyTmp= scc.getStressResultantComponent("My") momentThreshold= VuTmp/1000.0 if(abs(MyTmp)<momentThreshold): #bending moment too small. MyTmp= momentThreshold MzTmp= scc.getStressResultantComponent("Mz") if(abs(MzTmp)<momentThreshold): #bending moment too small. MzTmp= momentThreshold VyTmp= scc.getStressResultantComponent("Vy") if(abs(VyTmp)>VuTmp/5.0): #We "eliminate" very small shear forces. posEsf= geom.Pos3d(NTmp,MyTmp,MzTmp) diagInt= e.getProp("diagInt") intersection= diagInt.getIntersection(posEsf) Mu= intersection.z VuTmp= self.calcVu(NTmp,MzTmp, Mu, VyTmp) #Mz associated with Vy else: #Fictitious ultimate moment. Mu= self.concrete.Ecm()*section.getIz_RClocalZax()*1e-3/section.h if(abs(MzTmp)>Mu): errMsg= 'Fictitious ultimate moment too low;' errMsg+= ' Mu= '+ str(Mu) + ' MzTmp= ' + str(MzTmp) lmsg.error(errMsg) #13.02.2018 right-justified in order to be run only if VyTmp>VuTmp/5.0 if(VuTmp!=0.0): FCtmp= abs(VyTmp)/VuTmp else: FCtmp= 10 if(FCtmp>=e.getProp(self.limitStateLabel).CF): VzTmp= scc.getStressResultantComponent("Vz") e.setProp(self.limitStateLabel,cv.RCShearControlVars(idSection,nmbComb,FCtmp,NTmp,MyTmp,MzTmp,Mu,VyTmp,VzTmp,theta,self.Vcu,self.Vsu,VuTmp)) # Worst case
def getIJKRangeListFromSurfaces(surfaces): '''generates the list of ranges that delimite all the surfaces given as a parameter :param surfaces: list of objects of type ``MaterialSurface`` return object of type ``IJKRangeList`` ''' retval= None if(surfaces): retval= IJKRangeList(surfaces[0].name+'IJKRangeList',surfaces[0].grid) retval.appendSurfaceListRanges(surfaces) else: lmsg.error('Error: surface list empty.') return retval
def exportShellInternalForces(nmbComb, elems, fDesc,fConv= 1.0): '''Writes a comma separated values file with the element's internal forces.''' errMsg= 'exportShellInternalForces deprecated use exportInternalForces' errMsg+= 'with apropriate arguments' lmsg.error(errMsg) internalForces= internal_forces.ShellMaterialInternalForces() for e in elems: internalForces.setFromAverageInShellElement(e) strEsf= internalForces.getCSVString() forcesOnNodes= internalForces.getWoodArmer() sz= len(forcesOnNodes) for i in range(0,sz): force= forcesOnNodes[i] outStr= nmbComb+", "+str(e.tag)+", "+str(i)+", "+force.getCSVString()+'\n' fDesc.write(outStr)
def getStrXCCommand(self,xcImportExportData): strId= str(self.id) handlerName= xcImportExportData.getBlockHandlerName(self.getType()) strCommand= None if(self.cellType=='line'): strId= 'l'+strId strCommand= strId + '= ' + handlerName + '.newLine(' + self.getStrKeyPointsIds() +')' elif(self.cellType=='face'): strId= 'f'+strId strCommand= strId + '= ' + handlerName + '.newQuadSurfacePts(' + self.getStrKeyPointsIds() +')' else: lmsg.error('BlockRecord::getStrXCCommand not implemented for blocks of type: '+ self.cellType) if(self.labels): strCommand+= '; '+strId+'.setProp("labels",'+str(self.labels)+')' return strCommand
def get_max_coo_nod(setWithNod,cooId): '''Return the maximum value of the specified coordinate in the set of nodes :param setWithNod: set that contains the nodes :param cooId: identification of the desired coordinate (0 for X coordinate, 1 for Y coord. and 2 for Z coord. ''' retval=0 nodInSet=setWithNod.getNodes if cooId in [0,1,2]: CoorNod=[n.getCoo[cooId] for n in nodInSet] retval=max(CoorNod) else: lmsg.error("Wrong coordinate id. Available values: 0, 1, 2 \n") return retval
def VtkDefineActorCells(recordGrid, renderer, tipoRepr): ''' Actor for the surfaces.''' uGridMapper= vtk.vtkDataSetMapper() uGridMapper.SetInputData(recordGrid.uGrid) cellActor= vtk.vtkActor() cellActor.SetMapper(uGridMapper) cellActor.GetProperty().SetColor(1,1,0) if (tipoRepr=="points"): cellActor.GetProperty().SetRepresentationToPoints() elif(tipoRepr== "wireframe"): cellActor.GetProperty().SetRepresentationToWireframe() elif(tipoRepr== "surface"): cellActor.GetProperty().SetRepresentationToSurface() else: lmsg.error("error: "+tipoRepr+" no implementada.") renderer.AddActor(cellActor) # Actor para las celdas
def getDispComponentFromName(self,compName): if compName == 'uX': return 0 elif compName == 'uY': return 1 elif compName == 'uZ': return 2 elif compName == 'rotX': return 3 elif compName == 'rotY': return 4 elif compName == 'rotZ': return 5 else: lmsg.error('Item '+str(compName) +'is not a valid component. Displayable items are: uX, uY, uZ, rotX, rotY, rotZ') return 2
def fyEC3(desig, t): ''' Return steel yield strength from its name and the part thickness (see table 3.1). ''' retval= 0.0 if(t>0.1): lmsg.error("Part thickness out of range: ",t*1000," mm\n") if(desig == 235): retval= ifte(t<40e-3,235e6,215e6) elif(desig == 275): retval= ifte(t<40e-3,275e6,255e6) elif(desig == 355): retval= ifte(t<40e-3,355e6,335e6) else: lmsg.error("Unknown steel designation: ",desig,"\n") return retval
def fuEC3(desig, t): ''' Return steel ultimate strength from its name and the part thickness (see table 3.1). ''' retval= 0.0 if(t>0.1): lmsg.error("Part thickness out of range: ",t*1000," mm\n") if(desig == 235): retval= ifte(t<40e-3,360e6,340e6) elif(desig == 275): retval= ifte(t<40e-3,430e6,410e6) elif(desig == 355): retval= ifte(t<40e-3,510e6,490e6) else: lmsg.error("Unknown steel designation: ",desig,"\n") return retval
def assign(self,elemSet,setRCSects): '''Assigns the sections names: setRCSectsName+'1', setRCSectsName+'2', ... to the elements of the set. :param elemSet: set of elements that receive the section name property. :param setRCSects: RC section definition, name, concrete type, rebar positions,... ''' if len(elemSet)== 0: lmsg.warning("element set is empty\n") for e in elemSet: if(not e.hasProp(self.propName)): self[e.tag]=[] for i in range(len(setRCSects.lstRCSects)): sname=setRCSects.name+str(i+1) self[e.tag].append(sname) e.setProp(self.propName,setRCSects.name) else: lmsg.error("element: "+ str(e.tag) + " has already a section ("+e.getProp(self.propName)+")\n")
def loadElementSectionMap(): lmsg.error('loadElementSectionMap DEPRECATED use loadRCMaterialDistribution' )
defTermica = xc.DeformationPlane(alpha * AT) eleLoad.backEndDeformationPlane = defTermica eleLoad.frontEndDeformationPlane = defTermica #We add the load case to domain. lPatterns.addToDomain("0") analisis = predefined_solutions.simple_static_linear(feProblem) result = analisis.analyze(1) elements.getElement(1).getResistingForce() axil1 = elements.getElement(1).getN1 axil2 = elements.getElement(1).getN2 N = (-E * A * alpha * AT) ratio = ((axil2 - N) / N) # print "N= ",N # print "axil1= ",axil1 # print "axil2= ",axil2 # print "ratio= ",ratio import os from miscUtils import LogMessages as lmsg fname = os.path.basename(__file__) if abs(ratio) < 1e-5: print "test ", fname, ": ok." else: lmsg.error(fname + ' ERROR.')
def generatePlot(self): self.contour = self.fiberSection.getRegionsContour() fig = plt.figure() ax2d = plt.subplot(111) ax2d.axis('equal') #Fiber section contour (y, z) = data_xcpolygon_to_pyplot(self.contour) ax2d.plot(y, z, 'k') #Neutral axis if self.colorNeutralAxis != None: (y, z) = data_axis_to_pyplot(self.fiberSection.getNeutralAxis(), self.contour) ax2d.plot(y, z, self.colorNeutralAxis, label='Neutral axis') #Bending plane if self.colorBendingPlane != None: (y, z) = data_axis_to_pyplot(self.fiberSection.getBendingPlaneTrace(), self.contour) ax2d.plot(y, z, self.colorBendingPlane, label='Bending plane') #Compression plane if self.colorCompressionPlane != None: (y, z) = data_axis_to_pyplot( self.fiberSection.getCompressedPlaneTrace(), self.contour) ax2d.plot(y, z, self.colorCompressionPlane, label='Compression plane') #Tension plane if self.colorTensionPlane != None: (y, z) = data_axis_to_pyplot( self.fiberSection.getTensionedPlaneTrace(), self.contour) ax2d.plot(y, z, self.colorTensionPlane, label='Tension plane') #Internal forces axis if self.colorIntForcAxis != None: (y, z) = data_axis_to_pyplot( self.fiberSection.getInternalForcesAxes(), self.contour) ax2d.plot(y, z, self.colorIntForcAxis, label='Internal forces axis') #Lever arm if self.colorLeverArm != None: (y, z) = data_xcsegment_to_pyplot( self.fiberSection.getLeverArmSegment()) ax2d.plot(y, z, self.colorLeverArm, label='Lever arm') #Effective depth if self.colorEffDepth != None: (y, z) = data_xcsegment_to_pyplot( self.fiberSection.getEffectiveDepthSegment()) ax2d.plot(y, z, self.colorEffDepth, label='Effective depth') #Limit of concrete effective area if self.colorEffConcrArea != None: if self.MaxEffHeight == None: lmsg.error( "I can't plot the limit of the effective concrete area, a value to MaxEffHeight must be provided \n" ) else: (y, z) = data_axis_to_pyplot( self.fiberSection.getEffectiveConcreteAreaLimitLine( self.MaxEffHeight), self.contour) ax2d.plot(y, z, self.colorEffConcrArea, label='Limit of effective concrete area') if self.colorGrossEffConcrAreaContours != None: if self.MaxEffHeight == None: lmsg.error( "I can't plot the contours of the gross effective concrete area, a value to MaxEffHeight must be provided \n" ) else: countLst = self.fiberSection.getGrossEffectiveConcreteAreaContour( self.MaxEffHeight) label = 'Contours of gross effective concrete area' for pol in countLst: (y, z) = data_xcpolygon_to_pyplot(pol) ax2d.plot(y, z, self.colorGrossEffConcrAreaContours, label=label) label = None ax2d.legend() return fig, ax2d
combs = cargas.getLoadCombinations comb = combs.newLoadCombination("COMB", "1.33*A+1.5*B") #We add the load case to domain. cargas.addToDomain("COMB") import os from miscUtils import LogMessages as lmsg fname = os.path.basename(__file__) # Solution analisis = predefined_solutions.simple_static_linear(feProblem) result = analisis.analyze(1) os.system("rm -f /tmp/combinacion04.db") lmsg.error(fname + ' test in QUARANTINE; SQLite interface debugging needed.') exit(-1) db = feProblem.newDatabase("SQLite", "/tmp/combinacion04.db") db.save(100) feProblem.clearAll() db.restore(100) nodes = preprocessor.getNodeLoader nod2 = nodes.getNode(2) deltax = nod2.getDisp[0] deltay = nod2.getDisp[2] elements = preprocessor.getElementLoader
def check(self, elements, nmbComb): '''Crack control.''' lmsg.error('limit state check not implemented.')
def displayElementalLoads(self, preprocessor, loadPattern, color, fScale): loadPattern.addToDomain() eleLoadIter = loadPattern.loads.getElementalLoadIter eleLoad = eleLoadIter.next() lmsg.error('displayElementalLoads not implemented.')
def appendRanges(self,ijkRangeList): if(ijkRangeList.grid==self.grid): self.ranges.extend(ijkRangeList.ranges) else: lmsg.error("Error: reference grids are not the same.")
def dispLoadCaseBeamEl(self, loadCaseName='', setToDisplay=None, fUnitConv=1.0, elLoadComp='transComponent', elLoadScaleF=1.0, nodLoadScaleF=1.0, viewName='XYZPos', hCamFct=1.0, caption='', 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 fUnitConv: factor of conversion to be applied to the results (defaults to 1) :param elLoadComp: component of the loads on elements to be depicted [possible components: 'axialComponent', 'transComponent', 'transYComponent', 'transZComponent'] :param elLoadScaleF: factor of scale to apply to the diagram display of element loads (defaults to 1) :param nodLoadScaleF: factor of scale to apply to the vector display of nodal loads (defaults to 1) :param viewName: name of the view that contains the renderer (possible options: "XYZPos", "XPos", "XNeg","YPos", "YNeg", "ZPos", "ZNeg") (defaults to "XYZPos") :param hCamFct: factor that applies to the height of the camera position in order to change perspective of isometric views (defaults to 1). Usual values 0.1 to 10 :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) ''' if (setToDisplay): self.xcSet = setToDisplay if self.xcSet.color.Norm() == 0: self.xcSet.color = xc.Vector( [rd.random(), rd.random(), rd.random()]) else: lmsg.warning( 'QuickGraphics::dispLoadCaseBeamEl; set to display not defined; using previously defined set (total if None).' ) preprocessor = self.feProblem.getPreprocessor loadPatterns = preprocessor.getLoadHandler.getLoadPatterns loadPatterns.addToDomain(loadCaseName) defDisplay = self.getDisplay(vwName=viewName, hCamF=hCamFct) grid = defDisplay.setupGrid(self.xcSet) defDisplay.defineMeshScene(None, defFScale, color=self.xcSet.color) orNodalLBar = 'H' #default orientation of scale bar for nodal loads # auto-scaling parameters LrefModSize = setToDisplay.getBnd(1.0).diagonal.getModulo( ) #representative length of set size (to auto-scale) diagAux = lld.LinearLoadDiagram(scale=elLoadScaleF, fUnitConv=fUnitConv, loadPatternName=loadCaseName, component=elLoadComp) maxAbs = diagAux.getMaxAbsComp(preprocessor) if maxAbs > 0: elLoadScaleF *= LrefModSize / maxAbs * 100 # diagram = lld.LinearLoadDiagram(scale=elLoadScaleF, fUnitConv=fUnitConv, loadPatternName=loadCaseName, component=elLoadComp) diagram.addDiagram(preprocessor) if diagram.isValid(): defDisplay.appendDiagram(diagram) orNodalLBar = 'V' # nodal loads vField = lvf.LoadVectorField(loadPatternName=loadCaseName, fUnitConv=fUnitConv, scaleFactor=nodLoadScaleF, showPushing=True) # loadPatterns= preprocessor.getLoadHandler.getLoadPatterns lPattern = loadPatterns[loadCaseName] count = 0 if (lPattern): count = vField.dumpNodalLoads(preprocessor, defFScale=defFScale) else: lmsg.error('load pattern: ' + loadCaseName + ' not found.') if count > 0: vField.addToDisplay(defDisplay, orientation=orNodalLBar) defDisplay.displayScene(caption=caption, fName=fileName)