コード例 #1
0
def gdls_resist_materiales2D(nodes):
  '''Defines the dimension of the space: nodes by two coordinates (x,y) and three DOF for each node (Ux,Uy,theta)

  :param nodes: preprocessor nodes loader
  '''
  lmsg.warning('gdls_resist_materiales2D DEPRECATED; use StructuralMechanics2D.')
  return StructuralMechanics2D(nodes)
コード例 #2
0
ファイル: predefined_spaces.py プロジェクト: lcpt/xc
def gdls_resist_materiales3D(nodes):
    '''Define the dimension of the space: nodes by three coordinates (x,y,z) and six DOF for each node (Ux,Uy,Uz,thetaX,thetaY,thetaZ)

    :param nodes: preprocessor nodes handler
    '''
    lmsg.warning('gdls_resist_materiales3D DEPRECATED; use StructuralMechanics3D.')
    return StructuralMechanics3D(nodes)
コード例 #3
0
ファイル: typical_materials.py プロジェクト: lcpt/xc
def defConcrete02(preprocessor,name,epsc0,fpc,fpcu,epscu,ratioSlope,ft,Ets):
  ''''Constructs an uniaxial concrete material with linear tension
  softening. Compressive concrete parameters should be input as negative values.
  The initial slope for this model is (2*fpc/epsc0) 

  :param preprocessor: preprocessor
  :param name:         name identifying the material
  :param epsc0:        concrete strain at maximum strength 
  :param fpc:          concrete compressive strength at 28 days (compression is negative)
  :param fpcu:         concrete crushing strength 
  :param epscu:        concrete strain at crushing strength 
  :param ratioSlope:   ratio between unloading slope at epscu and initial slope 
  :param ft:           tensile strength
  :param Ets:          tension softening stiffness (absolute value) (slope of the linear tension softening branch) 

  '''
  materials= preprocessor.getMaterialHandler
  materials.newMaterial("concrete02_material",name)
  retval= materials.getMaterial(name)
  retval.name= name
  retval.epsc0= epsc0
  retval.fpc= fpc
  retval.fpcu= fpcu
  retval.epscu= epscu
  retval.ratioSlope=ratioSlope
  retval.ft=ft
  retval.Ets=Ets
  if fpc==fpcu:
    lmsg.warning("concrete02 compressive strength fpc is equal to crushing strength fpcu => the solver can return wrong stresses or have convergence problems ")
  return retval
コード例 #4
0
ファイル: predefined_spaces.py プロジェクト: lcpt/xc
def gdls_elasticidad2D(nodes):
    '''Defines the dimension of the space: nodes by two coordinates (x,y) and two DOF for each node (Ux,Uy)

    :param nodes: nodes handler
    '''
    lmsg.warning('gdls_elasticidad2D DEPRECATED; use SolidMechanics2D.')
    return SolidMechanics2D(nodes)
コード例 #5
0
    def displayLocalAxes(self,
                         setToDisplay=None,
                         vectorScale=1.0,
                         viewNm="XYZPos",
                         hCamFct=1.0,
                         caption='',
                         fileName=None):
        '''vector field display of the loads applied to the chosen set of elements in the load case passed as parameter
    
    :param setToDisplay:   set of elements to be displayed (defaults to total set)
    :param vectorScale:    factor to apply to the vectors length in the representation
    :param viewNm:         name of the view  that contains the renderer (possible options: "XYZPos", "XPos", "XNeg","YPos", "YNeg", "ZPos", "ZNeg")
    :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 fileName:       full name of the graphic file to generate. Defaults to `None`, in this case it returns a console output graphic.
    :param caption:        text to display in the graphic 
    '''
        if (setToDisplay == None):
            setToDisplay = self.getPreprocessor().getSets.getSet('total')
            setToDisplay.fillDownwards()
            lmsg.warning('set to display not defined; using total set.')

        defDisplay = vtk_grafico_ef.RecordDefDisplayEF()
        defDisplay.setupGrid(setToDisplay)
        vField = lavf.LocalAxesVectorField(setToDisplay.name + '_localAxes',
                                           vectorScale)
        vField.dumpLocalAxes(setToDisplay)
        defDisplay.viewName = viewNm
        defDisplay.hCamFct = hCamFct
        defDisplay.defineEscenaMalla(None)
        vField.addToDisplay(defDisplay)
        defDisplay.displayScene(caption, fileName)
        return defDisplay
コード例 #6
0
ファイル: def_vars_control.py プロジェクト: xyuan/xc
def defVarControlMov(obj, code):
  if(not obj.hasProp('span')):
    lmsg.warning('span property not defined for: '+str(obj.tag) + ' object.')
  obj.setProp(code+'Max',0.0)
  obj.setProp('Comb'+code+'Max',"")
  obj.setProp(code+'Min',0.0)
  obj.setProp('Comb'+code+'Min',"")
コード例 #7
0
ファイル: section_properties.py プロジェクト: lcpt/xc
 def alphaZ(self):
   '''Return shear shape factor with respect to local z-axis'''
   msg= 'alphaZ: shear shape factor not implemented for section: '
   msg+= self.sectionName
   msg+= '. 5/6 returned'
   lmsg.warning(msg)
   return 5.0/6.0
コード例 #8
0
ファイル: vtk_internal_force_diagram.py プロジェクト: lcpt/xc
  def getElementComponentData(self,elem):
    '''Returns the data to use to represent the diagram over the element
 
       :param elem: element to deal with.
       :param component: component to represent:
    '''
    # default values.
    elemVDir= elem.getJVector3d(True) #initialGeometry= True
    value1= 0.0
    value2= 0.0
    if(self.component == 'N'):
      value1= elem.getN1
      value2= elem.getN2
    elif(self.component == 'Qy'):
      elemVDir= elem.getJVector3d(True) # initialGeometry= True 
      value1= elem.getVy1
      value2= elem.getVy2
    elif(self.component == 'Qz'):
      elemVDir= elem.getKVector3d(True) # initialGeometry= True 
      value1= elem.getVz1
      value2= elem.getVz2
    elif(self.component == 'T'):
      value1= elem.getT1
      value2= elem.getT2
    elif(self.component == 'My'):
      elemVDir= elem.getKVector3d(True) # initialGeometry= True 
      value1= elem.getMy1
      value2= elem.getMy2
    elif(self.component == 'Mz'):
      elemVDir= elem.getJVector3d(True) # initialGeometry= True 
      value1= elem.getMz1
      value2= elem.getMz2
    else:
      lmsg.warning("'component :'"+ self.component+ "' unknown.")
    return [elemVDir,value1,value2]
コード例 #9
0
 def getAeff(self,sectionClass= 1):
   '''return effective area depending of the cross-section class.'''
   retval= self.A()
   if(sectionClass>=3):
     lmsg.warning('effective area for sections of class: '+ str(sectionClass) + ' not implemented.')
     retval/=100.0
   return retval
コード例 #10
0
ファイル: section_properties.py プロジェクト: aishugang/xc
 def J(self):
   '''Return torsional constant of the section'''
   msg= 'Torsional constant not implemented for section:'
   msg+= self.sectionName
   msg+= '. Zero returned'
   lmsg.warning(msg)
   return 0.0
コード例 #11
0
ファイル: vtk_CAD_graphic.py プロジェクト: ahke-sied/xc
 def defineMeshScene(self):
     ''' Define mesh scene on ouput display.'''
     self.gridRecord.uGrid = vtk.vtkUnstructuredGrid()
     self.gridRecord.cellType = "lines"
     setToDraw = self.gridRecord.xcSet
     self.gridRecord.uGrid.name = setToDraw.name + '_grid'
     numKPts = setToDraw.getPoints.size
     if (numKPts > 0):
         cad_mesh.VtkCargaMalla(self.gridRecord)
         self.renderer = vtk.vtkRenderer()
         self.renderer.SetBackground(self.bgRComp, self.bgGComp,
                                     self.bgBComp)
         cad_mesh.VtkDefineActorKPoint(self.gridRecord, self.renderer, 0.02)
         cad_mesh.VtkDefineActorCells(self.gridRecord, self.renderer,
                                      "wireframe")
         #Experimental yet (31/07/2018) LCPT
         vField = lavf.QuadSurfacesLocalAxesVectorField(
             setToDraw.name + '_localAxes', 1)  #vectorScale)
         vField.dumpVectors(setToDraw)
         vField.addToDisplay(self)
         #End of the experiment
         self.renderer.ResetCamera()
     else:
         lmsg.warning(
             "Error when drawing set: '" + setToDraw.name +
             "' it has not key points so I can't get set geometry (use fillDownwards?)"
         )
コード例 #12
0
  def displayLocalAxes(self,setToDisplay=None,vectorScale=1.0,viewNm="XYZPos",hCamFct=1.0,caption= '',fileName=None,defFScale=0.0):
    '''vector field display of the loads applied to the chosen set of elements in the load case passed as parameter
    
    :param setToDisplay:   set of elements to be displayed (defaults to total set)
    :param vectorScale:    factor to apply to the vectors length in the representation
    :param viewNm:         name of the view  that contains the renderer (possible options: "XYZPos", "XPos", "XNeg","YPos", "YNeg", "ZPos", "ZNeg")
    :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 fileName:       full name of the graphic file to generate. Defaults to `None`, in this case it returns a console output graphic.
    :param caption:        text to display in the 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)
    '''
    if(setToDisplay == None):
      setToDisplay=self.getPreprocessor().getSets.getSet('total')
      setToDisplay.fillDownwards()
      lmsg.warning('set to display not defined; using total set.')

    defDisplay= vtk_FE_graphic.RecordDefDisplayEF()
    defDisplay.setupGrid(setToDisplay)
    if setToDisplay.color.Norm()==0:
      setToDisplay.color=xc.Vector([rd.random(),rd.random(),rd.random()])
    vField=lavf.LocalAxesVectorField(setToDisplay.name+'_localAxes',vectorScale)
    vField.dumpVectors(setToDisplay)
    defDisplay.viewName= viewNm
    defDisplay.hCamFct=hCamFct
    defDisplay.defineMeshScene(None,defFScale,color=setToDisplay.color) 
    vField.addToDisplay(defDisplay)
    defDisplay.displayScene(caption,fileName)
    return defDisplay
コード例 #13
0
ファイル: section_properties.py プロジェクト: aishugang/xc
 def alphaZ(self):
   '''Return shear shape factor with respect to local z-axis'''
   msg= 'alphaZ: shear shape factor not implemented for section: '
   msg+= self.sectionName
   msg+= '. 5/6 returned'
   lmsg.warning(msg)
   return 5.0/6.0
コード例 #14
0
  def displayLocalAxes(self,setToDisplay=None,vectorScale=1.0,viewDef= vtk_graphic_base.CameraParameters('XYZPos'), caption= '',fileName=None,defFScale=0.0):
    '''vector field display of the loads applied to the chosen set of elements in the load case passed as parameter
    
    :param setToDisplay:   set of elements to be displayed (defaults to total set)
    :param vectorScale:    factor to apply to the vectors length in the representation
    :param viewDef:       parameters that define the view to use
           predefined view names: 'XYZPos','XNeg','XPos','YNeg','YPos',
           'ZNeg','ZPos'
    :param fileName:       full name of the graphic file to generate. Defaults to `None`, in this case it returns a console output graphic.
    :param caption:        text to display in the 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)
    '''
    if(setToDisplay == None):
      setToDisplay=self.getPreprocessor().getSets.getSet('total')
      setToDisplay.fillDownwards()
      lmsg.warning('set to display not defined; using total set.')

    defDisplay= vtk_FE_graphic.RecordDefDisplayEF()
    defDisplay.setupGrid(setToDisplay)
    if setToDisplay.color.Norm()==0:
      setToDisplay.color=xc.Vector([rd.random(),rd.random(),rd.random()])
    vField=lavf.LocalAxesVectorField(setToDisplay.name+'_localAxes',vectorScale)
    vField.dumpVectors(setToDisplay)
    defDisplay.cameraParameters= viewDef
    defDisplay.defineMeshScene(None,defFScale,color=setToDisplay.color) 
    vField.addToDisplay(defDisplay)
    defDisplay.displayScene(caption,fileName)
    return defDisplay
コード例 #15
0
ファイル: quick_graphics.py プロジェクト: lcpt/xc
    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)
コード例 #16
0
def defConcrete02(preprocessor, name, epsc0, fpc, fpcu, epscu, ratioSlope, ft,
                  Ets):
    ''''Constructs an uniaxial concrete material with linear tension
  softening. Compressive concrete parameters should be input as negative values.
  The initial slope for this model is (2*fpc/epsc0) 

  :param preprocessor: preprocessor
  :param name:         name identifying the material
  :param epsc0:        concrete strain at maximum strength 
  :param fpc:          concrete compressive strength at 28 days (compression is negative)
  :param fpcu:         concrete crushing strength 
  :param epscu:        concrete strain at crushing strength 
  :param ratioSlope:   ratio between unloading slope at epscu and initial slope 
  :param ft:           tensile strength
  :param Ets:          tension softening stiffness (absolute value) (slope of the linear tension softening branch) 

  '''
    materials = preprocessor.getMaterialHandler
    materials.newMaterial("concrete02_material", name)
    retval = materials.getMaterial(name)
    retval.name = name
    retval.epsc0 = epsc0
    retval.fpc = fpc
    retval.fpcu = fpcu
    retval.epscu = epscu
    retval.ratioSlope = ratioSlope
    retval.ft = ft
    retval.Ets = Ets
    if fpc == fpcu:
        lmsg.warning(
            "concrete02 compressive strength fpc is equal to crushing strength fpcu => the solver can return wrong stresses or have convergence problems "
        )
    return retval
コード例 #17
0
def AsSimpleBending(M, fcd, fsd, b, d):
    ''' Return the required reinforcement for a rectangular section
      subjected to simple bending.

  :param M: bending moment to resist.
  :param fcd: concrete design compressive strength (absolute value).
  :param fsd: steel design yield strength.
  :param b: section width.
  :param d: section depth.
  '''
    if (fcd < 0.0):
        lmsg.warning(
            'positive value expected for concrete design strength fcd= ' +
            str(fcd / 1e6) + ' MPa.')
    Ml = Mlim(fcd, b, d)
    if (M > Ml):
        lmsg.warning('compression reinforcement needed Ml= ' + str(Ml / 1e3) +
                     ' kN m < ' + str(M / 1e3) + ' kN m')
        T = 1e9
    else:
        c = 0.85 * fcd * b
        T = c * (d - math.sqrt(d**2 - 2 * M / c))
        xpl = T / c
        assert xpl <= d, "xpl bigger than section depth."
    return T / fsd
