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
- Execute all input files in a directory sequentially
- Select Abaqus version and number of cores
- Log execution time for the individual jobs
- 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
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!
Want to talk about scripting? Reach me at ebbe.smith@technia.com!