ABAQUS subroutine runs when configured as a program but not as a subroutine

微笑、不失礼 提交于 2019-12-25 02:55:56

问题


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. 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. 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 ? The ABAQUS documentation is pretty vague on this.

Any ideas would be greatly appreciated, thanks for your help.

Edit : as may be obvious, the file "displaced_shape.dat" has the format

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

回答1:


The problem is very likely due to assigning your file unit number to a value that should be reserved for use by Abaqus. According to the docs1 there is a simple fix: For Abaqus/Standard, use a file unit number 15-18 or >100. For Explicit, use 16-18 or >100 ending in 5 through 9 (e.g. 105).

1Abaqus Analysis User's Manual > Introduction > Job Execution > FORTRAN Unit Numbers




回答2:


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. Adding the absolute file path solved the problem.



来源:https://stackoverflow.com/questions/54237675/abaqus-subroutine-runs-when-configured-as-a-program-but-not-as-a-subroutine

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!