Are you ready to talk?

Running Batches of Jobs with Abaqus Python

Table of contents

In this blog post, we’ll show you how to build a tiny yet highly useful python script that can easily be modified to include more useful features. This solution is based on built-in functionality, i.e., no additional installation or investment is required.

A batch in this setting is a collection of Abaqus jobs. These can be the cause of several load-cases and geometries, parameter studies and design of experiments, or just a mix of everything. Regardless, the possibility to run a batch of jobs without any human interference is an essential feature in the FEA analyst toolbox.

There are many techniques and tools that are designed to do exactly this – from advanced third-party queuing systems to OS-dependent batch scripts. One-size fits none as team-size, hardware, OSes, and usage poses different needs from one company to the next when it comes to the implementation of FEA.

Abaqus Batch Script Requirements

Requirements for the Batch Script is as follows

  1. Execute all input files in a directory sequentially
  2. Select Abaqus version and number of cores
  3. Log execution time for the individual jobs
  4. Compatible with Abaqus Python (Python 2.7)

Every Abaqus installation comes with a python interpreter available as “abaqus python <script>”, this means that on every machine “abaqus job=” is available, we have access to “abaqus python”.

Input files in a standing directory can be found using glob – a unix style pathname pattern expansion. Loop over the elements in this pattern expansion and create abaqus execution commands, add “int” for “interactive” to ensure that the jobs are executed sequentially. Issue this command using sub process library. Log the time this command takes and keep the seconds per job in log.txt – which is helpful when planning future batch runs.

The Code

script_picture

PS: You might want to edit your environment file and set ask_delete=OFF and handle the existence of .odb files in the script (keep or overwrite).

Additional Feature Ideas

This script can be used as a building block to which functionality can be added as needed. Below are some ideas of useful features:

  • Include more logging information
    • Relevant Server Information. Abaqus version, OS, and Hardware
  • Process files
    • Delete files
    • Move files to different locations
  • Add automatic post-processing
  • Add new input files to execution queue
  • Provide a way to manipulate order of jobs
  • Identify available cores and licenses for each job (dynamic load balancing)
  • Job Monitoring (tail -f on linux…)
  • Execute files in different directories (sorted by priority?)
  • Command-line arguments for cores, Abaqus versions

Regardless of feature additions, you are now able to keep your office or server-room running during your off-hours! 

header_piucture

Want to talk about scripting? Reach me at ebbe.smith@technia.com!

Need to speak to an expert?

Our simulation team are on-hand to provide tailored guidance and support with a deep knowledge of the full SIMULIA portfolio. Reach out to talk to an expert today.

Want to receive more content like this?

Sign up to receive a weekly roundup of Expert insights as they are published...

  • Related news & articles straight to your inbox
  • Hints, tips & how-tos
  • Thought leadership articles