Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Abaqus Python - Create Multiple Analyses One at a Time 1

Status
Not open for further replies.

MegaStructures

Structural
Sep 26, 2019
366
0
0
US
I'm trying to line up multiple analyses in Abaqus to run one after another using a Python macro.

My desired workflow is to start with CAE open and run the macro while viewing the first model in the set. I've written the below code to create an analysis for the active model, run the analysis, wait for completion and then start the next analysis. However, the current code has a couple errors, which may or may not be related.

[ol 1]
[li]The macro does not wait for the previous analysis to finish before starting the next string of code. As soon as the macro runs all three analyses begin[/li]

Why does this command not work?

Code:
[indent] mdb.jobs['x-05-21-250_TET-3Layers_Analysis'].waitForCompletion[/indent]

[li]The first analysis in the set does not run and gives the following error code: "Error in job x-05-21-250_TET-2Layers_analysis: The executable pre.exe aborted with system error code 1073740791. Please check the .dat, .msg, and .sta files for error messages if the files exist."[/li][/ol]

Text file is attached
The problem seems to be in the following lines:
pre.exe ???
pre.exe ???​

Python:
def Multi_Analysis():
    import section
    import regionToolset
    import displayGroupMdbToolset as dgm
    import part
    import material
    import assembly
    import step
    import interaction
    import load
    import mesh
    import optimization
    import job
    import sketch
    import visualization
    import xyPlot
    import displayGroupOdbToolset as dgo
    import connectorBehavior
 
    vps = session.viewports.values()[0]
    model_name = vps.displayedObject.modelName   
    
    mdb.Job(name= model_name+'_analysis', model= model_name, description='', type=ANALYSIS, 
        atTime=None, waitMinutes=0, waitHours=0, queue=None, memory=90, 
        memoryUnits=PERCENTAGE, getMemoryFromAnalysis=True, 
        explicitPrecision=SINGLE, nodalOutputPrecision=SINGLE, echoPrint=OFF, 
        modelPrint=OFF, contactPrint=OFF, historyPrint=OFF, userSubroutine='', 
        scratch='', resultsFormat=ODB, multiprocessingMode=DEFAULT, numCpus=5, 
        numDomains=5, numGPUs=0)
    
    inp_name= model_name+'_analysis'
    mdb.jobs[model_name+'_analysis'].submit(consistencyChecking=OFF)
    
    #Tell Abaqus to wait until first job finishes
    
    mdb.jobs[model_name+'_analysis'].waitForCompletion
    
    #Second Analysis
    
    mdb.Job(name='x-05-21-250_TET-3Layers_Analysis', 
        model='x-05-21-250_TET-3Layers', description='', type=ANALYSIS, 
        atTime=None, waitMinutes=0, waitHours=0, queue=None, memory=90, 
        memoryUnits=PERCENTAGE, getMemoryFromAnalysis=True, 
        explicitPrecision=SINGLE, nodalOutputPrecision=SINGLE, echoPrint=OFF, 
        modelPrint=OFF, contactPrint=OFF, historyPrint=OFF, userSubroutine='', 
        scratch='', resultsFormat=ODB, multiprocessingMode=DEFAULT, numCpus=4, 
        numDomains=4, numGPUs=0)
    
    #Submit Job
    mdb.jobs['x-05-21-250_TET-3Layers_Analysis'].submit(consistencyChecking=OFF)
    
    
    #Tell Abaqus to wait until second job finishes
    
    mdb.jobs['x-05-21-250_TET-3Layers_Analysis'].waitForCompletion
    
    #Third Analysis
    
    mdb.Job(name='x-05-21-250_TET-4Layers_Analysis', 
        model='x-05-21-250_TET-4Layers', description='', type=ANALYSIS, 
        atTime=None, waitMinutes=0, waitHours=0, queue=None, memory=90, 
        memoryUnits=PERCENTAGE, getMemoryFromAnalysis=True, 
        explicitPrecision=SINGLE, nodalOutputPrecision=SINGLE, echoPrint=OFF, 
        modelPrint=OFF, contactPrint=OFF, historyPrint=OFF, userSubroutine='', 
        scratch='', resultsFormat=ODB, multiprocessingMode=DEFAULT, numCpus=4, 
        numDomains=4, numGPUs=0)
    
    #Submit Job
    mdb.jobs['x-05-21-250_TET-4Layers_Analysis'].submit(consistencyChecking=OFF)

“The most successful people in life are the ones who ask questions. They’re always learning. They’re always growing. They’re always pushing.” Robert Kiyosaki
 
 https://files.engineering.com/getfile.aspx?folder=47b4f09d-bb5c-4ba2-9483-add041cbbc7c&file=x-05-21-250_TET-2Layers_analysis.log
Replies continue below

Recommended for you

Try changing this command to waitForCompletion()

If the second problem still persists, check the .dat, .msg and .sta files for more specific error messages. Also, make sure that the generated input file is correct.

A recent article on Simuleon's blog ("Abaqus python scripting: how difficult is it?") might be interesting for you. Automatic submission of subsequent jobs is also discussed there.
 
FEA, like so?

Code:
mdb.jobs[model_name+'_analysis'].waitForCompletion()

I'll give it a try.

I liked that blog post you referred me to. Love the getInputs command. I've been trying to figure out how to get Abaqus to prompt me for inputs.

Abaqus_Python_Gui_vxqt4b.png


“The most successful people in life are the ones who ask questions. They’re always learning. They’re always growing. They’re always pushing.” Robert Kiyosaki
 
Status
Not open for further replies.
Back
Top