当我们Reading field output data时,不知道fieldOutputs的keys怎么办呢?
答案很简单,利用
| Reading field output data | |
| 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
printThe 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: NODALIn 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.
里的办法,给他输出一下:
for fieldName in lastFrame.fieldOutputs.keys():
print fieldName
看看都有啥keys,需要什么取什么即可。
免责声明:本文系网络转载或改编,未找到原创作者,版权归原作者所有。如涉及版权,请联系删