1 Star 0 Fork 1

吉祥水/fsi

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
beam.py 2.63 KB
一键复制 编辑 原始数据 按行查看 历史
Romain Boman 提交于 2017-03-16 08:32 . Update beam.py
# -*- coding: latin-1; -*-
# bends a simple beam from a gmsh file
from wrap import *
metafor = None
def params(q={}):
""" default model parameters
"""
p={}
p['tolNR'] = 1.0e-7 # Newton-Raphson tolerance
p['tend'] = 2. # final time
p['dtmax'] = 0.005 # max time step
# BC type
#p['bctype'] = 'pressure' # uniform pressure
#p['bctype'] = 'deadload' # uniform nodal load
#p['bctype'] = 'pydeadload1' # uniform nodal load (python)
p['bctype'] = 'pydeadloads' # variable loads
#p['bctype'] = 'slave' # variable loads (mpi)
p.update(q)
return p
def getMetafor(p={}):
global metafor
if metafor: return metafor
metafor = Metafor()
p = params(p)
domain = metafor.getDomain()
geometry = domain.getGeometry()
geometry.setDimPlaneStrain(1.0)
# import .geo
from toolbox.gmsh import GmshImport
f = os.path.join(os.path.dirname(__file__), "beam.geo")
importer = GmshImport(f, domain)
importer.execute2D()
groupset = domain.getGeometry().getGroupSet()
# solid elements / material
interactionset = domain.getInteractionSet()
app1 = FieldApplicator(1)
app1.push( groupset(100) ) # physical group 100
interactionset.add( app1 )
materset = domain.getMaterialSet()
materset.define( 1, ElastHypoMaterial )
mater1 = materset(1)
mater1.put(MASS_DENSITY, 100.0) # [kg/m³]
mater1.put(ELASTIC_MODULUS, 2.5e5) # [Pa]
mater1.put(POISSON_RATIO, 0.35) # [-]
prp = ElementProperties(Volume2DElement)
app1.addProperty(prp)
prp.put (MATERIAL, 1)
prp.put(CAUCHYMECHVOLINTMETH,VES_CMVIM_STD)
# boundary conditions
loadingset = domain.getLoadingSet()
#Physical Line(101) - clamped side of the beam
loadingset.define(groupset(101), Field1D(TX,RE))
loadingset.define(groupset(101), Field1D(TY,RE))
#Physical Line(102) - free surface of the beam
#Physical Line(103) - upper surface of the beam (for tests only)
mim = metafor.getMechanicalIterationManager()
mim.setMaxNbOfIterations(4)
mim.setResidualTolerance(p['tolNR'])
ti = AlphaGeneralizedTimeIntegration(metafor)
metafor.setTimeIntegration(ti)
# visu
if 0:
tsm = metafor.getTimeStepManager()
tsm.setInitialTime(0.0, 1.0)
tsm.setNextTime(1.0, 1, 1.0)
# results
#vmgr = metafor.getValuesManager()
#vmgr.add(1, MiscValueExtractor(metafor, EXT_T), 'time')
#vmgr.add(2, DbNodalValueExtractor(groupset(104), Field1D(TY,RE)), 'dy')
return metafor
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/jixiangshui/fsi.git
git@gitee.com:jixiangshui/fsi.git
jixiangshui
fsi
fsi
master

搜索帮助