问题描述
我正在将Abaqus与用户定义的子例程一起使用.据我所知,Abaqus Standard或Explicit可以与以专门语言编写的子例程一起使用,该子例程以Fortran 77语言编写,而不是改进后的Fortran 90/95语言!有没有办法将Fortran 90及更高版本与Abaqus一起使用?
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?
推荐答案
默认情况下,Abaqus希望用户子例程以较旧的固定格式样式编写.但是,您几乎可以使用编译器支持的任何现代语言功能.包括使用模块,新的内在函数,派生类型等,只要您遵循固定格式的样式即可.
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. 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:
-
修改abaqus环境文件:环境文件是影响所有用户的系统范围的设置文件. 您可以在此处更改设置,但是如果不先咨询您的团队,则不要这样做.或者,复制.env文件并将其放在您的工作目录中,以便所有更改仅本地化到您的分析中(您的同事将感谢您).
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).
找到compile_fortran
变量.将'/free'
(windows)或'-free'
(linux)添加到列表中.如果在其中看到'/extend-source'
,则可能需要将其删除.
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.
使用编译器指令:您可以在子例程的开头放置编译器指令,而不是修改.env文件.根据我的经验,这允许我的子例程在使用它们的任何位置进行编译和运行.
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.
假设您使用的是Intel Fortran,则伪指令为:!DIR$ FREEFORM
Assuming you are using Intel Fortran, the directive is: !DIR$ FREEFORM
这篇关于将用Fortran 90编写的子例程与Abaqus Standard一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!