Fortran Could Not Compile Fixed-form Format Code

Fortran Could Not Compile Fixed-form Format Code

I tried to link FORTRAN to ABAQUS and using the following attached example to test if it works. It seems the Fortran Compile does not work with this fixed-form Fortran format. The errors look like this:

USDFLD.for(1): error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: ( % : . = =>
c
-------^
USDFLD.for(2): error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: * <IDENTIFIER>
SUBROUTINE USDFLD(FIELD,STATEV,PNEWDT,DIRECT,T,CELENT,
-------------------------------------------------------------^
USDFLD.for(3): error #5082: Syntax error, found ',' when expecting one of: ( % : . = =>
1 TIME,DTIME,CMNAME,ORNAME,NFIELD,NSTATV,NOEL,NPT,LAYER,
-----------^
USDFLD.for(3): error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: ( * :: <IDENTIFIER> <CHAR_CON_KIND_PARAM> <CHAR_NAM_KIND_PARAM> <CHARACTER_CONSTANT> ...
1 TIME,DTIME,CMNAME,ORNAME,NFIELD,NSTATV,NOEL,NPT,LAYER,
-------------------------------------------------------------^

My compiler version is Intel Fortran Compiler 11.1 + Microsoft Visual Studio C++ 10.0.30319.1 on Windows 7 64 bit

Anyone can advise solution on this would be great. Thanks very much for any help!

[fortran>]

c
SUBROUTINE USDFLD(FIELD,STATEV,PNEWDT,DIRECT,T,CELENT,
1 TIME,DTIME,CMNAME,ORNAME,NFIELD,NSTATV,NOEL,NPT,LAYER,
2 KSPT,KSTEP,KINC,NDI,NSHR,COORD,JMAC,JMATYP,MATLAYO,LACCFLA)
c
c Every ABAQUS/Standard Subroutine must have the following statement
c
INCLUDE 'ABA_PARAM.INC'
c
c CMNAME = User-Specified material name, left justified
c ORNAME = User-Specified local orientation name, left justified
c
c since the variable is initialize in declaration block .FALSE.
c value will be set only for first USDFLD call.
c since we have "save" parameter the variable will be not destroyed
c after USDFLD call.
c
logical, save :: isFileOpen = .FALSE.
c
CHARACTER*80 CMNAME,ORNAME
CHARACTER*3 FLGRAY(15)
DIMENSION FIELD(NFIELD),STATEV(NSTATV),DIRECT(3,3),T(3,3),TIME(2)
DIMENSION ARRAY(15),JARRAY(15),JMAC(*),JMATYP(*),COORD(*)
INTEGER, PARAMETER :: uSTATEV = 105
c
c user coding to define FIELD and, if necessary, STATEV and PNEWDT
c
c ~~ CALL VALUES FROM ABAQUS ~~
c
c Absolute value of current strain 'E'
c
CALL GETVRM('E',ARRAY,JARRAY,FLGRAY,JRCD,JMAC,JMATYP,
1 MATLAYO,LACCFLA)
E11=ARRAY(1)
c
c Use the strain as a field variable
c
FIELD(1)=E11
c
c Store the strain as a solution dependent state variable
c
STATEV(1)=FIELD(1)
c
101 FORMAT (F12.6)
c
c is the file open?
C if (105.NE.isFileOpen) then
if (.not. isFileOpen) then
c open external file
open(105, file='\STATEV.txt',STATUS='UNKNOWN', ACTION='WRITE')
c 1 file='\STATEV.txt',
c Also tried to put the full path for the file above
c 2 STATUS='NEW')
c change file flag
isFileOpen = .TRUE.
end if
c
c write data to STATEV.txt file
WRITE(105,*) 'Test Writing'
write(105,'(F12.6)') statev(1)

c OPEN (UNIT=uSTATEV,
c 1 FILE='STATEV.txt',
c Also tried to put the full path for the file above
c 2 STATUS='NEW')
c WRITE (uSTATEV,101) STATEV(1)
c CLOSE (UNIT=uSTATEV)
c
c WRITE (1),STATEV(1)
c
c ~~ REPORTING AN ERROR IF IT OCCURS ~~
c
c If error, write comment to .DAT file:
c
IF(JRCD.NE.0)THEN
WRITE(6,*) 'REQUEST ERROR IN USDFLD FOR ELEMENT NUMBER ',
1 NOEL,'INTEGRATION POINT NUMBER ',NPT
c
c - Return Code (0 - no error, 1 - output request error or all components of output request are zero)
c
ENDIF
RETURN
END

[/fortran]

publicaciones de 4 / 0 nuevos
Último envío
Para obtener más información sobre las optimizaciones del compilador, consulte el aviso sobre la optimización.

Re-attach source code file ..

Adjuntos: 

AdjuntoTamaño
Descargar usdfld.for2.68 KB

I can't reproduce those errors - the only error I see is the missing include file. However, if I force the compiler to treat the .for as free-form source, with /free, then I see those sort of errors. So you need to check how the source is being compiled to make sure that /free is not being specified.

Steve

Excellent, I remove the '/free' option that specified for compile_fortran in abaqus_v6.env file and it working now.

Thanks Steve.

Inicie sesión para dejar un comentario.