SUBROUTINE PPCLWTL(KPROMA,KSTART,KPROF,KFLEV,KLEVP,KLOLEV,KLEVB,&
 & PRPRES,LDBELO,LDBELS,LDBLOW,&
 & PRXP,PRXPD,PCLWF,&
 & PCLWPP,&
 & PRXP5,PRXPD5,PCLWF5)  

!**** *PPCLWTL * - POST-PROCESS CLOUD LIQUID WATER (TL)

!     PURPOSE.
!     --------
!        PERFORMS THE VERTICAL INTERPOLATION OF CLOUD LIQUID WATER
!     TO A GIVEN LEVEL.

!**   INTERFACE.
!     ----------
!        *CALL* *PPCLWTL(KPROMA,KSTART,KPROF,KFLEV,KLEVP,KLOLEV,KLEVB,
!                        PRPRES,LDBELO,LDBELS,LDBLOW,
!                        PRXP,PRXPD,PCLWF,
!                        PCLWPP,
!                        PRXP5,PRXPD5,PCLWF5)

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

!        KPROMA                    - HORIZONTAL DIMENSION.             (INPUT-C)
!        KSTART                    - START OF WORK.                    (INPUT-C)
!        KPROF                     - DEPTH OF WORK.                    (INPUT-C)
!        KFLEV                     - NUMBER OF INPUT PRESSURE LEVELS   (INPUT-C)
!        KLEVP                     - NUMBER OF OUTPUT PRESSURE LEVELS  (INPUT-C)
!        KLOLEV                    - BEGINING FOR THE INTERPOLATION    (INPUT-C)
!        KLEVB(KPROMA,KLEVP,NPPM)  - INPUT LEVEL BELOW PRPRES          (INPUT-C)
!                                    (SEE PPFLEV)
!        PRPRES(KPROMA,KFLEV)       - POST-PROCESS   LEVEL PRESSURES.   (INPUT-C)
!        LDBELO(KPROMA,KLEVP)      - .TRUE. IF PRESSURE IS UNDER
!                                     LOWEST (FULL) MODEL LEVEL        (INPUT-C)
!        LDBELS(KPROMA,KLEVP)      - .TRUE. IF PRESSURE IS UNDER
!                                     MODEL SURFACE                    (INPUT-C)
!        LDBLOW                    - .TRUE. IF LDBELO(J) IS CONTAINING
!                                    AT LEAST ONE .TRUE.               (INPUT-C)
!        PRXP(KPROMA,0:KFLEV,NPPM) - HALF,FULL AND LN HALF,FULL LEVEL
!                                    PRESSURES (SEE PPINIT)            (INPUT)
!        PRXPD(KPROMA,0:KFLEV,NPPM)- 1./D(P) AND 1./D(LN(P))           (INPUT)
!        PCLWF(KPROMA,0:KFLEV)     - CLOUD LW ON FULL INPUT LEVELS     (INPUT)

!        PCLWPP(KPROMA,KLEVP)      - POST-PROCESSED CLOUD LW           (OUTPUT)

!        IMPLICIT ARGUMENTS :  CONSTANTS FROM YOMCST AND YOMSTA.
!        --------------------

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

!     EXTERNALS.  PPINTP - LINEAR INTERPOLATION
!     ----------

!     REFERENCE.
!     ----------
!        ECMWF Research Department documentation of the IFS

!     AUTHOR.
!     -------
!        D. VASILJEVIC  *ECMWF*

!     MODIFICATIONS.
!     --------------
!        ORIGINAL : 93-01-12
!        M.Hamrud      01-Oct-2003 CY28 Cleaning
!     ------------------------------------------------------------------

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

USE YOMDIM   , ONLY : NPPM

IMPLICIT NONE

INTEGER(KIND=JPIM),INTENT(IN)    :: KPROMA 
INTEGER(KIND=JPIM),INTENT(IN)    :: KFLEV 
INTEGER(KIND=JPIM),INTENT(IN)    :: KLEVP 
INTEGER(KIND=JPIM),INTENT(IN)    :: KSTART 
INTEGER(KIND=JPIM),INTENT(IN)    :: KPROF 
INTEGER(KIND=JPIM),INTENT(IN)    :: KLOLEV 
INTEGER(KIND=JPIM),INTENT(IN)    :: KLEVB(KPROMA,KLEVP,NPPM) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PRPRES(KPROMA,KLEVP) 
LOGICAL           ,INTENT(IN)    :: LDBELO(KPROMA,KLEVP) 
LOGICAL           ,INTENT(IN)    :: LDBELS(KPROMA,KLEVP) 
LOGICAL           ,INTENT(IN)    :: LDBLOW(KLEVP) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PRXP(KPROMA,0:KFLEV,NPPM) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PRXPD(KPROMA,0:KFLEV,NPPM) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PCLWF(KPROMA,0:KFLEV) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PCLWPP(KPROMA,KLEVP) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PRXP5(KPROMA,0:KFLEV,NPPM) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PRXPD5(KPROMA,0:KFLEV,NPPM) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PCLWF5(KPROMA,0:KFLEV) 
INTEGER(KIND=JPIM) :: ISLCT, JL, JLEVP
REAL(KIND=JPRB) :: ZHOOK_HANDLE

#include "ppintptl.intfb.h"

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

!*       1.    POST-PROCESS CLOUD LIQUID WATER (CLW)
!              -------------------------------------

!*       1.1   PREPARE FOR EXTRAPOLATION ABOVE TOP

IF (LHOOK) CALL DR_HOOK('PPCLWTL',0,ZHOOK_HANDLE)
DO JL=KSTART,KPROF
  PCLWF5(JL,0)=PCLWF5(JL,1)
  PCLWF(JL,0)=PCLWF(JL,1)
ENDDO

!*       1.2   INTERPOLATE CLW

ISLCT=2
CALL PPINTPTL(KPROMA,KSTART,KPROF,KFLEV,KLEVP,KLOLEV,&
 & KLEVB,ISLCT,&
 & LDBELO,LDBLOW,PRPRES,PRXP,PRXPD,&
 & PCLWF,PCLWPP,&
 & PRXP5,PRXPD5,PCLWF5)  

!*       1.3   INTERPOLATE BETWEEN LOWEST LEVEL AND SURFACE.

DO JLEVP=KLOLEV,KLEVP
  IF (LDBLOW(JLEVP)) THEN
    DO JL=KSTART,KPROF
      IF(LDBELO(JL,JLEVP).AND..NOT.LDBELS(JL,JLEVP) ) THEN
        PCLWPP(JL,JLEVP)=PCLWF(JL,KFLEV)
      ENDIF
    ENDDO
  ENDIF
ENDDO

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

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

