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

时间:2017-05-04 12:44:20

标签: python abaqus

我试图在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()

1 个答案:

答案 0 :(得分:2)

我猜你已经在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

即使它不是你要求的解决方案,我希望这会有所帮助。