Your Essential Guide to Mastery Fortran Abaqus
Are you seeking a concise overview of “Fortran Abaqus” and eager to craft your own subroutine? This post delves into the core aspects of the Abaqus Fortran. In Abaqus, user subroutines are mainly composed in Fortran, though you have the option to code in C or C++. Fortran stands out for its simplicity, ranking among the most beginnerfriendly programming languages. Its core functionality centers on fundamental lowlevel operations, a universal trait among programming languages. Furthermore, its syntax exhibits similarities to MATLAB. Stay with CAE Assistant for an indepth exploration of the Abaqus Fortran subroutines.
If you’re looking to create your first Abaqus subroutine, we’ve prepared a comprehensive guide. Simply click on ‘Start Writing Subroutine in Abaqus‘ to get started. 
1. Basics : what is the structure of Abaqus Fortran?
A Fortran program is just a sequence of lines of text. It has to follow a specific structure. Take a look at this simple piece of code:
PROGRAM CIRCLE REAL R, AREA C THIS PROGRAM READS A REAL NUMBER R AND PRINTS C THE AREA OF A CIRCLE WITH RADIUS R. WRITE (*,*) 'GIVE RADIUS R:' READ (*,*) R !THIS IS RADIUS OF THE CIRCLE AREA = 3.14159*R*R WRITE (*,*) 'AREA = ', AREA STOP END
Originally, all Fortran programs had to be written in all uppercase letters. However, Fortran is not casesensitive, so “X” and “x” are the same variable.
Let’s now delve into some fundamental headings for understanding the structure of Abaqus Fortran. starting with column rules.
⭐⭐⭐Free Abaqus Course  ⏰10 hours Video 👩🎓+1000 Students ♾️ Lifetime Access
✅ Module by Module Training ✅ Standard/Explicit Analyses Tutorial ✅ Subroutines (UMAT) Training … ✅ Python Scripting Lesson & Examples 
Column Position Rules
Fortran has very few rules for how to format the source code. The most important rules are the column position rules:
» Col. 1 Blank, or a “C” for comments
» Col. 15 Statement label (optional)
» Col. 6 Continuation of the previous line (optional)
» Col. 772 Statements
Comments
The lines that begin with a “C” here are comments and have no purpose other than to make the program more readable. You may also use the exclamation mark (!) for comments. This type of comment can be any place among your piece of code (look at ‘!THIS IS RADIUS OF THE CIRCLE’).
Statement label
Statement labels are used to mark positions in the program. Typically, many loops and other statements in a single program require a statement label. The programmer is responsible for assigning a unique number to each label in each program (or subprogram). Look at 4.1. Loops Section (Do Loop) in the second part of this article (Under Construction) to see a practical use of statement labels.
Read More: Abaqus subroutine
Continuation
Sometimes, a statement does not fit into the 66 available columns (772) of a single line. One can then break the statement into two or more lines and use the continuation mark in position 6 (I mean, you put 5 spaces and then type +). Example:
C THE NEXT STATEMENT GOES OVER TWO PHYSICAL LINES AREA = 3.14159265358979 + * R * R
Any character can be used instead of the plus sign (+) as a continuation character. Also, we may use digits (using 2 for the second line, 3 for the third, and so on).
Keep reading this post to know the main points of Abaqus Fortran subroutine writing.

