Andrew
Andrew

Reputation: 31

Abaqus prematurely terminates a python script when the job does not converge

I have an Abaqus script that needs to be run iteratively, and continue running even if the job submitted does not converge. This is no problem if the script is submitted from the command line as following:

abaqus cae script=script.py

However, when executing a python script in Abaqus from the command line such as:

abaqus cae nogui=script.py

the python script itself terminates running immediately after the job is aborted. Is there any way to keep running the script after the job within is aborted when it was called using nogui?

Thanks,

Andrew

The relevant part of my script looks like:

import os 
from odbAccess import * 
from job import *  
from abaqusConstants import * 

cjob = mdb.JobFromInputFile(name='abaqus_opt_rd',inputFileName='../FEM_in_out/abaqus_opt_rd.inp',numCpus=4,numDomains=4) 
cjob.submit() 
cjob.waitForCompletion() 
ef = cjob.status 
conv = ef != ABORTED 

if conv == True: 
    # perform desired operations ...
else:
    # perform operations for aborted job ...

Upvotes: 2

Views: 1170

Answers (2)

heleen_feh
heleen_feh

Reputation: 11

I solved this using a try statement.

try: 
    cjob.submit() 
    cjob.waitForCompletion()
    conv = True
exept AbaqusException, message: 
    conv = False

Upvotes: 1

PShank007
PShank007

Reputation: 46

When runnning from noGUI option, the script do not have access to mdb object. You may want to try running the script after including the following line:

 from abaqus import *

By including the above line, abaqus imports all modules and will gain access to mdb object.

Upvotes: 1

Related Questions