!OCL  NOEVAL
SUBROUTINE GPGRP( &
 ! --- INPUT -----------------------------------------------------------------
 & LDVERCOR, &
 & KPROMA,KPROMVC,KPROMNH,KSTART,KPROF,KFLEV, &
 & PRT,PRTL,PRTM,PRDELP,PREL,PREM,PRTGR, &
 & PLNPR,PLNPRL,PLNPRM,PALPH,PALPHPLL,PALPHPLM, &
 & PDELNHPRE,PLNNHPREFL,PLNNHPREFM, &
 & PRNHPPI,PQCHAL,PQCHAM, &
 & PHIHL,PHIHM,PHIFL,PHIFM, &
 & PVCTSF,PVCTSFL,PVCTSFM,PVCMUSF,PVCMUSFL,PVCMUSFM, &
 ! --- OUTPUT ----------------------------------------------------------------
 & PSGRTL,PSGRTM,PSGRTSL,PSGRTSM, &
 ! --- OPTIONAL --------------------------------------------------------------
 & LDRWSDLR,PRDLR)

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

USE YOMCT0   , ONLY : LNHDYN
USE YOMCST   , ONLY : RD
USE YOMGEM   , ONLY : VFE_RDETAH
USE YOMCVER  , ONLY : LVERTFE
USE PAR_RDLR , ONLY : JP_RSAF  ,JP_DIMR

!**** *GPGRP* - Computation of the pressure gradient force term used in the
!               RHS of the horizontal wind equation in both NH and
!               hydrostatic models.
!               This term is computed at full levels.

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

!     1/ Thin layer equations:

!        The pressure gradient force term writes:
!        * for hydrostatic model:
!          - grad[gz] - RT grad[log(prehyds)]
!        * for NH model:
!          - (d pre/d prehyd) grad[gz] - RT grad[pre]/pre

!     2/ Deep layer equations according to (White & Bromley, 1995).

!        Some additional terms containing "mu" and "grad[mu]" appear.
!        This option is available in the hydrostatic model only.

!     3/ Deep layer equations according to (Wood and Staniforth, 2003)
!        for NH model (LRWSDLR=T).
!        The pressure gradient force term writes:
!          - (r**2/a**2) (d pre/d presim) grad[Gr] - RT grad[pre]/pre
!        In this case quantities based on hydrostatic pressure now contain
!         quantities based on "presim",
!         with d(presim)/d(prehyd)=(r**2/a**2)*(G/g).

!     4/ This new simplified version of GPGRP treats both NH and hydrostatic
!        models.
         
!**   Interface.
!     ----------
!        *CALL* *GPGRP(...)

