!OCL NOEVAL
SUBROUTINE SURCORDI

!**** *SURCORDI*   - Computation of RCORDIT, RCORDIH, RCORDIF

!     Purpose.
!     --------

!**   Interface.
!     ----------
!        *CALL* *SURCORDI

!        Explicit arguments :
!        --------------------

!        Implicit arguments :
!        --------------------

!     Method.
!     -------
!        See documentation

!     Externals.
!     ----------

!     Reference.
!     ----------
!        ARPEGE/ALADIN DOCUMENTATION

!     Author.
!     -------
!        K. Yessad (CNRM/GMAP) after the old part 2.5 of SUHDF
!         (written by M. Hortal).

!     Modifications.
!     --------------
!        Original : August 2005
!     ------------------------------------------------------------------

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

USE YOMCT0   , ONLY : NPRINTLEV
USE YOMLUN   , ONLY : NULOUT
USE YOMDIM   , ONLY : NFLEVG
USE YOMGEM   , ONLY : VBH      ,VAH      ,VP00
USE YOMDYN   , ONLY : RCORDIT  ,RCORDIH  ,RCORDIF
USE YOMSTA   , ONLY : RTSUR    ,RTTROP   ,RDTDZ1
USE YOMCST   , ONLY : RG       ,RD

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

IMPLICIT NONE

INTEGER(KIND=JPIM) :: JLEV

REAL(KIND=JPRB) :: ZALPHA, ZPB, ZPBH, ZTB, ZTBH, ZZL  

REAL(KIND=JPRB) :: ZHOOK_HANDLE

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

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

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

!*       1.    Computation of RCORDIT, RCORDIH, RCORDIF:

! * Remark: this piece of code is fully consistent with
!   lvertfe=F, ndlnpr=0, laprxpk=T
!   where prehyd(l)=0.5*prehyd(lbar-1)+0.5*prehyd(lbar)
!   and not completely consistent with the other cases
!   for lvertfe,ndlnpr,laprxpk.

IF (NFLEVG > 1) THEN
  ZALPHA=-RDTDZ1*RD/RG
  RCORDIH(0)=0._JPRB
  DO JLEV=1,NFLEVG
    ZPB=0.5_JPRB*(VAH(JLEV)+VAH(JLEV-1)+(VBH(JLEV)+VBH(JLEV-1))*VP00)
    ZPBH=VAH(JLEV)+VBH(JLEV)*VP00
    ZTB=RTSUR*(ZPB/VP00)**ZALPHA
    ZTBH=RTSUR*(ZPBH/VP00)**ZALPHA
    RCORDIF(JLEV)=0.5_JPRB*(VBH(JLEV)+VBH(JLEV-1))*ZALPHA*ZTB*VP00/ZPB
    RCORDIH(JLEV)=VBH(JLEV)*ZALPHA*ZTBH*VP00/ZPBH
    IF (ZTB > RTTROP) THEN
      ZZL=0.5_JPRB*(VBH(JLEV)+VBH(JLEV-1))*ZALPHA*ZTB*VP00/ZPB
    ELSE
      ZZL=0._JPRB
    ENDIF
    RCORDIT(JLEV)=ZZL
  ENDDO
ELSE
  RCORDIT(1)=1._JPRB
ENDIF

! * Printings:
                                                                                
IF (NPRINTLEV > 0) THEN
  WRITE(NULOUT,'(A)')
  WRITE(NULOUT,'(A)') ' --- SURCORDI:'
  WRITE(NULOUT,'(A)') ' RCORDIT:'
  WRITE(NULOUT,'(4(1X,E19.13))') (RCORDIT(JLEV), JLEV=1,NFLEVG)
  IF (NFLEVG > 1) THEN
    WRITE(NULOUT,'(A)') ' RCORDIH:'
    WRITE(NULOUT,'(4(1X,E19.13))') (RCORDIH(JLEV), JLEV=0,NFLEVG)
    WRITE(NULOUT,'(A)') ' RCORDIF:'
    WRITE(NULOUT,'(4(1X,E19.13))') (RCORDIF(JLEV), JLEV=1,NFLEVG)
  ENDIF
  CALL FLUSH(NULOUT)
ENDIF

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

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