!!======================================================================
 
  SUBROUTINE summary
 
!&E---------------------------------------------------------------------
!&E                 ***  ROUTINE summary  ***
!&E
!&E ** Purpose : Summarize main parameters of the configuration
!&E
!&E ** Description :
!&E
!&E ** Called by :
!&E
!&E ** External calls :
!&E
!&E ** Reference :
!&E
!&E ** History :
!&E       !  2007-03  (V. Garnier, F. Vandermeirch) Original code
!&E       !  2009-09  (S. Michel, HOCER) add CPP keys description
!&E       !  2011-02 (B. Thouvenin) correction for key_subs_part_eqsubdt key
!&E       !  2014-10 (B. Thouvenin) add test for key parsub_adv
!&E       !  2016-12  (B.Thouvenin) version sedim_MUSTANG : only mixsed (mudsand not operationnal)
!&E
!&E---------------------------------------------------------------------





























































!! * Modules used
   USE parameters, ONLY : l_testcase,imin,imax,jmin,jmax,kmax, &
                          ishift_obc_west,ishift_obc_east,jshift_obc_south,jshift_obc_north
   USE comvars2d,  ONLY : iscreenlog,l_modele2d,dhj,h0fond,hm,hminim, &
                          fvisc,hminfrot,botstressmax,dt,dtmin,dtmax, &
                          hmaxfrot,file_bathy,filecl,fileclsv,        &
                          iwarnlog,ierrorlog,l_obc_cycl_x,l_obc_cycl_y
   USE comvars3d,  ONLY : nzinit,kzinit
   USE obccombine, ONLY : l_obc_mars,l_obc_diri,l_obc_char,l_obc_cycl

   USE comsubstance, ONLY : nvp


   IMPLICIT NONE


   include 'mpif.h'


!! * Declaration function

!! * Arguments

!! * Local declarations
   INTEGER :: IERR_MPI,nb

