Skip to main content
 首页 » 编程设计

python之如何在 ABAQUS Python 中请求能量场输出

2024年10月01日8tuyile006

我正在尝试在 Abaqus 中的每个积分点提取能量。我可以为压力或应变做,但我不能为能量量做。获得的错误是:“KeyError: 'ELEN'”,但在 Abaqus 中它是好的关键字......下面是我提取它的代码:

from odbAccess import * 
import numpy as np 
 
odb = openOdb(path='C:/Desktop/Fish1.odb') 
 
# lastFrame = odb.steps['Step-2'].frames[-1] 
lastFrame = odb.steps['Step-1'].frames[-1] 
 
topCenter = \ 
odb.rootAssembly.instances['PART-1-1'] 
stressField = lastFrame.fieldOutputs['ELEN'] 
 
 
field = stressField.getSubset(region=topCenter, 
position=INTEGRATION_POINT, elementType = 'CPS3') 
fieldValues = field.values 
 
sortie = open('C:/Users/tests.txt', 'w') 
sortie.write('Eleme \t Integ \t\t PE11 \t\t\t PE22 \t\t\t PE12 \n') 
 
 
for v in fieldValues: 
    sortie.write('%-10.2f'% ( v.elementLabel)) 
    if v.integrationPoint: 
        sortie.write('%-10.2f'% (v.integrationPoint)) 
        sortie.write('%-10.3f\t\t %-10.3f\t\t %-10.3f\t\t %-10.3f\t\t \n'% (v.data[0], v.data[1], v.data[2], v.data[3])) 
 
sortie.close() 

请您参考如下方法:

我想您已经在 Abaqus Viewer 中检查过 FieldOutput ELEN 是否可用。

ELEN 是一个完整的元素变量,因此您不能在集成点提取它,因为它在那里不可用。

from odbAccess import * 
import numpy as np 
 
odb = openOdb(path='C:/Desktop/Fish1.odb') 
lastFrame = odb.steps['Step-1'].frames[-1] 
 
topCenter = odb.rootAssembly.instances['PART-1-1'] 
stressField = lastFrame.fieldOutputs['ELEN'] 
 
field = stressField.getSubset(region=topCenter, elementType = 'CPS3') 
fieldValues = field.values 

虽然这不是您真正要求的解决方案,但我希望这会有所帮助。