!        Explicit arguments :
!        --------------------
!         * INPUT:
!           LDVERCOR    : .T./.F.: thin layer hypothesis relaxed/applied
!           KPROMA      : horizontal dimension
!           KPROMVC     : hor. dimension for arrays used only if "lvercor=T"
!           KPROMNH     : hor. dimension for arrays used only if "lnhdyn=T"
!           KSTART      : start of work
!           KPROF       : working length
!           KFLEV       : number of levels
!           PRT         : "R(air)*temperature" on layers
!           PRTL        : zonal component of "rssavnabla (RT)" on layers
!           PRTM        : meridian component of "rssavnabla (RT)" on layers
!           PRDELP      : 1/[Delta prehyd] on layers
!           PREL        : zonal component of "rssavnabla (prehyds)"
!           PREM        : meridian component of "rssavnabla (prehyds)"
!           PRTGR       : the ratio between "rssavnabla log(prehyd)"
!                          and "rssavnabla log(prehyds)", on layers
!           PLNPR       : "delta" on layers (is equal to
!                          "log(prehyd[lbar]/prehyd[lbar-1])" if "ndlnpr=0")
!           PLNPRL      : zonal component of "rssavnabla delta" on layers
!           PLNPRM      : meridian component of "rssavnabla delta" on layers
!           PALPH       : "alpha" on layers
!           PALPHPLL    : zonal component of "rssavnabla (alpha + log prehyd)"
!                          on layers
!           PALPHPLM    : meridian component "rssavnabla (alpha + log prehyd)"
!                          on layers
!           PDELNHPRE   : [Delta pre] on layers
!           PLNNHPREFL  : zonal component of "[rssavnabla pre]/pre" on layers
!           PLNNHPREFM  : merid component of "[rssavnabla pre]/pre" on layers
!           PRNHPPI     : (prehyd/pre) at full levels
!           PQCHAL      : zonal comp of "grad (log(pre/prehyd))" at full levels
!           PQCHAM      : merid comp of "grad (log(pre/prehyd))" at full levels
!           PHIHL       : zonal component of "rssavnabla[gz]" on half levels
!           PHIHM       : merid component of "rssavnabla[gz]" on half levels
!           PHIFL       : zonal component of "rssavnabla[gz]" on full levels
!           PHIFM       : merid component of "rssavnabla[gz]" on full levels
!           PVCTSF      : reference temperature "Ts" on layers
!           PVCTSFL     : zonal component of "rssavnabla Ts" on layers
!           PVCTSFM     : meridian component of "rssavnabla Ts" on layers
!           PVCMUSF     : "mu_s" on layers
!           PVCMUSFL    : zonal component of "rssavnabla mu_s", on layers
!           PVCMUSFM    : meridian component of "rssavnabla mu_s", on layers

!         * OUTPUT:
!           PSGRTL      : zonal comp. of pressure (semi-reduced) gradient force
!           PSGRTM      : merid comp. of pressure (semi-reduced) gradient force
!           PSGRTSL     : zonal comp. of surf pressure (semi-reduc) grad force
!           PSGRTSM     : merid comp. of surf pressure (semi-reduc) grad force

!         * OPTIONAL INPUT:
!           LDRWSDLR    : key for metric terms in Wood and Staniforth DL eqns
!           PRDLR       : array containing "r/a", "a/r", "grad(r/a)".


!        Implicit arguments :   None.
!        --------------------

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

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

!     Reference.
!     ----------
!        See  documentation Arpege ALGORITHME CHAPITRE 6 paragraphe 6

!     Author.
!     -------
!        Florence Rabier

!     Modifications.
!     --------------
!   Original : 91-11-01
!   Modified : 94-10-11 by Radmila Bubnova: correction in the case
!                            of the other approximation of d (ln p).
!   Modified by K. YESSAD (AUGUST 2000):
!         - correct false or ambiguous comments.
!         - add comments.
!         - relaxation of thin layer hypothesis.
!         - new way of coding to isolate the quantities
!           "rssavnabla alpha + log prehyd" and "rssavnabla delta" which
!           are the only ones depending on "ndlnpr".
!   00-12-18 C. Fischer : merge karim's ldvercor with ecmwf's lvertfe
!   M.Hamrud      01-Oct-2003 CY28 Cleaning
!   K.Yessad         Dec-2004 Complete rewriting.
!   J. Vovoda and K. Yessad (Oct 2007): VFE in NH model
!   N. Wedi and K. Yessad (Jan 2008): different dev for NH model and PC scheme
!   K. Yessad (Dec 2008): remove dummy CDLOCK
!   K. Yessad (March 2009): correct false comments for LRWSDLG=T
!     ------------------------------------------------------------------

IMPLICIT NONE

