问题
I am using Abaqus with user-defined subroutines. To the best of my knowledge, Abaqus Standard or Explicit can be used with subroutines written specifically in Fortran 77 language, not the improved Fortran 90/95 language! Is there a way how to use Fortran 90 and later with Abaqus?
回答1:
By default, Abaqus expects user subroutines to be written in the older fixed-format style. However, you can use just about any modern language feature supported by your compiler.1 This includes using modules, new intrinsics, derived types, etc, as long as you adhere to the fixed-format style.
But if you find the fixed-format restrictive, like I do, then you have options. To use the free-format style, you may either:
Modify the abaqus environment file: The environment file is a system-wide settings file that affects all users. You may change settings here, but you should not do it without consulting your team first. Alternatively, make a copy of the .env file and put it in your work directory so that any changes are localized to your analyses only (your coworkers will thank you).
Find the
compile_fortran
variable. Add'/free'
(windows) or'-free'
(linux) to the list. If you see'/extend-source'
there, you will probably need to remove it.Use a compiler directive: Rather than modifying the .env file, you can place a compiler directive at the beginning of your subroutine. In my experience, this allows my subroutines to compile and run anywhere they are used.
Assuming you are using Intel Fortran, the directive is:
!DIR$ FREEFORM
1 Of course, I haven't tested every language feature, and so I'm hedging here. But I do say "just about" because there definitely seem to be some features that cause problems. For example, my subroutines with parameterized derived types always seem to crash, much to my chagrin. If any readers have been able to use them successfully, I'd love to hear about it.
来源:https://stackoverflow.com/questions/49040255/using-subroutines-written-in-fortran-90-with-abaqus-standard