MODULE YOMDYNA

USE PARKIND1  ,ONLY : JPIM     ,JPRB

IMPLICIT NONE

SAVE

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

!=========== VARIABLES FOR DYNAMICS: FIRST PART ===============================

! ------ NH model ------------------------------------------------------

! NPDVAR : switch for type of variable used for pressure departure
!         2: q_hat = ln(p/pi)
!         3: Phi - B*Phi_surf
!         4: Phi 

! NVDVAR : switch for type of variable used for pseudo vertical divergence
!         3: d3 = -g (p/(m.Rd.T)) d_parc w/d_parc eta
!         4: d4 = d3 + X = d3 + (p/m.R.T) nabla_phi d_parc V/d_parc eta
!         5: gw-B*gw_s
!         6: gw

! ND4SYS : switch for the way of treatment of term NHX in the NH d4 equation.
!          ND4SYS=1: all contributions of D(NHX)/Dt are treated at the level
!                    of CPG_DYN+CALL_SL, and X is updated via GPXX in CPG_GP.
!          ND4SYS=2 (SL only): only the advective terms are treated at the
!                    level of CPG_DYN+CALL_SL; additional contributions
!                    are done in CPGLAG, and X(t+dt) is updated in CPGLAG.

! LNH_PDVD: NH model with NH variables based on pressure departure and
!           vertical divergence (i.e currently NPDVAR=2, NVDVAR=3 or 4).

! LNH_GEOGW: NH model with NH variables based on geopotential and vertical
!            velocity (i.e. currently NPDVAR=3 or 4, NVDVAR=5 or 6).

! LNHX   : variable NHX (grid-point and spectral) is needed at t.
! LNHXDER: horizontal derivatives of variable NHX are needed at t.

! LGWADV: .T. => "vwv" prognostic variable in NH model is "g*w"
!                (but the variable which is transformed into spectral
!                space is "d_nvdvar").
!         .F. => "vwv" prognostic variable in NH model is "d_nvdvar".

! NGWADVSI: when LGWADV, alternate treatments for linear terms.
!           NGWADVSI=1: linear terms set to 0 in LATTEX, LATTES for all eqns;
!            linear terms evaluated at O and linear terms evaluated at F
!            added to the RHS of equations in GPENDTR.
!           NGWADVSI=2 (relevant for LSETTLS but not for LPC_NESC):
!            linear terms set to 0 in LATTEX, LATTES for all eqns;
!            linear terms evaluated at O added to the RHS of equations in
!            LAPINEB (after the call to GNHGW2SVD); linear terms evaluated
!            at F added to the RHS of equations in GPENDTR.

! LRDBBC: .T. if S.-L. diagnostic BBC active for NH (if LSLAG=.T. only)
!         .F. if eulerian development of NH  BBC in LSLAG.

! LGWOPT1: Case LNH_GEOGW=T only. Way to compute "dver" from "gw" in the RHS
!          of temperature equation.
!          .F. => vertical derivative applied to "gw".
!          .T. => vertical derivative applied to pseudo NH departure of "gw".

! ------ SLHD diffusion ------------------------------------------------

!          SLHD (= horizontal diffusion using damping properties of some
!          semi-Lagrangian interpolatores) keys
! LSLHD     : internal model switch for semi-Lagrangian diffusion computation
! LSLHD_W   : switch for SLHD of horizontal flow.
! LSLHD_T   : switch for SLHD of temperature.
! LSLHD_SPD : switch for SLHD of (NH) pressure departure vs geopotential var.
! LSLHD_SVD : switch for SLHD of (NH) vertical divergence vs 'gw' var.
! LSLHD_OLD : use old SLHD interpolator (cubic Lagrange mixed with linear)
! LSLHD_STATIC : do not diagnose kappa from horizontal flow deformation,
!                use static value instead:
!                  SLHDKMIN for undiffused fields
!                  SLHDKMAX for diffused fields
! LSLHDQUAD : internal model switch indicating need to precompute quadratic
!             weights
! SLHDKMIN  : minimum value for the kappa function
! SLHDKMAX  : maximum value for the kappa function
! SLHDEPSH  : dimensionless strength of horizontal Laplacian smoothing
! SLHDEPSV  : dimensionless strength of vertical Laplacian smoothing

! ------ Deep-layer equations: Wood and Staniforth formulation ---------

! The Wood and Staniforth formulation of deep-layer equations is different
!  from the White and Bromley one (variable LVERCOR) and is well designed
!  for the versions of the NH model present in ARPEGE/IFS.

! LRWSDLW   : "w" inertia terms taken into account.
! LRWSDLR   : metric terms taken into account (elsewhere than in the
!             conversions between "dver" and "w").
! LRWSDLR2  : metric terms taken into account also in the conversions
!             between "dver" and "w" (requires LRWSDLR=T).
! LRWSDLG   : vertical variations of "g" taken into account (requires LRWSDLR=T)

! LSLDIA    : switch on semi-lagrangian dynamics diagnostics

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

INTEGER(KIND=JPIM) :: NPDVAR
INTEGER(KIND=JPIM) :: NVDVAR
INTEGER(KIND=JPIM) :: ND4SYS
LOGICAL :: LNH_PDVD
LOGICAL :: LNH_GEOGW
LOGICAL :: LNHX
LOGICAL :: LNHXDER
LOGICAL :: LGWADV
INTEGER(KIND=JPIM) :: NGWADVSI
LOGICAL :: LRDBBC
LOGICAL :: LGWOPT1
LOGICAL :: LSLHD
LOGICAL :: LSLHD_W
LOGICAL :: LSLHD_T
LOGICAL :: LSLHD_SPD
LOGICAL :: LSLHD_SVD
LOGICAL :: LSLHD_OLD
LOGICAL :: LSLHD_STATIC
LOGICAL :: LSLHDQUAD
REAL(KIND=JPRB) :: SLHDKMIN
REAL(KIND=JPRB) :: SLHDKMAX
REAL(KIND=JPRB) :: SLHDEPSH
REAL(KIND=JPRB) :: SLHDEPSV
LOGICAL :: LRWSDLW
LOGICAL :: LRWSDLR
LOGICAL :: LRWSDLR2
LOGICAL :: LRWSDLG
LOGICAL :: LSLDIA

! ----------------------------------------------------------------------
END MODULE YOMDYNA