INTEGER(KIND=JPIM),INTENT(IN)    :: KPROMA 
INTEGER(KIND=JPIM),INTENT(IN)    :: KPROMVC 
INTEGER(KIND=JPIM),INTENT(IN)    :: KPROMNH
INTEGER(KIND=JPIM),INTENT(IN)    :: KFLEV 
LOGICAL           ,INTENT(IN)    :: LDVERCOR 
INTEGER(KIND=JPIM),INTENT(IN)    :: KSTART 
INTEGER(KIND=JPIM),INTENT(IN)    :: KPROF 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PRT(KPROMA,KFLEV) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PRTL(KPROMA,KFLEV) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PRTM(KPROMA,KFLEV) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PRDELP(KPROMA,KFLEV) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PREL(KPROMA) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PREM(KPROMA) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PRTGR(KPROMA,KFLEV) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PLNPR(KPROMA,KFLEV) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PLNPRL(KPROMA,KFLEV) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PLNPRM(KPROMA,KFLEV) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PALPH(KPROMA,KFLEV) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PALPHPLL(KPROMA,KFLEV) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PALPHPLM(KPROMA,KFLEV) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PDELNHPRE(KPROMNH,KFLEV) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PLNNHPREFL(KPROMNH,KFLEV) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PLNNHPREFM(KPROMNH,KFLEV) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PRNHPPI(KPROMA,KFLEV) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PQCHAL(KPROMNH,KFLEV) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PQCHAM(KPROMNH,KFLEV) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PHIHL(KPROMA,0:KFLEV) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PHIHM(KPROMA,0:KFLEV) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PHIFL(KPROMA,KFLEV) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PHIFM(KPROMA,KFLEV) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PVCTSF(KPROMVC,KFLEV) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PVCTSFL(KPROMVC,KFLEV) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PVCTSFM(KPROMVC,KFLEV) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PVCMUSF(KPROMVC,KFLEV) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PVCMUSFL(KPROMVC,KFLEV) 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PVCMUSFM(KPROMVC,KFLEV) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PSGRTL(KPROMA,KFLEV) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PSGRTM(KPROMA,KFLEV) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PSGRTSL(KPROMNH) 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PSGRTSM(KPROMNH) 
LOGICAL,OPTIONAL  ,INTENT(IN)    :: LDRWSDLR
REAL(KIND=JPRB),OPTIONAL,INTENT(IN) :: PRDLR(KPROMA,0:KFLEV,JP_DIMR)

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

REAL(KIND=JPRB) :: ZGPHL(KPROMA,0:KFLEV),ZGPHM(KPROMA,0:KFLEV)
REAL(KIND=JPRB) :: ZINL(KPROMA,KFLEV),ZINM(KPROMA,KFLEV)
REAL(KIND=JPRB) :: ZDPRESDPREHYD(KPROMA,KFLEV)
REAL(KIND=JPRB) :: ZLNPREFL(KPROMA,KFLEV),ZLNPREFM(KPROMA,KFLEV)
REAL(KIND=JPRB) :: ZRNHPPI(KPROMA,KFLEV)

INTEGER(KIND=JPIM) :: JLEV, JROF
LOGICAL :: LLRWSDLR

REAL(KIND=JPRB) :: ZVCRDMUSTSF, ZVCRDMUSTSFL, ZVCRDMUSTSFM
REAL(KIND=JPRB) :: ZFAC
REAL(KIND=JPRB) :: ZHOOK_HANDLE

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

#include "abor1.intfb.h"
#include "verint.intfb.h"

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

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

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

!     CHECK RELIABILITY OF INPUT ARGUMENTS.

IF (PRESENT(LDRWSDLR)) THEN
  LLRWSDLR=LDRWSDLR
ELSE
  LLRWSDLR=.FALSE.
ENDIF
IF (LLRWSDLR.AND.(.NOT.PRESENT(PRDLR))) THEN
  CALL ABOR1('GPGRP: if LRWSDLR=T, PRDLR should be present')
ENDIF

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

!*       1.    COMPUTATION OF THE PRESSURE GRADIENT TERM.
!              ------------------------------------------

! * SOME PRE-CALCULATIONS:

