Hey spintwo,
I have done this before. Below you can find a script that works for my output database. You can adjust it to make it work for yours as well.
If you have any more questions, don't hesitate to ask.
# Import the necessary libraries from Abaqus
from Numeric import *
from Matrix import *
from LinearAlgebra import *
from abaqusConstants import *
from abaqus import *
import odbAccess
## calculate the average stiffness ####
# Calculate the entire volume of UC
LenX=100
LenY=100
LenZ=1
UVol=LenX*LenY*LenZ
# These values will be needed later in the program
Cord100=0
Cord010=0
Cord001=0
Cord200=1
# Enter the correct name of the job in the next line
JobName='Dirichlet_d5_10'
OdbName=JobName+'.odb'
myodb=odbAccess.openOdb(path=OdbName)
# Enter the correct step name in the next line
mystress=myodb.steps['Step-1'].frames[-1].fieldOutputs['S']
mystrain=myodb.steps['Step-1'].frames[-1].fieldOutputs['E']
# Transform the stress to the global coordinate system. The stresses were originally in local coordinates, you have to transform them!
odb = session.odbs[OdbName]
scratchOdb = session.ScratchOdb(odb)
# Build up the global coordinate system
scratchOdb.rootAssembly.DatumCsysByThreePoints(name='AGlobalSys',
coordSysType=CARTESIAN, origin=(Cord100, Cord010,
Cord001), point1=(Cord200, Cord010, Cord001), point2=(
Cord100, Cord200, Cord001))
# The actual transformation happens in the next three lines
s_AGlobalCoord = session.scratchOdbs[OdbName].rootAssembly.datumCsyses['AGlobalSys']
tmpField1 = mystress.getTransformedField(datumCsys=s_AGlobalCoord)
mystress=tmpField1
tmpField2 = mystrain.getTransformedField(datumCsys=s_AGlobalCoord)
mystrain=tmpField2
# Make sure IVOL is defined in the fieldoutputs!
myivol=myodb.steps['Step-1'].frames[-1].fieldOutputs['IVOL']
# Give the instance the correct name!
myelement=myodb.rootAssembly.instances['PART-1-1'].elements
# Home made for exercise 1 - calculation for all boundary conditions
############# Actual calculations ##############
strain11 = 0
strain22 = 0
stress11 = 0
# Loop over all elements
for j in range(len(mystress.values)):
# data[0] means S11, values[j] indicates the element
stress11 = stress11 + mystress.values[j].data[0]*myivol.values[j].data
for j in range(len(mystrain.values)):
# data[0] means E11, values[j] indicates the element
strain11 = strain11 + mystrain.values[j].data[0]*myivol.values[j].data
strain22 = strain22 + mystrain.values[j].data[1]*myivol.values[j].data
# Take the average over the volume
stress11 = stress11/UVol
strain11 = strain11/UVol
strain22 = strain22/UVol
# Calculate stiffness
stiffness = stress11/strain11
poisson = -strain22/strain11
# Print the values for verification
print strain
print stress
print stiffness
print poisson