How to start using Fortran subroutines in Abaqus

Abaqus is a very powerful and versatile software for the simulation of many different physical phenomena. However, the amount of functionalities is not infinite, e.g. the number of constitutive models (materials) available is limited. The huge versatility in Abaqus comes from the application of user subroutines written in Fortran.

In this article, you will learn how to install and setup a free Fortran compiler for Abaqus, and finally we will see an Abaqus FE model including a subroutine that you can download.

1. Steps to start using Fortran subroutines in Abaqus

The steps that we have to follow, starting with Abaqus installed, are the following:

  1. Download and install Visual Studio.
  2. Download and install Intel OneAPI Base Toolkit and Intel OneAPI HPC Toolkit.
  3. Modify the Abaqus launcher (abaqus.bat).
  4. Edit the Abaqus environment file (abaqus_v6.env).

And you’ll be ready to run your subroutines in Abaqus!

Watch out!

Abaqus Learning Edition is not compatible with the use of subroutines.

1.1. Install Visual Studio

Download and install Visual Studio (VS). Visual Studio Community Editions are free to use under the terms of the License agreement.

If you are using Abaqus 2020 or Abaqus 2021, you can install either VS 2017 or VS 2019. However, for Abaqus 2022 and 2023 you will need the latest release: VS 2022.

To download older VS versions click here.

Start by downloading and executing the “Visual Studio Installer”. After the initial setup, the only workload that we need to install is: “Desktop development with C++”.

install visual studio community with c++

When the installation process is completed you will see the following:

installer of visual studio community 2019

After installing Visual Studio, I highly recommend to reboot your PC.

1.2. Install Intel OneAPI Base and HPC Toolkits

First, download the Intel OneAPI Base Toolkit and install it. This toolkit is free to download and use under the terms of the License agreement. Follow the instructions to complete the installation process, you only have to make sure that the right Visual Studio version is selected, which in general is automatically detected if only one version of VS is found.
download intel oneapi base toolkit

Registration is not required by selecting “Continue as a guest” to start the download process.

intel oneapi download

Then, read and accept the terms of the License agreement and continue with “Recommended installation”.

Installation Intel OneAPI Base Toolkit.. Recommended installation

If you get a warning after this step regarding the GPU drivers, just ignore it, and click on the arrow pointing to the right. Let’s move on!

Select the version of VS previously installed, e.g. VS 2022 for Abaqus 2023.

intel oneapi hpc toolkit

Afterwards comes the Software improvement collection, as in all these packages, you may consent it or not. And finally, the installation process begins…

Installation process of Intel onAPI Base Toolkit 2023
Upon completion of the download/installation process go to “Installed products” and you will see the following:
installed products intel

Follow the same procedure to download and install the Intel OneAPI HPC Toolkit.


At the end, you will see both products (Base and HPC toolkits) installed.

installed products intel oneapi

1.3. Modify the Abaqus launcher file (.bat)

At this point, the compiler is set and ready! The next step is to enable Abaqus to use it.
There are two main ways to do this, whether we run Abaqus from a shortcut in the Desktop (icon) or from the command line. However, the most common is to use subroutines in Abaqus from the command line, so let’s see what we have to modify in that case.

First, we need to locate the file that launches Abaqus from the command line. In most cases it will be “abaqus.bat“, but depending on the Abaqus version or if we have multiple versions installed it could be “abq2021.bat”, “abq2023.bat”, etc. This file is located at “C:\SIMULIA\Commands“.

From the Abaqus launcher file we have to call the “vars.bat” file passing two arguments: intel64 and vs2022 (depending on the VS version). The vars.bat file is found at “C:\Program Files (x86)\Intel\oneAPI\compiler\latest\env“.

In the end, the bat file (e.g. “abq2023.bat”) may look like the snippet below. The new line (#5) is responsible for making the Fortran compiler available from Abaqus.

					@echo off
:: Comment: include Fortran compiler
call "C:\Program Files (x86)\Intel\oneAPI\compiler\latest\env\vars.bat" intel64 vs2022
:: Comment: Commands already in the bat file
"C:\SIMULIA\EstProducts\2023\win_b64\code\bin\SMALauncher.exe" %*

 Note: comments start with :: in batch files.

1.4. Modify the Abaqus environment file (.env)

To make Fortran subroutines fully compatible with the Intel OneAPI compiler, it is necessary to modify the environment file of Abaqus: ‘abaqus_v6.env‘. This file is executed when Abaqus is started. Look for this file in the Abaqus installation directory. In my case, it is located at: “C:\SIMULIA\EstProducts\2023\win_b64\SMA\site

Insert the following Python command at the end of the environment file:
					# Run subroutines (compatible with previous compilers)

In some cases, the compiler will do its job, but the simulation will fail after linking the subroutines. If that happens, there is a problem in the linking process that is solved by adding the following line at the end of the abaqus_v6.env file:

					# Overwrite linking options
link_sl = 'LINK /NODEFAULTLIB:LIBCMT.LIB /dll /def:%E /out:%U %F %A %L %B'

2. Verification

Before getting started testing our own subroutines, it is a good practice to verify that the compiler and linker work properly using Abaqus verification tests.


For that, in the command line we have to execute the following statements:

					>> abaqus verify -user_std

>> abaqus verify -user_exp

If everything was installed correctly, you will see a “result: PASS” message at the end of both executions.

3. Ready to run subroutines!

Finally, everything is ready! Download the following files and place them in the same directory to test that everything works:



Then, run the following in the command line (cmd). Make sure that you execute it in the directory where you saved the previous files (inp and for):

					>> abaqus int user=loadControl.for job=cmm_loadControl
The analysis will run in interactive mode (int), so you will see in real time the compilation of the subroutine and the execution of the simulation.

The model represents a 2D unit cell of a unidirectional fiber reinforced composite under transverse tension using isostrain boundary conditions (uniform displacement applied). The model includes cohesive zones to capture fiber-matrix debonding and the matrix takes plastic deformation and damage as well, therefore a load drop is expected after some transverse deformation.

FRP unit cell subroutine load control

The subroutine employed (loadControl.for) will stop the analysis when the force applied decreases (below 80% of the peak load):

  • The analysis is sped up by skipping the most unstable part of the simulation, which is not of interest in this case.
  • Current and maximum load applied are printed out every 10 increments.
prints Abaqus subroutine URDFIL load control

3. Conclusions

Setting up the compiler to run subroutines in Abaqus has always been a bit of a headache, but the release of the Intel OneAPI toolkits makes a lot easier this process and does not involve additional costs.

Learn how to implement this and many more subroutines in the course User Subroutines in Abaqus. From advanced boundary conditions, custom output variables or heat transfer analysis, up to material subroutines, user elements and a lot more!

Happy modeling and see you soon!

Leave a Comment

Scroll to Top