简体   繁体   English

ABAQUS子例程在配置为程序而不是子例程时运行

[英]ABAQUS subroutine runs when configured as a program but not as a subroutine

I am writing a DISP subroutine for ABAQUS 6.14, starting with small steps -- trying to open and read the file containing the displacement data. 我正在为ABAQUS 6.14编写DISP子例程,从小步骤开始-尝试打开并读取包含位移数据的文件。 So far I have a fortran script which runs perfectly when configured as an independent program but crashes when ABAQUS runs it as a subroutine. 到目前为止,我有一个fortran脚本,该脚本在配置为独立程序时可以完美运行,但是在ABAQUS作为子例程运行该脚本时会崩溃。 The working version : 工作版本:

PROGRAM DISP

INTEGER nnodes, IOS
PARAMETER (nnodes = 5652)
REAL A(nnodes,4)

WRITE(*,*) 'hello world'

OPEN(UNIT=11,FILE ="displaced_shape.dat",IOSTAT=IOS)
WRITE(*,*) IOS

DO ix = 1,nnodes
  READ(11,*) A(ix,:)
END DO

WRITE(*,*) A(2,3)
END PROGRAM DISP

The output of this program is 该程序的输出是

hello world
          0
 5.4729998E-04

The subroutine : 子程序:

SUBROUTINE DISP(U,KSTEP,KINC,TIME,NODE,NOEL,JDOF,COORDS) 

INCLUDE 'ABA_PARAM.INC' 
DIMENSION U(3),TIME(2),COORDS(3) 

INTEGER nnodes, IOS
PARAMETER (nnodes = 5652)
REAL A(nnodes,4)

WRITE(*,*) 'hello world'

OPEN(UNIT=11,FILE ="displaced_shape.dat",IOSTAT=IOS)
WRITE(*,*) IOS

DO ix = 1,nnodes
  READ(11,*) A(ix,:)
END DO

WRITE(*,*) A(2,3)

RETURN
END SUBROUTINE DISP

The output of the subroutine is 子程序的输出是

hello world
          0
forrtl: severe (24): end-of-file during read, unit 11

As you can see, the scripts are identical except for the wrapping. 如您所见,除了包装外,这些脚本是相同的。 I run them from the same folder referencing the same data file. 我从引用相同数据文件的同一文件夹中运行它们。 Could it be a matter of fortran version ? 可能是fortran版本的问题吗? The ABAQUS documentation is pretty vague on this. ABAQUS文档对此非常含糊。

Any ideas would be greatly appreciated, thanks for your help. 任何想法将不胜感激,谢谢您的帮助。

Edit : as may be obvious, the file "displaced_shape.dat" has the format 编辑:显而易见,文件“ displaced_shape.dat”具有以下格式

1  0.1  0.2  0.3
2  0.1  0.2  0.3
....
5652  0.1  0.2  0.3

The problem is very likely due to assigning your file unit number to a value that should be reserved for use by Abaqus. 该问题很可能是由于将文件单元号分配给应保留供Abaqus使用的值。 According to the docs 1 there is a simple fix: For Abaqus/Standard, use a file unit number 15-18 or >100. 根据docs 1,有一个简单的解决方法:对于Abaqus / Standard,请使用文件单元号15-18或> 100。 For Explicit, use 16-18 or >100 ending in 5 through 9 (eg 105). 对于“显式”,请使用以5到9结尾的16-18或> 100(例如105)。

1 Abaqus Analysis User's Manual > Introduction > Job Execution > FORTRAN Unit Numbers 1 Abaqus Analysis用户手册>简介>工作执行> FORTRAN单元编号

For others who may come across this problem : the issue is that ABAQUS requires the full path to the file and won't just check the working directory for it. 对于其他可能遇到此问题的人:问题是ABAQUS需要文件的完整路径,而不仅仅是检查工作目录。 Adding the absolute file path solved the problem. 添加绝对文件路径解决了该问题。

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

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