×
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

ABAQUS/Explicit: Executing multiple input files sequentially

ABAQUS/Explicit: Executing multiple input files sequentially

ABAQUS/Explicit: Executing multiple input files sequentially

(OP)
I have put together a Python script (.py) to execute multiple input files sequentially, It will be run from CAE --> Run Script. But its not working, could anyone have a look and suggest some edits?


----------------------------------------------------------------------------------------------------
import abaqus
import abaqusConstants

myJob = mdb.JobFromInputFile(inputFileName="C:\Scratch\Job-1.inp", name="Firstjob", type=ANALYSIS, waitMinutes=15, numCpus=20, explicitPrecision=DOUBLE, nodalOutputPrecision=FULL, parallelizationMethodExplicit=DOMAIN, numDomains=20, multiprocessingMode=DEFAULT)
myJob.submit()
myJob.waitForCompletion()

-----------------------------------------------------------------------------------------------------

The machine will wait 15 minutes before executing next input file.

I will just copy-paste the above code under each block and change the directory.

RE: ABAQUS/Explicit: Executing multiple input files sequentially

The machine would wait 15min before this job would be executed.

I assume the wait command isn't working on windows. Try without that.
Use the python functionality instead. In the time module is a sleep command.

RE: ABAQUS/Explicit: Executing multiple input files sequentially

just curious - why not run your analyses sequentially from the command line?

RE: ABAQUS/Explicit: Executing multiple input files sequentially

(OP)
The problem is actually something else, please see the image.


Do I need to import some additional namespaces at the beginning of the script?

@Dave442, Python script is something I can save in my HDD and later use it again by minor revision. Command line is different than that.

RE: ABAQUS/Explicit: Executing multiple input files sequentially

Sorry,

I don't know how to fix your Python error. But you can do what you want from the command line without using Python. You can also store the commands in a text file and save to your HDD for revision/reuse in the future. If you are planning to spend any significant amount of time working with Abaqus, chances are you will commit these commands to memory anyhow.

windows:
abaqus job=jobname1 cpus=20 interactive & abaqus job=jobname2 cpus=20 interactive & .....

unix:
abaqus job=jobname1 cpus=20 interactive; abaqus job=jobname2 cpus=20 interactive; .....

Alternatively you can create a batch file to schedule a series of analyses. You can also save that on your HDD for future revision/reuse.

Good Luck,
Dave

RE: ABAQUS/Explicit: Executing multiple input files sequentially

Quote:

Do I need to import some additional namespaces at the beginning of the script?

Probably the abaqusConstants.

RE: ABAQUS/Explicit: Executing multiple input files sequentially

(OP)
@Dave442 - Can I add an additional argument for delaying next input file execution for 5 minutes?

RE: ABAQUS/Explicit: Executing multiple input files sequentially

@ShadowWarrior - the 'interactive' term in the commands I posted ensures that each consecutive analysis is submitted as soon as the previous analysis is completed. Is this not what your after?

If not, there are instructions on how to schedule jobs to run at a specific time using command prompt & batch files in the link i posted previously (http://imechanica.org/node/18290).

Dave

RE: ABAQUS/Explicit: Executing multiple input files sequentially

(OP)
@Dave442 - After analysis, Abaqus does some calculations to find out the values of secondary variables from primary variables. That is why I think it is a good idea to give the machine some buffer time to do those calculations before running another job.

Does the interactive command takes care of those calculations??

RE: ABAQUS/Explicit: Executing multiple input files sequentially

@ShadowWarrior - The commands I've shown earlier will run each analysis consecutively. This includes all standard pre- and post-processing stages of the analysis. This procedure is the same as submitting a job in CAE, waiting for the job to complete and then submitting another job immediately. A standard analysis does not "complete" until all calculations have been completed. You should not need to specify any buffer time.

Does this make sense? Or have I misunderstood your intentions?

Dave



RE: ABAQUS/Explicit: Executing multiple input files sequentially

(OP)
Yes, makes sense. I have followed the instructions provided in your link. But I'm getting the following message after 1st job finishes and the next job does not start -

THE ANALYSIS HAS COMPLETED SUCCESSFULLY

1/26/2016 5:29:36 AM
End Abaqus/Explicit Analysis
Begin State File Translator
1/26/2016 5:29:36 AM
Run state.exe


Any solution to this?

@IceBreakerSours - What I meant is all post-processing stages of analysis, as explained by Dave442. Now, If I use the command prompt with interactive, then I can see the progression of analysis. How can I see the same on screen with scripting (.py)??

RE: ABAQUS/Explicit: Executing multiple input files sequentially

If you used the commands i listed previously the analyses should run one after another. Assuming your using WIndows: Put all your input files into one folder on your machine. Name them 01, 02, 03, 04 ... Go to start menu -> Programs -> Abaqus -> Abaqus Command Prompt and navigate to the folder containing the input files. Issue the following commands:

abaqus job=01 cpus=20 interactive & abaqus job=02 cpus=20 interactive & abaqus job=03 cpus=20 interactive & ...

Minimize the command window and don't interfere with it. Navigate to the folder containing the input files and check the .log, .dat or .sta file if you want to check the progress of your analyses. If you interfere with the command window before your analyses have completed you will likely interrupt something. If you are still struggling, check the users manual or search "Abaqus sequential analyses". It comes up a lot.

I've used this method for all sorts of standard and explicit analyses and never had any problem. Hopefully you can get sorted. Not sure what you meant by "How can I see the same on screen with scripting (.py)". You don't need Python to do any of this.

EDIT
Just remembered something that might explain why your batch of runs did not complete. You need to alter the power saving settings on your machine. If your machine goes into hibernate due to inactivity your analyses will just stop progressing like you saw. Set your machine never to hibernate and when you leave in the evening just lock your screen.

RE: ABAQUS/Explicit: Executing multiple input files sequentially

Dave is right. There is no need for a Python script because a batch script with those commands will get the job done. Googling should reveal several links where this has been discussed.

*********************************************************
Are you new to this forum? If so, please read these FAQs:

http://www.eng-tips.com/faqs.cfm?fid=376
http://www.eng-tips.com/faqs.cfm?fid=1083

RE: ABAQUS/Explicit: Executing multiple input files sequentially

(OP)
I have researched Abaqus documentation thoroughly and put together a fully controllable batch script (.bat) and it works perfectly -

abaqus job="Job_name" analysis input="C:\Temp\Mesh_convergence\study1\Job-1.inp" cpus=4 parallel=domain domains=4 interactive double=both output_precision=full

Now, I'm copy-pasting the above line for subsequent input files, but only the first analysis gets done and displays this message -

THE ANALYSIS HAS COMPLETED SUCCESSFULLY

1/26/2016 5:29:36 AM
End Abaqus/Explicit Analysis
Begin State File Translator
1/26/2016 5:29:36 AM
Run state.exe


What am I doing wrong??

Note that I have tried copy-pasting lines one below another or using "&" between two analysis lines, but both gives the same message.

RE: ABAQUS/Explicit: Executing multiple input files sequentially

Dig around in the .log, .dat, .sta and .msg files for the hung up analysis to look for an issue?

RE: ABAQUS/Explicit: Executing multiple input files sequentially

(OP)
@Dave442 - There is nothing suspicious in .dat, .sta and .msg files. However, When Jobs are being run through CAE, .log files are created. But with my batch script, no log file is being created.

Below is a typical log file from CAE run -



The marked section is where it gets stuck in batch script run.

RE: ABAQUS/Explicit: Executing multiple input files sequentially

The .log file isn't generated when you run your analysis using the command prompt as the output of the .log file is displayed directly on your screen. If you want to save this output to a text file you can use the following commands:

abaqus job=jobname.inp cpus=20 interactive > jobname.txt

Is your machine going into hibernate/standby when you run your analyses? As I mentioned previously this will interrupt any analyses that are running interactively. I would take a small explicit analysis from the verification manual, copy it three times and then run the three analysis consecutively using your batch file. If they all run, you know your batch file is working fine. If they don't all run you know you have a problem. Also, post the contents of your batch file.

RE: ABAQUS/Explicit: Executing multiple input files sequentially

(OP)
From ABAQUS documentation - http://50.16.225.63/v6.14/books/usb/default.htm?st...

interactive

This option will cause the job to run interactively. For Abaqus/Standard and Abaqus/CFD the log file will be output to the screen; for Abaqus/Explicit the status file and the log file will be output to the screen. The default run_mode can be set in the environment file (see “Using the Abaqus environment settings,” Section 3.3.1).

background

This option will submit the job to run in the background, which is the default. Log file output will be saved in the file job-name.log in the current directory. The default method for submitting the job can be set in the environment file by using the run_mode parameter (see “Using the Abaqus environment settings,” Section 3.3.1).



Contents of my batch file -

abaqus job="Job_name1" analysis input="C:\Temp\Mesh_convergence\study1\Job-1.inp" cpus=4 parallel=domain domains=4 interactive double=both output_precision=full
abaqus job="Job_name2" analysis input="C:\Temp\Mesh_convergence\study2\Job-2.inp" cpus=4 parallel=domain domains=4 interactive double=both output_precision=full
PAUSE

RE: ABAQUS/Explicit: Executing multiple input files sequentially

What i said previously applies to analyses run with the interactive command and is correct. Not sure why you have copy/pasted instructions from the documentation that agree with what i said? Forget your batch file for a moment, open up a command window and issue the following:

abaqus job="C:\Temp\Mesh_convergence\study1\Job-1" cpus=4 interactive & abaqus job="C:\Temp\Mesh_convergence\study2\Job-2" cpus=4 interactive

Do the two analyses run consecutively?

RE: ABAQUS/Explicit: Executing multiple input files sequentially

(OP)
@Dave442 - I mentioned the documentation for future reference. :)

