Use the following command to retrieve the example script: abaqus fetch job=sumRegionFieldValue The fetch command also retrieves an input file that you can use to generate the output database that is read by the example script. #
# fieldValue operators example problem:
#
# sum and average stress field values in a region
#
from odbAccess import *
#
# get field
#
odb = openOdb(path='sumRegionFieldValue.odb')
endSet = odb.rootAssembly.elementSets['END1']
field = odb.steps.values()[-1].frames[-1].fieldOutputs['S']
subField = field.getSubset(region=endSet)
#
# sum values
#
sum = 0
for val in subField.values:
sum = sum + val
ave = sum / len(subField.values)
#
# print results
#
print 'Component Sum Average'
labels = field.componentLabels
for i in range( len(labels) ):
print '%s %5.3e %5.3e'% \
(labels[i], sum.data[i], ave.data[i])
|