×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

ODB scripting key error issue

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?

RE: ODB scripting key error issue

There is a difference in your two ways approaching the element sets.

RE: ODB scripting key error issue

(OP)
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?

RE: ODB scripting key error issue

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.

RE: ODB scripting key error issue

(OP)
Funny you should ask, its part of a mesh sensitivity study :)

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources