Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Restart Job with Python Script

Status
Not open for further replies.

Ezio88

Mechanical
Jun 3, 2015
14
Hi,

I want to restart a job after a step. Doing it in the cae viewer works well. But i need to restart the job many times. So i want to implement a python script.

By Creating a Macro, i got the commands:

mdb.Job(name=JobName, model=modelName, description='', type=RESTART,
atTime=None, waitMinutes=0, waitHours=0, queue=None, memory=70,
memoryUnits=PERCENTAGE, getMemoryFromAnalysis=True,
explicitPrecision=SINGLE, nodalOutputPrecision=SINGLE, echoPrint=OFF,
modelPrint=OFF, contactPrint=OFF, historyPrint=OFF, userSubroutine='',
scratch='', resultsFormat=ODB)


but if i run the python script i get the error message:

mdb.Job(name=JobName, model=modelName, description='', type=RESTART,
NameError: name 'RESTART' is not defined


I dont find my way with this message.
Could anybody help me, please?

Many thx
 
Replies continue below

Recommended for you

I think your script is not aware of the Abaqus specific commands. You have to import them at the beginning.

Start CAE and then open the .rpy in the work directory. Take out all the import commands and add them into your script.
 
You mean the .py File in which the macros are saved? I copied all import lines, but the problem don't disappear...

Is the command right?

Many thx
 
I've just tried it and it worked fine.

Code:
from abaqus import *
from abaqusConstants import *
from caeModules import *

mdb.Job(name='Job-2', model='Model-2', description='', type=RESTART,
    atTime=None, waitMinutes=0, waitHours=0, queue=None, memory=30,
    memoryUnits=PERCENTAGE, getMemoryFromAnalysis=True,
    explicitPrecision=SINGLE, nodalOutputPrecision=SINGLE, echoPrint=OFF,
    modelPrint=OFF, contactPrint=OFF, historyPrint=OFF, userSubroutine='',
    scratch='', resultsFormat=ODB, multiprocessingMode=DEFAULT, numCpus=2,
    numDomains=2, numGPUs=0)
 
Many thanks. I forgot those lines. I only used import job, and so on.

Now it works well.

Best regards.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor