[英]How to export field output data and coordinates of a node using Abaqus/Scripting?
With Abaqus, I am trying to export node coordinates and the CSDMG value at each node of my impact model to rebuild it with Python.使用 Abaqus,我试图在我的影响 model 的每个节点处导出节点坐标和 CSDMG 值,以使用 Python 重建它。 However, my program does not seem to extract the CSDMG value of the node considered.
但是,我的程序似乎没有提取所考虑节点的 CSDMG 值。 The value extracted from my Python program are different than those exported from Abaqus/Viewer.
从我的 Python 程序中提取的值与从 Abaqus/Viewer 中导出的值不同。 From Abaqus/Viewer From Python program
来自 Abaqus/Viewer来自 Python 程序
My program:我的程序:
for node in instance.nodes:
inc.append(i)
Noeud.append(node.label)
CoordX.append(node.coordinates[0])
CoordY.append(node.coordinates[1])
CoordZ.append(node.coordinates[2])
CSDMG.append(lastFrame.fieldOutputs['CSDMG General_Contact_Domain'].values[node.label].data)
i=i+1
I suppose the penultimate line reads the CSDMG value at another node than 'node.label'.我想倒数第二行在“node.label”之外的另一个节点读取 CSDMG 值。 What do you recommend to improve my code?
你有什么建议来改进我的代码?
When you access values of a field output, the attribute values
acts as a list of FieldValue
objects.当您访问字段 output 的值时,属性
values
充当FieldValue
对象的列表。 Since the attribute values
works like a list, the indexes are regular list indexes starting from 0. The indexes are not node labels.由于属性
values
像列表一样工作,因此索引是从 0 开始的常规列表索引。索引不是节点标签。
Abaqus stores field output results sorted by the labels in ascending order. Abaqus 存储字段 output 结果按标签升序排序。 If you only have a single instance, then the order of field output results matches the order of nodes inside the instance.
如果您只有一个实例,则字段 output 结果的顺序与实例内的节点顺序相匹配。 In that case, you can access the values one by one using a sequential index:
在这种情况下,您可以使用顺序索引一一访问这些值:
for i, node in enumerate(instance.nodes):
inc.append(i)
Noeud.append(node.label)
CoordX.append(node.coordinates[0])
CoordY.append(node.coordinates[1])
CoordZ.append(node.coordinates[2])
CSDMG.append(lastFrame.fieldOutputs['CSDMG General_Contact_Domain'].values[i].data)
Please also note that I replaced your manual incrementation of i
using a built-in function enumerate
.另请注意,我使用内置的 function
enumerate
替换了您对i
的手动增量。
If you have multiple instances, then you first have to retrieve a subset of results for that specific instance.如果您有多个实例,那么您首先必须检索该特定实例的结果子集。 After you have the subset of field outputs, you can proceed in the same way as before.
在获得字段输出的子集后,您可以按照与以前相同的方式进行操作。
field_output = lastFrame.fieldOutputs['CSDMG General_Contact_Domain'].getSubset(region=instance)
for i, node in enumerate(instance.nodes):
inc.append(i)
Noeud.append(node.label)
CoordX.append(node.coordinates[0])
CoordY.append(node.coordinates[1])
CoordZ.append(node.coordinates[2])
CSDMG.append(field_output .values[i].data)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.