1、问题描述:
2、生成viewport,导入响应模块,生成模型数据对象
# -*- coding: mbcs -*-
from abaqus import *
from abaqusConstants import *
session.Viewport(name='Viewport: 1', origin=(0.0, 0.0), width=309.612487792969,
height=30.9703712463379)
session.viewports['Viewport: 1'].makeCurrent()
session.viewports['Viewport: 1'].maximize()
from caeModules import *
from driverUtils import executeOnCaeStartup
executeOnCaeStartup()
session.viewports['Viewport: 1'].partDisplay.geometryOptions.setValues(
referenceRepresentation=ON)
Mdb()
#: 新的模型数据库已创建.
#: 模型 "Model-1" 已创建.
session.viewports['Viewport: 1'].setValues(displayedObject=None)
2、绘制草绘图并生成三维部件,并将其显示在当前窗口
s = mdb.models['Model-1'].ConstrainedSketch(name='__profile__',
sheetSize=200.0)
g, v, d, c = s.geometry, s.vertices, s.dimensions, s.constraints
s.setPrimaryObject(option=STANDALONE)
s.Line(point1=(0.0, 0.0), point2=(1000.0, 0.0))
s.HorizontalConstraint(entity=g[2], addUndoState=False)
p = mdb.models['Model-1'].Part(name='Part-1', dimensionality=THREE_D,
type=DEFORMABLE_BODY)
p = mdb.models['Model-1'].parts['Part-1']
p.BaseWire(sketch=s)
s.unsetPrimaryObject()
p = mdb.models['Model-1'].parts['Part-1']
session.viewports['Viewport: 1'].setValues(displayedObject=p)
del mdb.models['Model-1'].sketches['__profile__']
session.viewports['Viewport: 1'].view.setValues(nearPlane=1909.96,
farPlane=2090.04, width=1066.73, height=525.02, viewOffsetX=20.6559,
viewOffsetY=-0.0769844)
session.viewports['Viewport: 1'].partDisplay.setValues(sectionAssignments=ON,
engineeringFeatures=ON)
session.viewports['Viewport: 1'].partDisplay.geometryOptions.setValues(
referenceRepresentation=OFF)
3、创建材料截面赋予截面和指定梁截面在空间的走向
mdb.models['Model-1'].Material(name='Material-steel')
mdb.models['Model-1'].materials['Material-steel'].Density(table=((7.8e-09, ),
))
mdb.models['Model-1'].materials['Material-steel'].Elastic(table=((210000.0,
0.3), ))
mdb.models['Model-1'].RectangularProfile(name='Profile-rectangular', a=50.0,
b=20.0)
mdb.models['Model-1'].BeamSection(name='Section-1',
integration=DURING_ANALYSIS, poissonRatio=0.0,
profile='Profile-rectangular', material='Material-steel',
temperatureVar=LINEAR, consistentMassMatrix=False)
p = mdb.models['Model-1'].parts['Part-1']
e = p.edges
edges = e.getSequenceFromMask(mask=('[#1 ]', ), )
region = p.Set(edges=edges, name='Set-1')
p = mdb.models['Model-1'].parts['Part-1']
p.SectionAssignment(region=region, sectionName='Section-1', offset=0.0,
offsetType=MIDDLE_SURFACE, offsetField='',
thicknessAssignment=FROM_SECTION)
#: 视口 "Viewport: 1" 的内容已复制到剪贴板.
p = mdb.models['Model-1'].parts['Part-1']
e = p.edges
edges = e.getSequenceFromMask(mask=('[#1 ]', ), )
region=p.Set(edges=edges, name='Set-2')
p = mdb.models['Model-1'].parts['Part-1']
p.assignBeamSectionOrientation(region=region, method=N1_COSINES, n1=(0.0, 0.0,
-1.0))
#: 选中区域内的梁方向已指定.
4、部件到instance的过程
a = mdb.models['Model-1'].rootAssembly
session.viewports['Viewport: 1'].setValues(displayedObject=a)
session.viewports['Viewport: 1'].assemblyDisplay.setValues(
optimizationTasks=OFF, geometricRestrictions=OFF, stopConditions=OFF)
a = mdb.models['Model-1'].rootAssembly
a.DatumCsysByDefault(CARTESIAN)
p = mdb.models['Model-1'].parts['Part-1']
a.Instance(name='Part-1-1', part=p, dependent=ON)
5、创建静力分析步
session.viewports['Viewport: 1'].assemblyDisplay.setValues(
adaptiveMeshConstraints=ON)
mdb.models['Model-1'].StaticStep(name='Step-1', previous='Initial')
session.viewports['Viewport: 1'].assemblyDisplay.setValues(step='Step-1')
6、创建边界条件
session.viewports['Viewport: 1'].assemblyDisplay.setValues(loads=ON, bcs=ON,
predefinedFields=ON, connectors=ON, adaptiveMeshConstraints=OFF)
#: 警告: 无法继续--请完成该步骤或取消这一操作.
#: 警告: 无法继续--请完成该步骤或取消这一操作.
a = mdb.models['Model-1'].rootAssembly
v1 = a.instances['Part-1-1'].vertices
verts1 = v1.getSequenceFromMask(mask=('[#1 ]', ), )
region = a.Set(vertices=verts1, name='Set-1')
mdb.models['Model-1'].DisplacementBC(name='BC-1', createStepName='Step-1',
region=region, u1=0.0, u2=0.0, u3=0.0, ur1=0.0, ur2=0.0, ur3=0.0,
amplitude=UNSET, fixed=OFF, distributionType=UNIFORM, fieldName='',
localCsys=None)
a = mdb.models['Model-1'].rootAssembly
v1 = a.instances['Part-1-1'].vertices
verts1 = v1.getSequenceFromMask(mask=('[#2 ]', ), )
region = a.Set(vertices=verts1, name='Set-2')
mdb.models['Model-1'].ConcentratedForce(name='Load-1', createStepName='Step-1',
region=region, cf2=-5000.0, distributionType=UNIFORM, field='',
localCsys=None)
7、划分网格
session.viewports['Viewport: 1'].assemblyDisplay.setValues(mesh=ON, loads=OFF,
bcs=OFF, predefinedFields=OFF, connectors=OFF)
session.viewports['Viewport: 1'].assemblyDisplay.meshOptions.setValues(
meshTechnique=ON)
p = mdb.models['Model-1'].parts['Part-1']
session.viewports['Viewport: 1'].setValues(displayedObject=p)
session.viewports['Viewport: 1'].partDisplay.setValues(sectionAssignments=OFF,
engineeringFeatures=OFF, mesh=ON)
session.viewports['Viewport: 1'].partDisplay.meshOptions.setValues(
meshTechnique=ON)
p = mdb.models['Model-1'].parts['Part-1']
e = p.edges
pickedEdges = e.getSequenceFromMask(mask=('[#1 ]', ), )
p.seedEdgeByNumber(edges=pickedEdges, number=50, constraint=FINER)
elemType1 = mesh.ElemType(elemCode=B31, elemLibrary=STANDARD)
p = mdb.models['Model-1'].parts['Part-1']
e = p.edges
edges = e.getSequenceFromMask(mask=('[#1 ]', ), )
pickedRegions =(edges, )
p.setElementType(regions=pickedRegions, elemTypes=(elemType1, ))
p = mdb.models['Model-1'].parts['Part-1']
p.generateMesh()
a = mdb.models['Model-1'].rootAssembly
session.viewports['Viewport: 1'].setValues(displayedObject=a)
a1 = mdb.models['Model-1'].rootAssembly
a1.regenerate()
8、提交作业
session.viewports['Viewport: 1'].assemblyDisplay.setValues(mesh=OFF)
session.viewports['Viewport: 1'].assemblyDisplay.meshOptions.setValues(
meshTechnique=OFF)
mdb.Job(name='beam', model='Model-1', description='', type=ANALYSIS,
atTime=None, waitMinutes=0, waitHours=0, queue=None, memory=90,
memoryUnits=PERCENTAGE, getMemoryFromAnalysis=True,
explicitPrecision=SINGLE, nodalOutputPrecision=SINGLE, echoPrint=OFF,
modelPrint=OFF, contactPrint=OFF, historyPrint=OFF, userSubroutine='',
scratch='', resultsFormat=ODB, multiprocessingMode=DEFAULT, numCpus=6,
numDomains=6, numGPUs=0)
mdb.jobs['beam'].submit(consistencyChecking=OFF)
#: 作业输入文件 "beam.inp" 已提交分析.
#: Job beam: Analysis Input File Processor completed successfully.
#: Job beam: Abaqus/Standard completed successfully.
#: Job beam completed successfully.
9、结果可视化,输出应力云图
session.viewports['Viewport: 1'].setValues(displayedObject=None)
o1 = session.openOdb(name='C:/Users/Administrator/Desktop/beam.odb')
session.viewports['Viewport: 1'].setValues(displayedObject=o1)
#: 模型: C:/Users/Administrator/Desktop/beam.odb
#: 装配件个数: 1
#: 装配件实例个数: 0
#: 部件实例的个数: 1
#: 网格数: 1
#: 单元集合数: 3
#: 结点集合数: 5
#: 分析步的个数: 1
session.viewports['Viewport: 1'].odbDisplay.display.setValues(plotState=(
CONTOURS_ON_DEF, ))
session.viewports['Viewport: 1'].odbDisplay.display.setValues(plotState=(
DEFORMED, ))
session.viewports['Viewport: 1'].odbDisplay.display.setValues(plotState=(
CONTOURS_ON_DEF, ))
版权声明:本文为weixin_42237984原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。