コード例 #18
0
ファイル: predefined_spaces.py プロジェクト: gwiedemair/xc
def gdls_elasticidad2D(nodes):
    '''Defines the dimension of the space: nodes by two coordinates (x,y) and two DOF for each node (Ux,Uy)

    :param nodes: nodes handler
    '''
    lmsg.warning('gdls_elasticidad2D DEPRECATED; use SolidMechanics2D.')
    return SolidMechanics2D(nodes)
コード例 #19
0
ファイル: quick_graphics.py プロジェクト: xyuan/xc
def display_strong_weak_axis(preprocessor,
                             setToDisplay=None,
                             vectorScale=1.0,
                             viewDef=vtk_graphic_base.CameraParameters(
                                 "XYZPos", 1.0),
                             caption='',
                             fileName=None,
                             defFScale=0.0):
    '''vector field display of the loads applied to the chosen set of elements 
       in the load case passed as parameter
    
    :param setToDisplay: set of elements to be displayed (defaults to total set)
    :param vectorScale: factor to apply to the vectors length in the 
           representation.
    :param viewDef: camera parameters.
    :param fileName: full name of the graphic file to generate. Defaults to 
           `None`, in this case it returns a console output graphic.
    :param caption: text to display in the 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)
    '''
    if (setToDisplay == None):
        setToDisplay = preprocessor.getSets.getSet('total')
        setToDisplay.fillDownwards()
        lmsg.warning('set to display not defined; using total set.')
    vField = lavf.StrongWeakAxisVectorField(
        setToDisplay.name + '_strongWeakAxis', vectorScale)
    vField.dumpVectors(setToDisplay)
    return display_axes(vField, preprocessor, setToDisplay, vectorScale,
                        viewDef, caption, fileName, defFScale)
コード例 #20
0
ファイル: predefined_spaces.py プロジェクト: gwiedemair/xc
    def setUniaxialBearing2D(self, iNod, bearingMaterial, direction):
        '''Modelize an uniaxial bearing on the defined direction.

          Args:
              iNod (int): node identifier (tag).
              bearingMaterial (str): material name for the zero length
                 element.
          Returns:
              :rtype: (int, int) new node tag, new element tag.
        '''
        nodes = self.preprocessor.getNodeHandler
        newNode = nodes.duplicateNode(iNod)  # new node.
        # Element definition
        elems = self.preprocessor.getElementHandler
        elems.dimElem = self.preprocessor.getNodeHandler.dimSpace  # space dimension.
        if (elems.dimElem > 2):
            lmsg.warning("Not a bi-dimensional space.")
        elems.defaultMaterial = bearingMaterial
        zl = elems.newElement("ZeroLength", xc.ID([newNode.tag, iNod]))
        zl.setupVectors(xc.Vector([direction[0], direction[1], 0]),
                        xc.Vector([-direction[1], direction[0], 0]))
        zl.clearMaterials()
        zl.setMaterial(0, bearingMaterial)
        # Boundary conditions
        numDOFs = self.preprocessor.getNodeHandler.numDOFs
        for i in range(0, numDOFs):
            spc = self.constraints.newSPConstraint(newNode.tag, i, 0.0)
        return newNode.tag, zl.tag
コード例 #21
0
ファイル: predefined_spaces.py プロジェクト: lcpt/xc
    def setUniaxialBearing2D(self,iNod,bearingMaterial,direction):
        '''Modelize an uniaxial bearing on the defined direction.

          Args:
              iNod (int): node identifier (tag).
              bearingMaterial (str): material name for the zero length
                 element.
          Returns:
              :rtype: (int, int) new node tag, new element tag.
        '''
        nodes= self.preprocessor.getNodeHandler
        newNode= nodes.duplicateNode(iNod) # new node.
        # Element definition
        elems= self.preprocessor.getElementHandler
        elems.dimElem= self.preprocessor.getNodeHandler.dimSpace # space dimension.
        if(elems.dimElem>2):
            lmsg.warning("Not a bi-dimensional space.")
        elems.defaultMaterial= bearingMaterial
        zl= elems.newElement("ZeroLength",xc.ID([newNode.tag,iNod]))
        zl.setupVectors(xc.Vector([direction[0],direction[1],0]),xc.Vector([-direction[1],direction[0],0]))
        zl.clearMaterials()
        zl.setMaterial(0,bearingMaterial)
        # Boundary conditions
        numDOFs= self.preprocessor.getNodeHandler.numDOFs
        for i in range(0,numDOFs):
            spc= self.constraints.newSPConstraint(newNode.tag,i,0.0)
        return newNode.tag, zl.tag
