The user subroutines in Abaqus allow the program to be customized for particular applications, which are not available through main Abaqus facilities. You should write a user subroutine if you could not run your analysis by ABAQUS built-in models for materials, loads, properties, elements, etc. for example, if you need to model a user-defined nonlinear stress-strain relation, which is not provided by Abaqus, then look for UMAT user subroutine. UMAT will allow you to define the material model customized exactly for your problem. Here we want to provide you with a road map to start writing your first (or very early) subroutine in Abaqus.
The subroutines are available for both Abaqus/Standard and Abaqus/Explicit. For example, we have DLOAD in Abaqus/Standard and VDLOAD in Abaqus/Explicit.
1. What you need to write a subroutine in Abaqus (perquisites)
User subroutines are mostly written in Fortran. When a simulation model that contains user subroutines is submitted to Abaqus, the correct compile and link commands should be used automatically. If the version of your Fortran compiler does not correspond to that specified, incompatibilities may occur. Therefore, it is important to have compatible components for subroutine configuration. You can find a comprehensive guide to compatible versions of Abaqus, Intel Fortran and Visual Studio In this article:
First, prepare required programs. Then you should follow an instruction to link Abaqus with Intel Fortran and Visual Studio. For example, this article help you with Abaqus 2017:
The basics is similar for other versions of Abaqus. Just pick the compatible versions from the former article or use this Q&A as a quick guide:
2. An Introduction to different subroutines in Abaqus
User subroutines UMAT allows constitutive models to be added to the program. A more advanced subroutine is UEL, which allows the creation of user-defined elements. Other, less complex user subroutines include:
- DLOAD for specifying user-defined loading
- DISP to define the magnitudes of prescribed boundary conditions
- UVARM for defining a user output variable
- URDFIL for reading the results file during analyses
- SIGINI for specifying initial stress fields
- USDFLD for defining field variable dependence
UEL or UMAT are more complicated and require a good understanding of applied mechanics concepts (FEM, Continuum mechanics, Computational Plasticity…).
Although, several subroutines like DLOAD, USDFLD or DISP could be simple and can be learned with little effort using the Abaqus documentation and examples that come with it.
You can get familiar with the most important and typical subroutines by reading this article:
3. Finding appropriate subroutine due to your problem
This is where you should decide which subroutine is the answer to your need. While a complete understanding of the structure of Abaqus is not required to develop a user subroutine, it helps if the developer has at least an overview of the structure. This understanding is really mandatory when writing advanced subroutines like UMAT or UEL.
This is the basic flow of data and actions from the start of an Abaqus/Standard analysis to the end:
In addition, you can see this article to master the step, increment and iteration concepts:
And this is the basic flow diagram in an Abaqus/Explicit analysis:
4. Referring to Abaqus Documentation
Reading the documentation before working on it, can save you time in the end. Most difficulties in using Abaqus can be solved by following the instructions in the manuals carefully.
Open Abaqus User Subroutines Reference Guide from Abaqus Documentation:
First, select User Subroutines in the left panel. Then, Find your subroutine name from the list either for Abaqus/Standard or Abaqus/Explicit. Now, you will see these details in the right:
Sections of a subroutine guide in Abaqus Documentation:
(1) Subroutine title and a short description of its usage in Abaqus
(2) Some links to the related topics of Documentation. Relation of the subroutine and the keywords of Abaqus.
(3) There are some refers to different examples included in Abaqus Documentation related to this subroutine. Open those examples too and look at them carefully.
It is generally useful to look for relevant examples in Abaqus Documentation to review them when embarking on a new class of problems. You may find these examples in Example Problems Guide, Benchmarks Guide, Verification Guide and less likely in Getting Started with Abaqus/CAE. Study the example problem description and the inputs and outputs. Find the most similar example to your specific problem.
(4) Here you can learn what this subroutine can do, its limitations, etc.
Sometimes, after the Overview, there are some notes about the theory behind the subroutine and so on (for example, see Creep subroutine section in Documentation). Read them carefully, too.
(5) That is the code structure for the subroutine. Copy this part exactly
Generally, the variables passed into a user subroutine via the argument list are classified as either variables to be defined, variables that can be defined, or variables passed in for information.
(6) The parameters introduced in this part constitute the main part of subroutine. You should define the parameters listed here.
(7) The user must not alter the values of the Variables passed in for information at all. Doing so will have unpredictable results.
5. Developing Your Fortran Subroutine for Abaqus
Now, you need to create a Fortran file (a simple txt file with .for ending) with whatever name you like.
Open the file. Here, we named it as myDISP.for. By default, Microsoft Visual Studio will show up:
First, copy exactly the User subroutine interface part of Documentation ((5) in the above figure). Now you should define the parameters listed in Variables to be defined section (6) instead of user coding to define x line. Here your coding skill come in! Write the customized expression for the parameters.
For example, for a DISP subroutine, we should define U (user defined special form of displacement B.C. that is not supported in Abaqus itself). Therefore, you need to be familiar with Fortran coding language. However, knowing just the main commands (loops, conditions…) and the data structures can be sufficient for most applications.
6. Using the Subroutine in Abaqus Analysis
Then you tell Abaqus to the user subroutine in where you need. It depends on the type of subroutine. For example, DISP is a type of B.C. So, we go to Load module:
And when creating a new job, you give the address of your written subroutine. See this Q&A:
LINK=How to test subroutine
7. Testing Your Written Subroutine for Abaqus
The last and the trickiest step! Follow these instructions when running your sample jobs with subroutines:
» Always test your subroutines on the smallest possible model.
» Do not include other complicated features, such as contact, unless they are absolutely necessary when testing the subroutine.
» Test the most basic model of the user subroutine before adding additional complexity to the subroutine. Whenever add a new feature to the model in a user subroutine, test it before adding another feature.
» When appropriate, try to test the user subroutine in models where only values of the nodal degrees of freedom (displacement, rotations, temperature) are specified: simple tension test, simple shear test, simple temp B.C. s, etc.
To start to write the subroutine, you need to have Fortran knowledge. You can read “Fortran ‘Must Knows’ for Writing Subroutines in Abaqus (PART I)” article to get what you need!
Eager to hear from you…
Any complication or other questions? Feel free to comment here…