SUBROUTINE ROUSEAAD(&
 & KPROMA,KIDIA,KFDIA,&
 & PAPHI5,PUB5,PVB5,PSLM5,&
 & PAPHI,PUB,PVB,&
 & PAZO)  

!**** *ROUSEATL* - ADJOINT OF ROUSEATL

!     PURPOSE
!     -------
!          ADJOINT OF THE TANGENT LINEAR OF ROUSEA

!        EXPLICIT ARGUMENTS
!        ------------------

!        KPROMA             - HORIZONTAL DIMENSION.                    (INPUT-C)
!        KIDIA              - INDEX OF START POINT                     (INPUT-C)
!        KFDIA              - INDEX OF END   POINT                     (INPUT-C)
!        PAPHI5(KPROMA)     - GEOPOTENTIAL MODEL LEVELS     M**2/S**2  (INPUT)
!        PUB5(KPROMA)       - U-WIND COMPONENT                 M/S     (INPUT)
!        PVB5(KPROMA)       - V-WIND COMPONENT                 M/S     (INPUT)
!        PSLM5(KPROMA)      - SEA LAND MASK                            (INPUT)

!        IMPLICIT ARGUMENTS :  NONE.
!        --------------------

!     METHOD.
!     -------
!        SEE DOCUMENTATION

!     EXTERNALS.
!     ----------
!        NONE

!     REFERENCE.
!     ----------
!        ECMWF RESEARCH DEPARTMENT DOCUMENTATION OF THE IFS

!     AUTHOR.
!     -------
!        CARLA CARDINALI *ECMWF*

!        ORIGINAL : 92-07-14
!        M.Hamrud : 95-09-15  Some cleaning
!     ------------------------------------------------------------------

USE PARKIND1  ,ONLY : JPIM     ,JPRB
USE YOMHOOK   ,ONLY : LHOOK,   DR_HOOK

USE YOMCST   , ONLY : RG
USE YOEVDF   , ONLY : RKAP

IMPLICIT NONE

INTEGER(KIND=JPIM),INTENT(IN)    :: KPROMA 
INTEGER(KIND=JPIM),INTENT(IN)    :: KIDIA 
INTEGER(KIND=JPIM),INTENT(IN)    :: KFDIA 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PAPHI5(KPROMA) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PUB5(KPROMA) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PVB5(KPROMA) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PSLM5(KPROMA) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PAPHI(KPROMA) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PUB(KPROMA) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PVB(KPROMA) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PAZO(KPROMA) 
INTEGER(KIND=JPIM) :: JL

REAL(KIND=JPRB) :: ZA1, ZA2, ZA3, ZB2, ZB3, ZCDN, ZCDN5, ZNLEV, ZNLEV5, ZWIN, ZWIN5
REAL(KIND=JPRB) :: ZHOOK_HANDLE

!     1.     DEFINITION OF THE CONSTANTS
!            ---------------------------

!*    1.1    PHISICAL CONSTANTS

!*    1.2  *RKAP* IS THE VON KARMAN CONSTANT

!*    1.3     COMPUTATIONAL CONSTANTS.

IF (LHOOK) CALL DR_HOOK('ROUSEAAD',0,ZHOOK_HANDLE)
ZA1=0.756_JPRB/1000.0_JPRB
ZA2=0.60_JPRB/1000.0_JPRB
ZA3=0.79_JPRB/1000.0_JPRB
ZB2=0.052_JPRB/1000.0_JPRB
ZB3=0.0358_JPRB/1000.0_JPRB

!*         2.     COMPUTATION OF THE ADJOINT

!*         2.1    INITIALIZE LOCAL VARIABLES

DO JL=KIDIA,KFDIA
  IF(PSLM5(JL) < 0.5_JPRB) THEN
    ZWIN5=SQRT(PUB5(JL)**2+PVB5(JL)**2)
    ZNLEV5=PAPHI5(JL)/RG
    IF(ZWIN5 < 3.0_JPRB) THEN
      ZCDN5=ZA1
    ELSEIF(ZWIN5 >= 3.0_JPRB.AND.ZWIN5 <= 11.7284_JPRB) THEN
      ZCDN5=ZA2+ZB2*ZWIN5
    ELSE
      ZCDN5=ZA3+ZB3*ZWIN5
    ENDIF
  ENDIF

  IF(PSLM5(JL) < 0.5_JPRB) THEN
    ZNLEV=0.0_JPRB
    ZCDN=0.0_JPRB
    ZWIN=0.0_JPRB
    ZNLEV=ZNLEV+EXP(-RKAP/SQRT(ZCDN5))*PAZO(JL)
    ZCDN=ZCDN+ZNLEV5*EXP(-RKAP/SQRT(ZCDN5))&
     & *RKAP/(ZCDN5*2.0_JPRB*SQRT(ZCDN5))*PAZO(JL)  
    IF(ZWIN5 < 3.0_JPRB) THEN
      ZWIN=ZWIN
    ELSEIF(ZWIN5 >= 3.0_JPRB.AND.ZWIN5 <= 11.7284_JPRB) THEN
      ZWIN=ZWIN+ZB2*ZCDN
    ELSE
      ZWIN=ZWIN+ZB3*ZCDN
    ENDIF
    PAPHI(JL)=PAPHI(JL)+ZNLEV/RG
    PUB(JL)=PUB(JL)+1.0_JPRB/ZWIN5*PUB5(JL)*ZWIN
    PVB(JL)=PVB(JL)+1.0_JPRB/ZWIN5*PVB5(JL)*ZWIN
  ENDIF
ENDDO

!     --------------------------------------------------------------

IF (LHOOK) CALL DR_HOOK('ROUSEAAD',1,ZHOOK_HANDLE)
END SUBROUTINE ROUSEAAD