IF (LNHDYN) THEN

  ! * Calculation of "d pre / d prehyd" at full levels (LRWSDLR=F)
  !   or "d pre / d presim" at full levels (LRWSDLR=T):
  DO JLEV=1,KFLEV
    DO JROF=KSTART,KPROF
      ZDPRESDPREHYD(JROF,JLEV)=PDELNHPRE(JROF,JLEV)*PRDELP(JROF,JLEV)
    ENDDO
  ENDDO

  ! * Calculation of "[rssavnabla pre]/pre" at full levels:
  DO JLEV=1,KFLEV
    DO JROF=KSTART,KPROF
      ZLNPREFL(JROF,JLEV)=PLNNHPREFL(JROF,JLEV)
      ZLNPREFM(JROF,JLEV)=PLNNHPREFM(JROF,JLEV)
      ZRNHPPI(JROF,JLEV)=PRNHPPI(JROF,JLEV)
    ENDDO
  ENDDO

ELSE
  ! * In this case:
  !   "d pre / d prehyd" is equal to 1.
  !   "[rssavnabla pre]/pre" is replaced by "rssavnabla (log(prehyd))".
  DO JLEV=1,KFLEV
    DO JROF=KSTART,KPROF
      ZDPRESDPREHYD(JROF,JLEV)=1.0_JPRB
      ZLNPREFL(JROF,JLEV)=PRTGR(JROF,JLEV)*PREL(JROF)
      ZLNPREFM(JROF,JLEV)=PRTGR(JROF,JLEV)*PREM(JROF)
      ZRNHPPI(JROF,JLEV)=1.0_JPRB
    ENDDO
  ENDDO
ENDIF

! * WE NOW COMPUTE THE PRESSURE GRADIENT TERM:

IF (LVERTFE.AND.(.NOT.LLRWSDLR)) THEN

  ! * The pressure gradient term is directly computed on layers in
  !   this case and no quantity at half layers is computed.

  ! * First transfer
  !   " rssavnabla[gz] + RT [rssavnabla (log(prehyd))] " (hyd)
  !   or
  !   " (d pre/d prehyd) rssavnabla[gz] + RT [rssavnabla pre]/pre " (NH)
  !   in (PSGRTL,PSGRTM).
  DO JLEV=1,KFLEV
    DO JROF=KSTART,KPROF
      PSGRTL(JROF,JLEV)=ZDPRESDPREHYD(JROF,JLEV)*PHIFL(JROF,JLEV) &
       & +PRT(JROF,JLEV)*ZLNPREFL(JROF,JLEV)
      PSGRTM(JROF,JLEV)=ZDPRESDPREHYD(JROF,JLEV)*PHIFM(JROF,JLEV) &
       & +PRT(JROF,JLEV)*ZLNPREFM(JROF,JLEV)
    ENDDO
  ENDDO

  IF (LDVERCOR.AND.(.NOT.LNHDYN)) THEN
    ! * Compute the increment containing "mu" and "rssavnabla mu"
    !   and add it to (PSGRTL,PSGRTM).
    DO JLEV=1,KFLEV
      DO JROF=KSTART,KPROF
        ZVCRDMUSTSF=RD*PVCTSF(JROF,JLEV)*PVCMUSF(JROF,JLEV)
        ZVCRDMUSTSFL=RD*(&
         & PVCTSF(JROF,JLEV)*PVCMUSFL(JROF,JLEV) &
         & +PVCMUSF(JROF,JLEV)*PVCTSFL(JROF,JLEV))
        ZVCRDMUSTSFM=RD*(&
         & PVCTSF(JROF,JLEV)*PVCMUSFM(JROF,JLEV) &
         & +PVCMUSF(JROF,JLEV)*PVCTSFM(JROF,JLEV))
        ZINL(JROF,JLEV)=(PLNPR(JROF,JLEV)*ZVCRDMUSTSFL &
         & +PLNPRL(JROF,JLEV)*ZVCRDMUSTSF)*VFE_RDETAH(JLEV)
        ZINM(JROF,JLEV)=(PLNPR(JROF,JLEV)*ZVCRDMUSTSFM &
         & +PLNPRM(JROF,JLEV)*ZVCRDMUSTSF)*VFE_RDETAH(JLEV)
      ENDDO
    ENDDO
    CALL VERINT(KPROMA,KSTART,KPROF,KFLEV,ZINL,ZGPHL,1)
    CALL VERINT(KPROMA,KSTART,KPROF,KFLEV,ZINM,ZGPHM,1)
    DO JLEV=1,KFLEV
      DO JROF=KSTART,KPROF
        PSGRTL(JROF,JLEV)=PSGRTL(JROF,JLEV)+ZGPHL(JROF,JLEV-1)
        PSGRTM(JROF,JLEV)=PSGRTM(JROF,JLEV)+ZGPHM(JROF,JLEV-1)
      ENDDO
    ENDDO

    ! * Add "- mu Rd Ts [rssavnabla prehyd] / prehyd" to (PSGRTL,PSGRTM).
    DO JLEV=1,KFLEV
      DO JROF=KSTART,KPROF
        ZVCRDMUSTSF=RD*PVCTSF(JROF,JLEV)*PVCMUSF(JROF,JLEV)
        PSGRTL(JROF,JLEV)=PSGRTL(JROF,JLEV) &
         & -ZVCRDMUSTSF*PRTGR(JROF,JLEV)*PREL(JROF)
        PSGRTM(JROF,JLEV)=PSGRTM(JROF,JLEV) &
         & -ZVCRDMUSTSF*PRTGR(JROF,JLEV)*PREM(JROF)
      ENDDO
    ENDDO

  ENDIF

