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?
-
Welcome. Please use tag [tag:fortran] for all Fortran questions. – Vladimir F Героям слава Mar 01 '18 at 11:55
-
Note that you can write Fortran 90 or even in Fortran 2008 in fixed form just fine. – Vladimir F Героям слава Nov 15 '18 at 13:12
1 Answers
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.

- 2,287
- 1
- 11
- 26
-
Hi, thank you so much for your reply. I am very interested in the second option that you provided. I would rather not even touch the abaqus environment file. I wouldn't know anything about it!!!! However, this "place a compiler directive at the beginning of your subroutine" sounds interesting! So you just type "!DIR$ FREEFORM" at the begining of the script where you are writing your subroutines? – MousumiG Mar 01 '18 at 22:11
-
fyi `!DIR$ NOFREEFORM` specifies fixed form and you can mix in the same source file using the directives to switch form. Too bad they didn't make a directive like that part of the standard.. – agentp Mar 02 '18 at 22:08