SUBROUTINE GPHLUV(&
 ! --- INPUT -----------------------------------------------------------------
 & KPROMA,KSTART,KPROF,PWW0,PUT0,PVT0,&
 ! --- OUTPUT ----------------------------------------------------------------
 & PLHU0,PLHV0)

!**** *GPHLUV* - wind components calculation in half-levels

!     Purpose.
!     --------
!           Compute wind components in half-levels (PLHU0,PLHV0)

!**   Interface.
!     ----------
!        *CALL* *GPHLUV()

!        Explicit arguments :
!        --------------------
!        * INPUT:
!          KPROMA  - length of work
!          KSTART  - start of work
!          KPROF   - end of work
!          PWW0    - vertical weight
!          PUT0    - U-wind at full levels
!          PVT0    - V-wind at full levels

!        * OUTPUT:
!          PLHU0   - U-wind at half levels
!          PLHV0   - V-wind at half levels

!        Implicit arguments : none.
!        --------------------

!     Method.
!     -------
!        Interpolation from full-levels using logaritmic pressure profile
!        Then modify values on the top and bottom using boundary condition
!        (at the bottom free-slip condition)
!        Store also the weights of vertical interpolation

!     Externals.
!     ----------
!     Reference.
!     ----------
!        ARPEGE/ALADIN documentation

!     Author.
!     -------
!        Radmila Bubnova & Martin Janousek,  CNRM/GMAP/EXT

! Modifications
! -------------
!   Original : February 1996
!   10-11-97 : making more general module
!   Modified : JUNE  1998 by Danijel Cemas (Lower boundary 
!              condition for pseudo vertical divergence)
!   Modified 02-07-02 by C. Fischer : intents for dummy arrays
!   Modified 08-2002 C. Smith and K. YESSAD:
!    - make optional the vertical averaging.
!    - some cleanings and optimisations.
!   01-Oct-2003 M. Hamrud  CY28 Cleaning
!   09-Jun-2004 J. Masek   NH cleaning (LVSLWBC)
!   21-Jan-2005 K. Yessad  Remove useless dummy arguments.
!   07-Mar-2007 K. Yessad  Remove LVERAVE_HLUV.
!   N. Wedi and K. Yessad (Jan 2008): different dev for NH model and PC scheme
!   K. Yessad (Dec 2008): remove dummy CDLOCK
! End Modifications
!------------------------------------------------------------------

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

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

IMPLICIT NONE

INTEGER(KIND=JPIM),INTENT(IN)    :: KPROMA 
INTEGER(KIND=JPIM),INTENT(IN)    :: KSTART 
INTEGER(KIND=JPIM),INTENT(IN)    :: KPROF 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PWW0(KPROMA,NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PUT0(KPROMA,NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PVT0(KPROMA,NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PLHU0(KPROMA,0:NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PLHV0(KPROMA,0:NFLEVG) 

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

INTEGER(KIND=JPIM) :: JLEV

REAL(KIND=JPRB) :: ZHOOK_HANDLE

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

IF (LHOOK) CALL DR_HOOK('GPHLUV',0,ZHOOK_HANDLE)

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

!*    1. General case:

DO JLEV=1, NFLEVG - 1
  PLHU0(KSTART:KPROF,JLEV) = &
   & PWW0(KSTART:KPROF,JLEV)*PUT0(KSTART:KPROF,JLEV) &
   & +(1.0_JPRB-PWW0(KSTART:KPROF,JLEV))*PUT0(KSTART:KPROF,JLEV+1)  
  PLHV0(KSTART:KPROF,JLEV) = &
   & PWW0(KSTART:KPROF,JLEV)*PVT0(KSTART:KPROF,JLEV) &
   & +(1.0_JPRB-PWW0(KSTART:KPROF,JLEV))*PVT0(KSTART:KPROF,JLEV+1)  
ENDDO

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

!*    2. Top.

PLHU0(KSTART:KPROF,0) = PUT0(KSTART:KPROF,1)
PLHV0(KSTART:KPROF,0) = PVT0(KSTART:KPROF,1)

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

!*    3. Surface.

PLHU0(KSTART:KPROF,NFLEVG) = PUT0(KSTART:KPROF,NFLEVG)
PLHV0(KSTART:KPROF,NFLEVG) = PVT0(KSTART:KPROF,NFLEVG)

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

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