1 Star 0 Fork 0

吉祥水/xc_examples

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
fan_truss_example.py 5.27 KB
一键复制 编辑 原始数据 按行查看 历史
Luis C. Pérez Tato 提交于 2020-04-13 12:20 . Update code
# -*- 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()
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/jixiangshui/xc_examples.git
git@gitee.com:jixiangshui/xc_examples.git
jixiangshui
xc_examples
xc_examples
master

搜索帮助