!*
!     ------------------------------------------------------------------
#ifdef DOC

!     AVIS AUX GENS DE LA PHYSIQUE :
!     WARNING TO PHYSICS PEOPLE    :
!     CA COMMENCE A URGER D' AVOIR L'ADJOINT DE LA PHYSIQUE  !
!     THE ADJOINT OF PHYSICS STARTS TO BE DESPERATELY NEEDED !
!     JE VEUX BIEN EN FAIRE UN CHOUIA MAIS C'EST BIEN POUR
!     VOUS FAIRE PLAISIR.
!     I ACCEPT TO CODE A SMALL CHOUIA BUT IT IS REALLY TO
!     PLEASE YOU

!     CE CHOUIA FAIT EFFECTIVEMENT PLAISIR!
!     I ENJOYED REALLY THIS CHOUIA!
!     ------------------------------------------------------------------
#endif
!     FUNCTION FOR COMPUTATION OF Es (tangent linear)
!         INPUT : PTART = TEMPERATURE
!                 PDELART = 0 if it is for water
!                           1 if it is for ice(snow)
REAL(KIND=JPRB) :: FOEWTL
REAL(KIND=JPRB) :: PTART,PTARG5,PDELART
FOEWTL(PTART,PTARG5,PDELART ) = FOEW( PTARG5,PDELART) *&
     &( ( RBETW+PDELART*RBETD ) / PTARG5**2 &
      &-( RGAMW+PDELART*RGAMD ) /PTARG5) * PTART


!     FUNCTION FOR SATURATED SPECIFIC HUMIDITY (tangent linear)
!        INPUT : PESPFAT = FOEW DIVIDED BY PRESSURE
!              : PESPFAR5 = TRAJECTORY FOR THE SAME
REAL(KIND=JPRB) :: FOQSTL1,FOQSTL2
REAL(KIND=JPRB) :: PESPFAT,PESPFAR5
FOQSTL1(PESPFAR,PESPFAR5)=((1.0_JPRB+RETV)/&
      &(1.0_JPRB+RETV*(1.0_JPRB-PESPFAR5))**2)*PESPFAR

FOQSTL2(PESPFAR,PESPFAR5)=PESPFAR

!     FUNCTION FOR COMPUTATION OF LATENT HEAT (tangent linear)
!        INPUT : PTART = TEMPERATURE
!                PDELART = 0 if it is for water
!                          1 if it is for ice (snow)
REAL(KIND=JPRB) :: FOLHTL
FOLHTL( PTART,PDELART ) =  RV * (&
  &- ( RGAMW+PDELART*RGAMD ) * PTART )


!     FUNCTION FOR COMPUTATION OF DERIVATION OF NATURAL LOGARITH
!     OF Es (tangent linear)
!        INPUT : PTART = TEMPERATURE
!                PDELART = 0 if it is for water
!                          1 if it is for ice(snow)
REAL(KIND=JPRB) :: FODLEWTL
FODLEWTL( PTART,PTARG5,PDELART ) =&
      &((RGAMW+PDELART*RGAMD)*PTARG5 &
    &- 2*(RBETW+PDELART*RBETD))*PTART &
    &/ (PTARG5**3)

!     FUNCTION FOR DERIVATION OF SATURATED SPECIFIC HUMIDITY
!     (tangent linear)
!        INPUT : PQSFART = FOQS
!                PESPFAT = FOEW DIVIDED BY PRESSURE
!                PDLEFAT = FODLEW.
REAL(KIND=JPRB) :: FODQSTL
REAL(KIND=JPRB) :: PQSFART,PQSFARG5,PDLEFAT,PDLEFAR5
FODQSTL(PQSFART,PQSFARG5,PESPFAT,PESPFAR5,PDLEFAT,PDLEFAR5)=&
    &(1.0_JPRB-2*PQSFARG5)*PDLEFAR5*PQSFART/(1.0_JPRB-PESPFAR5)&
   &+(PQSFARG5-PQSFARG5**2)*PDLEFAT/(1.0_JPRB-PESPFAR5)&
   &+(PQSFARG5-PQSFARG5**2)*PDLEFAR5*PESPFAT &
   &/((1.0_JPRB-PESPFAR5)**2)
!  ------------------------------------------------------------------


