我有3个模块(自由格式.f90格式),它们是从UMAT子例程内部调用的,例如:
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
现在,我的问题是,使用UMAT子例程编写这些模块的适当格式应该是什么?如何将不同的模块文件合并为单个* .for文件(自由格式)?
答案 0 :(得分:2)
如果我正确理解,您有多个源文件要为UMAT编译。由于内置的Abaqus make实用程序仅占用一个文件,因此您可以使用INCLUDE
语句告诉Fortran编译器在主源文件中包括其他源文件。假设您有四个文件:module_A.for,module_B.for,module_C.for和umat.for。 umat.for在顶部应包含一些INCLUDE
语句:
INCLUDE 'module_C.for'
INCLUDE 'module_B.for'
INCLUDE 'module_A.for'
SUBROUTINE UMAT(... umat args ...)
USE module_A
ENDSUBROUTINE UMAT
确保所有* .for文件位于同一目录中,以便编译器可以轻松找到它们。当编译器遇到INCLUDE
时,它将读取引用的源文件并继续进行编译,就好像其内容直接位于umat.for源文件中一样,然后返回到编译umat.for。