What wrong with the USDFLD Fortran77 Code ?

Good Morning Community,

I'm trying to write a simple USDFLD that elment deltes when  the max principal train is greater than the critical strain.

When I submit it it fails to compile and I know it is the code and not the complier. Can you help?

 

      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(*)


 

C Start of my fortran77 (.f & .for) code

      IMPLICIT NONE  !  *** VERY IMPORTANT: FORCE EXPLICIT DECLARATION ***


 

C Local variables:

      REAL*8  EQPLAS, CRIT_STRAIN, Max_Principal_Strain

      INTEGER JRCD  ! Return code from GETVRM


 

C   The critical strain is set to be 0.3

      CRIT_STRAIN = 0.3D0  ! Use D0 to ensure double precision


 

C Using GETVRM to get the Max principle strain

      CALL GETVRM('LEP',ARRAY,JARRAY,FLGRAY,JRCD,JMAC,JMATYP,MATLAYO,

    1 LACCFLA)


 

C Check the return code from GETVRM

      IF (JRCD .NE. 0) THEN

        WRITE(*,*) 'Error in GETVRM, JRCD = ', JRCD

        FIELD(1) = 0.0D0  ! Or some other appropriate value

        RETURN

      ENDIF


 

C Generating the Max principle strain array

      Max_Principal_Strain = ARRAY(3)


 

C Ratio of the current principal strain to the critcal strain

C This is for visuluation purpose

      STATEV(1) = Max_Principal_Strain / CRIT_STRAIN  ! Corrected assignment


 

      IF (Max_Principal_Strain .GE. CRIT_STRAIN) THEN ! Comparing the correct variables

C   Set the filed variable to -1 to triger element deletion

C   Abaqus interprets Field(1) < -0.5 as element deletion

        FIELD(1) = -1.0D0

 

      ELSE

        Field(1) = 0.0D0

      EndIf

      RETURN

      END