      ! ************************************************************************
      
      ! THIS MODULE IS A CONTAINER FOR THE INITIALISATION AND SOLUTION
      ! OF A USER FAILURE MODEL
      
      ! THE FOLLOWING ROUTINES ARE INCLUDED:

      ! MODULE FAI_USER_1
      !   DEFINE VARIABLES THAT ARE COMMON BETWEEN THE ROUTINES BELOW

      ! SUBROUTINE INIT_FAI_USER_1
      !   DEFINE THE INPUT PARAMETERS FOR THE USER FAILURE MODEL

      ! SUBROUTINE CHECK_FAI_USER_1
      !   CHECK PARAMETERS ARE VALID FOR THE USER FAILURE MODEL

      ! SUBROUTINE SET_FAI_USER_1
      !   SET SHORTCUTS TO PARAMETERS FOR THE USER FAILURE MODEL

      ! SUBROUTINE SOLVE_FAI_USER_1
      !   SOLVE THE USER FAILURE MODEL

      ! BEFORE EACH ROUTINE IS CALLED, THE FOLLOWING POINTERS ARE SET-UP
      !   MTL - POINTER TO THE CURRENT MATERIAL
      !   EQ  - POINTER TO THE CURRENT FLAG/EQUATION/MATERIAL OPTION

      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
      ! NOTE: CARE SHOULD BE TAKEN WHEN USING THIS MATERIAL MODEL WITH THE 
      !       ANP TETRAHEDRAL ELEMENTS. IT IS HIGHLY RECOMMENDED THAT YOU
      !       CONTACT ANSYS FOR ADVICE ON THE TYPES OF MATERIALS
      !       APPLICABLE TO THE ANP TERTRAHEDRAL ELEMENT.
      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

      ! ************************************************************************

      MODULE FAI_USER_1
      USE kindef
      IMPLICIT NONE
      SAVE

      ! SPECIFY COMMON VARIABLES TO BE ACCESSED BY ROUITNES BELOW HERE
      !INTEGER(INT4) ::
      !REAL(REAL8) ::
      REAL(REAL8), DIMENSION(50) :: FC
      
      END MODULE FAI_USER_1


      SUBROUTINE INIT_FAI_USER_1(IFACT)

      USE material
      USE fai_user_1

      IMPLICIT NONE

      INTEGER (INT4) ::   IFACT

      ! ************************************************************************

      ! THIS SUBROUTINE INITIALISES (ALLOCATES) PARAMETERS AND DATA

      ! FLAG - IMF_FAI_USER_1

      ! INPUT - IFACT = 0 JUST GET NAME OF EQUATION AND DEPENDANT FLAGS
      !         IFACT = 1 EQUATION IS ACTIVE HENCE ALLOCATE

      ! ************************************************************************

      ! DEFINE PARAMETERS TO ALLOW ALLOCATION
      EQ%EQTYPE = IMF_FAI_USER_1 ! DO NOT MODIFY THIS LINE
      EQ%NAME = 'User Failure #1'
      EQ%NPAR = 10               ! NUMBER OF REAL INPUT PARAMETER
      EQ%NUMOPT = 0              ! NUMBER OF OPTION LISTS
      EQ%NDEPFLG = 0             ! NUMBER OF NON-OPTIONAL DEPENDANT (CHILD) FLAGS/MODEL OPTION
      EQ%NCHAR = 0
      EQ%NPAR_VEC = 0

      IF (IFACT==1) THEN
        CALL ALLOC_EQ ! DO NOT MODIFY THIS LINE, ALLOCATES MEMORY

        ! FOR EACH REAL INPUT PARAMETER, ASSIGN DATA
        !              ('name        '  L, T, M, H, val, min,max, default,0,required)
        EQ%PAR(1)=PRMT (1,'FC(1)'       ,-1,-2,1,0,ZERO,ZERO,BIG,ZERO   ,0,1)  ! THIS LINE MUST ALWAYS EXIST
        EQ%PAR(2)=PRMT (2,'FC(2)'       ,-1,-2,1,0,ZERO,ZERO,BIG,ZERO   ,0,0)
        EQ%PAR(3)=PRMT (3,'FC(3)'       ,-1,-2,1,0,ZERO,ZERO,BIG,ZERO   ,0,0)
        EQ%PAR(4)=PRMT (4,'FC(4)'       ,-1,-2,1,0,ZERO,ZERO,BIG,ZERO   ,0,0)
        EQ%PAR(5)=PRMT (5,'FC(5)'       ,-1,-2,1,0,ZERO,ZERO,BIG,ZERO   ,0,0)
        EQ%PAR(6)=PRMT (6,'FC(6)'       ,-1,-2,1,0,ZERO,ZERO,BIG,ZERO   ,0,0)
        EQ%PAR(7)=PRMT (7,'FC(7)'       ,-1,-2,1,0,ZERO,ZERO,BIG,ZERO   ,0,0)
        EQ%PAR(8)=PRMT (8,'FC(8)'       ,-1,-2,1,0,ZERO,ZERO,BIG,ZERO   ,0,0)
        EQ%PAR(9)=PRMT (9,'FC(9)'       ,-1,-2,1,0,ZERO,ZERO,BIG,ZERO   ,0,0)
        EQ%PAR(10)=PRMT(10,'FC(10)'      ,-1,-2,1,0,ZERO,ZERO,BIG,ZERO   ,0,0)

        ! FOR EACH OPTION LIST, ASSIGN DATA
        !   FOR EXAMPLE, ADD AN OPTION TO INCLUDE CRACK SOFTENING OPTION
        !   EQ%OPTION(1)%NAME = 'Crack Softening'
        !   EQ%OPTION(1)%NUMOPT = 2
        !   EQ%OPTION(1)%DEFAULT = 2
        !   EQ%OPTION(1)%SELECTED = 2
        !   CALL ALLOC_OPTION(1)
        !   EQ%OPTION(1)%OPTS(1) = OPTION('Yes','Y','cracksoft.bmp',IMF_FAI_CRACKSOFT)
        !   EQ%OPTION(1)%OPTS(2) = OPTION('No','Y','cracksoft.bmp',0)

        ! FOR EACH NON-OPTIONAL DEPENDANT (CHILD) FLAG/MODEL OPTION, ASSIGN DEPENDANT FLAG
        !   EXAMPLE, ALWAYS INCLUDE CRACK SOFTENING
        !   EQ%DEPFLG(1) = IMF_FAI_CRACKSOFT
      ENDIF

      ! SET IN ACTIVE SWITCH FOR APPROPRIATE PROCESSOR TYPE:: ALL ON BY DEFAULT
      EQ%IFSOLVER(ISLV_FCT) = 0

      RETURN
      END SUBROUTINE INIT_FAI_USER_1


      SUBROUTINE SET_FAI_USER_1

      USE material
      USE fai_user_1

      IMPLICIT NONE

      ! ************************************************************************

      ! THIS SUBROUTINE ASSIGNS SHORTCUTS FOR DIRECT USE IN THE SOLVER

      ! ************************************************************************

      ! FOR EXAMPLE
      FC(1) = EQ%PAR(1)%VAL
      FC(2) = EQ%PAR(2)%VAL
      FC(3) = EQ%PAR(3)%VAL
      FC(4) = EQ%PAR(4)%VAL
      FC(5) = EQ%PAR(5)%VAL
      FC(6) = EQ%PAR(6)%VAL
      FC(7) = EQ%PAR(7)%VAL
      FC(8) = EQ%PAR(8)%VAL
      FC(9) = EQ%PAR(9)%VAL
      FC(10) = EQ%PAR(10)%VAL

      ! FOR EXAMPLE
      ! PMIN = EQ%PAR(1)%VAL
      ! IFCRKSOFT = EQ%OPTION(1)%SELECTED

      RETURN

      END SUBROUTINE SET_FAI_USER_1

      SUBROUTINE CHECK_FAI_USER_1
      USE material
      USE fai_user_1
      IMPLICIT NONE

      ! ************************************************************************

      ! THIS SUBROUTINE CHECKS INPUT DATA

      ! ************************************************************************

      ! PLACE USER CHECKS HERE

      RETURN

      END SUBROUTINE CHECK_FAI_USER_1


      SUBROUTINE SOLVE_FAI_USER_1_2D (NFCRIT,TT1,TT2,TT3,TT12,ET1,ET2,ET3,ET12,PANG,IFAIL)

      USE material
      USE fai_user_1
      USE cycvar
      USE locelm
      USE mdgrid
      USE wrapup

      IMPLICIT NONE

      INTEGER (INT1) ::  IFAIL
      INTEGER (INT4) :: NFCRIT
      REAL (REAL8)   ::    ET1, ET12, ET2, ET3, PANG, TT1, TT12
      REAL (REAL8)   ::    TT2,  TT3, FT11U, FT12U

      ! ************************************************************************

      ! THIS IS A USER SUPPLIED SUBROUTINE WHICH CAN BE USED TO COMPUTE
      ! FAILURE OF A MATERIAL.

      ! INPUT PARAMETER

      !    NFCRIT  FAILURE CRITERION NUMBER
      !            = 1   None (EXFAIL IS NOT CALLED FOR THIS)
      !            = 2   Principal Stress
      !            = 3   Principal Strain
      !            = 4   Principal Material Stress
      !            = 5   Principal Material Strain
      !            = 6   Principal Stress and/or Strain
      !            = 7   Principal Material Stress and/or Strain
      !            = 8   User (DEFINED ONLY IN THIS SUBROUTINE)
      !    TTn     PRINCIPAL STRESSES
      !    ETn     PRINCIPAL STRAINS
      !    PANG    ANGLE OF PRINCIPAL PLANE IN DEGREES
      !    IFAIL   STRESS STATE INDICATOR
      !            = 0   HYDRO
      !            = 1   ELASTIC
      !            = 2   PLASTIC
      !            = 3   BULK FAILURE (WITH HEAL)
      !            = 4   BULK FAILURE (NO HEAL)
      !            = 5   DIRN. 11 FAILURE (NO HEAL)
      !            = 6   DIRN. 22 FAILURE (NO HEAL)
      !            = 7   DIRN. 33 FAILURE (NO HEAL)
      !            = 8   DIRN. 12 FAILURE (NO HEAL)

      ! OUTPUT PARAMETERS

      !    IFAIL     STRESS STATE INDICATOR (SEE ABOVE)

      ! THE FOLLOWING MODULES CONTAIN INFORMATION WHICH MAY BE
      ! USEFUL FOR COMPUTING THE OUTPUT PARAMETERS :-

      ! MODULE  'MATDEF'
      ! MATNO         -  THE MATERIAL NUMBER OF THE CURRENT MATERIAL
      ! MATERIALS(MATNO)%NAME -  THE MATERIAL NAME OF THE CURRENT MATERIAL

      ! MODULE  'CYCVAR'
      !                NCYCLE - CURRENT CYCLE NUMBER
      !                TIME   - CURRENT TIME
      !                DLTH   - TIME STEP FOR CURRENT CYCLE

      ! THE FOLLOWING GRID VARIABLES MAY ALSO BE USEFUL :-

      ! DAM(IJK)     -  CELL DAMAGE
      ! EFS(IJK)     -  CELL EFFECTIVE GEOMETRIC STRAIN
      ! EPS(IJK)     -  CELL EFFECTIVE PLASTIC STRAIN
      ! EPSDOT(IJK)  -  CELL EFFECTIVE PLASTIC STRAIN RATE
      ! PN(IJK)      -  CELL PRESSURE
      ! TXX(IJK)     -  CELL STRESS FOR XX DIRECTION
      ! TYY(IJK)     -  CELL STRESS FOR YY DIRECTION
      ! TTT(IJK)     -  CELL STRESS FOR TT DIRECTION
      ! TXY(IJK)     -  CELL STRESS FOR XY DIRECTION

      ! THE INDEX IJK FOR THE CURRENT CELL IS DEFINED IN locelm

      ! ************************************************************************

      ! TEMPORARY ERROR MESSAGE - REPLACE WITH YOUR OWN CODE
      IF (NFCRIT>=IMF_FAI_USER_1) THEN
        CALL USR_MESSAG ('User subroutine FAI_USER_1_2D missing')
        NSWRAP = 9
      END IF

      ! TO ACCESS A V4.3 USER SUBROUITNE FOR AUTODYN-2D, UNCOMMENT THE NEXT LINE(S)
      !CALL EXFAIL (NFCRIT,TT1,TT2,TT3,TT12,ET1,ET2,ET3,ET12,PANG,IFAIL)

      RETURN

      END SUBROUTINE SOLVE_FAI_USER_1_2D

      SUBROUTINE SOLVE_FAI_USER_1_2D_SHELL(NFCRIT,NLAY,TT1,TT2,IFAIL)

      USE material
      USE fai_user_1
      USE cycvar
      USE locelm
      USE wrapup

      IMPLICIT NONE

      INTEGER (INT1) ::  IFAIL
      INTEGER (INT4) :: NFCRIT,  NLAY
      REAL (REAL8)   ::    TT1,    TT2

      ! ******************************************************************

      ! THIS IS A USER SUPPLIED SUBROUTINE WHICH CAN BE USED TO COMPUTE
      ! FAILURE OF A MATERIAL IN SHELL SUBGRIDS.

      ! THIS ROUTINE IS CALLED FOR EACH INTEGRATION POINT THROUGH THE
      ! THICKNESS OF THE SHELL ELEMENT

      ! INPUT PARAMETER

      !      NFCRIT  FAILURE CRITERION NUMBER
      !              = 4   Principal Stress
      !              = 11  User (DEFINED ONLY IN THIS SUBROUTINE)
      !      NLAY    CURRENT SHELL THROUGH THICKNESS INTEGRATION POINT NUMBER
      !      TTn     PRINCIPAL STRESSES AT LAYER NLAY
      !      IFAIL   = STRESS STATE INDICATOR
      !              = 0   HYDRO
      !              = 1   ELASTIC
      !              = 2   PLASTIC
      !              = 3   BULK FAILURE (WITH HEAL)
      !              = 4   BULK FAILURE (NO HEAL)
      !              = 5   DIRN. 11 FAILURE (NO HEAL)
      !              = 6   DIRN. 22 FAILURE (NO HEAL)

      ! OUTPUT PARAMETERS

      !      IFAIL     STRESS STATE INDICATOR (SEE ABOVE)

      ! THE FOLLOWING MODULES CONTAIN INFORMATION WHICH MAY BE
      ! USEFUL FOR COMPUTING THE OUTPUT PARAMETERS :-

      ! MODULE  'MATDEF'
      ! MATNO         -  THE MATERIAL NUMBER OF THE CURRENT MATERIAL
      ! MATERIALS(MATNO)%NAME -  THE MATERIAL NAME OF THE CURRENT MATERIAL

      ! MODULE  'CYCVAR'
      !              NCYCLE - CURRENT CYCLE NUMBER
      !              TIME   - CURRENT TIME
      !              DLTH   - TIME STEP FOR CURRENT CYCLE

      ! THE INDEX IJK FOR THE CURRENT CELL IS DEFINED IN locelm

      ! ******************************************************************

      ! TEMPORARY ERROR MESSAGE - REPLACE WITH YOUR OWN CODE
      IF (NFCRIT>=IMF_FAI_USER_1) THEN
        CALL USR_MESSAG ('User subroutine FAI_USER_1_2D_SHELL missing')
        NSWRAP = 9
      END IF

      ! TO ACCESS A V4.3 USER SUBROUITNE FOR AUTODYN-2D, UNCOMMENT THE NEXT LINE(S)
      !CALL EXFAILS(NFCRIT,NLAY,TT1,TT2,IFAIL)

      RETURN

      END SUBROUTINE SOLVE_FAI_USER_1_2D_SHELL



      SUBROUTINE SOLVE_FAI_USER_1_3D (NFCRIT,TT1,TT2,TT3,TT12,TT23,TT31, &
                           ET1,ET2,ET3,ET12,ET23,ET31,ANG,X11P,Y11P,Z11P,IFAIL)

      USE material
      USE fai_user_1
      USE cycvar
      USE locelm
      USE mdgrid3
      USE wrapup

      IMPLICIT NONE

      INTEGER (INT1) ::  IFAIL
      INTEGER (INT4) :: NFCRIT
      REAL (REAL8)   ::    ANG,    ET1,   ET12,    ET2,   ET23,    ET3
      REAL (REAL8)   ::   ET31,    TT1,   TT12,    TT2,   TT23,    TT3
      REAL (REAL8)   ::   TT31,   X11P,   Y11P,   Z11P

      ! ************************************************************************

      ! THIS IS A USER SUPPLIED SUBROUTINE WHICH CAN BE USED TO COMPUTE
      ! FAILURE OF A MATERIAL.

      ! INPUT PARAMETER

      ! NFCRIT  FAILURE CRITERION NUMBER
      ! = 4         Principal Stress
      ! = 5         Principal Strain
      ! = 6         Principal Stress and/or Strain
      ! = 7         Principal Material Stress
      ! = 8         Principal Material Strain
      ! = 9         Principal Material Stress and/or Strain
      ! = LIMFAI    User (DEFINED ONLY IN THIS SUBROUTINE)
      !
      ! TTn     PRINCIPAL STRESSES
      ! ETn     PRINCIPAL STRAINS
      !
      ! IMPORTANT NOTE:
      !
      !    FOR MATERIAL DIRECTION FAILURE OPTIONS + User defined ONLY:
      !            THE STRESSES/STRAINS ARE IN MATERIAL DIRECTIONS
      !
      !    FOR PRINCIPAL STRAIN FAILURE:
      !            THE STRESSES/STRAINS ARE IN PRINCIPAL STRAIN DIRECTIONS
      !
      !    FOR PRINCIPAL STRESS FAILURE:
      !            THE STRESSES/STRAINS ARE IN PRINCIPAL STRESS DIRECTIONS
      !
      !    FOR PRINCIPAL STRESS + STRAIN FAILURE:
      !            THE STRESSES/STRAINS ARE IN PRINCIPAL STRAIN DIRECTIONS
      !
      ! ANG     ANGLE OF PRINCIPAL DIRECTION 22 IN DEGREES
      ! X11P,Y11P,Z11P = PRINCIPAL DIRECTION 11
      ! IFAIL   STRESS STATE INDICATOR
      ! = 0   HYDRO
      ! = 1   ELASTIC
      ! = 2   PLASTIC
      ! = 3   BULK FAILURE (WITH HEAL)
      ! = 4   BULK FAILURE (NO HEAL)
      ! = 5   DIRN. 11 FAILURE (NO HEAL)
      ! = 6   DIRN. 22 FAILURE (NO HEAL)
      ! = 7   DIRN. 33 FAILURE (NO HEAL)
      ! = 8   DIRN. 12 FAILURE (NO HEAL)
      ! = 9   DIRN. 23 FAILURE (NO HEAL)
      ! = 10  DIRN. 31 FAILURE (NO HEAL)

      ! OUTPUT PARAMETERS

      ! IFAIL     STRESS STATE INDICATOR (SEE ABOVE)

      ! THE FOLLOWING MODULES CONTAIN INFORMATION WHICH MAY BE
      ! USEFUL FOR COMPUTING THE OUTPUT PARAMETERS :-

      ! MODULE  'MATDEF'
      ! MATNO         -  THE MATERIAL NUMBER OF THE CURRENT MATERIAL
      ! MATERIALS(MATNO)%NAME -  THE MATERIAL NAME OF THE CURRENT MATERIAL

      ! MODULE  'CYCVAR'
      ! NCYCLE - CURRENT CYCLE NUMBER
      ! TIME   - CURRENT TIME
      ! DLTH   - TIME STEP FOR CURRENT CYCLE

      ! THE FOLLOWING GRID VARIABLES MAY ALSO BE USEFUL :-

      ! ML(NCDM)     -  CELL DAMAGE
      ! EFS(IJK)     -  CELL EFFECTIVE GEOMETRIC STRAIN3
      ! ML(NCPS)     -  CELL EFFECTIVE PLASTIC STRAIN3
      ! EPSDOT(IJK)  -  CELL EFFECTIVE PLASTIC STRAIN RATE
      ! PN(IJK)      -  CELL PRESSURE
      ! TXX(IJK)     -  CELL STRESS FOR XX DIRECTION
      ! TYY(IJK)     -  CELL STRESS FOR YY DIRECTION
      ! TTT(IJK)     -  CELL STRESS FOR TT DIRECTION
      ! TXY(IJK)     -  CELL STRESS FOR XY DIRECTION

      ! THE INDEX IJK FOR THE CURRENT CELL IS DEFINED IN LOCELM

      ! ************************************************************************
      
      ! TEMPORARY ERROR MESSAGE - REPLACE WITH YOUR OWN CODE
      IF (NFCRIT>=IMF_FAI_USER_1) THEN
        CALL USR_MESSAG ('User subroutine FAI_USER_1_3D missing')
        NSWRAP = 9
      END IF

      ! TO ACCESS A V4.3 USER SUBROUITNE FOR AUTODYN-2D, UNCOMMENT THE NEXT LINE(S)
      !CALL EXFAIL (NFCRIT,TT1,TT2,TT3,TT12,TT23,TT31,ET1,ET2,ET3,ET12,ET23,ET31,ANG,X11P,Y11P,Z11P,IFAIL)


      RETURN

      END SUBROUTINE SOLVE_FAI_USER_1_3D


      SUBROUTINE SOLVE_FAI_USER_1_3D_SHELL (NFCRIT,NLAY,STR1,STR2,STR12,T11,T22,STN1,STN2, &
      STN12,ET1,ET2,IFAIL)

      USE material
      USE fai_user_1
      USE cycvar
      USE locelm
      USE wrapup

      IMPLICIT NONE

      INTEGER (INT1) ::  IFAIL
      INTEGER (INT4) :: NFCRIT,   NLAY
      REAL (REAL8)   ::    ET1,    ET2,  STN12,   STN1,   STN2,   STR1
      REAL (REAL8)   ::  STR12,   STR2,    T11,    T22

      ! ************************************************************************

      ! THIS IS A USER SUPPLIED SUBROUTINE WHICH CAN BE USED TO COMPUTE
      ! FAILURE OF A MATERIAL IN SHELL SUBGRIDS.

      ! THIS ROUTINE IS CALLED FOR EACH INTEGRATION POINT THROUGH THE
      ! THICKNESS OF THE SHELL ELEMENT

      ! INPUT PARAMETER

      ! NFCRIT  FAILURE CRITERION NUMBER
      ! = 4   PRINCIpal STRESS
      ! = 5   PRINCIpal STRAIN
      ! = 6   PRINCIpal STRESS and/or STRAIN3
      ! = 11  User (DEFINED ONLY IN THIS SUBROUTINE)
      ! NLAY    CURRENT SHELL THROUGH THICKNESS INTEGRATION POINT NUMBER
      ! STRn    STRESSES IN SHELL LOCAL INPLANE DIRECTIONS
      ! TTn     PRINCIPAL STRESSES AT LAYER NLAY
      ! STNn    STRAINS IN SHELL LOCAL INPLANE DIRECTIONS, AT MID LAYER
      ! ETn     PRINCIPAL STRAINS AT MID LAYER
      ! IFAIL   = STRESS STATE INDICATOR
      ! = 0   HYDRO
      ! = 1   ELASTIC
      ! = 2   PLASTIC
      ! = 3   BULK FAILURE (WITH HEAL)
      ! = 4   BULK FAILURE (NO HEAL)
      ! = 5   DIRN. 11 FAILURE (NO HEAL)
      ! = 6   DIRN. 22 FAILURE (NO HEAL)

      ! OUTPUT PARAMETERS

      ! IFAIL     STRESS STATE INDICATOR (SEE ABOVE)

      ! THE FOLLOWING MODULES CONTAIN INFORMATION WHICH MAY BE
      ! USEFUL FOR COMPUTING THE OUTPUT PARAMETERS :-

      ! MODULE  'MATDEF'
      ! MATNO         -  THE MATERIAL NUMBER OF THE CURRENT MATERIAL
      ! MATERIALS(MATNO)%NAME -  THE MATERIAL NAME OF THE CURRENT MATERIAL

      ! MODULE  'CYCVAR'
      ! NCYCLE - CURRENT CYCLE NUMBER
      ! TIME   - CURRENT TIME
      ! DLTH   - TIME STEP FOR CURRENT CYCLE

      ! THE FOLLOWING GRID VARIABLES MAY ALSO BE USEFUL :-
      ! STRS1(IJK)         -  STRESS IN LOACL 1 DIRECTION, MID LAYER
      ! STRS2(IJK)         -  STRESS IN LOACL 2 DIRECTION, MID LAYER
      ! STRS3(IJK)         -  STRESS IN LOACL 12 DIRECTION, MID LAYER
      ! STN1(IJK)          -  STRAIN IN LOACL 1 DIRECTION, MID LAYER
      ! STN2(IJK)          -  STRAIN IN LOACL 2 DIRECTION, MID LAYER
      ! STN12(IJK)         -  STRAIN IN LOACL 12 DIRECTION, MID LAYER
      ! BMOM1(IJK)         -  BENDING MOMENT IN LOACL 1 DIRECTION
      ! BMOM2(IJK)         -  BENDING MOMENT IN LOACL 2 DIRECTION
      ! BMOM12(IJK)        -  BENDING MOMENT IN LOACL 12 DIRECTION
      ! ML(NCDM)           -  CELL DAMAGE
      ! EFS(IJK)           -  CELL EFFECTIVE GEOMETRIC STRAIN3
      ! ML(NCPS)           -  CELL EFFECTIVE PLASTIC STRAIN3
      ! EPSDOT(IJK)        -  CELL EFFECTIVE PLASTIC STRAIN RATE

      ! THE INDEX IJK FOR THE CURRENT CELL IS DEFINED IN locelm

      ! ************************************************************************

      ! TEMPORARY ERROR MESSAGE - REPLACE WITH YOUR OWN CODE
      IF (NFCRIT>=IMF_FAI_USER_1) THEN
        CALL USR_MESSAG ('User subroutine FAI_USER_1_3D_SHELL missing')
        NSWRAP = 9
      END IF

      ! TO ACCESS A V4.3 USER SUBROUITNE FOR AUTODYN-2D, UNCOMMENT THE NEXT LINE(S)
      !CALL EXFAILS (NFCRIT,NLAY,STR1,STR2,STR12,T11,T22,STN1,STN2,STN12,ET1,ET2,IFAIL)

      RETURN

      END SUBROUTINE SOLVE_FAI_USER_1_3D_SHELL