!!----------------------------------------------------------------------
!! * Executable part

   IF (l_testcase) THEN

     WRITE(iscreenlog,*) ' '
     WRITE(iscreenlog,*) '**************************************************'
     WRITE(iscreenlog,*) '**************** SUMMARY.F90 *********************'
     WRITE(iscreenlog,*) '**************************************************'
     WRITE(iscreenlog,*) ' '
     WRITE(iscreenlog,*) '**************************************************'
     WRITE(iscreenlog,*) '       MAIN PARAMETERS OF THE TEST CASE           '
     WRITE(iscreenlog,*) '**************************************************'
     WRITE(iscreenlog,*) ' '
     WRITE(iscreenlog,*) 'resolution',imax,jmax
     WRITE(iscreenlog,*) 'Nombre de niveau',kmax
     WRITE(iscreenlog,*) '-------------------------------'
     IF (l_modele2d) THEN
     WRITE(iscreenlog,*) ' '
       WRITE(iscreenlog,*) 'CALCUL 2D'
     ELSE
     WRITE(iscreenlog,*) ' '
       WRITE(iscreenlog,*) 'CALCUL 3D'
     END IF
     WRITE(iscreenlog,*) '-------------------------------'
     WRITE(iscreenlog,*) ' '
     WRITE(iscreenlog,*) 'dhj=',dhj
     WRITE(iscreenlog,*) 'h0fond=',h0fond
     WRITE(iscreenlog,*) 'hminim=',hminim
     WRITE(iscreenlog,*) 'hm=',hm
     WRITE(iscreenlog,*) '-------------------------------'
     WRITE(iscreenlog,*) ' '
     WRITE(iscreenlog,*) 'fvisc=',fvisc
     WRITE(iscreenlog,*) '-------------------------------'
     WRITE(iscreenlog,*) ' '
     WRITE(iscreenlog,*) 'nzinit=',nzinit
     WRITE(iscreenlog,*) 'kzinit=',kzinit
     WRITE(iscreenlog,*) '-------------------------------'
     WRITE(iscreenlog,*) ' '
     WRITE(iscreenlog,*) 'botstressmax=',botstressmax
     WRITE(iscreenlog,*) 'hminfrot=',hminfrot
     WRITE(iscreenlog,*) 'hmaxfrot=',hmaxfrot
     WRITE(iscreenlog,*) '-------------------------------'
     WRITE(iscreenlog,*) ' '
     WRITE(iscreenlog,*) 'dtini=',dt
     WRITE(iscreenlog,*) 'dtmin=',dtmin
     WRITE(iscreenlog,*) 'dtmax=',dtmax
     WRITE(iscreenlog,*) '-------------------------------'

   ELSE IF (.NOT.l_testcase) THEN
     WRITE(iscreenlog,*) 'Fichier bathymetrique :',file_bathy
     WRITE(iscreenlog,*) '-------------------------------'
     WRITE(iscreenlog,*) '--   Parametres sauvegarde   --'
     WRITE(iscreenlog,*) '-------------------------------'
     WRITE(iscreenlog,*) '---------------------------------------'
     WRITE(iscreenlog,*) '-- Parametres pour les emboitements  --'
     WRITE(iscreenlog,*) '---------------------------------------'
     WRITE(iscreenlog,*) 'Fichier utilise pour les conditions aux limites (filecl) :',filecl
     WRITE(iscreenlog,*) 'Fichier d ecriture des conditions aux limites du rang suivant (fileclsv) :',fileclsv
   END IF

   WRITE(iscreenlog,*) ' '
   WRITE(iscreenlog,*) '**************************************************'
   WRITE(iscreenlog,*) '                    USED CPP KEYS                 '
   WRITE(iscreenlog,*) '**************************************************'
   WRITE(iscreenlog,*) ' '

   WRITE(iscreenlog,*) '         OPEN BOUNDARY CONDITIONS                 '
   IF (l_obc_diri) WRITE(iscreenlog,*) 'Dirichlet s conditions'
   IF (l_obc_char) WRITE(iscreenlog,*) 'Characterics method for 2D variables'
   IF (l_obc_mars) WRITE(iscreenlog,*) 'Standard conditions (zero gradient of velocity)'
   IF (l_obc_cycl) WRITE(iscreenlog,*) 'Periodic conditions'


   IF (l_obc_cycl_x) THEN
   WRITE(iscreenlog,*) ' '
   WRITE(iscreenlog,*) '         SHIFT OF OPEN BOUNDARY CONDITIONS                 '
   WRITE(iscreenlog,*) 'to have a sufficient stencil, choose the following shifts  '
   WRITE(iscreenlog,*) 'ishift_obc_west >= 2 '
   WRITE(iscreenlog,*) 'ishift_obc_east >= 2 '
   END IF

   IF (l_obc_cycl_y) THEN
   WRITE(iscreenlog,*) ' '
   WRITE(iscreenlog,*) '         SHIFT OF OPEN BOUNDARY CONDITIONS                 '
   WRITE(iscreenlog,*) 'to have a sufficient stencil, choose the following shifts  '
   WRITE(iscreenlog,*) 'jshift_obc_south >= 2 '
   WRITE(iscreenlog,*) 'jshift_obc_north >= 2 '
   END IF

   WRITE(iscreenlog,*) ' '
   WRITE(iscreenlog,*) '         INPUT/OUTPUT FILES                       '





   WRITE(iscreenlog,*) ' '
   WRITE(iscreenlog,*) '         TIDAL FORCING                            '

   WRITE(iscreenlog,*) 'key_tide_shom              : model from the French Navy Hydrographic Service (SHOM)'




   WRITE(iscreenlog,*) ' '
   WRITE(iscreenlog,*) '         SOLAR HEAT FLUXES                    '

   WRITE(iscreenlog,*) 'default               : no solar parametrization'
   WRITE(iscreenlog,*) 'default               : Solar flux is read from an atmospherical file'


   WRITE(iscreenlog,*) ' '
   WRITE(iscreenlog,*) '         THERMAL HEAT FLUXES                    '

   WRITE(iscreenlog,*) 'key_sflx_ir_swimbank  : parameterisation by Swimbank'


   WRITE(iscreenlog,*) ' '
   WRITE(iscreenlog,*) '         TURBULENT HEAT FLUXES                    '

   WRITE(iscreenlog,*) 'key_sflx_turb_default : parameterisation from the Proudman Oceanographic Laboratory (POL)'


   WRITE(iscreenlog,*) ' '
   WRITE(iscreenlog,*) '         HORIZONTAL GRID                          '

   WRITE(iscreenlog,*) 'default               : Mercator-type grid (X: West->East, Y: South->North)'


   WRITE(iscreenlog,*) ' '
   WRITE(iscreenlog,*) '         VERTICAL COORDINATE                      '

   WRITE(iscreenlog,*) 'default               : standard sigma coordinates'


   WRITE(iscreenlog,*) ' '
   WRITE(iscreenlog,*) '         PRESSURE GRADIENT                        '

   WRITE(iscreenlog,*) 'default               : pressure jacobian'




   WRITE(iscreenlog,*) ' '
   WRITE(iscreenlog,*) '         MOMENTUM NON-LINEAR TERMS                '

   WRITE(iscreenlog,*) 'key_dyn_adv_quick     : QUICK advection scheme'



   WRITE(iscreenlog,*) ' '
   WRITE(iscreenlog,*) '         TRACER ADVECTION (T/S/Dissolved substances) '

   WRITE(iscreenlog,*) 'key_tssub_adv_ultimatequickest     : QUICKEST horizontal scheme with Ultimate limiter'




   IF(nvp > 0) THEN
     WRITE(iscreenlog,*) ' '
     WRITE(iscreenlog,*) '         TRACER ADVECTION (Particulate substances) '

     WRITE(iscreenlog,*) 'key_parsub_wquickupwind             : QUICK scheme along the vertical direction'


     WRITE(iscreenlog,*) ' '
     WRITE(iscreenlog,*) '   ADVECTION OF PARTICULATE TRACERS '

     WRITE(iscreenlog,*) 'key_parsub_wquickupwind            : QUICK scheme along the vertical direction'

   ENDIF






   nb = 0



   IF (nb > 0) THEN
     WRITE(ierrorlog,*) 'You must chose only one scheme for the advection of the tracer'
     WRITE(ierrorlog,*) 'The simulation is stopped'
     CALL MPI_FINALIZE(IERR_MPI)
     STOP
   END IF






   WRITE(iwarnlog,*) ' '
   WRITE(iwarnlog,*) ' ------------------------------------------------------- '
   WRITE(iwarnlog,*) ' If you simulate substances with settling velocity,'
   WRITE(iwarnlog,*) ' pay attention to define properly the sub time step in subreaddat.F90'
   WRITE(iwarnlog,*) ' '
   WRITE(iwarnlog,*) ' It is recommended to use key_subs_part_eqsubdt cpp key to save time'
   WRITE(iwarnlog,*) ' in the estimation of the advection :'
   WRITE(iwarnlog,*) ' then, variables are ordered according to their maximum settling velocity defined in variables.dat file'
   WRITE(iwarnlog,*) ' and the advection is computed per group of settling velocity'
   WRITE(iwarnlog,*) ' ------------------------------------------------------- '




   WRITE(iscreenlog,*) ' '
   WRITE(iscreenlog,*) '         TRACER DIFFUSION                         '

   WRITE(iscreenlog,*) 'default               : diffusion along sigma surfaces'


   WRITE(iscreenlog,*) ' '
   WRITE(iscreenlog,*) '         BIOGEOCHEMICAL TRACERS                   '

   WRITE(iscreenlog,*) 'key_substance         : transport active/passive substances'
