#ifdef RS6K
@PROCESS NOCHECK
#endif
SUBROUTINE CPG_GP_TL( &
 !---------------------------------------------------------------------
 ! - INPUT .
 & KST,KEND,KSTC,KENDC,KSTGLO,LDLFSTEP,LDLADNMI,PTE,PGM, &
 & PGFL, &
 !---------------------------------------------------------------------
 ! - INPUT/OUTPUT .
 & PGMV,PGMVS, &
 !---------------------------------------------------------------------
 ! - OUTPUT .
 & PRE0,PRE0L,PRE0M,PRE0F,PDELP0,PRDELP0,PLNPR0,PALPH0, &
 !NYC-NH & PLHU0,PLHV0, &
 & PHI0,PHIF0,PCP0,PR0,PRTGR0,PKAP0, &
 !NYC-NH & PRRED0, &
 & PEVEL0,PVVEL0,PSDVBC0,PKENE0, &
 & PSGRTL,PSGRTM,PGPHL,PGPHM, &
 & PSDIV0,PDIVP0,PRT0L,PRT0M,&
 !NYC-NH & PWW0, &
 & PRE9,PRE9F,PDELP9,PRDELP9,PLNPR9,PALPH9,PHI9,PHIF9,PCP9,PR9, &
 & PGPPC,PB2, &
 & PGMVT1,PGMVT1S,PGFLT1, &
 !---------------------------------------------------------------------
 ! - TRAJECTORY (INPUT) .
 & PGFL5,PGMV5,PGMV5S, &
 & PRE5,PRE5L,PRE5M,PRE5F,PDELP5,PRDELP5,PLNPR5,PALPH5,PCP5,PR5,PRTGR5,&
 !NYC-NH & PRRED5, &
 & PVVEL5,PSDIV5,PRT5,PRT5L,PRT5M,&
 !NYC-NH & PWW5, &
 & PRPRE5,PRPREF5,PRPP5, &
 !NYC-NH & PGPPC5,&
 !NYC-NH & PQCHA5L,PQCHA5M, &
 & PALPH5L,PALPH5M,PALPHPL5L,PALPHPL5M,PLNPR5L,PLNPR5M, &
 & PRNHPPI5,PHI5FL,PHI5FM, &
 & PCOEFD5,PCOEFA5,PCOEFAPL5, &
 !NYC-NH & PNH15L,PNH15M, &
 !NYC-NH & PUT95,PVT95, &
 & PTT95,PRE95,PRE95F,PDELP95,PRDELP95,PLNPR95,PALPH95,PR95, &
 & PRPRE95,PRPP95 &
 !NYC-NH & PRRED95 &
 & )

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

USE YOMDIM   , ONLY : NFLEVG   ,NPROMA   ,NPROMNH  ,NFGPPC
USE YOMDIMT  , ONLY : NPROMT
USE YOMCT0   , ONLY : LNHDYN   ,LTWOTL   ,LSPRT    ,LPC_OLD  ,LPC_FULL
USE YOMCST   , ONLY : RD       ,RV
USE YOMDYN   , ONLY : NCURRENT_ITER  
USE YOMGEM   , ONLY : VBH      ,VC       ,VDELB    ,RSTRET  
USE YOMCVER  , ONLY : LVERTFE
USE YOMSC2   , ONLY : NFLDSLB2
USE YOMGPPCB , ONLY : GPPCBUF
USE YOMSIMPHL, ONLY : LSIMPH
USE YOM_YGFL , ONLY : YGFL ,YQ
USE YOMGMV   , ONLY : NDIMGMV,NDIMGMVS,YT0,YT9,YT5,YT1
USE PTRSLB2  , ONLY : MSLB2VVEL
!NYC-NH USE PTRGPPC  , ONLY : MGPPCO_WW,MGPPCO_WW5

!**** *CPG_GP_TL* - Tan. lin. grid point calculations.
!                   initial part of not lagged grid-point calculations.

!     Purpose.
!     --------
!           Tan. lin. grid point calculations.
!           initial part of not lagged grid-point calculations.
!           - get data in buffers.
!           - multiply p-order horizontal derivatives by M**p.
!           - second part of the temporal filter.
!           - calls some GP... routines to initialise some auxiliary variables.
!           - sets-up and PB2.

!           Remark: the way of coding is the most consistent as possible
!           with the way of coding of CPG_GP. Some items present in CPG_GP
!           and not coded in CPG_GP_TL are mentioned by comments.

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

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

!     INPUT:
!     ------
!        KST       : first element of work.
!        KEND      : last element of work.
!        KSTC,KENDC: the same as KST,KEND but including zone C for ALADIN.
!        KSTGLO    : global offset.
!        LDLFSTEP  : .T.: first time-step (T if NSTEP < or = NSTART-NITNMI)
!        LDLADNMI  : .T. if adiabatic NNMI iteration.
!        PTE       : 1. or 0. according to different configurations.
!        PGM       : mapping factor.
!        PGFL      : unified_treatment grid-point fields at t

!     INPUT/OUTPUT:
!     -------------
!        PGMV      : upper air GMV variables at time t and t-dt.
!        PGMVS     : surface GMV variables at time t and t-dt.

