C DAM_AB    SOURCE    FANDEUR   11/07/20    21:15:01     7043
c
      SUBROUTINE DAM_AB (AVALC, BVALC, cons1, cons2, cons3, EBOUN,
     &                   HBOUN, stra1, stra2, stre1, stre2, thr0c)
c
c=====================================================================
c                                                                    =
c  Evaluation of parameters A and B (plastic-damage model) is made   =
c  by means of the Newton-Raphson method.                            =
c                                                                    =
c   Author: Rui Faria                           Version: 93.04.20    =
c                                               --------             =
c=====================================================================
      IMPLICIT INTEGER(I-N)
      IMPLICIT REAL*8(A-H,O-Z)
      real*8    AVALC, BVALC, cons1, cons2, cons3, EBOUN, HBOUN,
     .          stra1, stra2, stre1, stre2, thr0c
c
      integer   itera, miter
      real*8    a1   , a2   , a3   , a4   , a5   , a6   , a7   ,
     .          a8   , a9   , a10  , a11  , a12  , boldv, btria,
     .          deriv, error, funct, prov0, prov1, prov2, r1   ,
     .          r2   , str01, str02, toler
c
      parameter (miter = 150, btria = 0.1 d-17, toler = 0.1 d-08)
c=====----------------------------------------------------------------
c  determination of str01 and str02                                  |
c=====----------------------------------------------------------------
      str01 = cons1 * stra1 + cons2
      str02 = cons1 * stra2 + cons2
c=====----------------------------------------------------------------
c  equivalent "strains"                                              |
c=====----------------------------------------------------------------
      r1 = cons3 * str01
      r2 = cons3 * str02
      IF (r1.LT.0.D0 .OR. r2.LT.0.D0) THEN
        write(*,*) '===== DAM_AB ===='
        write(*,*) 'Donnees incompatibles ( sqrt(val<0) )'
        write(*,*) 'Revoir vos parametres materiau (compression)'
        CALL ERREUR(5)
      ENDIF
      r1 = SQRT (r1)
      r2 = SQRT (r2)
c
      eboun = r2
c=====----------------------------------------------------------------
c  many constants                                                    |
c=====----------------------------------------------------------------
      a4  =  thr0c / r2
      a1  = (stre2 - a4 * str02) * str01
      a2  =  thr0c / r1
      a11 =  stre1 - a2 * str01
      a3  =  a11 * str02
      a5  =  a1 * a2
      a6  =  a3 * a4
      a7  =  thr0c - r1
      a8  =  thr0c - r2
      a9  =  a1 * a7
      a10 =  a3 * a8
      a12 =  a6 - a5
c=====----------------------------------------------------------------
c  newton method for A and B                                         |
c=====----------------------------------------------------------------
      boldv = btria
      itera = 1
c
      do while (itera .le. miter)
         prov0 = EXP(boldv*a7)
         prov1 = a1 * prov0
         prov2 = a3 * EXP(boldv*a8)
c
         funct = prov1 - prov2 + a12
         deriv = prov1 * a7 - prov2 * a8
c
         bvalc = boldv - funct / deriv
c
         error = ABS ((bvalc-boldv)/bvalc)
c
         if (error .lt. toler)  then
             avalc = a11 / (str01 * (prov0 - a2))
             hboun = thr0c / r2**2 * (1.0 d0 - avalc) +
     .               avalc * bvalc * exp (bvalc*(thr0c-r2))
             RETURN
         else
             itera = itera + 1
             boldv = bvalc
         end if
      end do
c=====----------------------------------------------------------------
c  not converged                                                     |
c=====----------------------------------------------------------------
      write(*,'(/,''***** Pas de convergence dans DAM_AB *****'')')
      CALL ERREUR(5)
c
      RETURN
      END