I ran jobs using 'background' instead of 'interactive' and everything works well, there is no difference between CAE and 'background' run as per the documentation. Good thing is, consecutive run is also a success with 'background'.

call abaqus job="Job_name1" analysis input="C:\Temp\Mesh_convergence\study1\Job-1.inp" cpus=4 parallel=domain domains=4 background double=both output_precision=full
call abaqus job="Job_name2" analysis input="C:\Temp\Mesh_convergence\study2\Job-2.inp" cpus=4 parallel=domain domains=4 background double=both output_precision=full
PAUSE


But if I remove 'call' command, then analysis exits after first job run. Interesting...

I'll check what you suggested above shortly.


Edit: I'm also having a feeling that my ABAQUS installation needs a refresh.

RE: ABAQUS/Explicit: Executing multiple input files sequentially

I've been using this .bat:

CODE -->

path=c:\SIMULIA\Abaqus\Commands
abaqus python Ejecuta_Directorio.py 

with this .py:

CODE --> python

# Python script to execute all input decks
# within the directory from which this script is run
#
import sys
import os
#
i=0
run=[]
#
COMMAND = os.environ['ABA_COMMAND']
print
print 'NOTE all input files in this directory will be executed with ',COMMAND
files = os.listdir('.')
print
#
while i < len(files):
   nameall = files[i]
   ext = nameall[(len(nameall)-3):]
   if ext == 'inp':
     run.append(nameall[:(len(nameall)-4)])
   i=i+1
#
i=0
#
while i < len(run):
   name = run[i]
   cmd = COMMAND+' -j '+str(name)+' inter'+' cpus=48'
   print 'Executing '+cmd
   os.system(cmd)
   i=i+1
#
print
print '***'
print '**Completed all analysis runs**' 

Ejecuting the file .bat all the .inp files will run in alphabetical order.
Maybe it will be useful for you.

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