Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28456 Discussions

Problem to complier fortran code in abaqus user subroutine

uconnlilu
Beginner
1,644 Views

I am a beginner for fortran and abaqus. I have a very simple USDFLD subroutine for abaqus as follow

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
INCLUDE 'ABA_PARAM.INC'
C
CHARACTER*80 CMNAME,ORNAME
CHARACTER*3 FLGRAY(15)
DIMENSION FIELD(NFIELD),STATEV(NSTATV),DIRECT(3,3),
1 T(3,3),TIME(2)
DIMENSION ARRAY(15),JARRAY(15),JMAC(*),JMATYP(*),COORD(*)
Y=COORD(2)
FIELD(1) = Y
STATEV(1) = 24.D10+6.D10*FILED(1)
RETURN
END

However, when I run it in abaqus, it gives me the following error

udfld.for(8): error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: * <IDENTIFIER>
SUBROUTINE USDFLD(FIELD,STATEV,PNEWDT,DIRECT,T,CELENT,
------------------------------------------------------------^
udfld.for(9): error #5082: Syntax error, found ',' when expecting one of: ( : % [ . = =>
1 TIME,DTIME,CMNAME,ORNAME,NFIELD,NSTATV,NOEL,NPT,LAYER,
----------^
udfld.for(9): 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,
------------------------------------------------------------^
udfld.for(10): error #5276: Unbalanced parentheses
2 KSPT,KSTEP,KINC,NDI,NSHR,COORD,JMAC,JMATYP,MATLAYO,LACCFLA)
----------------------------------------------------------------^
udfld.for(10): error #5082: Syntax error, found ',' when expecting one of: ( : % [ . = =>
2 KSPT,KSTEP,KINC,NDI,NSHR,COORD,JMAC,JMATYP,MATLAYO,LACCFLA)
----------^
udfld.for(10): error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: ( % . = =>
2 KSPT,KSTEP,KINC,NDI,NSHR,COORD,JMAC,JMATYP,MATLAYO,LACCFLA)
-----------------------------------------------------------------^
udfld.for(16): error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: <IDENTIFIER>
DIMENSION FIELD(NFIELD),STATEV(NSTATV),DIRECT(3,3),
---------------------------------------------------------^
udfld.for(17): error #5082: Syntax error, found ',' when expecting one of: ( % . = =>
1 T(3,3),TIME(2)
------------^
udfld.for(17): error #6072: A dummy argument of a statement function must be a scalar identifier. [3]
1 T(3,3),TIME(2)
--------^
udfld.for(17): error #6072: A dummy argument of a statement function must be a scalar identifier. [3]
1 T(3,3),TIME(2)
----------^
udfld.for(22): error #6353: A RETURN statement is invalid in the main program.
RETURN
------^
udfld.for(16): error #6591: An automatic object is invalid in a main program. [FIELD]
DIMENSION FIELD(NFIELD),STATEV(NSTATV),DIRECT(3,3),
----------------^
udfld.for(16): error #6591: An automatic object is invalid in a main program. [STATEV]
DIMENSION FIELD(NFIELD),STATEV(NSTATV),DIRECT(3,3),
------------------------------^
udfld.for(16): error #6219: This variable, used in a specification expression, must be a dummy argument, a COMMON block object, or an object accessible through host or use association. [NFIELD]
DIMENSION FIELD(NFIELD),STATEV(NSTATV),DIRECT(3,3),
----------------------^
udfld.for(16): error #6219: This variable, used in a specification expression, must be a dummy argument, a COMMON block object, or an object accessible through host or use association. [NSTATV]
DIMENSION FIELD(NFIELD),STATEV(NSTATV),DIRECT(3,3),
-------------------------------------^
udfld.for(18): error #6221: The assumed-size array must be a dummy argument. [COORD]
DIMENSION ARRAY(15),JARRAY(15),JMAC(*),JMATYP(*),COORD(*)
-------------------------------------------------------^
udfld.for(18): error #6221: The assumed-size array must be a dummy argument. [JMAC]
DIMENSION ARRAY(15),JARRAY(15),JMAC(*),JMATYP(*),COORD(*)
-------------------------------------^
udfld.for(18): error #6221: The assumed-size array must be a dummy argument. [JMATYP]
DIMENSION ARRAY(15),JARRAY(15),JMAC(*),JMATYP(*),COORD(*)
---------------------------------------------^
udfld.for(17): remark #7713: This statement function has not been used. [T]
1 T(3,3),TIME(2)
------^
compilation aborted for udfld.for (code 1)
Abaqus Error: Problem during compilation - udfld.for
Abaqus/Analysis exited with errors

 

Anyone could help me?

 

0 Kudos
2 Replies
mecej4
Honored Contributor III
1,623 Views

I think that the Abaqus script that you use to build the DLL expects the Fortran source to be in fixed format. In this format, statements start in column 7, continuation marks in column 6, etc. By convention, a file suffix of "for" is used for fixed format source files. Compare the corrected version below with what you posted. Note that the first non-blank characters in lines 1,2 and 4 are in columns 7, 6 and 1.

When you post source code, instead of typing it in the body of your text, use the "insert code" button </> .

 

 

      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
      INCLUDE 'ABA_PARAM.INC'
C
      CHARACTER*80 CMNAME,ORNAME
      CHARACTER*3 FLGRAY(15)
      DIMENSION FIELD(NFIELD),STATEV(NSTATV),DIRECT(3,3),
     1 T(3,3),TIME(2)
      DIMENSION ARRAY(15),JARRAY(15),JMAC(*),JMATYP(*),COORD(*)
      Y=COORD(2)
      FIELD(1) = Y
      STATEV(1) = 24.D10+6.D10*FILED(1)
      RETURN
      END

 

 

0 Kudos
uconnlilu
Beginner
1,597 Views

Thank you so much. The problem already solved with your kindly help. 

 

Have a nice day !

0 Kudos
Reply