Matt Veidth
Free Abaqus Course
✅ Abaqus Free Course for Beginners, Intermediate  ✔ UMAT Subroutine Writing ✔ Python Scripting…
2. Data Types in Fortran
In Fortran, like in many programming languages, data types determine the kind of data that a variable can hold. Fortran offers a variety of data types to suit different needs. Let’s take a look at the familiar data types often used in Abaqus Fortran subroutines:
Variable names
Variable names in Fortran consist of the letters AZ, the digits 09 and the underscore (_). The first character must be a letter.
Like many other languages, the words which make up the Fortran language are called reserved words and cannot be used as names of variables. Some examples are PROGRAM, REAL, STOP, END, etc.
Variable Types
Fortran supports several different data types to make data manipulation easier:
The most frequently used data types are integer and real (floating point) in Abaqus Fortran.
Integers
An integer is a number that can be written without a fractional component. For example, 21, 4, 0, and −2048 are integers. Fortran has only one type for integer variables. They are usually stored as 4 bytes variables.
Floatingpoint variables
When a number is not an integer, it is considered a decimal. Fortran has two different types of decimal (floating point) variables, called REAL and DOUBLE PRECISION. Numerical calculations in subroutines usually need very high precision, and DOUBLE PRECISION should be used. Usually, a real is a 4byte variable, and the doubleprecision is 8 bytes. You may use the syntax REAL*8 to denote 8byte floatingpoint variables in Abaqus Fortran subroutines.
Declarations
Every variable should be defined in a declaration. This establishes the type of the variable. The most common declarations are:
INTEGER Variable1, Variable2,… REAL Variable1, Variable2,… DOUBLE PRECISION Variable1, Variable2,…
Each variable should be declared exactly once. If a variable is undeclared, Fortran uses a set of implicit rules to establish the type. This means all variables starting with the letters I, J, K, L, M and N are integers and all others are real. You have to be very careful with variable names.
However, you can make a habit of putting a simple piece of code at the top of each of your subroutines:
IMPLICIT NONE
Then, you must explicitly declare every variable that your subroutine uses or needs.
Parameters
Some constants appear many times in a program. Therefore, it is often desirable to define them only once, at the beginning of the program. This is called PARAMETER in Fortran:
 To reduce the number of typos (i.e., typing errors).
 To facilitate changing a constant that appears many times in a program.
 To increase the readability of the code.
For example, we can rewrite the example code above (circle area) as:
PROGRAM CIRCLE REAL R, AREA, PI PARAMETER (PI = 3.14159) C THIS PROGRAM READS A REAL NUMBER R AND... . . . END
The syntax of the parameter statement is
PARAMETER (name1 = value1, name2 = value2, …)
The PARAMETER statement(s) must come before the first executable statement.
Arrays
Many computations in Abaqus Fortran subroutines use vectors and matrices. The data type Fortran uses for representing such objects is the array. A onedimensional array corresponds to a vector, while a twodimensional array corresponds to a matrix. 
1D arrays
It is just a linear sequence of elements stored consecutively in memory. For example,
REAL A(6)
declares A as a real array of length 6. By convention, Fortran arrays are indexed from 1 and up. Each element of an array can be thought of as a separate variable. You reference the ith element of array A by A(i).
2D arrays
Matrices are very important in linear algebra. They are usually represented by twodimensional arrays. For example, the declaration
REAL A(3,5)
defines a twodimensional array of 3 × 5 = 15 real numbers. It is useful to think of the first index as the row index and the second as the column index.
In the following, we will discuss the remaining topics such as Operators and Expressions (for Variables and Matrices), Conditional (IF) and Loop (DO) Statements, some Buildin Functions in Fortran, and finally, a brief talk about How to Write to files from inside Fortran. Follow this post to know more about Fortran for Abaqus subroutines.
3. Operators in Fortran  Common Fortran Abaqus operators
The simplest nonconstant expressions are of the form:
operand operator operand
The result of an expression is itself an operand; hence we can nest expressions together.
ℜemember:
 The order of precedence is essential: arithmetic expressions are evaluated first, then relational operators, and finally logical operators (Take a look at Quiz Time question 3).
 Logical expressions are frequently used in conditional statements like the IF statement.