! biochemical module

! biological module



! sedimentological module

!!#if (defined key_sedim_mixsed && defined key_sedim_mudsand)
!!   WRITE(iscreenlog,*) 'WARNING: key_sedim_MUSTANG_mudsand and key_sedim_mixsed are conflictuous'
!!#elif defined key_sedim_mixsed
   WRITE(iscreenlog,*) 'key_sedim_MUSTANG  : use sedimentological module (mixed sediment version)'
!!#elif defined key_sedim_mudsand

!!#else
!!#ifdef key_sedim_mixsed
!!   WRITE(iscreenlog,*) 'WARNING: key_sedim_MUSTANG_mixsed requires key_sedim to be activated'
!!#endif
!!#ifdef key_sedim_mudsand
!!   WRITE(iscreenlog,*) 'WARNING: key_sedim_MUSTANG_mudsand requires key_sedim to be activated'
!!#endif

! no substances transport


   WRITE(iscreenlog,*) ' '
   WRITE(iscreenlog,*) '         OFFLINE TRACER ADVECTION                '


   WRITE(iscreenlog,*) 'default               : compute dynamics and tracers advection'


   WRITE(iscreenlog,*) ' '
   WRITE(iscreenlog,*) '         AGRIF REFINEMENT                         '


   WRITE(iscreenlog,*) 'default                 : no grid refinement'


!   WRITE(iscreenlog,*) ' '
!   WRITE(iscreenlog,*) '         OPTIONAL LIBRARIES                         '

   WRITE(iscreenlog,*) ' '
   WRITE(iscreenlog,*) '         MPI PARALLELISATION                      '

   WRITE(iscreenlog,*) 'key_MPI_2D            : MPI parallelisation along the x and y directions'


   WRITE(iscreenlog,*) ' '
   WRITE(iscreenlog,*) '         LAGRANGIAN TRAJECTORIES                  '

   WRITE(iscreenlog,*) 'default               : no lagrangian floats trajectories'






   WRITE(iscreenlog,*) '**************************************************'
   WRITE(iscreenlog,*) '**************** END OF SUMMARY ******************'
   WRITE(iscreenlog,*) '**************************************************'

  END SUBROUTINE summary