!     OUTPUT:
!     -------
!        PRE0      : hydrostatic pressure "prehyd" on interlayers at time t.
!        PRE0L     : zonal component of "rssavnabla prehyds" at t.
!        PRE0M     : meridian component of "rssavnabla prehyds" at t.
!        PRE0F     : hydrostatic pressure "prehyd" on layers at time t.
!        PDELP0    : hydrostatic pressure depth of layers at t.
!        PRDELP0   : 1/(hydrostatic pressure depth of layers) at t.
!        PLNPR0    : "delta" on layers at time t.
!        PALPH0    : "alpha" on layers at time t.
!        PLHU0     : zonal wind time t on interlayers. (NYC-NH)
!        PLHV0     : meridian wind time t on interlayers. (NYC-NH)
!        PHI0      : geopotential height "gz" at t on interlayers.
!        PHIF0     : geopotential height "gz" at t on layers.
!        PCP0      : "cp" at t.
!        PR0       : air constant "R" at t.
!        PRTGR0    : scalar ratio of vectors "(rssavnabla prehyd)/prehyd" at t.
!        PKAP0     : "kappa = R/cp" at t.
!        PRRED0    : reduced gas constant by (1.+Prond) in NH at t (NYC-NH).
!        PEVEL0    : "etadot d prehyd / d eta" at t.
!                    On interlayers (resp. layers) if LVERTFE=F (resp. T).
!        PVVEL0    : "omega/prehyd" on layers at t.
!        PSDVBC0   : vertical integral of divergence computed in "gpcty",
!                    including the "lrubc" and "delta m=1" contributions
!                    of "etadot d prehyd / d eta".
!        PKENE0    : kinetic energy at t.
!        PSGRTL    : semi-reduced zonal component of the pressure force grad.
!        PSGRTM    : semi-reduced merid. component of the pressure force grad.
!        PGPHL     : semi-reduced zonal component of "gz" gradient
!                    on interlayers.
!        PGPHM     : semi-reduced meridian component of "gz" gradient
!                    on interlayers.
!        PSDIV0    : vertical integral of divergence without
!                   "lrubc" and "delta m=1" contributions.
!        PDIVP0    : "rssavnabla( (rs/a) * vec(V) * (Delta prehyd) )" on layers
!        PRT0L     : zonal component of "rssavnabla RT" on layers.
!        PRT0M     : meridian component of "rssavnabla RT" on layers.
!        PWW0      : weights to compute (U,V) on interlayers. (NYC-NH)
!        PRE9      : hydrostatic pressure "prehyd" on interlayers at t-dt.
!        PRE9F     : hydrostatic pressure "prehyd" on layers at time t-dt.
!        PDELP9    : hydrostatic pressure depth of layers at t-dt.
!        PRDELP9   : 1/(hydrostatic pressure depth of layers) at t-dt.
!        PLNPR9    : "delta" on layers at time t-dt.
!        PALPH9    : "alpha" on layers at time t-dt.
!        PHI9      : geopotential height "gz" at t-dt on interlayers.
!        PHIF9     : geopotential height "gz" at t-dt on layers.
!        PCP9      : "cp" at t-dt.
!        PR9       : air constant "R" at t-dt.
!        PGPPC     : buffer containing some fields used in the PC schemes.
!        PB2       : "SLB2" buffer.
!        PGMVT1    : upper air GMV variables at t+dt.
!        PGMVT1S   : surface GMV variables at t+dt.
!        PGFLT1    : GFL variables at t+dt.

!     TRAJECTORY (INPUT):
!     -------------------
!        PGFL5     : unified_treatment grid-point fields at t.
!        PGMV5     : upper air GMV variables at time t and t-dt.
!        PGMV5S    : surface GMV variables at time t and t-dt.
!        PRE5      : hydrostatic pressure "prehyd" on interlayers at time t.
!        PRE5L     : zonal component of "rssavnabla prehyds" at t.
!        PRE5M     : meridian component of "rssavnabla prehyds" at t.
!        PRE5F     : hydrostatic pressure "prehyd" on layers at time t.
!        PDELP5    : hydrostatic pressure depth of layers at t.
!        PRDELP5   : 1/(hydrostatic pressure depth of layers) at t.
!        PLNPR5    : "delta" on layers at time t.
!        PALPH5    : "alpha" on layers at time t.
!        PCP5      : "cp" at t.
!        PR5       : air constant "R" at t.
!        PRTGR5    : scalar ratio of vectors "(rssavnabla prehyd)/prehyd" at t.
!        PRRED5    : reduced gas constant by (1.+Prond) in NH at t. (NYC-NH)
!        PVVEL5    : "omega/prehyd" on layers at t.
!        PSDIV5    : vertical integral of divergence without
!                   "lrubc" and "delta m=1" contributions.
!        PRT5      : RT on layers at t.
!        PRT5L     : zonal component of "rssavnabla RT" on layers at t.
!        PRT5M     : meridian component of "rssavnabla RT" on layers at t.
!        PWW5      : weights to compute (U,V) on interlayers. (NYC-NH)
!        PRPRE5    : 1/PRE5.
!        PRPREF5   : 1/PRE5F.
!        PRPP5     : 1/(PRE5(lbar-1)*PRE5(lbar)).
!        PGPPC5    : buffer containing some fields used only in the PC schemes. (NYC-NH)
!        PQCHA5L   : zonal comp grad(log(pre/prehyd)). (NYC-NH)
!        PQCHA5M   : merid comp grad(log(pre/prehyd)). (NYC-NH)
!        PALPH5L   : cf. PALPHL in GPGRXYB (time t).
!        PALPH5M   : cf. PALPHM in GPGRXYB (time t).
!        PALPHPL5L : cf. PALPHPLL in GPGRXYB (time t)
!        PALPHPL5M : cf. PALPHPLM in GPGRXYB (time t)
!        PLNPR5L   : cf. PLNPRL in GPGRXYB (time t).
!        PLNPR5M   : cf. PLNPRM in GPGRXYB (time t).
!        PRNHPPI5  : "prehyd/pre" on layers (time t).
!        PHI5FL    : zonal comp grad(gz) on layers
!        PHI5FM    : merid comp grad(gz) on layers
!        PCOEFD5   : coefficient to compute (PLNPR5L,PLNPR5M)
!        PCOEFA5   : coefficient to compute (PALPH5L,PALPH5M)
!        PCOEFAPL5 : coefficient to compute (PALPHPL5L,PALPHPL5M)
!        PNH15L    : zonal comp of RT grad(log(prehyd/pre)) at full layers (NYC-NH)
!        PNH15M    : merid comp of RT grad(log(prehyd/pre)) at full layers (NYC-NH)
!        PUT95     : U-wind at time t-dt on layers. (NYC-NH)
!        PVT95     : V-wind at time t-dt on layers. (NYC-NH)
!        PTT95     : temperature at time t-dt on layers.
!        PRE95     : hydrostatic pressure "prehyd" on interlayers at t-dt.
!        PRE95F    : hydrostatic pressure "prehyd" on layers at time t-dt.
!        PDELP95   : hydrostatic pressure depth of layers at t-dt.
!        PRDELP95  : 1/(hydrostatic pressure depth of layers) at t-dt.
!        PLNPR95   : "delta" on layers at time t-dt.
!        PALPH95   : "alpha" on layers at time t-dt.
!        PR95      : air constant "R" at t-dt.
!        PRPRE95   : 1/PRE95.
!        PRPP95    : 1/(PRE95(lbar-1)*PRE95(lbar)).
!        PRRED95   : reduced gas constant by (1.+Prond) in NH at t-dt. (NYC-NH)

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

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

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

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