Operators are really helpful when you’re writing code. In “Fortran Abaqus,” they play a big part in conditional statements, as you’ll see in the next section. Keep reading to learn more.
4. Controls in Fortran Abaqus
Fortran for Abaqus subroutine has some control features presented here briefly.
4.1. Conditional Statements
The most common conditional statement in Fortran is the IF statement, which has several forms:
I. Oneline (one executable statement)
IF (logical expression) executable statement
Example:
IF (X.LT.0) X = X
II. More than one executable statement
IF (logical expression) THEN Statement1 Statement2 . . . END IF
III. General Form
IF (logical expression1) THEN statements1 ELSE IF (logical expression2) THEN statements2 . . . ELSE statementsn END IF
The conditional expressions are evaluated in a row until one is found to be true. Then the associated statements are executed, and the control resumes after the endif.
⭐⭐⭐Free Abaqus Course  ⏰10 hours Video 👩🎓+1000 Students ♾️ Lifetime Access
✅ Module by Module Training ✅ Standard/Explicit Analyses Tutorial ✅ Subroutines (UMAT) Training … ✅ Python Scripting Lesson & Examples 
4.2. Loops
For repeated execution of similar things, loops are used. Here we only take a look at DOloop in Fortran.
Doloop
This loop repeats a series of one or more Fortran statements a set number of times. The general format is:
DO count_variable = start, stop, step . fortran statement(s) . END DO
count_variable is the loop variable (often called the ‘loop index’ or ‘counter’).
start specifies the initial value of count_variable,
stop is the terminating bound,
step is the increment (step).
Where the count_variable must be an integer variable. start, stop, and step are integer variables or integer expressions. The step value is optional. If it is omitted, the default value is 1.
Also, another general form of the DO loop that you may see is as follows:
DO label count_variable = start, stop, step . fortran statement(s) . label CONTINUE
Here is a simple example that prints the cumulative sums of the integers from 1 through N (assume N has been assigned a value elsewhere):
INTEGER I, N, SUM SUM = 0 DO 10 I = 1, N SUM = SUM + I WRITE(*,*) 'I =', I WRITE(*,*) 'SUM =', SUM 10 CONTINUE
The number 10 is a statement label. Recall that column positions 15 are reserved for statement labels and the numerical value of statement labels has no significance (see the explanation of Statement Label and Column Position Rules in the above parts.
The variable defined in the DOstatement is incremented by 1 by default. However, you can define the step to be any number but zero. This program segment prints the even numbers between 1 and 10 in decreasing order:
INTEGER I DO I = 10, 1, 2 WRITE(*,*) 'i =', I END DO
ℜemember:
 Other statements within the loop must never change the DOloop variable! Doing so may cause great confusion.
 The loop index can be of type REAL, but due to roundoff errors, may not take on precisely the expected sequence of values.
5. Builtin Functions
Some useful functions have been included in Fortran. For example, most of the practical mathematical functions:
Clearly, these builtin functions come in handy when working with Abaqus Fortran subroutines. Now, let’s explore arrays and matrices in Fortran:
6. Array and Matrix Operations
Fortran operates on vectors and matrices much like Matlab:
6.1. Vectorial Operations:
In the statements like
U = SIN (V)
U and V can be vectors, so you do not have to calculate such statements member by member (in a loop).
6.2. Matrix Multiplication
MATMUL (A,B)
Which is of great importance in FEA. Note that:
C = A * B
is NOT a matrix multiplication. However, it will multiply the elements of A and B to create C.
6.3. Inner Product
DOT_PRODUCT (U,V)
Compute a general dot product that is particularly useful in Abaqus subroutines.
6.4. Dimension of Vectors and Matrices
LENGTH = SIZE (vector_array)
Returns LENGTH as a single integer (2, 3, 6, …) to determine the length of a vector_array.
DIMS = SHAPE (matrix_array)
Returns DIMS as an integer vector ( (2,2), (3,1), (3,3), …) to determine the dimensions of a matrix. For a 2D matrix, simply shows the number of rows and number of columns, respectively.
Once you have understood the basics of “Fortran Abaqus,” the important next step is saving your data in files. We’ll explain this in the next section.
7. Writing data to files
In Fortran, the general syntax to write a file is:
WRITE (unit number, format string) list of variables
The unit number is an integervalued variable that is defined when opening the file.
format string describes how the output is to be formatted (This is something like %s or %d in MATLAB or C).
For debugging purposes in your Abaqus subroutines, you can write to the default (unit number=6), which is the Printed Output file:
WRITE (6,*) "Number 1 = ", num1, "Number 2 = ", num2
In Fortran, * means default. So, this will simply use standard defaults to print integers, doubleprecision numbers, etc.
With the above statement, the values held by num1 and num2 variables can be displayed. The information inside the quotes is shown as it is, including capitalization and any spelling errors. When you do not use quotes, it is interpreted as a variable.
Notes:
 Also, you can use:
Write (*,*)
Since the default output is unit number=6 (Printed Output file) for Abaqus Subroutine Interface.
 For Abaqus/Explicit, printed output is a .log file (Log tab in Job Monitor window displays the contents of this file during the analysis). The counterpart for Abaqus/Standard is a .dat file (and Data tab). If you are more curious, take a look at Fortran unit numbers that Abaqus uses.
Default formatting is OK for printing a few variables but not much good for printing an array, which will be largely incomprehensible. The format string is a character string that has a special meaning for Fortran, for example:
‘I4’ an integer length 4
‘1X’ a single blank space
‘E12.4’ a floatingpoint number in Exponent format with total length 12 and 4 decimal places
A10 a character string with 10 characters
For a handy reference of these format codes, you can see the Format Statements in Stanford Fortran Tutorial.
8. Your path to expertise Abaqus Fortran subroutines!
Here below, I have listed some main Abaqus Fortran tutorials that you may encounter when using Abaqus at an advanced level as a graduate student or researcher. Good news for you! You can learn each subroutine you want by clicking on that at CAE Assistant.
In this video, you’ll find an introduction to the Fortran language. It’s the perfect starting point for your journey into Fortran programming and creating Abaqus Fortran subroutines.

Matt Veidth
Free Abaqus Course
✅ Abaqus Free Course for Beginners, Intermediate  ✔ UMAT Subroutine Writing ✔ Python Scripting…
In this blog post, we’ve introduced you to “Fortran Abaqus “, a tool for engineering simulations. We’ve explained how Fortran programs are structured, discussed different types of data like numbers, and how to set constants. We’ve even talked about using arrays and matrices to handle groups of data. additionally, we’ve covered operators (like math operations), ways to control your program (ifelse statements and loops), and builtin functions to help you do more. We’ve also shown you how to save your results in files. This CAE Assistant blog post is your guide to becoming a pro in Abaqus Fortran programming, so don’t miss out.
Additionally, we’d love to hear your thoughts, Your comments mean the world to us! They not only make our tutorials better but also bring us closer to our ultimate goal: serving all your CAE needs without any extra tutorials.
you can get the PDF of this post by clicking on caeassistant.com – Fortran for Abaqus subroutines
References:
 FORTRAN 77 for Engineers and Scientists with an Introduction to Fortran 90, L. Nyhoff and S. Leestma, Prentice Hall
 Fortran 77 Tutorial, Stanford University
✅ Subscribed students  +80,000 
✅ Upcoming courses  +300 
✅ Tutorial hours  +300 
✅ Tutorial packages  +100 
What is the use of Fortran in Abaqus?
Fortran is one of the easiest programming languages to learn because it can do virtually nothing other than basic lowlevel operations common to all languages. Its syntax is also very similar to MATLAB. Furthermore, you need to know only an even smaller subset of FORTRAN to write a subroutine code in Abaqus.
How do I comment in Fortran?
The lines that begin with a “C” in Fortran are comments and have no purpose other than to make the program more readable. You may also use the exclamation mark (!) for comments. This type of comment can be any place among your piece of code.
What is the control structure in Fortran?
Fortran encompasses various control features, including conditional statements like IF statements, and loops such as DO loops. Each of these can be further categorized into different types.
What are the builtin functions in Fortran?
The Builtin functions can be very useful for performing various calculations and operations in your Fortran code. Some commonly used intrinsic functions include SIN, COS, SQRT for trigonometric and mathematical operations, LEN for string length determination, and MAX/MIN for finding maximum and minimum values, among many others.
What does write (* *) mean in Fortran?
In Fortran, the general syntax to write a file is:
WRITE (unit number, format string) list of variables
Additionally, * means default. So, write (* *) will simply use standard defaults to print integers, doubleprecision numbers, etc.