Dipaloke
Dipaloke

Reputation: 19

How to write Fortran modules in UMAT subroutine in ABAQUS?

I have 3 modules (in free form .f90 format) which are being called from inside of UMAT subroutine, such as:

module module_A  
use module_C  
use module_B  
....  
end module_A  

module module_B  
use module_C  
....  
end module_B

module module_C  
....  
end module_C

subroutine UMAT(STRESS,...)  

....  
Here the subroutines from module_A and module_B are being called  
...  
end subroutine UMAT

Now, my question is what should be the appropriate format of writing these modules with UMAT subroutine? How to merge different module files into a single *.for file (free format)?

Upvotes: 1

Views: 1182

Answers (1)

brady
brady

Reputation: 2257

If I understand correctly you have multiple source files that you want to compile for your UMAT. Since the built-in Abaqus make utility only takes one file you can use an INCLUDE statement to tell the Fortran compiler to include other source files in the main source file. So let's say you have four files: module_A.for, module_B.for, module_C.for and umat.for. umat.for should contain some INCLUDE statements at the top:

INCLUDE 'module_C.for'
INCLUDE 'module_B.for'
INCLUDE 'module_A.for'

SUBROUTINE UMAT(... umat args ...)
    USE module_A

ENDSUBROUTINE UMAT

Make sure all of the *.for files are in the same directory so the compiler can easily find them. When the compiler encounters an INCLUDE it will read the referenced source file and continue compiling as if it's contents were directly in the umat.for source file, and then return to compiling umat.for.

Upvotes: 2

Related Questions