コード例 #22
0
    def dumpVectors(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.dumpVectors: no loads defined.')
                loadPatterns.removeFromDomain(self.lpName)
        else:
            lmsg.error('Load pattern: ' + self.lpName + ' not found.')
        return count
コード例 #23
0
ファイル: predefined_spaces.py プロジェクト: lcpt/xc
def gdls_resist_materiales2D(nodes):
    '''Defines the dimension of the space: nodes by two coordinates (x,y) and three DOF for each node (Ux,Uy,theta)

    :param nodes: preprocessor nodes handler
    '''
    lmsg.warning('gdls_resist_materiales2D DEPRECATED; use StructuralMechanics2D.')
    return StructuralMechanics2D(nodes)
コード例 #24
0
  def getElementComponentData(self,elem):
    '''Returns the data to use to represent the diagram over the element
 
       :param elem: element to deal with.
       :param component: component to represent:
    '''
    # default values.
    elemVDir= elem.getJVector3d(True) #initialGeometry= True
    value1= 0.0
    value2= 0.0
    if(self.component == 'N'):
      value1= elem.getN1
      value2= elem.getN2
    elif(self.component == 'Qy'):
      elemVDir= elem.getJVector3d(True) # initialGeometry= True 
      value1= elem.getVy1
      value2= elem.getVy2
    elif(self.component == 'Qz'):
      elemVDir= elem.getKVector3d(True) # initialGeometry= True 
      value1= elem.getVz1
      value2= elem.getVz2
    elif(self.component == 'T'):
      value1= elem.getT1
      value2= elem.getT2
    elif(self.component == 'My'):
      elemVDir= elem.getKVector3d(True) # initialGeometry= True 
      value1= elem.getMy1
      value2= elem.getMy2
    elif(self.component == 'Mz'):
      elemVDir= elem.getJVector3d(True) # initialGeometry= True 
      value1= elem.getMz1
      value2= elem.getMz2
    else:
      lmsg.warning("'component :'"+ self.component+ "' unknown.")
    return [elemVDir,value1,value2]
コード例 #25
0
    def ic(self, deltaB, deltaL, Hload, Beff, Leff):
        '''Factor that introduces the effect of load inclination on
           the cohesion component.

        :param deltaB: angle between the load and the foundation width
                       atan(HloadB/VLoad).
        :param deltaL: angle between the load and the foundation length
                       atan(HloadL/VLoad).
        :param Hload: Horizontal load. 
        :param Beff: Width of the effective foundation area
                     (see figure 12 in page 44 of reference[2]).
        :param Leff: Length of the effective foundation area
                    (see figure 12 in page 44 of reference[2]).
        '''
        if (self.getDesignPhi() != 0.0):
            iq = self.iq(deltaB, deltaL)
            return (iq * self.Nq() - 1.0) / (self.Nq() - 1.0)
        else:  #See expresion (15) in reference [2]
            resist = Beff * Leff * self.getDesignC()
            if (Hload <= resist):
                twoAlpha = math.acos(Hload / resist)
                return 0.5 + (twoAlpha + math.sin(twoAlpha)) / (math.pi + 2.0)
            else:
                lmsg.warning('Load (H= ' + str(Hload) +
                             ') greater than soil strength R=' + str(resist) +
                             ' returns 0.0')
                return 0.0
コード例 #26
0
ファイル: extrapolate_elem_attr.py プロジェクト: aishugang/xc
def create_attribute_at_nodes(xcSet, attributeName, initialValue):
    ''' Create an attribute on the nodes of the set passed as parameter.
    return tags of the affected nodes.

    :param xcSet: nodes that will receive the attribute.
    :param attributeName: name of the attribute to define.
    :param initialValue: initial value to assign to the attribute.
    '''
    nodeTags = {}
    for e in xcSet:
        elemNodes = e.getNodes
        sz = len(elemNodes)
        for i in range(0, sz):
            n = elemNodes[i]
            tag = n.tag
            if tag not in nodeTags:
                nodeTags[tag] = 1
                if (n.hasProp(attributeName)):
                    lmsg.warning('node: ' + str(n.tag) +
                                 ' already has a property named: \'' +
                                 attributeName + '\'.')
                n.setProp(attributeName, initialValue)
            else:
                nodeTags[tag] += 1
    return nodeTags
コード例 #27
0
ファイル: LoadContainer.py プロジェクト: xyuan/xc
 def dumpSurfaceLoads(self, lp, destLoadCase):
     '''Dump loads over elements.'''
     eLoadIter = lp.loads.getElementalLoadIter
     el = eLoadIter.next()
     while el:
         eLoad = nld.ElementLoadRecord(destLoadCase,
                                       self.surfaceLoadCounter, 1.0)
         if (hasattr(el, "getGlobalForces")):
             eLoad.mode = False  # Referred to local coordinate system.
             lf = xc.Vector([el.Wx, el.Wy, el.Wz])
             eLoad.value = lf.Norm()
             if (eLoad.value >= 1e-3):
                 eLoad.vDir = [
                     el.Wx / eLoad.value, el.Wy / eLoad.value,
                     el.Wz / eLoad.value
                 ]
                 tags = el.elementTags
                 for i in range(0, len(tags)):
                     eLoad.tags.append(tags[i])
                 destLoadCase.loads.surfaceLoads.append(eLoad)
             else:
                 lmsg.warning(
                     'loads2Neutral: vDir vector very small: "+ str(vDir) + " load ignored.'
                 )
         self.surfaceLoadCounter += 1
         el = eLoadIter.next()
コード例 #28
0
    def getElementComponentData(self, elem):
        '''Returns the data to use to represent the diagram over the element
 
       :param elem: element to deal with.
       :param component: component to represent:
    '''
        elemVDir = elem.getVDirWeakAxisGlobalCoord()  # default values.
        value1 = 0.0
        value2 = 0.0
        if (self.component == 'N'):
            value1 = elem.getN1
            value2 = elem.getN2
        elif (self.component == 'Qy'):
            elemVDir = elem.getCoordTransf.getJVector
            value1 = elem.getVy1
            value2 = elem.getVy2
        elif (self.component == 'Qz'):
            elemVDir = elem.getCoordTransf.getKVector
            value1 = elem.getVz1
            value2 = elem.getVz2
        elif (self.component == 'T'):
            value1 = elem.getT1
            value2 = elem.getT2
        elif (self.component == 'My'):
            elemVDir = elem.getCoordTransf.getKVector
            value1 = elem.getMy1
            value2 = elem.getMy2
        elif (self.component == 'Mz'):
            elemVDir = elem.getCoordTransf.getJVector
            value1 = elem.getMz1
            value2 = elem.getMz2
        else:
            lmsg.warning("'component :'" + self.component + "' unknown.")
        return [elemVDir, value1, value2]
コード例 #29
0
ファイル: load_vector_field.py プロジェクト: lcpt/xc
  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
コード例 #30
0
ファイル: load_vector_field.py プロジェクト: gwiedemair/xc
    def dumpVectors(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.
        '''
        count = 0
        activeLoadPatterns = preprocessor.getDomain.getConstraints.getLoadPatterns
        if (len(activeLoadPatterns) < 1):
            lmsg.warning('No active load patterns.')
        for lp in activeLoadPatterns:  #Iterate over loaded elements.
            numberOfLoads = self.populateLoads(preprocessor, lp.data())
            if (numberOfLoads > 0):
                self.data.scaleFactor /= self.getMaxLoad()
                #Iterate over loaded elements.
                count += self.dumpElementalPositions(preprocessor, lp.data())
                #Iterate over loaded nodes.
                count += self.dumpNodalPositions(preprocessor, lp.data(),
                                                 defFScale)
                if (count == 0):
                    lmsg.warning(
                        'LoadVectorField.dumpVectors: no loads defined.')
        return count
コード例 #31
0
def gdls_resist_materiales3D(nodes):
  '''Define the dimension of the space: nodes by three coordinates (x,y,z) and six DOF for each node (Ux,Uy,Uz,thetaX,thetaY,thetaZ)

  :param nodes: preprocessor nodes loader
  '''
  lmsg.warning('gdls_resist_materiales3D DEPRECATED; use StructuralMechanics3D.')
  return StructuralMechanics3D(nodes)
コード例 #32
0
def displayStrongWeakAxis(preprocessor,setToDisplay=None,vectorScale=1.0,viewNm="XYZPos",hCamFct=1.0,caption= '',fileName=None,defFScale=0.0):
    '''vector field display of the loads applied to the chosen set of elements 
       in the load case passed as parameter
    
    :param setToDisplay: set of elements to be displayed (defaults to total set)
    :param vectorScale: factor to apply to the vectors length in the 
           representation.
    :param viewNm: name of the view  that contains the renderer 
            (possible options: 
             "XYZPos", "XPos", "XNeg","YPos", "YNeg", "ZPos", "ZNeg")
    :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 fileName: full name of the graphic file to generate. Defaults to 
           `None`, in this case it returns a console output graphic.
    :param caption: text to display in the 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)
    '''
    if(setToDisplay == None):
        setToDisplay=preprocessor.getSets.getSet('total')
        setToDisplay.fillDownwards()
        lmsg.warning('set to display not defined; using total set.')
    vField=lavf.StrongWeakAxisVectorField(setToDisplay.name+'_strongWeakAxis',vectorScale)
    vField.dumpVectors(setToDisplay)
    return displayAxes(vField,preprocessor,setToDisplay,vectorScale,viewNm,hCamFct,caption,fileName,defFScale)
コード例 #33
0
ファイル: quick_graphics.py プロジェクト: lcpt/xc
    def displayNodeValueDiagram(self,itemToDisp='',setToDisplay=None,fConvUnits=1.0,scaleFactor=1.0,unitDescription= '',viewDef= vtk_graphic_base.CameraParameters('XYZPos'),fileName=None,defFScale=0.0):
        '''displays the a displacement (uX,uY,...) or a property defined in nodes 
        as a diagram over lines (i.e. appropiated for beam elements).

        :param itemToDisp:   item to display.
        :param setToDisplay: set of entities (elements of type beam) to be 
               represented
        :param fConvUnits:   factor of conversion to be applied to the results 
               (defalts to 1)
        :param scaleFactor:  factor of scale to apply to the diagram display of
        :param unitDescription: string like '[m]' or '[rad]' or '[m/s2]'
        :param viewDef: camera parameters.
        :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::displayNodeValueDiagram; set to display not defined; using previously defined set (total if None).')
        diagram= npd.NodePropertyDiagram(scaleFactor= scaleFactor,fUnitConv= fConvUnits,sets=[self.xcSet],attributeName= itemToDisp)
        diagram.addDiagram()
        defDisplay= self.getDisplay(viewDef)
        defDisplay.setupGrid(self.xcSet)
        defDisplay.defineMeshScene(None,defFScale,color=self.xcSet.color)
        defDisplay.appendDiagram(diagram) #Append diagram to the scene.

        caption= self.loadCaseName+' '+itemToDisp+' '+unitDescription +' '+self.xcSet.description
        defDisplay.displayScene(caption=caption,fName=fileName)
コード例 #34
0
    def displayDispRot(self,itemToDisp='',setToDisplay=None,fConvUnits=1.0,unitDescription= '',viewName='XYZPos',hCamFct=1.0,fileName=None,defFScale=0.0):
      '''displays the component of the displacement or rotations in the 
      set of entities.

      :param itemToDisp: component of the displacement ('uX', 'uY' or 'uZ') 
                    or the rotation ('rotX', rotY', 'rotZ') to be depicted 
      :param setToDisplay:   set of entities to be represented (defaults to all 
                    entities)
      :param fConvUnits: factor of conversion to be applied to the results 
                    (defaults to 1)
      :param unitDescription: string describing units like '[mm] or [cm]'
      :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
      else:
          lmsg.warning('QuickGraphics::displayDispRot; set to display not defined; using previously defined set (total if None).')
      vCompDisp= self.getDispComponentFromName(itemToDisp)
      nodSet= self.xcSet.getNodes
      for n in nodSet:
          n.setProp('propToDisp',n.getDisp[vCompDisp])
      field= Fields.ScalarField('propToDisp',"getProp",None,fConvUnits)
      defDisplay= self.getDisplay(vwName=viewName,hCamF= hCamFct)
      defDisplay.displayMesh(xcSet=self.xcSet,field=field,diagrams= None, fName=fileName,caption=self.loadCaseName+' '+itemToDisp+' '+unitDescription+' '+self.xcSet.description,defFScale=defFScale)
コード例 #35
0
ファイル: quick_graphics.py プロジェクト: lcpt/xc
    def displayDispRot(self,itemToDisp='',setToDisplay=None,fConvUnits=1.0,unitDescription= '',viewDef= vtk_graphic_base.CameraParameters('XYZPos',1.0),fileName=None,defFScale=0.0,rgMinMax=None):
        '''displays the component of the displacement or rotations in the 
        set of entities.

        :param itemToDisp: component of the displacement ('uX', 'uY' or 'uZ') 
                    or the rotation ('rotX', rotY', 'rotZ') to be depicted 
        :param setToDisplay:   set of entities to be represented (defaults to all 
                    entities)
        :param fConvUnits: factor of conversion to be applied to the results 
                    (defaults to 1)
        :param unitDescription: string describing units like '[mm] or [cm]'
        :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)
        :param rgMinMax: range (vmin,vmax) with the maximum and minimum values of 
              the field to be represented. All the values less than vmin are 
              displayed in blue and those greater than vmax in red
              (defaults to None)

        '''
        if(setToDisplay):
            self.xcSet= setToDisplay
        else:
            lmsg.warning('QuickGraphics::displayDispRot; set to display not defined; using previously defined set (total if None).')
        vCompDisp= self.getDispComponentFromName(itemToDisp)
        nodSet= self.xcSet.getNodes
        for n in nodSet:
            n.setProp('propToDisp',n.getDisp[vCompDisp])
        field= Fields.ScalarField(name='propToDisp',functionName="getProp",component=None,fUnitConv=fConvUnits,rgMinMax=rgMinMax)
        defDisplay= self.getDisplay(viewDef)
        defDisplay.displayMesh(xcSets=self.xcSet,field=field,diagrams= None, fName=fileName,caption=self.loadCaseName+' '+itemToDisp+' '+unitDescription+' '+self.xcSet.description,defFScale=defFScale)
コード例 #36
0
ファイル: section_properties.py プロジェクト: lcpt/xc
 def J(self):
   '''Return torsional constant of the section'''
   msg= 'Torsional constant not implemented for section:'
   msg+= self.sectionName
   msg+= '. Zero returned'
   lmsg.warning(msg)
   return 0.0
コード例 #37
0
  def ic(self,deltaB,deltaL,Hload,Beff,Leff):
    '''Factor that introduces the effect of load inclination on
       the cohesion component.

    :param deltaB: angle between the load and the foundation width
                   atan(HloadB/VLoad).
    :param deltaL: angle between the load and the foundation length
                   atan(HloadL/VLoad).
    :param Hload: Horizontal load. 
    :param Beff: Width of the effective foundation area
                 (see figure 12 in page 44 of reference[2]).
    :param Leff: Length of the effective foundation area
                (see figure 12 in page 44 of reference[2]).
    '''
    if(self.getDesignPhi()!=0.0):
      iq= self.iq(deltaB,deltaL)
      return (iq*self.Nq()-1.0)/(self.Nq()-1.0)
    else: #See expresion (15) in reference [2]
      resist= Beff*Leff*self.getDesignC()
      if(Hload<=resist):
        twoAlpha= math.acos(Hload/resist)
        return 0.5+(twoAlpha+math.sin(twoAlpha))/(math.pi+2.0)
      else:
        lmsg.warning('Load (H= '+str(Hload)+') greater than soil strength R='+str(resist)+' returns 0.0')
        return 0.0
コード例 #38
0
ファイル: LoadVectorField.py プロジェクト: dratsiox/xc
 def dumpElementalLoads(self, preprocessor, lp):
     ''' Iterate over loaded elements dumping its loads into the graphic.'''
     lIter = lp.getElementalLoadIter
     elementLoad = lIter.next()
     i = self.components[0]
     j = self.components[1]
     k = self.components[2]
     count = 0
     while (elementLoad):
         tags = elementLoad.elementTags
         for i in range(0, len(tags)):
             eTag = tags[i]
             elem = preprocessor.getElementLoader.getElement(eTag)
             if (elem.getDimension == 2):
                 vLoad = elem.getCoordTransf.getVectorGlobalCoordFromLocal(
                     elementLoad.getLocalForce())
                 if (self.multiplyByElementArea):
                     vLoad *= elem.getArea(True)
                 vx = vLoad[i]
                 vy = vLoad[j]
                 vz = vLoad[k]
                 p = elem.getPosCentroid(True)
                 self.data.insertNextPair(p.x, p.y, p.z, vx, vy, vz,
                                          self.fUnitConv, self.showPushing)
             else:
                 lmsg.warning(
                     'displaying of loads over 1D elements not yet implemented'
                 )
         elementLoad = lIter.next()
         count += 1
     return count
コード例 #39
0
ファイル: prestressed_concrete.py プロジェクト: u-anurag/xc
    def getLossFriction(self,
                        coefFric,
                        k,
                        sigmaP0_extr1=0.0,
                        sigmaP0_extr2=0.0):
        ''' Return an array that contains  for each point in fineCoordMtr the 
        cumulative immediate loss of prestressing due to friction.
        The method also creates the attribute stressAfterLossFriction, of 
        type array, that contains  for each point in fineCoordMtr the stress
        after after this loss (it is used in calculation of losses due to
        anchorage slip)

        :param sigmaP0_extr1: maximum stress applied at the extremity 1 of 
                        the tendon (starting point) (stress refers to its 
                        value at the end of the anchorage, in the contact
                        with concrete). Defaults to 0.0 (no prestress applied)
        :param sigmaP0_extr2: idem for prestress applied at extremity 2
                         (end point of the tendon). Defaults to 0.0 (no 
                         prestress applied)
        :param coefFric: coefficient of friction between the tendon and its 
                        sheathing
        :param k: wobble coefficient or coefficient for wave effect, that 
                  refers to the unintentional deviation of the position of 
                  the tendon along the duct. It's expressed by unit length 
                  of tendon. The value of k varies from 0.0015 to 0.0050 per 
                  meter length of the tendon depending on the type of tendon. 
        '''
        if (sigmaP0_extr1 != 0.0):
            cum_len = self.getCumLength()
            cum_angl = self.getCumAngle()
            loss_frict_ext1 = np.array([
                sigmaP0_extr1 *
                (1 - math.exp(-coefFric * cum_angl[i] - k * cum_len[i]))
                for i in range(len(cum_angl))
            ])
            self.stressAfterLossFrictionOnlyExtr1 = sigmaP0_extr1 - loss_frict_ext1
        if (sigmaP0_extr2 != 0.0):
            cum_len = self.getReverseCumLength()
            cum_angl = self.getReverseCumAngle()
            loss_frict_ext2 = np.array([
                sigmaP0_extr2 *
                (1 - math.exp(-coefFric * cum_angl[i] - k * cum_len[i]))
                for i in range(len(cum_angl))
            ])
            self.stressAfterLossFrictionOnlyExtr2 = sigmaP0_extr2 - loss_frict_ext2
        if (sigmaP0_extr1 != 0.0) and (sigmaP0_extr2 != 0.0):
            lossFriction = np.minimum(loss_frict_ext1, loss_frict_ext2)
            self.stressAfterLossFriction = np.maximum(
                self.stressAfterLossFrictionOnlyExtr1,
                self.stressAfterLossFrictionOnlyExtr2)
        elif (sigmaP0_extr1 != 0.0):
            lossFriction = loss_frict_ext1
            self.stressAfterLossFriction = self.stressAfterLossFrictionOnlyExtr1
        elif (sigmaP0_extr2 != 0.0):
            lossFriction = loss_frict_ext2
            self.stressAfterLossFriction = self.stressAfterLossFrictionOnlyExtr2
        else:
            lmsg.warning("No prestressing applied.")
        return lossFriction
コード例 #40
0
ファイル: predefined_spaces.py プロジェクト: gwiedemair/xc
def gdls_elasticidad3D(nodes):
    '''Defines the dimension of the space: nodes by three coordinates (x,y,z) 
       and three DOF for each node (Ux,Uy,Uz)

    :param nodes: preprocessor nodes handler
    '''
    lmsg.warning('gdls_elasticidad3D DEPRECATED; use SolidMechanics3D.')
    return SolidMechanics3D(nodes)
コード例 #41
0
ファイル: quick_graphics.py プロジェクト: ahke-sied/xc
def checkSetToDisp(preprocessor, setToDisplay):
    if (setToDisplay == None):
        setToDisplay = preprocessor.getSets.getSet('total')
        setToDisplay.fillDownwards()
        lmsg.warning('set to display not defined; using total set.')
    if setToDisplay.color.Norm() == 0:
        setToDisplay.color = xc.Vector([rd.random(), rd.random(), rd.random()])
    return setToDisplay
コード例 #42
0
ファイル: predefined_spaces.py プロジェクト: lcpt/xc
def gdls_elasticidad3D(nodes):
    '''Defines the dimension of the space: nodes by three coordinates (x,y,z) 
       and three DOF for each node (Ux,Uy,Uz)

    :param nodes: preprocessor nodes handler
    '''
    lmsg.warning('gdls_elasticidad3D DEPRECATED; use SolidMechanics3D.')
    return SolidMechanics3D(nodes)
コード例 #43
0
ファイル: ng_retaining_wall.py プロジェクト: lcpt/xc
 def setULSInternalForcesEnvelope(self,wallInternalForces):
   '''Assigns the ultimate limit state infernal forces envelope for the stem.'''
   if(hasattr(self,'stemHeight')):
     if(self.getWFStemHeigth()!=wallInternalForces.stemHeight):
       lmsg.warning('stem height (' + str(self.stemHeight) + ' m) different from length of internal forces envelope law('+ str(wallInternalForces.stemHeight)+ ' m') 
   else:
     self.stemHeight= wallInternalForces.stemHeight-self.footingThickness/2.0
   self.internalForcesULS= wallInternalForces
コード例 #44
0
 def setULSInternalForcesEnvelope(self,wallInternalForces):
   '''Assigns the ultimate limit state infernal forces envelope for the stem.'''
   if(hasattr(self,'stemHeight')):
     if(self.getWFStemHeigth()!=wallInternalForces.stemHeight):
       lmsg.warning('stem height (' + str(self.stemHeight) + ' m) different from length of internal forces envelope law('+ str(wallInternalForces.stemHeight)+ ' m') 
   else:
     self.stemHeight= wallInternalForces.stemHeight-self.footingThickness/2.0
   self.internalForcesULS= wallInternalForces
コード例 #45
0
 def setSLSInternalForcesEnvelope(self,wallInternalForces):
   '''Assigns the serviceability limit state infernal forces envelope for the stem.'''
   if(hasattr(self,'stemHeight')):
     if(self.getWFStemHeigth()!=wallInternalForces.stemHeight):
       lmsg.warning('stem height (' + str(self.stemHeight) + ' m) different from length of internal forces envelope law('+ str(wallInternalForces.stemHeight)+ ' m') 
   else:
     self.stemHeight= wallInternalForces.stemHeight
   self.internalForcesSLS= wallInternalForces
コード例 #46
0
ファイル: ng_retaining_wall.py プロジェクト: lcpt/xc
 def setSLSInternalForcesEnvelope(self,wallInternalForces):
   '''Assigns the serviceability limit state infernal forces envelope for the stem.'''
   if(hasattr(self,'stemHeight')):
     if(self.getWFStemHeigth()!=wallInternalForces.stemHeight):
       lmsg.warning('stem height (' + str(self.stemHeight) + ' m) different from length of internal forces envelope law('+ str(wallInternalForces.stemHeight)+ ' m') 
   else:
     self.stemHeight= wallInternalForces.stemHeight
   self.internalForcesSLS= wallInternalForces
コード例 #47
0
ファイル: def_vars_control.py プロジェクト: lcpt/xc
def defVarsControlMovModulus(nodes):
  tags= []
  for n in nodes:
    if(not n.hasProp('span')):
      lmsg.warning('span property not defined for node: '+str(n.tag) + '.')
    tags.append(n.tag)
    n.setProp("dispMax",0.0)
    n.setProp("CombDispMax","")
  return tags
コード例 #48
0
ファイル: structural_steel.py プロジェクト: lcpt/xc
    def getWy(self,sectionClass= 1):
        '''return section modulus with respect to y-axis (weak axis)

        :param sectionClass: 1 to 3 (4 not yet implemented) (defaults to 1)
        '''
        if(sectionClass<3):
            return self.get('Wypl')
        elif(sectionClass==3):
            return self.get('Wyel')
        else:
            lmsg.warning('cross sections of class: '+ str(sectionClass) + ' not implemented.')
コード例 #49
0
ファイル: load_vector_field.py プロジェクト: lcpt/xc
 def dumpElementalPositions(self,preprocessor,lp):
   ''' Iterate over cumulated loads dumping them into the graphic.'''
   for eTag in self.elementalLoadVectors.keys():
     elem= preprocessor.getElementHandler.getElement(eTag)
     if(elem.getDimension==2):
       vLoad= self.elementalLoadVectors[eTag]
       p= elem.getPosCentroid(True)
       self.data.insertNextPair(p.x,p.y,p.z,vLoad[0],vLoad[1],vLoad[2],self.fUnitConv,self.showPushing)
     else:
       lmsg.warning('displaying of loads over 1D elements not yet implemented')
   return len(self.elementalLoadVectors)
コード例 #50
0
ファイル: vector_field_data.py プロジェクト: lcpt/xc
 def getPolydata(self,fUnitConv= 1.0):
   retval= vtk.vtkPolyData()
   retval.SetPoints(self.points)
   sz= self.getNumberOfTuples()
   if(sz>0):
     retval.GetPointData().AddArray(self.vectors)
     self.calculateLengths(fUnitConv)
     retval.GetPointData().AddArray(self.lengths)
   else:
     lmsg.warning('VectorFieldData.getPolydata: no vectors.')
   return retval
コード例 #51
0
ファイル: structural_steel.py プロジェクト: lcpt/xc
    def getAeff(self,sectionClass= 1):
        '''return effective area depending on the cross-section class.

        :param sectionClass: class of the section (1 to 3, 4 not yet 
               implemented) (defaults to 1)
        '''
        retval= self.A()
        if(sectionClass>=3):
            lmsg.warning('effective area for sections of class: '+ str(sectionClass) + ' not implemented.')
            retval/=100.0
        return retval
コード例 #52
0
ファイル: load_vector_field.py プロジェクト: lcpt/xc
 def populateWithElementalLoads(self,preprocessor,lp):
   ''' Populate the vector container with elemental loads 
       from the load pattern argument.'''
   self.elementalLoadVectors= self.sumElementalLoads(preprocessor,lp)
   for eTag in self.elementalLoadVectors.keys():
     elem= preprocessor.getElementHandler.getElement(eTag)
     if(elem.getDimension==2):
       vLoad= self.elementalLoadVectors[eTag]
       self.data.insertNextVector(vLoad[0],vLoad[1],vLoad[2])
     else:
       lmsg.warning('displaying of loads over 1D elements not yet implemented')
   return len(self.elementalLoadVectors)
コード例 #53
0
ファイル: vtk_graphic_base.py プロジェクト: lcpt/xc
 def getBND(self):
   ''' Returns the grid boundary'''
   retval= geom.BND3d()
   points= self.uGrid.GetPoints()
   if(points.GetNumberOfPoints()>0):
     bounds= points.GetBounds()
     retval= geom.BND3d(geom.Pos3d(bounds[0],bounds[2],bounds[4]),geom.Pos3d(bounds[1],bounds[3],bounds[5]))
   else:
     warnMsg= 'there are no points in the grid: '
     warnMsg+= self.uGrid.name
     warnMsg+= '. Maybe you must call fillDownwards on the set to display.'
     lmsg.warning('Warning; '+warnMsg)
   return retval
コード例 #54
0
ファイル: prestressed_concrete.py プロジェクト: lcpt/xc
    def plot2D(self,XaxisValues='X',axisEqualScale='N',symbolRougPoints=None,symbolFinePoints=None,symbolTendon=None,resultsToPlot=list()):
        '''Return in a 2D graphic the results to which a symbol is assigned.
        Symbol examples: 'r-': red solid line, 'mo': magenta circle, 'b--': blue dashes, 'ks':black square,'g^' green triangle_up, 'c*': cyan star, ...
        :param XaxisValues: ='X' (default) to represent in the diagram X-axis
                              the X coordinates of the tendon,
                            ='Y' to represent in the diagram X-axis 
                              the Y coordinates of the tendon,
                            ='XY' to represent in the diagram X-axis 
                              the coordinate by the projection of the 
                              curve on the XY plane
        :param axisEqualScale:  ='Y', 'y','yes' or 'Yes' for equal aspect ratio
                             (defaults to 'N')
        :param resultsToPlot: list of results to plot. Each result to be
               displayed is input with the following parameters:
               (matRes,symb,label), where:
               - matRes: is the matrix of dimension 1*number of elements in the 
                 tendon with the value of the result for each of those elements
               - symb: is the symbol to use for representing this result
               - label: is the text to label this result 
        '''
        if XaxisValues.upper()=='X':
            XaxisCoord=self.fineCoordMtr[0]
            XaxisRoughCoord=self.roughCoordMtr[0]
            xLab='X'
        elif XaxisValues.upper()=='Y':
            XaxisCoord=self.fineCoordMtr[1]
            YaxisRoughCoord=self.roughCoordMtr[1]
            xLab='Y'
        elif XaxisValues.upper()=='XY':
            XaxisCoord=self.fineProjXYcoord
            x0,y0=(self.roughCoordMtr[0][0],self.roughCoordMtr[1][0])
            XaxisRoughCoord=((self.roughCoordMtr[0]-x0)**2+(self.roughCoordMtr[1]-y0)**2)**(0.5)
            xLab='XYproj'
        else:
            lmsg.warning("Wrong value for XaxisValues ('X','Y','S'): X coordinates are represented in the figure")

        fig = plt.figure()
        ax2d=plt.subplot(111)
        if symbolRougPoints:
            ax2d.plot(XaxisRoughCoord,self.roughCoordMtr[2],symbolRougPoints,label='Rough points')
        if symbolFinePoints:
            ax2d.plot(XaxisCoord,self.fineCoordMtr[2],symbolFinePoints,label='Interpolated points (spline)')
        if symbolTendon:
            ax2d.plot(XaxisCoord,self.fineCoordMtr[2],symbolTendon,label='Tendon')
        for res in resultsToPlot:
            ax2d.plot(XaxisCoord,res[0],res[1],label=res[2])
        ax2d.legend()
        ax2d.set_xlabel(xLab)
        if str.lower(axisEqualScale[0])=='y':
            ax2d.axis('equal')
        return fig,ax2d
コード例 #55
0
ファイル: limit_state_data.py プロジェクト: lcpt/xc
    def saveAll(self,feProblem,combContainer,setCalc,fConvIntForc= 1.0,analysisToPerform= defaultAnalysis,lstSteelBeams=None):
        '''Write internal forces, displacements, .., for each combination

        :param feProblem: XC finite element problem to deal with.
        :param setCalc: set of entities for which the verification is 
                          going to be performed
        :param fConvIntForc: conversion factor between the unit of force 
                               in which the calculation is performed and that 
                               one desired for the displaying of internal forces
                               (The use of this factor won't be allowed in
                                future versions)
        :param lstSteelBeams: list of steel beams to analyze (defaults to None)
        '''
        if fConvIntForc != 1.0:
          lmsg.warning('fConvIntForc= ' + fConvIntForc + 'conversion factor between units is DEPRECATED' )
        preprocessor= feProblem.getPreprocessor
        loadCombinations= preprocessor.getLoadHandler.getLoadCombinations
        #Putting combinations inside XC.
        loadCombinations= self.dumpCombinations(combContainer,loadCombinations)
        elemSet= setCalc.getElements
        nodSet= setCalc.getNodes
        fNameInfForc= self.getInternalForcesFileName()
        fNameDispl= self.getDisplacementsFileName()
        os.system("rm -f " + fNameInfForc) #Clear obsolete files.
        os.system("rm -f " + fNameDispl)
        fIntF= open(fNameInfForc,"a")
        fDisp= open(fNameDispl,"a")
        if lstSteelBeams:
            fIntF.write(" Comb. , Elem. , Sect. , N , Vy , Vz , T , My , Mz ,chiLT\n")
        else:
            fIntF.write(" Comb. , Elem. , Sect. , N , Vy , Vz , T , My , Mz \n")
        fDisp.write(" Comb. , Node , Ux , Uy , Uz , ROTx , ROTy , ROTz \n")
        fIntF.close()
        fDisp.close()
        for key in loadCombinations.getKeys():
            comb= loadCombinations[key]
            feProblem.getPreprocessor.resetLoadCase()
            comb.addToDomain() #Combination to analyze.
            #Solution
            result= analysisToPerform(feProblem)
            if lstSteelBeams:
                for sb in lstSteelBeams:
                    sb.updateLateralBucklingReductionFactor()
            #Writing results.
            fIntF= open(fNameInfForc,"a")
            fDisp= open(fNameDispl,"a")
            eif.exportInternalForces(comb.getName,elemSet,fIntF)
            edisp.exportDisplacements(comb.getName,nodSet,fDisp)
            fIntF.close()
            fDisp.close()
            comb.removeFromDomain() #Remove combination from the model.
コード例 #56
0
ファイル: predefined_spaces.py プロジェクト: lcpt/xc
    def setPrescribedDisplacements(self,nodeTag,prescDisplacements):
        '''Prescribe displacement for node DOFs.

        :param nodeTag: tag of the node.
        :param prescDisplacements: (list) values of the displacements.
        '''

        numDOFs= self.preprocessor.getNodeHandler.numDOFs
        numDisp= len(prescDisplacements)
        if(numDisp<numDOFs):
            lmsg.warning('prescribed '+str(numDisp)+' displacements, nDOFS= '+str(numDOFs))
        sz= min(numDOFs,numDisp)
        for i in range(0,sz):
            spc= self.constraints.newSPConstraint(nodeTag,i,prescDisplacements[i])
コード例 #57
0
ファイル: vtk_graphic_base.py プロジェクト: lcpt/xc
  def setupWindow(self,caption= ''):
    '''sets the rendering window. A rendering window is a window in a
       graphical user interface where renderers draw their images.
    '''
    self.renWin= vtk.vtkRenderWindow()
    self.renWin.SetSize(self.windowWidth,self.windowHeight)
    self.renWin.AddRenderer(self.renderer)
    #Axes
    self.setupAxes()

    #Time stamp and window decorations.
    if(caption==''):
      lmsg.warning('setupWindow; window caption empty.')
    vtkCornerAnno= self.annotation.getVtkCornerAnnotation(caption)
    self.renderer.AddActor(vtkCornerAnno)
    return self.renWin
コード例 #58
0
ファイル: quick_graphics.py プロジェクト: lcpt/xc
def display_eigen_result(preprocessor,eigenMode, setToDisplay=None,defShapeScale=0.0,equLoadVctScale=None,accelMode=None, unitsScale=1.0,viewDef= vtk_graphic_base.CameraParameters("XYZPos",1.0),caption= '',fileName=None):
    '''Display the deformed shape and/or the equivalent static forces 
    associated with the eigenvibration mode passed as parameter.
    
    :param eigenMode: eigenvibration mode to be displayed
    :param setToDisplay: set of elements to be displayed (defaults to total set)
    :param defShapeScale: factor to apply to deformed shape so that the 
           displayed position of each node equals to the initial position 
           plus its eigenVector multiplied by this factor. (Defaults to 0.0, 
           i.e. display of initial/undeformed shape)
    :param equLoadVctScale: factor to apply to the vectors length in the 
            representation of equivalent loads on nodes. If vectorEqLoadScale
            equals 0 or None, equivalent static loads are not represented.
            (defaults to  None, in which case only deformed shape is depicted)
    :param accelMode: acceleration associated with the eigen mode depicted, 
            only used if the equivalent static loads are to be displayed.
    :param unitsScale: factor to apply to the results if we want to change the 
           unit system.
    :param viewDef: camera parameters.
    :param caption:   text to display in the graphic 
    :param fileName:  full name of the graphic file to generate. 
             Defaults to ` None`, in this case it returns a console output 
             graphic.
    '''
    if(setToDisplay == None):
        setToDisplay=preprocessor.getSets.getSet('total')
        setToDisplay.fillDownwards()
        lmsg.warning('set to display not defined; using total set.')
    if equLoadVctScale not in [None,0] and accelMode==None:
        lmsg.warning("Can't display equivalent static loads. Parameter accelMode should not be null ")
        equLoadVctScale=None
    if setToDisplay.color.Norm()==0:
        setToDisplay.color=xc.Vector([rd.random(),rd.random(),rd.random()])
    defDisplay= vtk_FE_graphic.RecordDefDisplayEF()
    defDisplay.setupGrid(setToDisplay)
    defDisplay.cameraParameters= viewDef
    defDisplay.defineMeshScene(None,defShapeScale,eigenMode,color=setToDisplay.color) 
    if equLoadVctScale not in [None,0]:
        vField=vf.VectorField(name='modo'+str(eigenMode),fUnitConv=unitsScale,scaleFactor=equLoadVctScale,showPushing= True)
        setNodes= setToDisplay.getNodes
        for n in setNodes:
            pos= n.getEigenPos3d(defShapeScale,eigenMode)
            vEqLoad=n.getEquivalentStaticLoad(eigenMode,accelMode)
            vField.data.insertNextPair(pos.x,pos.y,pos.z,vEqLoad[0],vEqLoad[1],vEqLoad[2],unitsScale,pushing= True)
        vField.addToDisplay(defDisplay)
    defDisplay.displayScene(caption,fileName)
    return defDisplay