×
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

Getting time step from ODB using python

Getting time step from ODB using python

Getting time step from ODB using python

(OP)
Hi there,

I have an odb from which I'd like to extract some data, namely a reaction force and some displacements. Here is a working part of the code (except for the Time1). The analysis is non-linear due to the material properties so I have to make various increments (around 60). I want to write to an output file Time.dat the different times (the increments, or the cum ulative increments) and to another file Results.dat the forces. If I remove the line ""Time1=lastStep.frameValue"" it works nicely, I get the forces in the different frames of the step, but I do not want to get the frames, I want to get the time step associated to the frame.I have looked at the scripting user manual but I do not seem to find what I need.


Any help would be appreciated,

Sincerely

*************************************

import odbAccess
ForceFile = open('Results.dat','w')
TimeFile=open('Time.dat','w')
myOdb = odbAccess.openOdb(path='Job1.odb')

lastStep=myOdb.steps['Step-1']

for x in range(len(lastStep.frames)):
lastFrame = lastStep.frames[x]
Time1=lastStep.frameValue%%%Here must be the thing...
ReactionForce = lastFrame.fieldOutputs['RF']
TimeFile.write(Time1)

for v in ReactionForce.values:
if v.nodeLabel == 1:
ForceFile.write('%10.8E\t' % (v.data[1]))

myOdb.close()
ForceFile.close()
TimeFile.close()
**************************

RE: Getting time step from ODB using python

Quote (eng23bio)

I want to get the time step associated to the frame

Quote (eng23bio)

I do not want to get the frames

But there's just one time step. So, why even request Time1, if all you want is the step time?

CODE --> Python

lastStep=myOdb.steps['Step-1'] 

CODE --> Python

TimeFile.write(Time1) 

Are you new to this forum? If so, please read these FAQ's:

http://www.eng-tips.com/faqs.cfm?fid=376
http://www.eng-tips.com/faqs.cfm?fid=1083

RE: Getting time step from ODB using python

(OP)
Hi IceBreakerSours,

thank you for your answer. Certainly the question was not very well formulated. There is one step with different frames on it due to the different increments. In the .sta file I get these results and I want to write into the file the column named Step Time/LPF or, equivalently, the increments of time. In the attachments there is a sta file and I want to get the 8th or 9th column on it.

Thank you again!

STEP INC ATT SEVERE EQUIL TOTAL TOTAL STEP INC OF DOF IF
DISCON ITERS ITERS TIME/ TIME/LPF TIME/LPF MONITOR RIKS
ITERS FREQ
1 1 1 5 3 8 0.0250 0.0250 0.02500
1 2 1 1 3 4 0.0500 0.0500 0.02500
1 3 1 1 3 4 0.0875 0.0875 0.03750
1 4 1 2 4 6 0.144 0.144 0.05625
1 5 1 2 3 5 0.228 0.228 0.08438
1 6 1 3 4 7 0.355 0.355 0.1266
1 7 1 4 4 8 0.545 0.545 0.1898
1 8 1 3 6 9 0.829 0.829 0.2848
1 9 1 3 2 5 1.00 1.00 0.1707

RE: Getting time step from ODB using python

(OP)
I found the problem. I was accessing lastStep.frameValue and I should access lastFrame.frameValue

Thank you again IceBreakerSours, your comment was very helpful to help see my error.

Cheers



import odbAccess
ForceFile = open('Results.dat','w')
TimeFile=open('Time.dat','w')
myOdb = odbAccess.openOdb(path='Job1.odb')

lastStep=myOdb.steps['Step-1']

for x in range(len(lastStep.frames)):
lastFrame = lastStep.frames[x]
Time1=lastFrame.frameValue%%%Here was the problem. Now solved
ReactionForce = lastFrame.fieldOutputs['RF']
TimeFile.write('%10.8E\t' %Time1)

for v in ReactionForce.values:
if v.nodeLabel == 1:
ForceFile.write('%10.8E\t' % (v.data[1]))

myOdb.close()
ForceFile.close()
TimeFile.close()

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