×
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

ERROR on Python Script File

ERROR on Python Script File

ERROR on Python Script File

(OP)
Hi All,

I am using a Matlab algoritm to execute the batch_file to do some simulations on abaqus. I am using the python program to help me extract the displacement output for only the nodeset I am interested in (which are 21 nodes) and writes it into a text file. Unfortunately it is giving me an error while I run the below program though I have used the right syntax.

P.S: I am using a loop on matlab program to do some simulations in sequence. Some of the simulations is doing well, but in some them the error apears.

Error message:

KeyError: Step-1
File "Out_Node1.py", line 8, in <module>
lastFrame = odb.steps['Step-1'].frames[-1]

Abaqus Error: cae exited with an error.

PS: if anyone of you can help me figure out what is wrong in the above code, it will be really helpful.

I thank you in advance

Hoping to hear from some one soon.

-George


PROGRAM:

#-----------------------------Out_Node1.py-------------------------------------------------------------
# Out_Node1.py is a python programme which reads the required field output (displacement of 21 nodes) data from an
# output data base and writes it into a text file
#----------------------------------------------------------------------------------------------------------
################################################################################
from odbAccess import *

#open abaqus output database
odb = openOdb(path='InputFile.odb')

# Create a variable that refers to the last frame of the first step.
lastFrame = odb.steps['Step-1'].frames[-1]

# Create a variable that refers to the displacement 'U' in the last frame of the first step.
displacement = lastFrame.fieldOutputs['U']

# Create a variable that refers to the node set 'All-Nodes'. The set is associated with the part instance 'PART-1-1'.
center = odb.rootAssembly.instances['PART-1-1'].nodeSets['NODE-1']

# Create a variable that refers to the displacement of the node set in the last frame of the first step.
centerDisplacement = displacement.getSubset(region=center)

# Finally, print some field output data from each node in the node set.
f = file("DisplacementPostInflation.txt", "w")
my_array = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21] # NODES POSITION (EXCEPTO THE 1ST ONE)
i = 0
for v in centerDisplacement.values:
i = i + 1
f.write (' %s, %16.8E\n'%(my_array[i],v.data[1])) # 0 = x, 1 = y e 2 = z
# Time must be times total value of pressure, load, etc.
# f.write(' 0000 , 0.000000000000')
f.close()

RE: ERROR on Python Script File

Is your stepname in the analysis really 'Step-1'?

RE: ERROR on Python Script File

(OP)
Mustaine3, thanks for reply

do you mean in the .inp File?

Yes, a named it as Step-1.

** STEP: Step-1
**
*Step, name=Step-1, nlgeom=YES, inc=50
*Static
0.025, 1., 1e-05, 0.025
** 0.1,1.0,,.1


I am confused, because the simulations go well when I use meshes with less than 1000 nodes. However, when I use meshes with more than 5000 nodes, this error appears.

George

RE: ERROR on Python Script File

Let's assume your script and your analysis are ok. More nodes usually mean longer runtime and larger files.
How is you script started? When it is started automatically from Matlab, then you should check if you analysis is already finished at that time.
Or you odb is large and the openOdb command is not completely executed when the next command comes. Check that by importing the time module and adding time.sleep(3) after the openOdb command.

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