Reading field output data

Field output data are stored in the fieldOutputs repository under the OdbFrame object. The key to the repository is the name of the variable. The following statements list all the variables found in the last frame of the first step (the statements use the variable lastFrame that we defined previously):

for fieldName in lastFrame.fieldOutputs.keys():
    print fieldName
COPEN    TARGET/IMPACTOR
CPRESS   TARGET/IMPACTOR
CSHEAR1  TARGET/IMPACTOR
CSLIP1   TARGET/IMPACTOR
LE
RF
RM3
S
U
UR3
Different variables can be written to the output database at different frequencies. As a result, not all frames will contain all the field output variables.

You can use the following to view all the available field data in a frame:

# For each field output value in the last frame,
# print the name, description, and type members.

for f in lastFrame.fieldOutputs.values():
    print f.name, ':', f.description
    print 'Type: ', f.type

    # For each location value, print the position.
  
    for loc in f.locations:
        print 'Position:',loc.position
    print

The resulting print output lists all the field output variables in a particular frame, along with their type and position.

COPEN    TARGET/IMPACTOR : Contact opening
Type:  SCALAR
Position: NODAL

CPRESS   TARGET/IMPACTOR : Contact pressure
Type:  SCALAR
Position: NODAL

CSHEAR1  TARGET/IMPACTOR : Frictional shear
Type:  SCALAR
Position: NODAL

CSLIP1   TARGET/IMPACTOR : Relative tangential motion direction 1
Type:  SCALAR
Position: NODAL

LE : Logarithmic strain components
Type:  TENSOR_2D_PLANAR
Position: INTEGRATION_POINT

RF : Reaction force
Type:  VECTOR
Position: NODAL

RM3 : Reaction moment
Type:  SCALAR
Position: NODAL

S : Stress components
Type:  TENSOR_2D_PLANAR
Position: INTEGRATION_POINT

U : Spatial displacement
Type:  VECTOR
Position: NODAL

UR3 : Rotational displacement
Type:  SCALAR
Position: NODAL

In turn, a FieldOutput object has a member values that is a sequence of FieldValue objects that contain data. Each data value in the sequence has a particular location in the model. You can query the FieldValue object to determine the location of a data value; for example,

displacement=lastFrame.fieldOutputs['U']
fieldValues=displacement.values

# For each displacement value, print the nodeLabel
# and data members.

for v in fieldValues:
    print 'Node = %d U[x] = %6.4f, U[y] = %6.4f' % (v.nodeLabel,
    v.data[0], v.data[1])

The resulting output is

Node = 1 U[x] = 0.0000, U[y] = -76.4580
Node = 3 U[x] = -0.0000, U[y] = -64.6314
Node = 5 U[x] = 0.0000, U[y] = -52.0814
Node = 7 U[x] = -0.0000, U[y] = -39.6389
Node = 9 U[x] = -0.0000, U[y] = -28.7779
Node = 11 U[x] = -0.0000, U[y] = -20.3237...

The data in the FieldValue object depend on the field output variable, which is displacement in the above example. The following command lists all the members of a particular FieldValue object:

fieldValues[0].__members__

The resulting output is

['instance', 'elementLabel', 'nodeLabel', 'position',
 'face', 'integrationPoint', 'sectionPoint', 
'localCoordSystem', 'type', 'data', 'magnitude',
 'mises', 'tresca', 'press', 'inv3', 'maxPrincipal',
 'midPrincipal', 'minPrincipal', 'maxInPlanePrincipal',
 'minInPlanePrincipal', 'outOfPlanePrincipal']

Where applicable, you can obtain section point information from the FieldValue object.