C HYVA3D    SOURCE    PV090527  23/01/27    21:15:38     11574          
c***********************************************************************      
      subroutine hydrvari3d(vari0,vari1,hydra0,hydra1,hydras)
c     effets de l hydratation sur les varibles internes
c     declaration externes
      real*8 vari0,vari1,hydra0,hydra1,hydras
      integer erreur   
c     varibles locales
      real*8 yy,yymin
      parameter (yymin=1.d-3)
c      print*,'hdratation actuelle:',hydra1
c      print*,'hydratation precedente:',hydra0
c      print*,'hydratation seuil:',hydras

c     initialisation controle d erreur      
      erreur=0
      if (hydra1.lt. yymin) then
c      le materiau est non coherent les varibles internes
c      sont mises a zero a chaque debut de pas  et chaque fin de pas
c      pour l affichage  
       vari1=0.d0
      else
       hydra1=min(hydra1,1.d0)
       if ((hydra1.ge.hydra0).and.(hydra0.gt.hydras)) then
c        apres le seuil on conserve les vari ou on les attenue
         if(hydra1.eq.hydra0) then
           vari1=vari0
         else           
           vari1=vari0*(hydra0-hydras)/(hydra1-hydras)
         end if
       else
         if (hydra1.le.hydras) then
c         avant le seuil on met les vari  a zero         
          vari1=0.d0
         else
          if((hydra1.gt.hydras).and.(hydra0.le.hydras)) then
c            la fin de pas a passé le seuil mais pas le debut de pas          
              vari1=0.d0
          else if (hydra1.lt.hydra0) then
c             l hydratation diminue on conserve la vari         
              vari1=vari0
          else
              print*,'Cas imprevu dans hyva3d de fldo3d'
              vari1=vari0
          end if
         end if          
       end if
      end if
      return
      end
c***********************************************************************
            
 
