代码拉取完成,页面将自动刷新
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import division
import xc_base
import geom
import xc
from model import predefined_spaces
from model.geometry import truss_generators
from materials import typical_materials
from materials.sections import section_properties
from solution import predefined_solutions
from postprocess.xcVtk import vtk_graphic_base
from postprocess import output_handler
inchToMeter= 2.54/100.0
feetToMeter= 0.3048
psfTokNm2= 0.04788026
#########################################################
# Problem definition.
feProblem= xc.FEProblem()
preprocessor= feProblem.getPreprocessor
modelSpace= predefined_spaces.StructuralMechanics3D(preprocessor.getNodeHandler)
#########################################################
# Material definition.
lumber4x2= section_properties.RectangularSection("lumber4x2",b=3.5*inchToMeter,h=1.5*inchToMeter)
wood= typical_materials.MaterialData(name= 'wood',E=12.4e9,nu=0.33,rho=500)
chordSectionsGeometry= lumber4x2
chordsSection= chordSectionsGeometry.defElasticShearSection3d(preprocessor,wood)
diagonalSectionsGeometry= lumber4x2
diagonalsMaterial= typical_materials.defElasticMaterial(preprocessor,"diagonalsMaterial",wood.E)
postsSection= chordsSection
depth= 22*inchToMeter-chordSectionsGeometry.h
panelSize= 60*inchToMeter
span= feetToMeter*31.0+5*inchToMeter
#########################################################
# Mesh generation.
lowerChordAxis= geom.Segment3d(geom.Pos3d(0.0,0.0,0.0),geom.Pos3d(span,0.0,0.0))
upperChordAxis= geom.Segment3d(geom.Pos3d(0.0,0.0,depth),geom.Pos3d(span,0.0,depth))
truss= truss_generators.FanTruss(lowerChordAxis, upperChordAxis, trussModule= panelSize)
truss.lowerChordMaterial= chordsSection
truss.upperChordMaterial= chordsSection
truss.diagonalMaterial= diagonalsMaterial
truss.diagonalArea= diagonalSectionsGeometry.A()
truss.postsMaterial= postsSection
truss.genMesh(feProblem)
#########################################################
# Boundary conditions.
ptA= truss.upperChordPoints[0]
ptB= truss.upperChordPoints[-1]
modelSpace.fixNode000_FFF(ptA.getNode().tag) # Fix all the 3 displacement DOFs of the node
# at point A.
modelSpace.fixNode000_FFF(ptB.getNode().tag) # Fix all the 3 displacement DOFs of the node
# at point B.
ptC= truss.lowerChordPoints[0]
ptD= truss.lowerChordPoints[-1]
modelSpace.fixNode('F0F_FFF',ptC.getNode().tag) # Fix the y displacement DOFs of the node
# at point C.
modelSpace.fixNode('F0F_FFF',ptD.getNode().tag) # Fix the y displacement DOFs of the node
# at point D.
#########################################################
# Load
lPatterns= preprocessor.getLoadHandler.getLoadPatterns # Load pattern container.
# Variation of load with time.
ts= lPatterns.newTimeSeries("constant_ts","ts") # Constant load, no variation.
lPatterns.currentTimeSeries= "ts" # Time series to use for the new load patterns.
# Load pattern definition
lp0= lPatterns.newLoadPattern("default","0") #New load pattern named 0
lPatterns.currentLoadPattern= lp0.name
centerSpacing= 16.0*inchToMeter
creepFactorDeadLoad= 1.0
creepFactorLiveLoad= 1.0
#Upper chord loads
uniformLiveLoad= (creepFactorDeadLoad*10.0+creepFactorLiveLoad*40.0)*centerSpacing*psfTokNm2*1e3
print('load: ', uniformLiveLoad)
loadVector=xc.Vector([0,0,-uniformLiveLoad,0,0,0])
for e in truss.upperChordSet.elements:
e.vector3dUniformLoadGlobal(loadVector)
#Lower chord loads
uniformLiveLoad= (creepFactorDeadLoad*5.0)*centerSpacing*psfTokNm2*1e3
print('load: ', uniformLiveLoad)
loadVector=xc.Vector([0,0,-uniformLiveLoad,0,0,0])
for e in truss.lowerChordSet.elements:
e.vector3dUniformLoadGlobal(loadVector)
# We add the load case to domain.
lPatterns.addToDomain(lp0.getName())
xcTotalSet= preprocessor.getSets.getSet("total")
#########################################################
# Solution
result= modelSpace.analyze(calculateNodalReactions= False)
lowerChordCentroid= truss.lowerChordSet.nodes.getCentroid(1.0)
lowerChordCenterNode= truss.lowerChordSet.nodes.getNearestNode(lowerChordCentroid)
print(lowerChordCentroid)
print(lowerChordCenterNode.getInitialPos3d)
globalCreepFactor= 1.5
deltaY= globalCreepFactor*lowerChordCenterNode.getDisp[2] # y displacement of node at point pt1.
deltaYTeor= -span/480.0
diff= (deltaYTeor-deltaY)
ratio= abs(diff/deltaYTeor)
print('deltaY= ', deltaY*1e3, ' mm')
print('deltaYTeor= ', deltaYTeor*1e3, ' mm')
print('diff= ', diff*1e3, ' mm')
print('ratio= ', ratio)
#########################################################
# Graphic stuff.
oh= output_handler.OutputHandler(modelSpace)
oh.outputStyle.cameraParameters= vtk_graphic_base.CameraParameters('Custom')
oh.outputStyle.cameraParameters.viewUpVc= [0,0,1]
oh.outputStyle.cameraParameters.posCVc= [0,-100,0]
## Uncomment to display blocks
#oh.displayBlocks()
## Uncomment to display local axes
#oh.displayLocalAxes()
## Uncomment to display the mesh
#oh.displayFEMesh()
## Uncomment to display the vertical displacement
#oh.displayDispRot(itemToDisp='uY')
## Uncomment to display the reactions
#oh.displayReactions()
## Uncomment to display the reactions
#oh.displayIntForc('M2')
## Uncomment to display the reactions
oh.displayLoads()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。