!
! MAIN RC FILE FOR PROCESSING BOTH EI AND OD MARS (ECMWF) MET FIELDS TO
! TM5 GLOBAL 1X1 GRID.
!
!-----------------------------------------------------------------------
! Only the following keys need to be regularly modified. They are here
! at the top of the file for quick access.

! Operational Data (od) or ERA Interim (ei) ?
!my.meteo.class  : ei
!~ new ERA5:
my.meteo.class  : ea

!! TEST: CAMS-CH4 demo month 2017-07
!timerange.start : 2015-06-30 00:00:00
!timerange.end   : 2015-08-01 00:00:00

!! TEST: single day:
!timerange.start : 2015-07-01 00:00:00
!timerange.end   : 2015-07-02 00:00:00

! TEST: rest of month:
timerange.start : 2015-07-01 00:00:00
timerange.end   : 2016-01-01 00:00:00

! extra run to producec "sub" files?
my.convec.ext   :
!my.convec.ext   : __sub


!=====================================================================!
! Run main specifications
!=====================================================================!
! [id]  basename for executable, runtime rcfile, job script (hence logfiles too), ${my.basename}__sources.tar
my.basename     : meteo_${my.meteo.class}

jobstep.length  : 1

! autorun
submit.auto     : True

! main directories
my.project.dir  : ${my.scratch}/TM5-RUNS/${my.meteo.class}-tm5-nc-1x1-prod-others${my.convec.ext}
my.run.dir      : ${my.project.dir}/rundir

! dir of standard input files (read in model init)
inputdir        : ${my.data.dir}

! run time meteo dir (not use for meteo pre-processing)
!my.meteo.dir :

