Mike S
Mike S

Reputation: 3

How to extract NFORC data in usable form

I'm able to access the NFORC data in the abaqus output file correctly from abaqus output database but I'm not sure how to format the data so that it's usable since the bulkDataBlocks data is somewhat opaque.

The data is apparently in an array and the following code outputs the correct nodal forces for the elements within the specified set, but every attempt at trying to obtain the corresponding element fails for some reason.

# OUTPUT
[[  437.9649   ]
[ -437.9649   ]
[  285.99744  ]
[ -285.99744  ]
[   26.090147 ]
[  -26.090147 ]
[  -20.221022 ]
[   20.221022 ]
[   19.118658 ]
[  -19.118658 ]
[   -1.9320803]
[    1.9320803]
[ 1336.26     ]
[-1336.26     ]
[ 1444.7339   ]
[-1444.7339   ]
[  285.6841   ]
[ -285.6841   ]
[  233.1313   ]
[ -233.1313   ]
[   -3.2911508]
[    3.2911508]
[  -18.943659 ]
[   18.943659 ]
[   10.187364 ]
[  -10.187364 ]
[    5.255753 ]
[   -5.255753 ]
[ 1255.6117   ]
[-1255.6117   ]
[ 1291.9855   ]
[-1291.9855   ]
from odbAccess import *
from sys import argv,exit
odb = openOdb('SPIE1_TIP_10MT_LC6A_REV9.odb', readOnly=True)
lastFrame = odb.steps['Step-1'].frames[-1]
mySet = odb.rootAssembly.elementSets['_FAST25-END_BRACKET_BOLTS_ZDIR_PF_']
nforc=lastFrame.fieldOutputs['NFORC1'].getSubset(region=mySet).bulkDataBlocks
for v in nforc:
    print v.data

Upvotes: 0

Views: 562

Answers (2)

Satish Thorat
Satish Thorat

Reputation: 924

Usually, the bulkDataBlocks outputs the data in the M x N shape. M is number of components and N is the number of data points.
Here, M is 1, hence the shape of the array is 1 x N. Now, we can convert 1 x N shape array into N shape array as below,

import numpy
# bulk data blocks array for 1 component (or scalar) field output
nforc = lastFrame.fieldOutputs['NFORC1'].getSubset(region=mySet).bulkDataBlocks

# just use concatenate method from numpy module
nforc = numpy.concatenate(nforc[0].data)

# now you can iterate easily.

Upvotes: 1

Mike S
Mike S

Reputation: 3

I found the solution to the above problem. The 'bulkDataBlocks' is an array of objects so specific objects within the bulkDataBlocks array need to be accessed. There are two specific arrays contained within bulkDataBlocks (i.e., data and elementLabels) that need to be called to pull the data. The updated working code is below:

from odbAccess import openOdb

#import database
odbName='MyOdb.odb'
path = './'
myOdbPath=path+odbName
odb=openOdb(myOdbPath, readOnly=True)

mySet=odb.rootAssembly.elementSets['MySet']
lastFrame = odb.steps['Step-1'].frames[-1]

# load the NFORC values into a list

NFORC1=lastFrame.fieldOutputs['NFORC1'].getSubset(region=mySet).bulkDataBlocks
NFORC2=lastFrame.fieldOutputs['NFORC2'].getSubset(region=mySet).bulkDataBlocks
NFORC3=lastFrame.fieldOutputs['NFORC3'].getSubset(region=mySet).bulkDataBlocks

lengthData=len(NFORC1[0].data)

ELMS=[] 

for e in range(lengthData):
    ELMS.append(NFORC1[0].elementLabels[e])

print 'ELEMENT',',','NFORC1',',','NFORC2',',','NFORC3'
for v in range(lengthData):
    print ELMS[v], ', ', NFORC1[0].data[v],', ', NFORC2[0].data[v],', ', NFORC3[0].data[v]

odb.close()

The resultant output is as follows:

ELEMENT , NFORC1 , NFORC2 , NFORC3
104 ,  [437.9649] ,  [-697.2612] ,  [-473.47888]
104 ,  [-437.9649] ,  [697.2612] ,  [473.47888]
105 ,  [285.99744] ,  [-434.03726] ,  [-238.9219]
105 ,  [-285.99744] ,  [434.03726] ,  [238.9219]
106 ,  [26.090147] ,  [-743.6757] ,  [-177.33986]
106 ,  [-26.090147] ,  [743.6757] ,  [177.33986]
107 ,  [-20.221022] ,  [-446.1231] ,  [-163.27362]
107 ,  [20.221022] ,  [446.1231] ,  [163.27362]
108 ,  [19.118658] ,  [-807.4475] ,  [-59.68711]
108 ,  [-19.118658] ,  [807.4475] ,  [59.68711]
109 ,  [-1.9320803] ,  [-375.06946] ,  [-61.075523]
109 ,  [1.9320803] ,  [375.06946] ,  [61.075523]
110 ,  [1336.26] ,  [-826.51166] ,  [-440.04373]
110 ,  [-1336.26] ,  [826.51166] ,  [440.04373]
111 ,  [1444.7339] ,  [-278.18558] ,  [-33.58101]
111 ,  [-1444.7339] ,  [278.18558] ,  [33.58101]
112 ,  [285.6841] ,  [-245.79713] ,  [-177.0824]
112 ,  [-285.6841] ,  [245.79713] ,  [177.0824]
113 ,  [233.1313] ,  [-52.73726] ,  [-88.574104]
113 ,  [-233.1313] ,  [52.73726] ,  [88.574104]
114 ,  [-3.2911508] ,  [-272.37708] ,  [-51.80418]
114 ,  [3.2911508] ,  [272.37708] ,  [51.80418]
115 ,  [-18.943659] ,  [-46.21007] ,  [-63.904617]
115 ,  [18.943659] ,  [46.21007] ,  [63.904617]
116 ,  [10.187364] ,  [-329.4325] ,  [-12.757114]
116 ,  [-10.187364] ,  [329.4325] ,  [12.757114]
117 ,  [5.255753] ,  [16.567253] ,  [-11.7989855]
117 ,  [-5.255753] ,  [-16.567253] ,  [11.7989855]
118 ,  [1255.6117] ,  [-382.62543] ,  [-563.8936]
118 ,  [-1255.6117] ,  [382.62543] ,  [563.8936]
119 ,  [1291.9855] ,  [94.39272] ,  [-53.78884]
119 ,  [-1291.9855] ,  [-94.39272] ,  [53.78884]

Upvotes: 0

Related Questions