ELSEIF((.NOT.LVERTFE).AND.(.NOT.LLRWSDLR)) THEN

  ! * The pressure gradient term calculation requires some
  !   calculations on half levels.

  ! * In the hydrostatic model, an accurate way to code this
  !   is to exhibit the quantity "rssavnabla alpha + log prehyd"
  !   which is simpler to compute than the separate terms
  !   "rssavnabla alpha" and "log prehyd"
  !   (some quantities cancel each other).
  !   One starts from half level "grad(Phi)" and write:
  !   [grad(Phi) + RT grad(log(prehyd))]_l
  !   = [grad(Phi)]_lbar
  !   + [alpha]_l [grad(RT)]_l
  !   + [RT]_l [grad(alpha + log(prehyd))]_l

  !   In the NH model, this term writes:
  !   (delta pre/delta prehyd) grap(Phi) + RT grad(pre) / pre
  !   For its discretisation we prefer to rewrite it as follows:
  !   [ grad(Phi) + (prehyd/pre) RT grad(log(prehyd)) ]
  !   + [ ((delta pre / delta prehyd) - 1) * grad(Phi) ]
  !   + [ RT grad(log(pre/prehyd)) ]
  !   + [ RT (1 - prehyd/pre) grad(log(prehyd)) ]
  !   The three last terms are non-zero only in the NH model.
  !   The first term [ grad(Phi) + (prehyd/pre) RT grad(log(prehyd)) ]
  !   looks like the hydrostatic pressure gradient term, but with an
  !   additional factor "prehyd/pre" and an additional term
  !   containing " (prehyd/pre) * grad(log(pre/prehyd)) ".
  !   This way of writing avoids the quasi cancellation of terms
  !   which have the same magnitude.

  ! * First get "rssavnabla[gz]" on half levels.
  DO JLEV=1,KFLEV
    DO JROF=KSTART,KPROF
      PSGRTL(JROF,JLEV)=PHIHL(JROF,JLEV)
      PSGRTM(JROF,JLEV)=PHIHM(JROF,JLEV)
    ENDDO
  ENDDO

  ! * Calculation of [ grad(Phi) + (prehyd/pre) RT grad(log(prehyd)) ]
  !   at full levels (cf. what is done in GPGRGEO to compute "grad(Phi)"
  !   at full levels, but replacing (palphl,palphm) by (palphpll,palphplm)):

  DO JLEV=1,KFLEV
    DO JROF=KSTART,KPROF
      PSGRTL(JROF,JLEV)=PSGRTL(JROF,JLEV)&
       & +ZRNHPPI(JROF,JLEV)*&
       & (PALPH(JROF,JLEV)*PRTL(JROF,JLEV)&
       & +PALPHPLL(JROF,JLEV)*PRT(JROF,JLEV))
      PSGRTM(JROF,JLEV)=PSGRTM(JROF,JLEV)&
       & +ZRNHPPI(JROF,JLEV)*&
       & (PALPH(JROF,JLEV)*PRTM(JROF,JLEV)&
       & +PALPHPLM(JROF,JLEV)*PRT(JROF,JLEV))
    ENDDO
  ENDDO

  IF (LNHDYN) THEN
    DO JLEV=1,KFLEV
      DO JROF=KSTART,KPROF
        PSGRTL(JROF,JLEV)=PSGRTL(JROF,JLEV)&
         & -ZRNHPPI(JROF,JLEV)*&
         & PALPH(JROF,JLEV)*PRT(JROF,JLEV)*PQCHAL(JROF,JLEV)
        PSGRTM(JROF,JLEV)=PSGRTM(JROF,JLEV)&
         & -ZRNHPPI(JROF,JLEV)*&
         & PALPH(JROF,JLEV)*PRT(JROF,JLEV)*PQCHAM(JROF,JLEV)
      ENDDO
    ENDDO
  ENDIF

  ! * Calculation of the additional anhydrostatic contributions
  !   at full levels:

  IF (LNHDYN) THEN

    DO JLEV=1,KFLEV
      DO JROF=KSTART,KPROF
        PSGRTL(JROF,JLEV)=PSGRTL(JROF,JLEV)&
         & + (ZDPRESDPREHYD(JROF,JLEV)-1.0_JPRB)*PHIFL(JROF,JLEV) &
         & + PRT(JROF,JLEV)*PQCHAL(JROF,JLEV) &
         & + PRT(JROF,JLEV)*(1.0_JPRB-ZRNHPPI(JROF,JLEV))*PRTGR(JROF,JLEV) &
         & *PREL(JROF)
        PSGRTM(JROF,JLEV)=PSGRTM(JROF,JLEV)&
         & + (ZDPRESDPREHYD(JROF,JLEV)-1.0_JPRB)*PHIFM(JROF,JLEV) &
         & + PRT(JROF,JLEV)*PQCHAM(JROF,JLEV) &
         & + PRT(JROF,JLEV)*(1.0_JPRB-ZRNHPPI(JROF,JLEV))*PRTGR(JROF,JLEV) &
         & *PREM(JROF)
      ENDDO
    ENDDO

  ENDIF

  IF (LDVERCOR.AND.(.NOT.LNHDYN)) THEN

    ! * Get the increments containing "mu" and "rssavnabla mu":

    ! * Increment containing "mu" and "rssavnabla mu" in the
    !   term containing the total geopotential.
    DO JROF=KSTART,KPROF
      ZGPHL(JROF,KFLEV)=0.0_JPRB
      ZGPHM(JROF,KFLEV)=0.0_JPRB
    ENDDO
    DO JLEV=KFLEV,2,-1
      DO JROF=KSTART,KPROF
        ZVCRDMUSTSF=RD*PVCTSF(JROF,JLEV)*PVCMUSF(JROF,JLEV)
        ZVCRDMUSTSFL=RD*(&
         & PVCTSF(JROF,JLEV)*PVCMUSFL(JROF,JLEV) &
         & +PVCMUSF(JROF,JLEV)*PVCTSFL(JROF,JLEV))  
        ZVCRDMUSTSFM=RD*(&
         & PVCTSF(JROF,JLEV)*PVCMUSFM(JROF,JLEV) &
         & +PVCMUSF(JROF,JLEV)*PVCTSFM(JROF,JLEV))  
        ZGPHL(JROF,JLEV-1)=ZGPHL(JROF,JLEV)&
         & +PLNPR(JROF,JLEV)*ZVCRDMUSTSFL+PLNPRL(JROF,JLEV)*ZVCRDMUSTSF
        ZGPHM(JROF,JLEV-1)=ZGPHM(JROF,JLEV)&
         & +PLNPR(JROF,JLEV)*ZVCRDMUSTSFM+PLNPRM(JROF,JLEV)*ZVCRDMUSTSF
      ENDDO
    ENDDO

    ! * Add this increment:
    DO JLEV=1,KFLEV
      DO JROF=KSTART,KPROF
        PSGRTL(JROF,JLEV)=PSGRTL(JROF,JLEV)+ZGPHL(JROF,JLEV)
        PSGRTM(JROF,JLEV)=PSGRTM(JROF,JLEV)+ZGPHM(JROF,JLEV)
      ENDDO
    ENDDO

    ! * Term "-mu Rd Ts [rssavnabla (log(prehyd))]" and residual
    !   "mu" and "rssavnabla mu" incremental term:
    !   "alpha" and "rssavnabla alpha + log prehyd" terms contributions.

    DO JLEV=1,KFLEV
      DO JROF=KSTART,KPROF
        ZVCRDMUSTSF=RD*PVCTSF(JROF,JLEV)*PVCMUSF(JROF,JLEV)
        ZVCRDMUSTSFL=RD*(&
         & PVCTSF(JROF,JLEV)*PVCMUSFL(JROF,JLEV) &
         & +PVCMUSF(JROF,JLEV)*PVCTSFL(JROF,JLEV))  
        ZVCRDMUSTSFM=RD*(&
         & PVCTSF(JROF,JLEV)*PVCMUSFM(JROF,JLEV) &
         & +PVCMUSF(JROF,JLEV)*PVCTSFM(JROF,JLEV))  
        PSGRTL(JROF,JLEV)=PSGRTL(JROF,JLEV)&
         & +PALPH(JROF,JLEV)*ZVCRDMUSTSFL&
         & +PALPHPLL(JROF,JLEV)*ZVCRDMUSTSF  
        PSGRTM(JROF,JLEV)=PSGRTM(JROF,JLEV)&
         & +PALPH(JROF,JLEV)*ZVCRDMUSTSFM&
         & +PALPHPLM(JROF,JLEV)*ZVCRDMUSTSF  
      ENDDO
    ENDDO

  ENDIF

