C EQUIST    SOURCE    CB215821  17/07/21    21:15:08     9513           
c---------------------------------------------------------------------
c
      SUBROUTINE EQUIST (STRES, TANGB, YOUNG, IFLAG, EQUIV)
c
c=====================================================================
c                                                                    =
c   This subroutine computes the equivalent strain in the eigen      =
c   system.                                               -----      =
c   ------                                                           =
c                                                                    =
c    Variables:                                                      =
c                                                                    =
c       stres (3)                      desired part of stress tensor =
c       tangb                          tang(beta)  (Drucker-Prager)  =
c       young                          E                             =
c       equiv                          equivalent strain             =
c                                                                    =
c    iflag:  -1     -     compression                                =
c            +1     -     tension                                    =
c                                                                    =
c   Author: Rui Faria                           Version: 93.04.20    =
c                                               --------             =
c=====================================================================
      IMPLICIT INTEGER(I-N)
      integer   iflag
      real*8    equiv, tangb, young, stres (3)
c
      real*8    oneth, root3, octno, octsh, argum
c
      parameter (oneth = 0.33333333333333 d0,
     .           root3 = 1.73205080756888 d0)
c
      if (iflag .eq. -1)  then
          octno = (stres (1) + stres (2) + stres (3)) * oneth
c
          octsh = SQRT ((stres (1) - stres (2))**2 +
     &                  (stres (2) - stres (3))**2 +
     &                  (stres (3) - stres (1))**2) * oneth
          argum = root3 * (octno * tangb + octsh)
          if (argum .gt. 0.0 d0)  then
              equiv = SQRT (argum)
          else
              equiv = 0.0 d0
          end if
      else
c
          equiv = SQRT ((stres(1)**2+stres(2)**2+
     .                                stres(3)**2) / young)
      endif
c
      return
      end

 
