我想优化某种材料的孔隙率分布。我希望看到结果。我可以使用“visualize->material”来可视化不同的材质,但他会给每个材质随机赋予颜色。我希望密度最小的材料是蓝色的,密度最大的材料是红色的。所以和压力图一样。在
在Abaqus有办法做到这一点吗?在
如果在GUI中没有简单的方法来实现这一点,我想知道是否可以通过使用脚本来实现?我试图改变一种颜色,结果产生了以下代码:
session.viewports['Viewport: 1'].enableMultipleColors()
session.viewports['Viewport: 1'].setColor(initialColor='#BDBDBD')
cmap=session.viewports['Viewport: 1'].colorMappings['Material']
session.viewports['Viewport: 1'].setColor(colorMapping=cmap)
session.viewports['Viewport: 1'].disableMultipleColors()
session.viewports['Viewport: 1'].enableMultipleColors()
session.viewports['Viewport: 1'].setColor(initialColor='#BDBDBD')
cmap = session.viewports['Viewport: 1'].colorMappings['Material']
cmap.updateOverrides(overrides={'IMPLANT_MATERIAL0':(True, '#FF0000',
'Default', '#FF0000')})
session.viewports['Viewport: 1'].setColor(colorMapping=cmap)
session.viewports['Viewport: 1'].disableMultipleColors()
session.viewports['Viewport: 1'].enableMultipleColors()
session.viewports['Viewport: 1'].setColor(initialColor='#BDBDBD')
cmap = session.viewports['Viewport: 1'].colorMappings['Material']
session.viewports['Viewport: 1'].setColor(colorMapping=cmap)
session.viewports['Viewport: 1'].disableMultipleColors()
如果你正在寻找类似压力图可视化的东西,你就得写你自己的
FieldOutput
数据。一般来说,将数据直接输出到外部可视化程序比较容易,但在Abaqus中也可以(如果不是有点复杂的话)。在一般流程如下:
生成一个
FieldOutput
对象;语法是FO = odbModel.steps.values()[-1].frames[-1].FieldOutput(name=data_name, description=data_description, type=SCALAR)
,其中odbModel
是一个打开的Odb
对象steps.values()[-1]
或命名步骤steps[...]
是要输出到的步骤frames[-1]
是在这一步中要输出到的最后一帧(或您选择的帧)SCALAR
是abaqusConstants
模块的参数获取
rootAssembly.instance
对象及其关联元素elementSet
s和sectionAssignment
,它们与具有material
属性的material
有明确链接。addData
命令更新FieldOutput
对象;语法是addData(position=CENTROID, instance=instance, labels=labels, data=data)
CENTROID
是abaqusConstants
模块中的一个参数(假设你只想在元素质心处有元素密度;如果你真的想要的话,你也可以把它们粘在积分点上)instance
是与元素集相关联的实例(或者更广泛地说,是与此材质分配的region
)labels
是一个整数的iterable(list
,tuple
),指定要在其中写入数据的关联实例的元素标签data
是float
s的iterable的iterable,指定数据。在您的例子中,一个单一的密度值意味着data
是一个长度为1个iterable的iterable,每个包含一个density值。data
的长度必须等于labels
的长度,因为{下面的脚本示例(警告:强烈建议备份
.odb
,以防出现问题)我不研究密度,但这里有一个例子,输出一个模型的杨氏模量,其中两种材质被指定给不同的元素。在
这可能不是一个完美的方法,但这是有效的。 限制:
-您需要手动放入材料量。在
-您的材料应根据密度进行排序(mat1,mat2->density1
-你应该在脚本中写上你的材料名称(在我的例子中是“植入物”)
对改进的建议总是受欢迎的,这是快速和肮脏的。在
相关问题 更多 >
编程相关推荐