An example of reading field data from an output database

The following script combines many of the commands you have already seen and illustrates how you read model data and field output data from the output database used by the Abaqus/CAE Visualization module tutorial. Use the following commands to retrieve the example script and the tutorial output database:

abaqus fetch job=odbRead
abaqus fetch job=viewer_tutorial

# odbRead.py
# A script to read the Abaqus/CAE Visualization module tutorial
# output database and read displacement data from the node at 
# the center of the hemispherical punch.

from odbAccess import *

odb = openOdb(path='viewer_tutorial.odb')

# Create a variable that refers to the
# last frame of the first step.

lastFrame = odb.steps['Step-1'].frames[-1]

# Create a variable that refers to the displacement 'U'
# in the last frame of the first step.

displacement = lastFrame.fieldOutputs['U']

# Create a variable that refers to the node set 'PUNCH'
# located at the center of the hemispherical punch.
# The set is  associated with the part instance 'PART-1-1'.

center = odb.rootAssembly.instances['PART-1-1'].\
    nodeSets['PUNCH']

# Create a variable that refers to the displacement of the node
# set in the last frame of the first step.

centerDisplacement = displacement.getSubset(region=center)

# Finally, print some field output data from each node
# in the node set (a single node in this example).

for v in centerDisplacement.values:
    print 'Position = ', v.position,'Type = ',v.type
    print 'Node label = ', v.nodeLabel
    print 'X displacement = ', v.data[0]
    print 'Y displacement = ', v.data[1]
    print 'Displacement magnitude =', v.magnitude

odb.close()

The resulting output is

Position =  NODAL Type =  VECTOR
Node label =  1000
X displacement =  -8.29017850095e-34
Y displacement =  -76.4554519653
Displacement magnitude = 76.4554519653