      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,
     3 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(*),
     1 COORD(*)
C
      real a
      real m
	real maxpeeq
  
      maxpeeq=0.2
	a=0.2
      m=-1/a
	A0=1/(exp(m)-1)
      B0=-1/(exp(m)-1)
      
C Absolute value of current strain:
      CALL GETVRM('PE',ARRAY,JARRAY,FLGRAY,JRCD,JMAC,JMATYP,
     1 MATLAYO,LACCFLA)
      
	EVP=ARRAY(1)+ARRAY(2)+ARRAY(3)
	EPEEQ=ARRAY(7) 
      EPEMAG=ARRAY(8)

C field variable
      DAMAGE=A0*exp(m*EPEEQ/maxpeeq)+B0
	
	FIELD(1)=EPEEQ

c      FIELD(2)=DAMAGE*EVP
c	print*,eps1,eps2,ev
c	if(ev.gt.0)then
C      Q=(0.39+EV)/(1+EV)
C      PR=Q/(1-Q)
c	ELSE
c     Q=(0.39-EV)/(1-EV)
c     PR=Q/(1-Q)
c	ENDIF
C state variable
      STATEV(1) =EPEEQ
      STATEV(2) =(3*(1-DAMAGE)+DAMAGE*3000)*(1e-12)
	STATEV(3) =DAMAGE

C If error, write comment to .DAT file:
      IF(JRCD.NE.0)THEN
       WRITE(6,*) 'REQUEST ERROR IN USDFLD FOR ELEMENT NUMBER ',
     1     NOEL,'INTEGRATION POINT NUMBER ',NPT
      ENDIF
C
      RETURN
      END
