Skip to content

Running Batches of Jobs With Abaqus Python

Posted by Ebbe Smith

Categories
Home > Blog > 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!

    Simulation Driven Innovation.

    TECHNIA Simulation provides top tier FEA, Non-linear, and Advanced Simulation Software, Training, and Consultancy. Our dedicated team of more than 65 Simulation experts across 16 countries advise and support your innovation with a wealth of specialist knowledge and experience.

    About TECHNIA
    Want to receive more content like this?
    • Related news and articles straight to your inbox
    • Hints, tips & how-tos
    • Thought leadership articles

    VISIT THE KNOWLEDGE HUB

    Helping you find the information you’re looking for. Discover webinars, events, FAQ's, case studies and tutorials.

    VIEW HUB
    © TECHNIA 2023 (Part of the Addnode Group) TECHNIA is certified according to ISO standards 9001:2015, 14001:2015 and 27001:2015 – Quality & Environment