代码拉取完成,页面将自动刷新
# -*- 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
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。