简体   繁体   English

如何使用 Abaqus/Scripting 导出字段 output 数据和节点坐标?

[英]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.

相关问题 如何使用 abaqus python 脚本创建单个节点集? - How to create individual node sets using abaqus python scripting? 如何使用 ABAQUS python 脚本(不消耗许可证)提取特定节点/节点集上所有步骤的载荷和位移数据? - How to extract load and displacement data for all steps on a particular node/node set using ABAQUS python scripting (without consuming licence)? Abaqus python脚本:如何在odb中添加向量场输出及其结果值 - Abaqus python scripting: How to add a vector field output with their resultant values in an odb 使用python脚本从abaqus输出数据库中获取元素密度 - Getting element density from abaqus output database using python scripting 使用一些无效数据创建 Abaqus 字段输出 - Create an Abaqus field output with some invalid data Abaqus ODB使用Python脚本输出的输出不一致 - Inconsistent output from Abaqus ODB using Python scripting 如何在Abaqus Python脚本的历史输出定义中定义历史区域? - How to define history region in history output definition for Abaqus Python scripting? 如何使用Python脚本在abaqus中识别程序集中的节点集名称? - How to identify node set names in an assembly in abaqus with Python scripting? 如何在 ABAQUS Python 中请求能量场输出 - How to request energy field output in ABAQUS Python 使用 python 脚本在 abaqus 中提取节点集坐标 - Extract node set coordinates in abaqus using python script
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM