MODULE YOMDFI

USE PARKIND1  ,ONLY : JPIM     ,JPRB

IMPLICIT NONE

SAVE

!**************  COMDECK YOMDFI  ************

! Filtering scheme

!   NEDFI =  0   COMPUTING DIGITAL FILTER WEIGHTS
!   NEDFI =  1   ADIABATIC DIGITAL FILTER INITIALIZATION
!   NEDFI =  2    DIABATIC DIGITAL FILTER INITIALIZATION WITHOUT CORRECTION
!   NEDFI =  3    DIABATIC DIGITAL FILTER INITIALIZATION  WITH   CORRECTION
!   NEDFI =  4   ADIABATIC DIGITAL FILTER FOLLOWED BY DIABATIC ONE
!   NEDFI =  5   MODIFIED DIABATIC DIGITAL FILTER INITIALIZATION
!   NEDFI =  6   FORWARD DIABATIC DIGITAL FILTER (FINALIZATION)
!   NEDFI =  7   BACKWARD+FORWARD DIGITAL FILTER INITIALIZATION

!   LADIFH : LOGICAL FOR HORIZONTAL DIFFUSION IN ADIABATIC INTEGRATIONS

! Filter characteristics

!   LRECURS : LOGICAL FOR USE OF RECURSIVE FILTERS
!   NTPDFI  : TYPE OF FILTER
!     NON-RECURSIVE FILTERS :
!                  1 IDEAL LOW-PASS
!                  2 IDEAL LOW-PASS WITH LANCZOS WINDOW 
!                  3 OPTIMAL
!                  4 DOLPH-CHEBYSHEV
!     RECURSIVE FILTERS :
!                  1 QUICK-START
!                  2 FLAT-DELAY
!                  3 BUTTERWORTH

!   TAUC   : CUT-OFF PERIOD (SECONDS)
!   TAUS   : PERIOD OF STOP-BAND EDGE (SECONDS) (OPTIMAL, DOLPH-CHEBYSHEV)
!   TAUP   : PERIOD OF PASS-BAND EDGE (SECONDS) (OPTIMAL)
!   NORDFI : ORDER OF FILTER (RECURSIVE)

! Other variables

!   RTDFI   : TIME-STEP FOR DFI (SECONDS)
!   RTDFIA  : --------------------------- (ADIABATIC INTEGRATIONS)
!   NSTDFI  : NUMBER OF DFI TIMESTEPS IN ONE DIRECTION
!   NSTDFIA : ---------------------------------------- (ADIABATIC)
! (caution : half-number of timesteps in one direction if NEDFI=6 or 7)
!   NOFFSETDFI : offset before starting Jc-DFI diagnostics

!   HWOPF   : FILTERING WEIGHTS
!   HWOPFA  : FILTERING WEIGHTS (ADIABATIC)
!   HWF0    : FILTERING WEIGHTS FOR THE MEAN OF THE FIELDS
!   HWFA0   : FILTERING WEIGHTS FOR THE MEAN OF THE FIELDS (ADIABATIC)
!   HWREC   : BASIC FILTERING WEIGHTS (RECURSIVE FILTERS)

!   Scale-selective DFI
!   RDFIS   : VELOCITY BELOW WHICH THERE IS NO FILTERING IN SSDFI
!             THIS IS THE VELOCITY C (m/s) IN Eq. (6) IN Termonia, 2008, MWR.

REAL(KIND=JPRB),ALLOCATABLE :: HWOPF(:,:)
REAL(KIND=JPRB),ALLOCATABLE :: HWOPFA(:,:)
REAL(KIND=JPRB),ALLOCATABLE :: HWF0(:)
REAL(KIND=JPRB),ALLOCATABLE :: HWFA0(:)
REAL(KIND=JPRB) :: HWREC(43)
INTEGER(KIND=JPIM) :: NTPDFI
INTEGER(KIND=JPIM) :: NORDFI
INTEGER(KIND=JPIM) :: NEDFI
INTEGER(KIND=JPIM) :: NSTDFI
INTEGER(KIND=JPIM) :: NSTDFIA
INTEGER(KIND=JPIM) :: NOFFSETDFI
REAL(KIND=JPRB) :: TAUS
REAL(KIND=JPRB) :: TAUP
REAL(KIND=JPRB) :: TAUC
REAL(KIND=JPRB) :: RTDFI
REAL(KIND=JPRB) :: RTDFIA
REAL(KIND=JPRB) :: RDFIS
LOGICAL :: LRECURS
LOGICAL :: LADIFH

END MODULE YOMDFI
