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!

Getting time step from ODB using python

Status
Not open for further replies.

eng23bio

Structural
Oct 11, 2011
24
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()
**************************
 
Replies continue below

Recommended for you

eng23bio said:
I want to get the time step associated to the frame
eng23bio said:
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?

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

Python:
TimeFile.write(Time1)



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

 
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
 
 http://files.engineering.com/getfile.aspx?folder=2efcffcb-8b8b-4a1b-8ed7-c19ed80487f3&file=Job1.sta
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()
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor