×
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

Extract data from .odb file for each time increment of Step-1

Extract data from .odb file for each time increment of Step-1

Extract data from .odb file for each time increment of Step-1

(OP)
I have written below a code in python to extract data (PHILSM values) from the output file (.odb) at Time increment=10.
How to write a recursive loop in the code in order to extract data (PHILSM values) from the odb.file for Time increment 0, 1,2,3,..., 100 ? Thank you.


from odbAccess import *
from abaqusConstants import *
from odbMaterial import *
from odbSection import *
odb = openOdb(path='Job-1.odb')
myAssembly = odb.rootAssembly

for stepName in odb.steps.keys():
print stepName
step1 = odb.steps.values()[0]
print step1.name

Frame = odb.steps['Step-1'].frames[10]

for fieldName in Frame.fieldOutputs.keys():
print fieldName

# Script to print the name, description, and type members
# for each field output value in the last frame,

for f in Frame.fieldOutputs.values():
print f.name, ':', f.description
print 'Type: ', f.type


# Script to extract and print the PHILSM value.
for loc in f.locations:
print 'Position:',loc.position
print
displacement=Frame.fieldOutputs['PHILSM']
fieldValues=displacement.values

for v in fieldValues:
print 'PHILSM= %6.4f' % (v.data)

RE: Extract data from .odb file for each time increment of Step-1

You need to add an outer loop that runs through the frames. Frame 0 is time increment 0.

RE: Extract data from .odb file for each time increment of Step-1

(OP)
What would be the code to add in this particular case ?

RE: Extract data from .odb file for each time increment of Step-1

Generically, it would look something like this:

for x in outerloop:
for y in innerloop:
do something

RE: Extract data from .odb file for each time increment of Step-1

(OP)
I wrote the code below in order to display the frame names, but get the error message 'expected an indented block'. What would be the appropriate code to display each frame ?

allFrames = odb.steps['Step-1'].frames.keys()
for j in range(len(allFrames)):
frame=odb.steps['Step-1'].frames[j]
print frame

RE: Extract data from .odb file for each time increment of Step-1

You just have to use

for x in odb.steps['Step-1'].frames:
do something

x would be the current frame in each loop

RE: Extract data from .odb file for each time increment of Step-1

(OP)
How to display the attributes of OdbFrameArray ?

RE: Extract data from .odb file for each time increment of Step-1

(OP)
I tried the code written below but it does not work. I want to extract the PHILSM for each frame

for stepName in odb.steps.keys():
print stepName
step1 = odb.steps.values()[0]
print step1.name

#These two lines below work ok and display each frame with their values
for frame in step1.frames:
print frame

for f in step1.frames.fieldOutputs.values():
print f.name, ':', f.description
print 'Type: ', f.type

## Script to extract and print node and PHILSM value.
for loc in f.locations:
print 'Position:',loc.position
print displacement=frame.fieldOutputs['PHILSM']
fieldValues=displacement.values

#for v in fieldValues:
print 'Node = %d PHILSM= %6.4f' % (v.nodeLabel,v.data)

RE: Extract data from .odb file for each time increment of Step-1

Python syntax expects indentation for each for loop, ie

for frames in step.frames:
do something
for vals in values:
do something else

RE: Extract data from .odb file for each time increment of Step-1

Scripting Users Guide 9.5.10 An example of reading field data from an output database

With some minor modifications it print out U_mag of one node for each frame.

CODE -->

from odbAccess import *

odb = openOdb(path='viewer_tutorial.odb')

center = odb.rootAssembly.instances['PART-1-1'].    nodeSets['PUNCH']

print '\n****************'

for x in odb.steps['Step-1'].frames:

    displacement = x.fieldOutputs['U']
    centerDisplacement = displacement.getSubset(region=center)

    for y in centerDisplacement.values:
        print x.description
        print 'Displacement magnitude =', y.magnitude
        print '\n'

odb.close() 

RE: Extract data from .odb file for each time increment of Step-1

(OP)
In the last line of the program below, what is the keywords to put instead of frame.description[1] and y.frame.description in order to display the name and value of Step Time in order to have on each line:
the TimeStep, Node and Philsm values

for frame in odb.steps['Step-1'].frames:
displacement = frame.fieldOutputs['PHILSM']
for y in displacement.values:
#print frame.description
print ' frame.description[1]=%6.4f,Node = %d PHILSM =%6.4f',(y.frame.description,y.nodeLabel, y.data)
print '\n'

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