 SUBROUTINE entropie(w,e)
!=========================== DOCUMENTATION ============================= 
!DOCDEBh*    PHY/entropie  *
!
!    NOM
! entropie(w,e)
!    DESCRIPTION 
!*
! Calcul de l entropie sur la cellule
!
! Calculating entropy on the cell
!*
! 
!    ENTREES / INPUT
! w    : objet de type "state" contenant les variables conservatives et primitives
!      / object of type "state" containing the conservative and primitive variables
!
!    SORTIES / OUTPUT
! e    : entropie / entropy
!
!    SOURCE
! Ce logiciel est regi par la licence [CeCILL-B]
! This software is governed by the [CeCILL-B] license
!=========================== DEBUT DES DECLARATIONS ==================== 
!.1-----  Implicit, Use
  use phy_typ
  IMPLICIT NONE
!.2-----  Declaration
  type(state),intent(inout)          :: w !! Variables primitives / Primitive variables
  real(kind=kind(0.d0)), intent(out) :: e !! Entropie / Entropy
  
  real(kind=kind(0.d0))              :: r,u1,u2,u3,p,h,zb
!=========================== DEBUT DU CODE EXECUTABLE ==================

  e=0.d0

  SELECT CASE (imodel_phy)
!---------------------------------------------------
      CASE (2) ! bifluide isotherme
          r =w%vprim%v(1)
          u1=w%vprim%v(2)
          u2=w%vprim%v(3)
          u3=w%vprim%v(4)
          p =w%vprim%v(5)
          ive_phy=6
          w%vprim%v(ive_phy) = 0.5d0*(u1*u1+u2*u2+u3*u3)*r+ r*log(r)*c_phy*c_phy&
                     +c_phy*c_phy*(r-rho0W_phy) - p +p0_phy
          e=w%vprim%v(ive_phy)

     CASE (1) ! SaintVenant
          ive_phy=4
          h = w%vprim%v(1)
          u1= w%vprim%v(2)
          u2= w%vprim%v(3)
          zb= w%vprim%v(5)
          w%vprim%v(ive_phy) = 0.5d0*(u1*u1+u2*u2)*h+ 0.5d0*gpes_phy*h*h+ gpes_phy*h*zb
          e=w%vprim%v(ive_phy)
!----------------------------------------------------

  END SELECT
!===========================   FIN DE LA ROUTINE    ====================
END SUBROUTINE entropie
!DOCFIN