SUBROUTINE PPINITTL(KPROMA,KSTART,KPROF,KFLEV,&
 & PRPRESH,PRPRESF,PRXP,PRXPD,&
 & PRPRESH5,PRPRESF5,PRXP5)  

!**** *PPINITTL* - SET UP HELP-ARRAYS FOR VERTICAL INTERPOLATION - T.L.

!     PURPOSE.
!     --------
!           SETS UP HELP-ARRAYS FOR PRESSURE LEVEL VERTICAL INTERPOLATION.
!           MUST BE CALLED BEFORE ANY INTERPOLATION ROUTINES.

!**   INTERFACE.
!     ----------
!        *CALL* *PPINITTL(KPROMA,KSTART,KPROF,KFLEV
!                        ,PRPRESH,PRPRESF,PRXP,PRXPD
!                        ,PRPRESH5,PRPRESF5,PRXP5)*

!        EXPLICIT ARGUMENTS :   NONE.
!        --------------------
!        KPROMA - FIRST DIMENSION FOR ARRAYS                           (INPUT-C)
!        KSTART - START OF WORK                                        (INPUT-C)
!        KPROF - NUMBER OF COLOMNS FOR INTERPOLATAION                  (INPUT-C)
!        KFLEV - NUMBER OF INPUT PRESSURE LEVELS                       (INPUT-C)
!        PRPRESH(KPROMA,0:KFLEV) - INPUT HALF LEVEL PRESSURES           (INPUT)
!        PRPRESF(KPROMA,KFLEV) - INPUT FULL LEVEL PRESSURES             (INPUT)
!        PRXP(KPROMA,0:KFLEV,NPPM) - HALF,FULL AND LN HALF,FULL LEVEL P.(OUTPUT)
!        PRXPD(KPROMA,0KFLEV,NPPM) - 1./D(P) AND 1./D(LN(P))           (OUTPUT)
!        PRPRESH5(KPROMA,0:KFLEV) - INPUT HALF LEVEL PRESSURES          (INPUT-C)
!        PRPRESF5(KPROMA,KFLEV) - INPUT FULL LEVEL PRESSURES            (INPUT-C)
!        PRXP5(KPROMA,0:KFLEV,NPPM)- HALF,FULL AND LN HALF,FULL LEVEL P.(INPUT-C)

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

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

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

!     AUTHOR.
!     -------
!        MATS HAMRUD  *ECMWF*

!     MODIFICATIONS.
!     --------------
!        ORIGINAL : 89-12-05
!        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)    :: KSTART 
INTEGER(KIND=JPIM),INTENT(IN)    :: KPROF 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PRPRESH(KPROMA,0:KFLEV) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PRPRESF(KPROMA,KFLEV) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PRXP(KPROMA,0:KFLEV,NPPM) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PRXPD(KPROMA,0:KFLEV,NPPM) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PRPRESH5(KPROMA,0:KFLEV) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PRPRESF5(KPROMA,KFLEV) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PRXP5(KPROMA,0:KFLEV,NPPM) 
INTEGER(KIND=JPIM) :: JFLEV, JL, JSLCT
REAL(KIND=JPRB) :: ZHOOK_HANDLE

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

!*       1.    COMPUTE HELPVARIABLES RELATED TO INPUT GRID.
!              --------------------------------------------

!*       1.1   PRESSURE AT HALF AND FULL LEVELS/LN PRESSURE AT HALF LEVELS.

IF (LHOOK) CALL DR_HOOK('PPINITTL',0,ZHOOK_HANDLE)
DO JFLEV=1,KFLEV
  DO JL=KSTART,KPROF
    PRXP(JL,JFLEV,1)=PRPRESH(JL,JFLEV)
    PRXP(JL,JFLEV,2)=PRPRESF(JL,JFLEV)
    PRXP(JL,JFLEV,3)=1.0_JPRB/PRPRESH5(JL,JFLEV)*PRPRESH(JL,JFLEV)
    PRXP(JL,JFLEV,4)=1.0_JPRB/PRPRESF5(JL,JFLEV)*PRPRESF(JL,JFLEV)
  ENDDO
ENDDO
DO JL=KSTART,KPROF
  PRXP(JL,0,1)=PRPRESH(JL,0)
  PRXP(JL,0,2)=0.0_JPRB
  PRXP(JL,0,3)=0.0_JPRB
  PRXP(JL,0,4)=0.0_JPRB
ENDDO

!*       1.2   1/D(PRES) AND 1/D(LN(PRES))
DO JSLCT=1,NPPM
  DO JFLEV=0,KFLEV-1
    DO JL=KSTART,KPROF
      PRXPD(JL,JFLEV,JSLCT)=-1.0_JPRB/&
       & (PRXP5(JL,JFLEV+1,JSLCT)-PRXP5(JL,JFLEV,JSLCT))**2*&
       & (PRXP(JL,JFLEV+1,JSLCT)-PRXP(JL,JFLEV,JSLCT))  
    ENDDO
  ENDDO
ENDDO

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

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