Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

ODB scripting key error issue

Status
Not open for further replies.

DrBwts

Mechanical
Nov 4, 2012
297
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?
 
Replies continue below

Recommended for you

There is a difference in your two ways approaching the element sets.
 
I sorted it. The set was at the Assembly level & not the Part level!

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?
 
Yes, I think so. But you can verify that by yourself. You have the element number. Hide everything beside that element and you'll see the result of this element with it's color and the legend. Or use Probe Value. Or you write a report and look into it.


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.
 
Funny you should ask, its part of a mesh sensitivity study :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor