Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MintJulep on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

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

Status
Not open for further replies.

dfgsdfgfd

Mechanical
Joined
Sep 30, 2015
Messages
37
Location
US
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.
 
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.
 
Abaqus does nothing special with the try. It work as in standalone Python.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top