!=====================================================================!
! Environment (compiler, libraries, job manager, //, ...)
!=====================================================================!

#if "${PE_ENV}" == "CRAY"
#include rc/machine-ecmwf-cca-cray.rc
#elif "${PE_ENV}" == "INTEL"
#include rc/machine-ecmwf-cca-ifort.rc
#else
#error could not load machine settings for PE_ENV "${PE_ENV}"
#endif

!my.queue.account         : nlchekli
!my.queue.account         : ${ECACCOUNT}
my.queue.account         : nlcko

my.queue.make            : F

!my.build.configure.flags : optim-none check-all
my.build.configure.flags : optim-strict

par.mpi       : T
par.nx        : 1
par.ny        : 2

!par.mpi       : T
!par.nx        : 1
!par.ny        : 1

!=====================================================================!
!   Grids & Levels
!=====================================================================!
my.levs                     :  all
! regions name
my.region1                  :  glb100x100
! grid names for meteo input (allows on the flight regridding):
my.region1m                 :  ${my.region1}

#include rc/regions-${my.region1}.rc

!=====================================================================!
! Source code
!=====================================================================!
my.source.proj : proj/inert1

!=====================================================================!
! C-preprocessors
!=====================================================================!

!my.df.define  :  with_hdf4 with_hdf5_par with_netcdf4_par
my.df.define  :  with_hdf5_par with_netcdf4_par

! macro to output pre-processed meteo
my.tmm.write  :  with_tmm_tm5 with_udunits2

! macro for input meteo from MARS @ ECMWF
my.tmm.read   :  with_tmm_ecmwf with_grib_api

my.without    :  without_advection without_convection without_diffusion without_dry_deposition without_wet_deposition without_chemistry without_emission without_photolysis

! meteo production requires
my.def_advec  : slopes

#if "sub" in "${my.convec.ext}"
my.tmm.define : ${my.tmm.read} ${my.tmm.write}
my.def_misc   : with_tmm_convec_raw without_lmax_conv
tiedtke       : T
#else
!my.tmm.define : ${my.tmm.read} ${my.tmm.write} with_tmm_convec_ec
! era5 features enabled by "with_ec_aver"
! - avaraged fields (instead of accumulated); see "tmm.F90"
! - forecast albedo and surface roughness (instead of constant?); see "grib_table.F90"
my.tmm.define : ${my.tmm.read} ${my.tmm.write} with_tmm_convec_ec with_ec_aver
my.def_misc   : without_lmax_conv
tiedtke       : F
#endif

my.tm5.define : ${my.without} ${my.def_advec} ${my.def_misc}

!=====================================================================!
! Model tuning
!=====================================================================!
! model timestep
time.ntimestep              : 3600
time.ndyn_max               : 3600
! processes
proces.advection.reduced    : F
proces.wet_removal.cp_scale : 0.5
! read diffusion coefficients (instead of calculate) (also: write if does not exist)
diffusion.write             : F
diffusion.dir               : ${my.run.dir}/output
!(diffusion dir is parent dir of diffusion files)

!=====================================================================!
! Restart files
!=====================================================================!
! initial fields
istart              : 2
! Directory (case of istart=33)
restart.read.dir    :  ${my.scratch}/TM-restart
! File (case of istart=4, 30, 31, 5)
start.31.glb100x100 :  ${my.scratch}/TM-restart/save_2005010100_glb300x200.hdf
start.31.glb600x400 :  ${my.scratch}/TM-restart/save_2005010100_glb300x200.hdf

! write restart file at end of run (T|F) ?
restart.write                 :  F
! extra restart files (T|F) ?
restart.write.extra           :  F
restart.write.extra.hour      :  00
restart.write.extra.dhour     :  24
! where to write restart files:
restart.write.dir             :  ${my.run.dir}/restart
! ensure creation of directory;
restart.install.dir           :  ${restart.write.dir}

! adhoc: for meteo production, ignore restarts, do not start from hdf save files, ...
! used in "bin/submit_tm5_setup_rcfile.py"
restart.ignore                :  T

!=====================================================================!
! METEO SETTINGS
!=====================================================================!
! - see top of the file - my.meteo.class        : ei
my.meteo.resol        : glb100x100
! - see top of the file - my.meteo.format       : tm5-nc
time.fc               : F
time.fc.day0          :
my.tmm.setup.apply    : T

!#include rc/meteo-tm5-produce-glb100x100.rc
!#include proj/cams73/rc/meteo-tm5-produce-glb100x100__${my.meteo.class}${my.convec.ext}.rc
#include meteo-tm5-produce-glb100x100__${my.meteo.class}${my.convec.ext}.rc


!=====================================================================!
! Extra ressources
!=====================================================================!
#include rc/expert-default.rc

!=====================================================================!
! Log & output dir
!=====================================================================!
! Log
okdebug               : F
go.print.all          : F
go.print.prompt.pe    : F
go.print.trace        : F
go.print.file         : F
go.print.file.base    : log.tm6

output.dir            : ${my.project.dir}/output
output.overwrite      : T

! alternative output dir
output.dir.base       :
output.dir.extensions :

output.types          : timing

!=====================================================================!
! Optional output from 'base' code
!=====================================================================!
! mean mixing ratio
output.mmix                : F

! budget fluxes through boundaries
apply.budget.global.flux   : F
budget.global.flux.lon_in  : -12
budget.global.flux.lon_out :  36
budget.global.flux.lat_in  :  34
budget.global.flux.lat_out :  62

! profiling
timing.output              : F
timing.output.subdir       : profile

!=====================================================================!
! Optional output from 'proj/user_output' code
!=====================================================================!
! none

!=====================================================================!
! PRE-Processing
!=====================================================================!

! I - Installation of input files ("install" keys)
install.tasks                 :  ${my.install.tasks} tmm.output

! II - User scripts to setup run
input.user.scripts            :  <bindir>/tm5-tmm-setup <rcfile>

!=====================================================================!
! POST-Processing
!=====================================================================!

! I - Archive output ("store" keys)
default.store.zipper          :
default.store.arch            : ${my.project.dir}/ARCHIVE
default.store.renew           : True
!----------------------------------------------------------
store.condition               : False
store.tasks                   :
sources.store.extra.command   :

! II - Touch files
output.touch                  : False

! III - Run user scripts
!output.user.scripts.condition : "%{jobstep.timerange.end}" == "%{timerange.end}"
output.user.scripts.condition : True
output.user.scripts           : <bindir>/tm5-tmm-store <rcfile>

! IV - DIADEM
!#include tools/diadem/rc/diadem.rc

!=====================================================================!
! Miscelleaneous (do not modify!)                                     !
!=====================================================================!
par.ntask : 2