!     Author.
!     -------
!        K. Yessad, after CPGTL (old part 4 of CPGTL)

! Modifications
! -------------
!   Original     : 12 Jul 2004.
!   02-Dec-2004 : Y. Seity, add 3 dummy arguments to call GPRCPTL  
!   M.Hamrud      15-Jan-2006  Revised GPRCP
!   K.Yessad         Mar-2006 Update according to CPG_GP (new GPGRPTL).
!   S. Ivatek-S   17-Apr-2007 Over dimensioning of PGPNH and PGPNH5 to
!                NFGPNH+1, boundary checking problem if NFGPNH=0 bf
!   N. Wedi and K. Yessad (Jan 2008): different dev for NH model and PC scheme
!   K. Yessad (Dec 2008): remove dummy CDLOCK + cleanings
! End Modifications
!------------------------------------------------------------------------------

IMPLICIT NONE

INTEGER(KIND=JPIM),INTENT(IN)    :: KST 
INTEGER(KIND=JPIM),INTENT(IN)    :: KEND 
INTEGER(KIND=JPIM),INTENT(IN)    :: KSTC 
INTEGER(KIND=JPIM),INTENT(IN)    :: KENDC 
INTEGER(KIND=JPIM),INTENT(IN)    :: KSTGLO 
LOGICAL           ,INTENT(IN)    :: LDLFSTEP 
LOGICAL           ,INTENT(IN)    :: LDLADNMI 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PTE 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PGM(NPROMA) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PGFL(NPROMA,NFLEVG,YGFL%NDIM) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PGMV(NPROMA,NFLEVG,NDIMGMV) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PGMVS(NPROMA,NDIMGMVS) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PRE0(NPROMA,0:NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PRE0L(NPROMA) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PRE0M(NPROMA) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PRE0F(NPROMA,NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PDELP0(NPROMA,0:NFLEVG+1) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PRDELP0(NPROMA,NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PLNPR0(NPROMA,NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PALPH0(NPROMA,NFLEVG) 
!NYC-NH REAL(KIND=JPRB)   ,INTENT(OUT)   :: PLHU0(NPROMNH,0:NFLEVG) 
!NYC-NH REAL(KIND=JPRB)   ,INTENT(OUT)   :: PLHV0(NPROMNH,0:NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PHI0(NPROMA,0:NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PHIF0(NPROMA,NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PCP0(NPROMA,NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PR0(NPROMA,NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PRTGR0(NPROMA,NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PKAP0(NPROMA,NFLEVG) 
!NYC-NH REAL(KIND=JPRB)   ,INTENT(OUT)   :: PRRED0(NPROMNH,NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PEVEL0(NPROMA,0:NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PVVEL0(NPROMA,NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PSDVBC0(NPROMA,0:NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(INOUT) :: PKENE0(NPROMA,NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PSGRTL(NPROMA,NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PSGRTM(NPROMA,NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PGPHL(NPROMA,0:NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PGPHM(NPROMA,0:NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PSDIV0(NPROMA,0:NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PDIVP0(NPROMA,NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PRT0L(NPROMA,NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PRT0M(NPROMA,NFLEVG) 
!NYC-NH REAL(KIND=JPRB)   ,INTENT(OUT)   :: PWW0(NPROMNH,NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PRE9(NPROMA,0:NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PRE9F(NPROMA,NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PDELP9(NPROMA,0:NFLEVG+1) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PRDELP9(NPROMA,NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PLNPR9(NPROMA,NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PALPH9(NPROMA,NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PHI9(NPROMA,0:NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PHIF9(NPROMA,NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PCP9(NPROMA,NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PR9(NPROMA,NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PGPPC(NPROMA,NFGPPC+1) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PB2(NPROMA,NFLDSLB2) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PGMVT1(NPROMA,NFLEVG,YT1%NDIM) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PGMVT1S(NPROMA,YT1%NDIMS) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PGFLT1(NPROMA,NFLEVG,YGFL%NDIM1) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PGFL5(NPROMA,NFLEVG,YGFL%NDIM5)
REAL(KIND=JPRB)   ,INTENT(IN)    :: PGMV5(NPROMA,NFLEVG,YT5%NDIM)
REAL(KIND=JPRB)   ,INTENT(IN)    :: PGMV5S(NPROMA,YT5%NDIMS)
REAL(KIND=JPRB)   ,INTENT(IN)    :: PRE5(NPROMA,0:NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PRE5L(NPROMA) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PRE5M(NPROMA) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PRE5F(NPROMA,NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PDELP5(NPROMA,0:NFLEVG+1) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PRDELP5(NPROMA,NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PLNPR5(NPROMA,NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PALPH5(NPROMA,NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PCP5(NPROMA,NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PR5(NPROMA,NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PRTGR5(NPROMA,NFLEVG) 
!NYC-NH REAL(KIND=JPRB)   ,INTENT(IN)    :: PRRED5(NPROMNH,NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PVVEL5(NPROMA,NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PSDIV5(NPROMA,0:NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PRT5(NPROMA,NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PRT5L(NPROMA,NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PRT5M(NPROMA,NFLEVG) 
!NYC-NH REAL(KIND=JPRB)   ,INTENT(IN)    :: PWW5(NPROMNH,NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PRPRE5(NPROMA,NFLEVG)
REAL(KIND=JPRB)   ,INTENT(IN)    :: PRPREF5(NPROMA,NFLEVG)
REAL(KIND=JPRB)   ,INTENT(IN)    :: PRPP5(NPROMA,NFLEVG)
!NYC-NH REAL(KIND=JPRB)   ,INTENT(IN)    :: PGPPC5(NPROMA,NFGPPC+1) 
!NYC-NH REAL(KIND=JPRB)   ,INTENT(IN)    :: PQCHA5L(NPROMNH,NFLEVG)
!NYC-NH REAL(KIND=JPRB)   ,INTENT(IN)    :: PQCHA5M(NPROMNH,NFLEVG)
REAL(KIND=JPRB)   ,INTENT(IN)    :: PALPH5L(NPROMA,NFLEVG)
REAL(KIND=JPRB)   ,INTENT(IN)    :: PALPH5M(NPROMA,NFLEVG)
REAL(KIND=JPRB)   ,INTENT(IN)    :: PALPHPL5L(NPROMA,NFLEVG)
REAL(KIND=JPRB)   ,INTENT(IN)    :: PALPHPL5M(NPROMA,NFLEVG)
REAL(KIND=JPRB)   ,INTENT(IN)    :: PLNPR5L(NPROMA,NFLEVG)
REAL(KIND=JPRB)   ,INTENT(IN)    :: PLNPR5M(NPROMA,NFLEVG)
REAL(KIND=JPRB)   ,INTENT(IN)    :: PRNHPPI5(NPROMA,NFLEVG)
REAL(KIND=JPRB)   ,INTENT(IN)    :: PHI5FL(NPROMA,NFLEVG)
REAL(KIND=JPRB)   ,INTENT(IN)    :: PHI5FM(NPROMA,NFLEVG)
REAL(KIND=JPRB)   ,INTENT(IN)    :: PCOEFD5(NPROMA,NFLEVG)
REAL(KIND=JPRB)   ,INTENT(IN)    :: PCOEFA5(NPROMA,NFLEVG)
REAL(KIND=JPRB)   ,INTENT(IN)    :: PCOEFAPL5(NPROMA,NFLEVG)
!NYC-NH REAL(KIND=JPRB)   ,INTENT(IN)    :: PNH15L(NPROMA,NFLEVG)
!NYC-NH REAL(KIND=JPRB)   ,INTENT(IN)    :: PNH15M(NPROMA,NFLEVG)
!NYC-NH REAL(KIND=JPRB)   ,INTENT(IN)    :: PUT95(NPROMT,NFLEVG)
!NYC-NH REAL(KIND=JPRB)   ,INTENT(IN)    :: PVT95(NPROMT,NFLEVG)
REAL(KIND=JPRB)   ,INTENT(IN)    :: PTT95(NPROMT,NFLEVG)
REAL(KIND=JPRB)   ,INTENT(IN)    :: PRE95(NPROMT,0:NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PRE95F(NPROMT,NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PDELP95(NPROMT,0:NFLEVG+1) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PRDELP95(NPROMT,NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PLNPR95(NPROMT,NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PALPH95(NPROMT,NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PR95(NPROMA,NFLEVG) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PRPRE95(NPROMT,NFLEVG)
REAL(KIND=JPRB)   ,INTENT(IN)    :: PRPP95(NPROMT,NFLEVG)
!NYC-NH REAL(KIND=JPRB)   ,INTENT(IN)    :: PRRED95(NPROMNH,NFLEVG) 

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

REAL(KIND=JPRB) :: ZRT0(NPROMA,NFLEVG)
REAL(KIND=JPRB) :: ZRPRE0(NPROMA,NFLEVG)
REAL(KIND=JPRB) :: ZRPRE0F(NPROMA,NFLEVG)
REAL(KIND=JPRB) :: ZRPP0(NPROMA,NFLEVG)
REAL(KIND=JPRB) :: ZRTGR9(NPROMA,NFLEVG)
REAL(KIND=JPRB) :: ZRPRE9(NPROMA,NFLEVG)
REAL(KIND=JPRB) :: ZRPP9(NPROMA,NFLEVG)
!NYC-NH REAL(KIND=JPRB) :: ZRRED9(NPROMNH,NFLEVG)
REAL(KIND=JPRB) :: ZDUM(NPROMA,NFLEVG)
!NYC-NH REAL(KIND=JPRB) :: ZLHU9(NPROMNH,0:NFLEVG) 
!NYC-NH REAL(KIND=JPRB) :: ZLHV9(NPROMNH,0:NFLEVG) 

!NYC-NH REAL(KIND=JPRB) :: ZRNHPPI0(NPROMNH,NFLEVG)
REAL(KIND=JPRB) :: ZLNPR0L(NPROMA,NFLEVG)
REAL(KIND=JPRB) :: ZLNPR0M(NPROMA,NFLEVG)
REAL(KIND=JPRB) :: ZALPH0L(NPROMA,NFLEVG)
REAL(KIND=JPRB) :: ZALPH0M(NPROMA,NFLEVG)
REAL(KIND=JPRB) :: ZALPHPL0L(NPROMA,NFLEVG)
REAL(KIND=JPRB) :: ZALPHPL0M(NPROMA,NFLEVG)

!NYC-NH REAL(KIND=JPRB) :: ZSGRTSL(NPROMNH)
!NYC-NH REAL(KIND=JPRB) :: ZSGRTSM(NPROMNH)
!NYC-NH REAL(KIND=JPRB) :: ZUS0(NPROMA)
!NYC-NH REAL(KIND=JPRB) :: ZVS0(NPROMA)
!NYC-NH REAL(KIND=JPRB) :: ZUS0_L(NPROMNH)
!NYC-NH REAL(KIND=JPRB) :: ZVS0_L(NPROMNH)
!NYC-NH REAL(KIND=JPRB) :: ZUS0_M(NPROMNH)
!NYC-NH REAL(KIND=JPRB) :: ZVS0_M(NPROMNH)
!NYC-NH REAL(KIND=JPRB) :: ZUS9(NPROMA)
!NYC-NH REAL(KIND=JPRB) :: ZVS9(NPROMA)

!NYC-NH REAL(KIND=JPRB) :: Z_PQCHA0L(NPROMNH,NFLEVG)
!NYC-NH REAL(KIND=JPRB) :: Z_PQCHA0M(NPROMNH,NFLEVG)
REAL(KIND=JPRB) :: Z_PHI0FL(NPROMA,NFLEVG)
REAL(KIND=JPRB) :: Z_PHI0FM(NPROMA,NFLEVG)

INTEGER(KIND=JPIM) :: JLEV, JROF, ILVVEL, IFLAG
!NYC-VC INTEGER(KIND=JPIM) :: IPROMVC

LOGICAL :: LLSTR
LOGICAL :: LLVERCOR
REAL(KIND=JPRB) :: ZEPS
REAL(KIND=JPRB) :: ZHOOK_HANDLE

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

#include "gpctytl.intfb.h"
#include "gpgeotl.intfb.h"
#include "gpgrgeotl.intfb.h"
#include "gpgrptl.intfb.h"
#include "gpgrxybtl.intfb.h"
!NYC-NH #include "gphluvtl.intfb.h"
!NYC-NH #include "gphlwitl.intfb.h"
#include "gpinislb.intfb.h"
#include "gpmpfc.intfb.h"
#include "gpmpfc_gmvs.intfb.h"
#include "gppreftl.intfb.h"
#include "gpprehtl.intfb.h"
#include "gprcptl.intfb.h"
#include "gprttl.intfb.h"
#include "gp_spvtl.intfb.h"
#include "gptf2.intfb.h"
!NYC-NH #include "gpuvs.intfb.h"
#include "gpxybtl.intfb.h"
#include "sc2rdg.intfb.h"

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

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

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

!*       0.    PRELIMINARY INITIALISATIONS.
!              ----------------------------

ZEPS=100.0_JPRB*TINY(1.0_JPRB)
LLSTR=(ABS(RSTRET-1.0_JPRB)>ZEPS)
LLVERCOR=.FALSE.
!NYC-VC IPROMVC=1

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

!*       1.    INTERFACE TO GLOBAL ARRAYS/WORK FILES.
!*             (PREDICTOR, CORRECTOR OF LPC_FULL)
!              --------------------------------------

PGPPC(:,:)=0.0_JPRB

!*       1.1  TENDENCY COUPLING FOR SURFACE PRESSURE.

! Not coded in the TL code (CALL GPTENCTL).

!*       1.3  SPONGE AT THE TOP OF THE MODEL (ACADEMIC SIMULATIONS).

! Not coded in the TL code (CALL GPSPNGTL).

!*       1.4  PART 2 OF TIME FILTER.

IF(NCURRENT_ITER == 0) THEN
  CALL GPTF2(&
   ! --- INPUT ---------------------------------------------------------
   & KST,KEND,LDLFSTEP,&
   ! --- INPUT for P.T0.; INPUT/OUTPUT for P.T9. -----------------------
   & PGMV,PGMVS,PGFL)
ENDIF

!*       1.5  MAP FACTOR AND SURFACE PRESSURE VARIABLES.

! * Geographical derivatives of orography (or semi-reduced ones if
!   deep layer equations): calculation has already
!   been done in CPG5_GP, so no need to do it here (contrary to
!   what is done in CPG_GP).

IF(LLSTR) THEN

  IFLAG=0

  CALL GPMPFC(&
   ! --- INPUT ---------------------------------------------------------
   & KST,KEND,IFLAG,PGM,&
   ! --- INPUT/OUTPUT --------------------------------------------------
   & PGMV(1,1,YT0%MU),PGMV(1,1,YT0%MV),PGMV(1,1,YT0%MDIV),&
   & PGMV(1,1,YT0%MTL),PGMV(1,1,YT0%MTM),&
   & PGMV(1,1,YT0%MSPDL),PGMV(1,1,YT0%MSPDM),&
   & PGMV(1,1,YT0%MSVDL),PGMV(1,1,YT0%MSVDM),ZDUM,ZDUM,&
   & PGMV(1,1,YT9%MU)   ,PGMV(1,1,YT9%MV)   ,PGMV(1,1,YT9%MDIV),&
   & PGMV(1,1,YT9%MTL)  ,PGMV(1,1,YT9%MTM)  ,PGMV(1,1,YT9%MSPDL),&
   & PGMV(1,1,YT9%MSPDM),PGMV(1,1,YT9%MSVDL),PGMV(1,1,YT9%MSVDM),&
   & PGMV(1,1,YT0%MUL),PGMV(1,1,YT0%MVL),PGMV(1,1,YT0%MVOR),&
   & PGMV(1,1,YT9%MUL),PGMV(1,1,YT9%MVL),PGMV(1,1,YT9%MVOR),&
   & PGFL)

  CALL GPMPFC_GMVS(&
   ! --- INPUT ---------------------------------------------------------
   & KST,KEND,IFLAG,PGM,&
   ! --- INPUT/OUTPUT --------------------------------------------------
   & PGMVS(1,YT0%MSPL),PGMVS(1,YT0%MSPM),&
   & PGMVS(1,YT9%MSPL),PGMVS(1,YT9%MSPM))

ENDIF

CALL GP_SPVTL(LDLADNMI,KST,KEND,&
 & PGMVS(1,YT0%MSP),PGMVS(1,YT0%MSPL),PGMVS(1,YT0%MSPM),PGMVS(1,YT9%MSP),&
 & PRE0,PRE0L,PRE0M,PRE9,&
 & PGMV5S(1,YT5%MSPL),PGMV5S(1,YT5%MSPM),PRE5,PRE95)

!*       1.6  GET SURFACE VARIABLES.

! Not coded in the TL code 

!*       1.7  SEMI-LAGRANGIAN MASS FIX.

! Not coded in the TL code.

!*       1.8  OZONE PHYSICO-CHEMICAL PROPERTIES AND SUBGRID SURFACE TEMPERATURE

! Not coded in the TL code (CALL GPINOZSTDMTL).

!*       1.9  NUDGING.

! Not coded in the TL code (CALL UPDSSTTL).

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

!*       2.    INTERFACE TO GLOBAL ARRAYS/WORK FILES (CORRECTOR OF LPC_OLD).
!              -------------------------------------------------------------

!*       2.1  NHS ITERATION: BUFFER.

IF (NCURRENT_ITER > 0 .AND. LPC_OLD) THEN
  ! * get PGPPC:
  CALL SC2RDG(GPPCBUF,KSTGLO,KSTC,KENDC,PGPPC(1:NPROMA,1:NFGPPC))
ENDIF

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

!*       3.    INITIALISE AUXILIARY VARIABLES.
!*             (PREDICTOR, CORRECTOR OF LPC_FULL)
!              -------------------------------

!*       3.1   TIME t0 CALCULATIONS.

!*       3.1.1 COMPUTE HALF-LAYER HYDROSTATIC PRESSURE.

CALL GPPREHTL(NPROMA,KST,KEND,NFLEVG,VBH,PRE0)

!*       3.1.2 COMPUTE AUXILIARY ARRAYS RELATED TO THE VERTICAL
!              AND FULL-LAYER HYDROSTATIC PRESSURE.

CALL GPXYBTL(NPROMA,KST,KEND,NFLEVG,VDELB,VC,&
 & PRE0,PDELP0(1,1),PRDELP0,PLNPR0,PALPH0,PRTGR0,&
 & ZRPRE0,ZRPP0,&
 & PRE5,PDELP5(1,1),PRDELP5,PLNPR5,PRPRE5,PRPP5)
CALL GPPREFTL(NPROMA,KST,KEND,NFLEVG,PALPH0,PRE0,PRE0F,&
 & PALPH5,PRE5)

IF ((NCURRENT_ITER == 0).OR.(NCURRENT_ITER > 0 .AND. LPC_FULL)) THEN

  ! * Case of finite elements:
  IF(LVERTFE) THEN
    DO JLEV=1,NFLEVG
      DO JROF=KST,KEND
        ZRPRE0F(JROF,JLEV)=-PRE0F(JROF,JLEV)*PRPREF5(JROF,JLEV)**2
      ENDDO
    ENDDO
  ENDIF

  CALL GPGRXYBTL(NPROMA,KST,KEND,NFLEVG,VC,VBH,&
   & PRE0L,PRE0M,PRDELP0,ZRPRE0,ZRPP0,PLNPR0,PALPH0,PRTGR0,&
   & ZLNPR0L,ZLNPR0M,ZALPH0L,ZALPH0M,ZALPHPL0L,ZALPHPL0M,&
   & PCOEFD5,PCOEFAPL5,PCOEFA5, &
   & PRE5L,PRE5M,PRDELP5,PRPP5,PLNPR5,PALPH5,PRTGR5)

!*       3.1.3 COMPUTE "R", "cp" AND "kappa".

  CALL GPRCPTL(NPROMA,KST,KEND,NFLEVG,&
   & PQ=PGFL(1,1,YQ%MP),PCP=PCP0,PR=PR0,PKAP=PKAP0,PCP5=PCP5,PR5=PR5)

!*       3.1.4 COMPUTES "RT" AND ITS GRADIENT.

  CALL GPRTTL(LSPRT,NPROMA,KST,KEND,NFLEVG,RD,RV,&
   & PR5,PGMV5(1,1,YT5%MT),PGMV5(1,1,YT5%MTL),PGMV5(1,1,YT5%MTM),&
   & PGFL5(1,1,YQ%MP5L),PGFL5(1,1,YQ%MP5M),&
   & PR0,PGMV(1,1,YT0%MT),PGMV(1,1,YT0%MTL),PGMV(1,1,YT0%MTM),&
   & PGFL(1,1,YQ%MPL),PGFL(1,1,YQ%MPM),ZRT0,PRT0L,PRT0M)

!*       3.1.5 COMPUTE QUANTITIES NECESSARY FOR DEEP LAYER EQUATIONS.

  ! Not coded in the TL code.

!*       3.1.6 COMPUTE QUANTITIES FOR NH MODEL.

  IF (LNHDYN) THEN
    ! TL of NH not yet coded.
    ! To be restored and completed when coding the TL of NH.
    !NYC-NH CALL GNHPRETL(...)
    !NYC-NH Calculation of PRRED0 and ZRTR0.
    !NYC-NH CALL GNHPREHTL(...)
    !NYC-NH CALL GNHGRPRETL(...)
  ELSE
    !NYC-NH ZRNHPPI0(1:NPROMNH,1:NFLEVG)=0.0_JPRB
    !NYC-NH Z_PQCHA0L(1:NPROMNH,1:NFLEVG)=0.0_JPRB
    !NYC-NH Z_PQCHA0M(1:NPROMNH,1:NFLEVG)=0.0_JPRB
  ENDIF

!*       3.1.7 COMPUTATION OF SOME VERTICAL VELOCITIES.
!*             Solve continuity equation
!              Computation of the vertical velocities
!              "etapt (d prehyd / d eta)" and "omega/prehyd".

  CALL GPCTYTL(NPROMA,KST,KEND,NFLEVG,VDELB,VBH,&
   & PGMV(1,1,YT0%MU),PGMV(1,1,YT0%MV),PGMV(1,1,YT0%MDIV),&
   & PDELP0(1,1),PRDELP0,PLNPR0,PALPH0,PRTGR0,PRE0L,PRE0M,&
   & PEVEL0,PVVEL0,PSDIV0,PDIVP0,ZRPRE0F,&
   & PGMV5(1,1,YT5%MU),PGMV5(1,1,YT5%MV),PGMV5(1,1,YT5%MDIV),&
   & PDELP5(1,1),PRDELP5,PLNPR5,PALPH5,PRTGR5,PRE5L,PRE5M,PSDIV5,PRPREF5 &
   & )  
  ! Since the options LRUBC=T and "delta m=1" are not coded in the TL code,
  ! PSDVBC0 is set equal to PSDIV0.
  PSDVBC0(KST:KEND,0:NFLEVG)=PSDIV0(KST:KEND,0:NFLEVG)

!*       3.1.8 COMPUTES THE GEOPOTENTIAL HEIGHT "gz" AND ITS GRADIENT.

  ! * "gz" on layers and interlayers.

  PHI0(KST:KEND,NFLEVG)=0.0_JPRB
  IF(LNHDYN) THEN
    ! TL of NH not yet coded.
    ! To be restored when coding the TL of NH.
    !NYC-NH CALL GPGEOTL(NPROMA,KST,KEND,NFLEVG,&
    !NYC-NH  & PHI0,PHIF0,PGMV(1,1,YT0%MT),PRRED0,PLNPR0,PALPH0,&
    !NYC-NH  & PGMV5(1,1,YT5%MT),PRRED5,PLNPR5,PALPH5)  
  ELSE
    CALL GPGEOTL(NPROMA,KST,KEND,NFLEVG,&
     & PHI0,PHIF0,PGMV(1,1,YT0%MT),PR0,PLNPR0,PALPH0,&
     & PGMV5(1,1,YT5%MT),PR5,PLNPR5,PALPH5)  
  ENDIF

  ! * "rssavnabla gz" on layers and interlayers

  CALL GPGRGEOTL(LNHDYN,&
   & NPROMA,KST,KEND,NFLEVG,&
   !NYC-NH & ZRNHPPI0,&
   & PGMV(1,1,YT0%MT),PR0,PRT0L,PRT0M,&
   & PLNPR0,ZLNPR0L,ZLNPR0M,PALPH0,ZALPH0L,ZALPH0M,&
   !NYC-NH & Z_PQCHA0L,Z_PQCHA0M,&
   & Z_PHI0FL,Z_PHI0FM,PGPHL,PGPHM,&
   & PRNHPPI5,PGMV5(1,1,YT5%MT),PR5,PRT5L,PRT5M,&
   & PLNPR5,PLNPR5L,PLNPR5M,PALPH5,PALPH5L,PALPH5M &
   !NYC-NH & PQCHA5L,PQCHA5M,PNH15L,PNH15M &
   & )

!*       3.1.9 COMPUTES KINETIC ENERGY.

  DO JLEV=1,NFLEVG
    DO JROF=KST,KEND
      PKENE0(JROF,JLEV)=(PGMV(JROF,JLEV,YT0%MU)*PGMV5(JROF,JLEV,YT5%MU)&
       & +PGMV(JROF,JLEV,YT0%MV)*PGMV5(JROF,JLEV,YT5%MV))  
    ENDDO
  ENDDO

!*       3.1.10 COMPUTES HALF-LEVEL WINDS FOR NH MODEL.

  ! ky: currently put under LNHDYN contrary to the direct code,
  !     because we don't need it for the hydrostatic TL code.
  !     This piece of code has not been yet validated
  !     (TL of NH not yet available).
  IF (LNHDYN.AND.(.NOT.LVERTFE)) THEN

    !NYC-NH ! * this part is not yet coded for lvertfe=true.
    !NYC-NH !   Currently we need it:
    !NYC-NH !   - in the hydrostatic model if LARPHY=T (TL not yet coded)
    !NYC-NH !   - in the NH model (TL not yet coded).
    !NYC-NH !   for lvertfe=true the half level winds must not be computed,
    !NYC-NH !    only the surface winds must be computed.

    !NYC-NH CALL GPHLWITL(NPROMA,KST,KEND,PLNPR5,PALPH5,&
    !NYC-NH  & PLNPR0,PALPH0,PWW0)  

    !NYC-NH CALL GPHLUVTL(NPROMA,KST,KEND,&
    !NYC-NH  & PGMV5(1,1,YT5%MU),PGMV5(1,1,YT5%MV),PWW5,&
    !NYC-NH  & PWW0,PGMV(1,1,YT0%MU),PGMV(1,1,YT0%MV),PLHU0,PLHV0)

    !NYC-NH LLDER=LNHDYN
    !NYC-NH CALL GPUVS(NFLEVG,NPROMA,KST,KEND,LLDER, &
    !NYC-NH  & PGMV(1,1,YT0%MU),PGMV(1,1,YT0%MV),ZUS0,ZVS0, &
    !NYC-NH  & PDIVF=PGMV(1,1,YT0%MDIV),PVORF=PGMV(1,1,YT0%MVOR), &
    !NYC-NH  & PUFL=PGMV(1,1,YT0%MUL),PVFL=PGMV(1,1,YT0%MVL), &
    !NYC-NH  & PUS_L=ZUS0_L,PVS_L=ZVS0_L,PUS_M=ZUS0_M,PVS_M=ZVS0_M)

  ENDIF

!*       3.1.11 COMPUTES MAX["(real wind)*(map factor)*(a/rs)"].

  ! * Not done in the TL code: the enhanced diffusion is assumed to be
  !   always zero in the TL model.

!*       3.1.12 COMPUTES THE PRESSURE FORCE FOR THE RHS OF MOMENTUM EQN.

  CALL GPGRPTL( &
   ! --- INPUT ----------------------------------------------------------------
   & LLVERCOR, &
   & NPROMA, &
   !NYC-VC & IPROMVC, &
   & NPROMNH,KST,KEND,NFLEVG, &
   & ZRT0,PRT0L,PRT0M, &
   !NYC-NH & PRDELP0, &
   & PRE0L,PRE0M,PRTGR0, &
   & PALPH0,ZALPHPL0L,ZALPHPL0M, &
   !NYC-NH & ZDELNHPRE0,ZLNNHPREF0L,ZLNNHPREF0M, &
   !NYC-NH & ZRNHPPI0,Z_PQCHA0L,Z_PQCHA0M, &
   & PGPHL,PGPHM,Z_PHI0FL,Z_PHI0FM, &
   !NYC-VC & Z_PVCTS0F,ZVCTS0FL,ZVCTS0FM,Z_PVCMUS0F,ZVCMUS0FL,ZVCMUS0FM,&
   ! --- OUTPUT ---------------------------------------------------------------
   & PSGRTL,PSGRTM, &
   !NYC-NH & ZSGRTSL,ZSGRTSM, &
   ! --- INPUT-TRAJECTORY -----------------------------------------------------
   & PRT5,PRT5L,PRT5M, &
   !NYC-NH & PRDELP5, &
   & PRE5L,PRE5M,PRTGR5, &
   & PALPH5,PALPHPL5L,PALPHPL5M, &
   !NYC-NH & PDELNHPRE5,PLNNHPREF5L,PLNNHPREF5M, &
   !NYC-NH & PRNHPPI5,PQCHA5L,PQCHA5M, &
   & PHI5FL,PHI5FM &
   & )

ENDIF

!*       3.2   TIME t9 CALCULATIONS.

IF(.NOT.LTWOTL .AND. NCURRENT_ITER == 0) THEN

!*       3.2.1 COMPUTE HALF-LAYER HYDROSTATIC PRESSURE.

  IF ((LSIMPH.AND..NOT.LDLADNMI).OR.LNHDYN) THEN
    CALL GPPREHTL(NPROMA,KST,KEND,NFLEVG,VBH,PRE9)
  ENDIF

!*       3.2.2 COMPUTE AUXILIARY ARRAYS RELATED TO THE VERTICAL
!              AND FULL-LAYER HYDROSTATIC PRESSURE.

  IF ((LSIMPH.AND..NOT.LDLADNMI).OR.LNHDYN) THEN
    CALL GPXYBTL(NPROMA,KST,KEND,NFLEVG,VDELB,VC,&
     & PRE9,PDELP9(1,1),PRDELP9,PLNPR9,PALPH9,ZRTGR9,&
     & ZRPRE9,ZRPP9,&
     & PRE95,PDELP95(1,1),PRDELP95,PLNPR95,PRPRE95,PRPP95)
    CALL GPPREFTL(NPROMA,KST,KEND,NFLEVG,PALPH9,PRE9,PRE9F,&
     & PALPH95,PRE95)
  ENDIF

  ! * Case of finite elements: not done in the TL code (ZRPRE9F is useless).

!*       3.2.3 COMPUTE "R", "cp" AND "kappa".

  IF(LSIMPH.AND..NOT.LDLADNMI) THEN
    CALL GPRCPTL(NPROMA,KST,KEND,NFLEVG,PQ=PGFL(1,1,YQ%MP9),PCP=PCP9,PR=PR9)
  ENDIF

!*       3.2.5 COMPUTE QUANTITIES NECESSARY FOR DEEP LAYER EQUATIONS.

  ! Not coded in the TL code.

!*       3.2.6 COMPUTE QUANTITIES FOR NH MODEL.

  IF(LSIMPH.AND.LNHDYN) THEN
    ! TL of NH not yet coded.
    ! To be restored and completed when coding the TL of NH.
    !NYC-NH CALL GNHPRETL(...)
    !NYC-NH Calculation of ZRRED9.
    !NYC-NH CALL GNHPREHTL(...)
  ENDIF

!*       3.2.8 COMPUTES THE GEOPOTENTIAL HEIGHT "gz" AND ITS GRADIENT.

  ! * "gz" on layers and interlayers.

  IF(LNHDYN.AND.LSIMPH) THEN
    ! TL of NH not yet coded.
    ! To be restored when coding the TL of NH.
    !NYC-NH PHI9(KST:KEND,NFLEVG)=0.0_JPRB
    !NYC-NH CALL GPGEOTL(NPROMA,KST,KEND,NFLEVG,PHI9,PHIF9,&
    !NYC-NH  & PGMV(1,1,YT9%MT),ZRRED9,PLNPR9,PALPH9,&
    !NYC-NH  & PTT95,PRRED95,PLNPR95,PALPH95)  
  ELSEIF ((.NOT.LNHDYN).AND.LSIMPH.AND.(.NOT.LDLADNMI)) THEN
    PHI9(KST:KEND,NFLEVG)=0.0_JPRB
    CALL GPGEOTL(NPROMA,KST,KEND,NFLEVG,PHI9,PHIF9,&
     & PGMV(1,1,YT9%MT),PR9,PLNPR9,PALPH9,&
     & PTT95,PR95,PLNPR95,PALPH95)  
  ENDIF

!*       3.2.10 COMPUTES HALF-LEVEL WINDS FOR NH MODEL.

  IF(LNHDYN) THEN

    !NYC-NH ! * same remark as for time t half-level winds (not yet properly coded
    !NYC-NH !   for lvertfe=true.

    ! TL of NH not yet coded.
    ! To be restored when coding the TL of NH.

    !NYC-NH CALL GPHLUVTL(NPROMA,KST,KEND,&
    !NYC-NH  & PUT95,PVT95,PWW5,&
    !NYC-NH  & PWW0,PGMV(1,1,YT9%MU),PGMV(1,1,YT9%MV),ZLHU9,ZLHV9)

    !NYC-NH LLDER=.FALSE.
    !NYC-NH CALL GPUVS(NFLEVG,NPROMA,KST,KEND,LLDER, &
    !NYC-NH  & PGMV(1,1,YT9%MU),PGMV(1,1,YT9%MV),ZUS9,ZVS9)

  ENDIF

ENDIF

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

!*       4.    INITIALISE AUXILIARY VARIABLES (CORRECTOR OF LPC_OLD).
!              ------------------------------------------------------

IF (NCURRENT_ITER > 0 .AND. LPC_OLD) THEN

  ! TL of NH not yet coded.
  ! To be restored when coding the TL of NH.
  !NYC-NH CALL GPHLUVTL(NPROMA,KST,KEND,&
  !NYC-NH  & PGMV5(1,1,YT5%MU),PGMV5(1,1,YT5%MV),PGPPC5(1,MGPPCO_WW5),&
  !NYC-NH  & PGPPC(1,MGPPCO_WW),PGMV(1,1,YT0%MU),PGMV(1,1,YT0%MV),PLHU0,PLHV0)

ENDIF

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

!*       5.    TIME DIMENSION.
!              ---------------

IF ((NCURRENT_ITER == 0).OR.(NCURRENT_ITER > 0 .AND. LPC_FULL)) THEN

  CALL GPINISLB(&
   ! --- INPUT ---------------------------------------------------------
   & KST,KEND,PTE,.TRUE.,&
   & PGFL,&
   & PGMV(1,1,YT9%MU),PGMV(1,1,YT9%MV),PGMV(1,1,YT9%MT), &
   & PGMV(1,1,YT9%MSPD),PGMV(1,1,YT9%MSVD),ZDUM, &
   & PGMVS(1,YT9%MSP), &
   & ZDUM,ZDUM, &
   ! --- OUTPUT --------------------------------------------------------
   & PGMVT1(1,1,YT1%MU),PGMVT1(1,1,YT1%MV),PGMVT1(1,1,YT1%MT),PGFLT1, &
   & PGMVT1(1,1,YT1%MSPD),PGMVT1(1,1,YT1%MSVD),ZDUM, &
   & PGMVT1S(1,YT1%MSP), &
   & PB2,ZDUM,ZDUM)

  ! * Compute perturbation of vertical velocity:
  !   (not coded in GPINISLB because non linear, allows to avoid to code
  !   GPINISLBTL).
  DO JLEV=1,NFLEVG
    ILVVEL=MSLB2VVEL+JLEV-1
    DO JROF=KST,KEND
      PB2(JROF,ILVVEL)=PVVEL5(JROF,JLEV)*PRE0F(JROF,JLEV)&
       & +PRE5F(JROF,JLEV)*PVVEL0(JROF,JLEV)
    ENDDO
  ENDDO

  ! Deep layer equations (CALL GPINISLB2VC): not coded in the TL code.

ENDIF

! * Update of PGP1 for predictor: not coded in the TL code.

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

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