ELSEIF(LLRWSDLR) THEN

  ! * The pressure gradient term calculation requires some
  !   calculations on half levels.
  !   The specific treatment done for the case 
  !   ((.NOT.LVERTFE).AND.(.NOT.LLRWSDLR)), which exhibit hydrostatic
  !   contributions and anhydrostatic departures, is not retained here
  !   because additional metric terms make no longer convenient
  !   this discretisation. The discretisation done here is the
  !   simplest one, close to the one done for VFE+.NOT.LLRWSDLR.

  DO JLEV=1,KFLEV
    DO JROF=KSTART,KPROF
      ZFAC=PRDLR(JROF,JLEV,JP_RSAF)*PRDLR(JROF,JLEV,JP_RSAF)
      PSGRTL(JROF,JLEV)=ZFAC*ZDPRESDPREHYD(JROF,JLEV)*PHIFL(JROF,JLEV) &
       & +PRT(JROF,JLEV)*ZLNPREFL(JROF,JLEV)
      PSGRTM(JROF,JLEV)=ZFAC*ZDPRESDPREHYD(JROF,JLEV)*PHIFM(JROF,JLEV) &
       & +PRT(JROF,JLEV)*ZLNPREFM(JROF,JLEV)
    ENDDO
  ENDDO

ENDIF

! * In the NH model, PSGRT(L,M) at jlev=KFLEV is copied in PSGRTS(L,M).
IF (LNHDYN) THEN
  DO JROF=KSTART,KPROF
    PSGRTSL(JROF)=PSGRTL(JROF,KFLEV)
    PSGRTSM(JROF)=PSGRTM(JROF,KFLEV)
  ENDDO
ENDIF

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

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