×
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

How to run an Abaqus (Python) code multiple times in a loop?

How to run an Abaqus (Python) code multiple times in a loop?

How to run an Abaqus (Python) code multiple times in a loop?

(OP)
Hi,

I'm trying to run my abaqus (python) code multiple times in a loop. I call it through the cmd window abaqus cae noGui=progname.py, which works fine. it executes my program that's in a for-loop for n in variable1: "PROGRAM CODE". At the beginning of my program I load the modules etc. and in the end I close the model and database with odb.close(), Mdb(). Generally, this works well. However, when one iteration/run fails (error message, e.g. due to convergence issues), the whole process stops and the console window closes. What I want is that the code then simply jumps to the next iteration of the for-loop.

Does anybody have a suggestion for this problem?
Thanks very much!

//Edit: When I run the code directly through the ABAQUS/CAE software, through "File/Run Script" it works well and jumps to the next iteration, but I want to run it through the cmd console.

RE: How to run an Abaqus (Python) code multiple times in a loop?

(OP)
Thanks very much for your answer. I tried to add try: "my Abaqus code" and except: pass/continue to the for-loop, but nothing changed. I suspect that the problem is related to Abaqus; maybe it closes down everything after an error, without even getting back to the original loop?

//edit: It actually seems to work when I don't "try:" the whole function, but only the part where I submit the job and wait for it to finish.

RE: How to run an Abaqus (Python) code multiple times in a loop?

Abaqus does nothing special with the try. It work as in standalone Python.

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