abaqus对参数化长方体进行自动仿真,外表面压力载荷100000Pa,用python编写代码,实现修改几何参数后,自动划分六面体网格,自动加载压力载荷;
(资料图片仅供参考)
1. 在创建网格前,添加一个命令将单元类型设置为六面体单元。
2. 在创建压力荷载时,需要修改 region 参数为一个包含单元的集合,而不是面的集合。
代码如下:
```python
from abaqus import *
from abaqusConstants import *
from caeModules import *
from driverUtils import executeOnCaeStartup
# 执行CAE界面
executeOnCaeStartup()
# 新建模型和草图
modelName = 'ParametricBox'
mdb.Model(name=modelName)
sketchName = modelName + '_Sketch'
mdb.models[modelName].ConstrainedSketch(name=sketchName, sheetSize=10.0)
# 定义几何参数
width = 2.5
height = 4.0
length = 5.0
# 绘制草图
sketch = mdb.models[modelName].sketches[sketchName]
sketch.rectangle(point1=(0.0, 0.0), point2=(width, height))
sketch.verticalLine(point=(0.0, 0.0), length=length)
# 创建特征
partName = modelName + '_Part'
extrudeName = modelName + '_Extrude'
part = mdb.models[modelName].Part(name=partName, dimensionality=THREE_D)
part.BaseSolidExtrude(sketch=sketch, depth=length)
part.SectionAssignment(region=part.faces.findAt((width/2.0, height/2.0, length)),
sectionName='Abaqus_Default')
# 创建网格和材料
meshName = partName + '_Mesh'
part.setElementType(elemTypes=(ElemType(elemCode=C3D8),),
regions=(part.cells,))
part.seedPart(size=0.1)
part.generateMesh()
materialName = 'Steel'
mdb.models[modelName].Material(name=materialName)
mdb.models[modelName].materials[materialName].Elastic(table=((200.0E9, 0.3),))
# 创建装配和分析步
assemblyName = modelName + '_Assembly'
mdb.models[modelName].rootAssembly.DatumCsysByDefault(CARTESIAN)
mdb.models[modelName].rootAssembly.Instance(name=partName + '_Instance',
part=part)
mdb.models[modelName].rootAssembly.Instance(name='Pressure_Instance',
part=mdb.models['Parts'].findAt((width/2.0, height/2.0, length),))
stepName = modelName + '_Step'
mdb.models[modelName].StaticStep(name=stepName, previous='Initial',
timePeriod=1.0, maxNumInc=1000)
# 定义压力荷载
pressureName = modelName + '_Pressure'
pressureRegion = part.cells.findAt((width/2.0, height/2.0, length),)
mdb.models[modelName].Pressure(name=pressureName, createStepName=stepName,
region=pressureRegion,
distributionType=UNIFORM, magnitude=100000.0)
# 提交作业
mdb.Job(name=modelName, model=modelName)
mdb.jobs[modelName].submit()
mdb.jobs[modelName].waitForCompletion()
# 修改几何参数并重新建模分析
for i in range(5):
width += 0.5
length += 0.5
sketch = mdb.models[modelName].sketches[sketchName]
sketch.rectangle(point1=(0.0, 0.0), point2=(width, height))
sketch.verticalLine(point=(0.0, 0.0), length=length)
mdl = mdb.models[modelName]
extrude = mdl.features[extrudeName]
mdl.ConstrainedSketch(name='__profile__', objectToCopy=sketch)
mdl.features.changeKey(fromName='__profile__', toName=sketchName)
extrude.setValues(sketch=sketch)
mdl.parts[partName].setElementType(elemTypes=(ElemType(elemCode=C3D8),),
regions=(mdl.parts[partName].cells,))
mdl.parts[partName].seedPart(size=0.1)
mdl.parts[partName].generateMesh()
mdb.jobs[modelName].rerun()
mdb.jobs[modelName].waitForCompletion()
```
链接:https://pan.baidu.com/s/1Qkrls0vtssNueYKsolvXrg
提取码:t0gw
--来自百度网盘超级会员V6的分享