ODB scripting key error issue
ODB scripting key error issue
(OP)
I'm trying to set up a script to read field values from a set of elements in one of the instances in my assembly but I keep getting an error, the script,
from odbAccess import *
from abaqusConstants import *
from odbMaterial import *
from odbSection import *
odb = openOdb(path='point_9.odb')
lastFrame = odb.steps['Step-1'].frames[-1]
damageAll = lastFrame.fieldOutputs['DUCTCRT']
targetEls = odb.rootAssembly.instances['PART-1-1'].elementSets['TARGET']
at which point CAE throws the following error,
KeyError: TARGET
So I typed,
>>> print 'Element sets = ',odb.rootAssembly.elementSets.keys()
and got,
Element sets = ['BOUNDARY', 'TARGET']
Why am I getting his error if the element set exists?
from odbAccess import *
from abaqusConstants import *
from odbMaterial import *
from odbSection import *
odb = openOdb(path='point_9.odb')
lastFrame = odb.steps['Step-1'].frames[-1]
damageAll = lastFrame.fieldOutputs['DUCTCRT']
targetEls = odb.rootAssembly.instances['PART-1-1'].elementSets['TARGET']
at which point CAE throws the following error,
KeyError: TARGET
So I typed,
>>> print 'Element sets = ',odb.rootAssembly.elementSets.keys()
and got,
Element sets = ['BOUNDARY', 'TARGET']
Why am I getting his error if the element set exists?





RE: ODB scripting key error issue
RE: ODB scripting key error issue
Changed, targetEls = odb.rootAssembly.instances['PART-1-1'].elementSets['TARGET']
to, targetEls = odb.rootAssembly.elementSets['TARGET']
and it works fine.
My issue now is which entry in values is the DUCTCRT value.
The full code listing,
from odbAccess import *
from abaqusConstants import *
from odbMaterial import *
from odbSection import *
odb = openOdb(path='point_9.odb')
lastFrame = odb.steps['Step-1'].frames[-1]
damageAll = odb.steps['Step-1'].frames[-1].fieldOutputs['DUCTCRT']
targetEls = odb.rootAssembly.elementSets['TARGET']
damageTarget = damageAll.getSubset(region=targetEls)
count = 0.0
totDamage = 0.0
for dam in damageTarget.values:
....if dam.data > 0.0:
........totDamage = totDamage + dam.data
........count = count + 1
avDamage = totDamage / count
print 'Total damage = ', totDamage
print 'Averaged damage over target = ', avDamage
If I,
>>>>print dam
I get,
({'baseElementType': 'C3D8R', 'conjugateData': None, 'conjugateDataDouble': 'unknown', 'data': 0.0129978889599442, 'dataDouble': 'unknown', 'elementLabel': 18816, 'face': None, 'instance': 'OdbInstance object', 'integrationPoint': 1, 'inv3': None, 'localCoordSystem': None, 'localCoordSystemDouble': 'unknown', 'magnitude': None, 'maxInPlanePrincipal': None, 'maxPrincipal': None, 'midPrincipal': None, 'minInPlanePrincipal': None, 'minPrincipal': None, 'mises': None, 'nodeLabel': None, 'outOfPlanePrincipal': None, 'position': INTEGRATION_POINT, 'precision': SINGLE_PRECISION, 'press': None, 'sectionPoint': None, 'tresca': None, 'type': SCALAR})
I am assuming in the above that 'data' is the ductile damage criteria?
RE: ODB scripting key error issue
It is not my business and maybe I'm wrong with the limited information I have, but are you sure that your avDamage result isn't mesh dependent? You should verify this.
RE: ODB scripting key error issue