简体   繁体   English

将用Fortran 90编写的子例程与Abaqus Standard一起使用

[英]Using subroutines written in Fortran 90 with Abaqus Standard

I am using Abaqus with user-defined subroutines. 我正在将Abaqus与用户定义的子例程一起使用。 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! 据我所知,Abaqus Standard或Explicit可以与专门以Fortran 77语言编写的子例程一起使用, 而不是经过改进的Fortran 90/95语言! Is there a way how to use Fortran 90 and later with Abaqus? 有没有办法将Fortran 90及更高版本与Abaqus一起使用?

By default, Abaqus expects user subroutines to be written in the older fixed-format style. 默认情况下,Abaqus希望以较旧的固定格式样式编写用户子例程。 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. 1这包括使用模块,新的内在函数,派生类型等,只要您遵循固定格式的样式即可。

But if you find the fixed-format restrictive, like I do, then you have options. 但是,如果您像我一样发现固定格式的限制,那么您可以选择。 To use the free-format style, you may either: 要使用自由格式样式,您可以:

  1. Modify the abaqus environment file: The environment file is a system-wide settings file that affects all users. 修改abaqus环境文件:环境文件是影响所有用户的系统范围的设置文件。 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). 或者,制作.env文件的副本并将其放在您的工作目录中,以便所有更改仅本地化为您的分析(您的同事将感谢您)。

    Find the compile_fortran variable. 找到compile_fortran变量。 Add '/free' (windows) or '-free' (linux) to the list. 在列表中添加'/free' (Windows)或'-free' (Linux)。 If you see '/extend-source' there, you will probably need to remove it. 如果在此处看到'/extend-source' ,则可能需要将其删除。

  2. Use a compiler directive: Rather than modifying the .env file, you can place a compiler directive at the beginning of your subroutine. 使用编译器指令:可以将编译器指令放在子例程的开头,而不是修改.env文件。 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 假设您使用的是Intel Fortran,则伪指令为: !DIR$ FREEFORM

1 Of course, I haven't tested every language feature, and so I'm hedging here. 1当然,我尚未测试所有语言功能,因此我在这里进行对冲。 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. 如果有任何读者能够成功使用它们,我很想听听。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM