C DPFUNC    SOURCE    CB215821  16/04/21    21:16:30     8920
      FUNCTION DPfunc(sigma,alpha)

c     Drucker Prager function to describe the compressive part of a concrete material.

c     sigmaeq = SQRT(3 J2) + alpha I1  with  J2 : 2nd invariant of the deviatoric stress
c                                        and   I1 : 1st invariant of the stress

      IMPLICIT REAL*8 (A-B,D-H,O-Z)
      implicit integer (I-K,M,N)
      implicit logical (L)
      implicit character*10 (C)

      dimension sigma(6)

      sigmaxx = sigma(1)
      sigmayy = sigma(2)
      sigmazz = sigma(3)
      sigmaxy = sigma(4)
      sigmaxz = sigma(5)
      sigmayz = sigma(6)

      rloc = (sigmaxx-sigmayy)**2 + (sigmayy-sigmazz)**2 +
     .            (sigmazz-sigmaxx)**2
      rloc2 = ((1d0)/(6d0))*rloc
      rj2 = rloc2 + sigmaxy**2 + sigmayz**2 + sigmaxz**2
      ri1 = sigmaxx + sigmayy + sigmazz
      DPfunc = SQRT(3d0*rj2) + alpha*ri1

      return
      end






