#!/bin/sh
#     keyword :: canesm_agcm
# description :: AGCM model basefile
###############################################################################
# Apr 01/2015 - ML.          --- v01 ---
# 1. This file is the official CGCM basefile for frozen area version CanAM4.4
#    (gcm18-based).
###############################################################################
 set -a
 . betapath2   # sets path for beta test version of new diagnostics package

### parmsub ###

#  * ........................... Parmsub Parameters ............................

 runid=job000; uxxx=mc; prefix="${uxxx}_${runid}"; crawork=${runid}_job;
 RUNID=`echo "${runid}"|tr '[a-z]' '[A-Z]'`;
 production=1

 modver=gcm18;
 gcmparm=gcmparm ; stime=3600 ; memory1=1000mb
 lopgm=lopgm; oldiag=diag4;

 # NOTE: use_NEMO must not be defined in the cppdefs_file
 use_nemo=off
 use_cancpl=on

 gcm_inpfls_extra=gcm_inpfls_extra

 year="yyyy"; mon="mm"; year_restart="yyyy"; mon_restart="mm";
 months=1; months_run=1;kfinal="0000000000";
 model=${prefix}_${year}_m${mon}_;
 start=${prefix}_${year_restart}_m${mon_restart}_;
 job="$runid"; run="${RUNID}_${year}_M${mon}";

 username="acrnxxx"; user="XXX"; nqsprfx="${model}"; nqsext="";

 initime=1801;  initmem="15000mb";
 gcmtime=10800; gcmmem="15000mb";

 iyear=" 1850"; iday="  001"; gmt=" 0.00"; incd="    1";

 runmode=SPBC-AGCM
 model_variant=p2

# post-processing switch
# with_post_processing = 1 means to post-process model output on frontend
# with_post_processing = 0 means to run model only
 with_post_processing=1

 # 3-node configuration (CanAM: 3 nodes, CanCPL - 1 node shared with AGCM)
 phys_node=3
 nproc_a=2
 nnode_a=32
 nproc_o=1
 nnode_o=0
 nproc_c=1
 nnode_c=1
 cmd_runp1='PMI_NO_FORK=1 aprun -n 33 -N 11 -d 3 -j 1 -cc depth env OMP_NUM_THREADS=3 ./gcmcpl_script '
 cmd_runp2=' '
 cmd_runp3=' '

 # Number of MPI tasks
 nnodex=33
 # Number of physical nodes to map the job to
 phys_nodex=$phys_node

 isoc="    1"; ires="    1";
 ifdiff="    0"; isen="    1";

 issp="   24"; isgg="   24"; israd="   12"; isbeg="   12";
 jlatpr="    0";icsw="    4"; iclw="    4";  iepr="    0";  istr="   24";
   ishf="    4";isst="    2"

 # A netcdf file containing the horizontal grid description for the atm
 # atm_grid_desc=grid_desc_t63_o_gcm3.5_landmask_128x64v5.nc
 atm_grid_desc=''

 # A netcdf file containing the horizontal grid description for the ocean
 # ocn_grid_desc=grid_desc_ocnt_o_uwl_canesm4_1_1_256x192l40_datadesc.nc
 # ocn_grid_desc=grid_desc_orca1_nemo_3.4_orca1_coordinates_ukorca1_with_mask.nc
 ocn_grid_desc=''

 # A netcdf file containing the horizontal grid description for the CanOM4 ocean
 # canom4_grid_desc=grid_desc_ocnt_o_uwl_canesm4_1_1_256x192l40_datadesc.nc

 # A restart from a CanESM4 coupled run
 # canesm4_cpl_restart=mc_cpl_gcm18_init_2320_m12_cs

 # Residual climatology
 resid=pa_gcm17_mix18_64bit_2004m01_2008m12_res;

# AMIP BC files - make sure it is consistent with coupler_specified_bc_file CPP flag below!
 coupler_specified_bc_file='';
 coupler_specified_bc_file_sicn=td_pcmdi-amip-1-1-3-v1_187001-201706_gp_128_64_sicn;
 coupler_specified_bc_file_gt=td_pcmdi-amip-1-1-3-v1_187001-201706_gp_128_64_gt;
 coupler_specified_bc_file_sic=td_orap5-piomas-v1_187001-201706_gp_128_64_sic;
 coupler_specified_bc_file_clim='';
 coupler_specified_bc_file_gtano='';

 pakgcm=pakgcm9

 icntrldat=icntrldat2
 nlcjcl=nlcjcl2

 gpinit=ie791gp
 inatmo=inatmo12
 inphys=inphys19

 llphys=iph18lp
 veg=glc2000_1_12x1_12_v2
 soci=mksmksrf_soilcol_global_c090324_cccma

 oz=ozclim_zonal_cmip6
 oz_chem=randel_ozclim_3d_1980_1999

# oz_rad_trans/oz_chem_trans are the names of the transient ozone concentration data
# (rcp26,rcp45,rcp85 - choose one!).
# NOTE!!! Use rcp45 for historical runs!!!!
 oz_rad_trans=cmip6_radozone_histo_picontrol_1850_2014_monthly_128_64
# oz_chem_trans=rcp45_ozone_chem_1850_2100_monthly_128_64

 ssti=ssti_amip2_360_180
 oxi=iphoxlp_cmam-961v_128_64
 mtnfile=opt_phis_t63
 spfilt=hoskfilt_r_12_n61_t63_tst
 maskfile=t63_to_orca1_fland_caspian
 flaku=ulake_definition4_06_thresh_quadrt_0.5_noant
 flakr=flakr_zero
 subfle=etopo5_gau_020_opt_200_129_64
 albtable=nasa_albedo_lookup_table_v3
 snow_rt_lut=snow_rt_lut2

# files for PLA.
 actdat0=urks_actdat0
 actdat1=urks_actdat1
 coagdat=urks_coagdat
 amdat=urks_amdat4
 ssdat=urks_ssdat

# llchem is the name of the non-transient aerosol emissions forcing data.
# llchem=ipemi_cl_128_64;
# llchem=ipemi_cl_128_64_duemi_orilai;
  llchem=ipemi_cl_128_64_duemi_orilai_l10_suz0;

# lltrans is the name of the transient aerosol emissions forcing data.
# CMIP6
  lltrans=input4mips_emissions_cmip_175001_201412_128_64_v1;

# Historic+Future (IPCC) for RCP2.6, RCP4.5 and RCP8.5 (rcp26,rcp45,rcp85 - choose one!):
# NOTE!!! Use rcp45 for historical runs!!!!
#  lltrans=urks_ar5_rcp45_1850_2100_128_64_int;
#  lltrans=emi_ar5_rcp45_1850_2100_128_64;

# Old Historic to 2005(IPCC):
# lltrans=emi_ipcc_hist_128_64;
# Historic (old approach):
# lltrans=ipchmphs_tr_128_64;

 # The "em_aerosols" parameter determines the emissions to be used from sources
 # which **could** be transient in nature, as follows:
 #
 # em_aerosols =   -1     continuously update aerosol emissions time series from data in the file "lltrans"
 #             = -YYYYMM  use an annual cycle from year abs(YYYYMM)/100 in the file "lltrans"
 #             =    0     use AEROCOMM data which has repeated annual cycle
 # NOTE!!! For now, there must be a consistency between this switch and the cpp directive
 #         "transient_aerosol_emissions" in the CPP_I section. That is, for em_aerosols=0,
 #         one must use "#undef transient_aerosol_emissions" and alternatively otherwise,
 #         "#def transient_aerosol_emissions". There is a consistency check done in the
 #         AGCM driver to ensure that this does not slip under the radar. Once the
 #         methodology is in place, the direct cpp directive will be removed and these
 #         comments modified to reflect the documentation of how things are done.
 em_aerosols=-1

 # The "conc_ozone" parameter determines concentrations which **could** be transient in nature, as follows:
 #
 # conc_ozone  =   -1     continuously update ozone concentrations form data in the file "oztrans"
 #             = -YYYYMM  use an annual cycle from year abs(YYYYMM)/100 in the file "oztrans"
 #             =    0     use the data in the file "ozclim_zonal", which has repeated annual cycle
 # NOTE!!! For now, there must be a consistency between this switch and the cpp directive
 #         "transient_ozone_concentrations" in the CPP_I section. That is, for conc_ozone=0,
 #         one must use "#undef transient_ozone_concentrations" and alternatively otherwise,
 #         "#def transient_ozone_concentrations". There is a consistency check done in the
 #         AGCM driver to ensure that this does not slip under the radar. Once the
 #         methodology is in place, the direct cpp directive will be removed and these
 #         comments modified to reflect the documentation of how things are done.
 conc_ozone=-1

 # ghg_scenario is the name of a file containing all GHG time series data
 # for a particular scenario.
 # If ghg_scenario is not set then GHG time series will be set to a CONSTANT
 # default value.
 ghg_scenario=mole_fraction_in_air_input4MIPs_GHGConcentrations_CMIP_UoM-CMIP-1-2-0_gr1-GMNHSH_0000-2014_v1

 # The ghg_xxx parameters determine how the data in ghg_scenario
 # is to be interpolated. ghg_xxx is one of
 # ghg_co2, ghg_ch4, ghg_n2o, ghg_cfc11, ghg_cfc12, ghg_cfc113, ghg_cfc114
 #
 # ghg_xxx =   -1     continuously update GHG time series from data in the file
 #         = YYYYMMDD use a constant value from YYYY/MM/DD
 #         = -YYYYMM  use an annual cycle from year abs(YYYYMM)/100
 #         =    0     use a default constant value (the value set in radcons4)
 # The default value when ghg_xxx is not set is "0"
 ghg_co2=-1
 ghg_ch4=-1
 ghg_n2o=-1
 ghg_cfc11=-1
 ghg_cfc12=-1

# datadest=pollux; datadir=/data/ccrn/r04

 # solvarfile contains time depent values of perturbations to the solar constant
 # broken down into separate values for radiation bands and sub bands
 # CMIP5 dataset
 #solvarfile=hist_15g_solar_cmip5_lean_6may09_1850_2300_monthly_anom
 # CMIP6 dataset
 solvarfile=solarforcing-ref-mon_input4MIPs_solar_CMIP_SOLARIS-HEPPA-3-2_gn_18500101-22991231_anom_v1

 # The "vtau_scn_mode" parameter determines the nature of the time variations in the stratospheric aerosols.
 #
 # vtau_scn_mode  =   -1     continuously update stratospheric aerosols form data in the file "vtau"
 #                =  YYYYMM  use a constant value from YYYY/MM in the file "vtau"
 #                = -YYYYMM  use an annual cycle from year abs(YYYYMM)/100 in the file "vtau"
 # The default value when vtau_scn_mode is not set is -1.  This means that the run will die if
 # the runs extends longer than the available dataset.
 vtau_scn_mode=-1
# vtau_scn_mode=200501

 # The vtaufile_type parameter defines the "type" of the stratospheric aerosol forcing file.
 # vtaufile_type = 1 is a dataset that only contains optical thickness at 550 nm
 #   - for example, sato_volcanic_4_tau_t63_1850_2300_monthly
 # vtaufile_type = 2 is a dataset that contains optical properties in the CCCma radiation bands
 # with data on pressure levels
 #   - for example, cmip_canesm_radiation_185001-201412_v1
 # NOTE: The value of vtaufile_type and vtaufile must be consistent or the run will crash

 vtaufile_type=2

 # The "vtau_offset_year" offset year for the file with the stratospheric aerosols.
 #
 # vtau_offset_year  =   0 (default) read the forcing data for the same year as the model year
 #                   =  +N read the forcing data for the year ($year + N)
 #                   =  -N read the forcing data for the year ($year - N)
 vtau_offset_year=0
 # year_vtau_offset = $year + $vtau_offset_year
 year_vtau_offset=`echo $year $vtau_offset_year | awk '{printf "%04d",$1+$2}'`

 # Transient volcanic aerosol optical depths from Sato et al (4 lat bands, monthly)
 # vtaufile=sato_volcanic_4_tau_t63_1850_2300_monthly
 # Transient volcanic aerosol optical depths from Vernier (4 lat bands, monthly)
 # vtaufile=ver_sol_2011_volcanic_tau_t63_1985_2022_monthly
 # Transient stratospheric aerosol optical properties from ETHZ (latitude, 70 levels, monthly)
 vtaufile=cmip_canesm_radiation_185001-201412_v3.0.1
 # "Control" 1850 stratospheric aerosol optical properties from ETHZ (latitude, 70 levels, monthly)
 # vtaufile=cmip_canesm_radiation_1850_control_v3.0.1

 # Tropopause climatology derived from a 5 year t63, 71 level gcm13d run
 tropclim=trop_clim_ms_z_t63_monthly

 # em_xxx =   -1     continuously update emission from 1850 to 2100
 #        = yyyymmdd use the emission of day "dd" of month "mm" of the year "yyyy"
 #        = -YYYYMM  use an annual cycle from year abs(YYYYMM)/100
 #        =    0   turn it off
 #
 emis_co2_file="co2_nolu_rcp45_1850-2100_128x64_mm"
 em_co2="       0";

 # initpool     = 0               initialize pools from zero
 #              = year            initialize pools from that year from file on disk
 #              = negative value  initialize pools from coupler restart file
 #
 # lndcvrmod    = 12345  continuously update land cover from 1850 to 2100
 #              = year   use the land cover of July of that year continously
 #
 # lndcvr_offset = offset between model year and calendar year (model + offset = calendar)
 # the following line initializes CTEM pools from zero
 # initpool="00000"; lndcvrmod="01850"; lndcvr_offset="00000";
 initpool="-1000"; lndcvrmod="12345"; lndcvr_offset="00000";

# ctem_an="uvalsml_t63_ctem_an_file_with_wetlands";
 ctem_an="ctem_an_file_for_cmip6_sep_2017_129_64";

# lndcvr="uvalsml_luh_av1_1850_2100_rcp45_land_cover_crops_linear_128_64";
 lndcvr="uva_cmip6_luh_v2h_land_cover_1850_2014_linear_128_64_aug_2017";

 # T63 iron mask
 ironmask="uwl_t63_ironmask_256x192l40_10_levels_only"

 # The following radiative forcing parameters are only used when
 # "#define radforce" is defined in the model update section below.

 # assign the radiative forcing scenario identifier
 # valid values :: SRESA1B SRESA2 SRESB1 2XCO2 4XCO2 2X4XCO2 CFMIPA TEST VOL AERORF PAMRF GHAN 4XCO2_GHAN
 RF_SCENARIO=TEST

 # trop_idx is the model level index at which the tropopause is assumed
 # to exist for the adjusted radiative forcing case. If trop_idx=0 then
 # instantaneous radiative forcing will be used. If trop_idx<0 then a
 # tropopause height will be generated internally by the model.
 # trop_idx=-1  # adjusted radiative forcing
 trop_idx=0  # instantaneous radiative forcing

 # start_year_r is the starting year for an IPCC experiment (e.g. 1850)
 # It is used only in certain scenarios, currently SRESA1B SRESA2 and SRESB1
 start_year_r=1850

 # NRFP is the number of secondary radiation calls that will be made
 # This must be consistent with the value of RF_SCENARIO
 case $RF_SCENARIO in
   SRESA1B|SRESA2|SRESB1)
            NRFP=1
            start_year_r=1850 ;;
     2XCO2) NRFP=1 ;;
   2X4XCO2) NRFP=2 ;;
4XCO2_GHAN) NRFP=2 ;;
    CFMIPA) NRFP=3 ;;
    AERORF) NRFP=6 ;;
     PAMRF) NRFP=6 ;;
         *) NRFP=1 ;;
 esac

#/ This is for saving high-frequency output at select points.
 cf_sites="off"
 cf_sites_file="cmip6-cfsites-locations_v1.txt"

# Required parmsub parameters for gcmparm
# (* denotes a critical parameter which must appear in the ##PARC section)
#ex   * ilev   = number of vertical model    levels                (e.g.  35)
#ex   * levs   = number of vertical moisture levels                (e.g.  35)
#ex   * lonsld = number of longitudes         on the dynamics grid (e.g. 144)
#ex   * nlatd  = number of gaussian latitudes on the dynamics grid (e.g.  72)
#ex     lond   = number of grid points per slice for dynamics      (e.g. 144)
#ex   * lonsl  = number of longitudes         on the physics  grid (e.g.  96)
#ex   * nlat   = number of gaussian latitudes on the physics grid  (e.g.  48)
#ex     lon    = number of grid points per slice for physics       (e.g.  96)
#ex   * lmt    = spectral truncation wave number                   (e.g.  47)
#ex     ioztyp = switch for input ozone distribution               (e.g.   2)
#ex   * ntrac  = total number of tracers in the model              (e.g.  17)
#ex   * itraca = number of advected tracers in the model           (e.g.  12)
#ex     nnode_a= number of smp nodes used to run atm (mpi for nnode_a>1)
#ex     ntld   = number of land  tiles in CLASS
#ex     ntlk   = number of lake  tiles in CLASS
#ex     ntwt   = number of water tiles in CLASS
#ex     iflm   = integer switch to control fractional land mask (iflm=1 -> on)
#
#       nnode_a is defined before gcmsub at the top of this script
#
    lon="  128";
   lond="  192";
 ioztyp="    6";

# --------------- Coupled Model Parameters -----------------
#
#
#     ocnmod: 0 = specified ocean temperature
#             1 = slab ocean
#             2 = NCOM 1.3 3D ocean model
#
#     icemod: 0 = specified ice
#             1 = thermodynamic + cavitating ice dynamics
#
#     rivmod: 0 = no targetting of land runoff to oceans
#             1 = targetting of land runoff using River Routing Scheme
#
#      iflux: 0 = adaptation (climatology file required)
#             1 = flux adjustment (flux correction file required)
#             2 = no flux correction
#
#  couplermod 0 = Standard mode
#             1 = NCOM/Coupler only mode

    ocnmod="00002";
    icemod="00001";
    rivmod="00001";
     iflux="00002";
couplermod="00000";

# --------------------- Time Parameters --------------------
#
# ncount:   Maximum number of coupling step before CGCM  stops and then
#           resubmits itself to the NQS queue.
#
# atmsteps: Coupling Frequency for the Atmospheric model (in seconds)
#
# ocnsteps: Coupling Frequency for the Ocean model (in seconds)
#
# ksteps:   Number of AGCM model time steps in a job (must be equal to
#           length of atmsteps)

   ncount="00032";
   atmsteps="  86400";
   ocnsteps="  86400";
#
   ksteps="   96";
   loop=1;

# -----------------------------------------------------------

 iocean="00000";
 if [ "$ocnmod" = "00001" ] ; then
   oceanslab=on;
   iocean="00001";
 fi

 if [ "$ocnmod" = "00002" ] ; then
   oceanslab=off;
   iocean="00001";
 fi

 if [ "$couplermod" = "00001" ] ; then
   oceanonly=on;
 else
   oceanonly=off;
 fi

 clim="udr_cgcm3.1_adaptation_256x192l29v1_v2";

 ocnmix=uwl_e_mix_t63_tidal_eddy_v2.dat

 # Daily chlorophyll climatology on ocean grid
 clim_bch=uwm_seawifs_bch_day_256x192v1

 # Flux added to heat and moisture fluxes; interpolated daily from mid-months values
 flux="mc_t63_zero_flux_year";

 # Flux added to heat and moisture fluxes; constant value from mid-month to mid-month
 flux2="mc_t63_zero2_flux_year";

#target="uva_128_64_river_parameters_v6";
# target="uva_river_parameters_128_64_aug_2016_for_cmip6_canesm_runs"
# target="uva_river_parameters_128_64_nov_2016_for_cmip6_canesm_runs"
# target="uva_river_parameters_128_64_dec_2016_for_cmip6_canesm_runs"
 target="uva_river_parameters_128_64_may_2017_cmip6_with_caspian_inland_lakes_t63_to_orca1_fland_caspian";
 lakes="gcm3.5_128x64_v5_lake_parameters_v2";

# cgcm_source="/users/tor/acrn/src/source/lsocn/CanESM4.3_cmip6_start";
# user_source="/users/tor/acrn/src/source/lsocn/CanESM4.3_cmip6_p02_agcm_ctem_river_routing_salinity_drift_fix";

## =========================================================================================
#  AGCM relaxation options
## =========================================================================================

 target_ss_pfx='' # target ss files. If not defined, use reanalysis.

 # reanalyses settings
#  reanal_use_era_t63l60=on # =on to use ERA-I T63L60 instead of T120L37
#  RUNPATH_SPCFILE=$RUNID_ROOT/../td_era_int_t63l60_${modver}_t63 # save location
 reanal_use_era_t63l60=off # =on to use ERA-I T63L60 instead of T120L37
 RUNPATH_SPCFILE=$RUNID_ROOT/../td_era_int_${modver}_t63 # save location

 reanal_use_era_yotc=off # =on to use ERA-YOTC for 2008m05 - 2010m04
 reanal_force_sp2ss=off # =on to recompute spectral files
 reanal_debias_ncep=on # =on to remove bias from NCEP reference based on the 1979-2001 period
 reanal_debias_era40=on # = on to remove bias from ERA40 based on the 1979-2001 period
 reanal_add_top_levels_to_ncep=on # =on to add top levels to NCEP reanalysis
 reanal_tfilter=_ngaus3 # time filter suffix for output bias-corrected files
 reanal_ncep_bias=td_ncep-eraint_isobaric_t63_1979_2001_sp_ac${reanal_tfilter} # NCEP vs ERA-I bias
 reanal_era40_bias=td_era40-eraint_isobaric_t72_1979_2001_sp_ac${reanal_tfilter} # ERA40 vs ERA-I bias
 reanal_ncep_top_levels=td_ncep-eraint_isobaric_t63_1979_2001_sp_ac_top${reanal_tfilter} # NCEP vs ERA-I top levels
 reanal_spcfile_save=on # save spectral reference files on disk

 # upper soil level files
#  target_soil_tg1=td_era40_eraint_195709_201805_dp_128_64_soit1 # upper level soil temperature
#  target_soil_wg1=td_era40_eraint_195709_201805_dp_128_64_soim1 # upper level soil volumetric moisture
 target_soil_tg1='' # upper level soil temperature
 target_soil_wg1='' # upper level soil volumetric moisture

 # Ocean surface files
#  target_ocn_sst=td_ncep_era40_eraint_194801_201708_dp_128_64_sst # SST
#  target_ocn_sicn=td_hadisst2.2_128x64_1850_2017m07_dp_sicn # SICN
#   target_ocn_sic=td_piomas_orap5_194701_201710_dp_128_64_sic # PIOMAS & ORAP5 in SH
#  # target_ocn_sic=td_piomas_194701_201710_dp_128_64_sic # PIOMAS SIC is available only in Arctic
#  # target_ocn_sic=td_piomas_cfsr-cfsv2_194701_201710_dp_128_64_sic # PIOMAS & CFSR/CFSv2 in SH
 target_ocn_sst=''  # SST
 target_ocn_sicn='' # SICN
 target_ocn_sic=''  # SIC

# climatological empirical correction
#  tspcclim=da_gcm16_01_rlx27_1981_2010_ss_ac_daymean${reanal_tfilter};  # spectral
#  tgrdclim=da_gcm16_01_rlx27_1981_2010_ggtend_ac${reanal_tfilter}_t127; # gridded
 tspcclim='' # spectral
 tgrdclim='' # gridded

# CPP definitions files
 cppdefs_file=$CCRNSRC/CanESM/CONFIG/AMIP/cppdefs/cppdefs_32bit_default
 cppdefs_diag=$CCRNSRC/CanESM/CONFIG/AMIP/cppdefs/cppdefs_diag_default

#  * .................... Begin Critical Parameters ...........................
##PARC

    lmt="   63"     ;
  nlatd="   96"     ; lonsld="  192"     ;
   nlat="   64"     ;  lonsl="  128"     ;

   delt="    900.0" ;    lay="    2"     ;

   ilev="   49"     ;   levs="   49"     ;
  ntrac="   16"     ; itraca="   12"     ;
  coord=" ET15"     ;   plid="      50.0";
  moist=" QHYB"     ; itrvar="QHYB"      ;

  ntld="    1";   ntlk="    3";   ntwt="    2";   iflm="    1";

  g01="-0108"; g02="-0144"; g03="-0190"; g04="-0250"; g05="-0327";
  g06="-0426"; g07="-0550"; g08="-0708"; g09="-0904"; g10="   11";
  g11="   15"; g12="   18"; g13="   23"; g14="   28"; g15="   35";
  g16="   43"; g17="   52"; g18="   64"; g19="   77"; g20="   92";
  g21="  110"; g22="  131"; g23="  154"; g24="  181"; g25="  211";
  g26="  245"; g27="  283"; g28="  325"; g29="  370"; g30="  420";
  g31="  474"; g32="  531"; g33="  592"; g34="  648"; g35="  698";
  g36="  742"; g37="  780"; g38="  813"; g39="  841"; g40="  865";
  g41="  885"; g42="  902"; g43="  916"; g44="  930"; g45="  944";
  g46="  958"; g47="  972"; g48="  986"; g49="  995"; g50="     ";
  h01="-0108"; h02="-0144"; h03="-0190"; h04="-0250"; h05="-0327";
  h06="-0426"; h07="-0550"; h08="-0708"; h09="-0904"; h10="   11";
  h11="   15"; h12="   18"; h13="   23"; h14="   28"; h15="   35";
  h16="   43"; h17="   52"; h18="   64"; h19="   77"; h20="   92";
  h21="  110"; h22="  131"; h23="  154"; h24="  181"; h25="  211";
  h26="  245"; h27="  283"; h28="  325"; h29="  370"; h30="  420";
  h31="  474"; h32="  531"; h33="  592"; h34="  648"; h35="  698";
  h36="  742"; h37="  780"; h38="  813"; h39="  841"; h40="  865";
  h41="  885"; h42="  902"; h43="  916"; h44="  930"; h45="  944";
  h46="  958"; h47="  972"; h48="  986"; h49="  995"; h50="     ";

# namelists

 sref="   7.18E-3";   spow="        1.";
 ilaun=0;

# tracer names

  it01=LWC;  it02=IWC;  it03=BCO;  it04=BCY;  it05=OCO;
  it06=OCY;  it07=SSA;  it08=SSC;  it09=DUA;  it10=DUC;
  it11=DMS;  it12=SO2;  it13=SO4;  it14=HPO;  it15=H2O;
  it16=CO2;

# tracer reference values (default=0 for all tracers)

  xref01=0.         #   LWC
  xref02=0.         #   IWC
  xref03=5.03e-10   #   BCO
  xref04=3.93e-10   #   BCY
  xref05=2.27e-09   #   OCO
  xref06=3.35e-09   #   OCY
  xref07=1.35e-08   #   SSA
  xref08=1.07e-07   #   SSC
  xref09=3.57e-06   #   DUA
  xref10=2.79e-05   #   DUC
  xref11=2.91e-10   #   DMS
  xref12=5.72e-09   #   SO2
  xref13=1.41e-09   #   SO4
  xref14=0.0        #   HPO
  xref15=0.0        #   H2O
  xref16=0.0        #   CO2

# tracer power values (default=1 for all tracers)

# tracer advection: 1/0 flag for tracer advection (on/off)
  adv01=0;   adv02=0;  adv03=1;   adv04=1;    adv05=1;
  adv06=1;   adv07=1;  adv08=1;   adv09=1;    adv10=1;
  adv11=1;   adv12=1;  adv13=1;   adv14=0;    adv15=0;
  adv16=1;

# tracer physics: 1/0 flag for physics on tracer turned on/off
#                 phxx=1 by default for all tracers
  phs01=0;  phs02=0;  phs15=-1;

# molecular weights in g/mole (-1 means no chemistry and not used)
  mw01=18.015;  mw02=18.015;  mw03=-1.;     mw04=-1.;  mw05=-1.;
  mw06=-1.;     mw07=58.443;  mw08=58.443;  mw09=-1.;  mw10=-1.;
  mw11=32.064;  mw12=32.064;  mw13=32.064;  mw14=-1.;  mw15=18.015;
  mw16=44.011;

# tracer surface flux:
  srf01=0;   srf02=0;  srf03=0;   srf04=0;    srf05=0;
  srf06=0;   srf07=0;  srf08=0;   srf09=0;    srf10=0;
  srf11=0;   srf12=0;  srf13=0;   srf14=0;    srf15=0;
  srf16=2;

# wet deposition (default=0 for all tracers)
  wet01=0;
  wet02=0;
  wet03=-1;
  wet04=1;
  wet05=-1;
  wet06=1;
  wet07=1;
  wet08=1;
  wet09=1;
  wet10=1;
  wet11=0;
  wet12=1;
  wet13=1;
  wet14=0;
  wet15=0;
  wet16=0;

# dry deposition (default=0 for all tracers)
  dry01=0;
  dry02=0;
  dry03=1;
  dry04=1;
  dry05=1;
  dry06=1;
  dry07=1;
  dry08=1;
  dry09=1;
  dry10=1;
  dry11=0;
  dry12=1;
  dry13=1;
  dry14=0;
  dry15=0;
  dry16=0;

# convective chemistry (default=0 for all tracers)
  cch01=0;
  cch02=0;
  cch03=-1;
  cch04=1;
  cch05=-1;
  cch06=1;
  cch07=1;
  cch08=1;
  cch09=1;
  cch10=1;
  cch11=0;
  cch12=1;
  cch13=1;
  cch14=1;
  cch15=0;
  cch16=0;

# boundary condition concentrations (ppm)

# initial data for tracer?
  sdn="    0"

# tile names

  ilt01=GEN;
  ikt01=ULK; ikt02=RWT; ikt03=RIC;
  iwt01=WAT; iwt02=SIC;

#  * ...................... End Critical Parameters ...........................

###

 # --- CanCPL coupler related parameters ---
 use_cancpl=$use_cancpl
 cancpl_ver=''
 cancpl_repo=''
 build_cpl_opts="-k xlfimp=on "

 # cpl_rs_abort_if_missing_field = .false. means that the coupler will not abort
 # when it encounters a missing field in the coupler restat file.
 # The default is to abort in this situation.
 # The only valid values for cpl_rs_abort_if_missing_field are .true. or .false.
 cpl_rs_abort_if_missing_field=''

 # Is a bulk formulation used in the coupler to define fields sent to NEMO
 # The only valid values for bulk_in_cpl are .true. or .false.
 bulk_in_cpl=''

 # couple_serial = .true. means couple in serial mode (the agcm runs then the ocean runs)
 # This should never be set unless debugging requires serial mode
 # The only valid values for couple_serial are .true. or .false. (default .false.)
 couple_serial=''

 # Save coupler history files to DATAPATH
 save_cplhist=''
 save_cplhist_tavg=''

 # When cpl_zero_runoff = on then runoff will zeroed in the coupler before being sent to the ocean
 cpl_zero_runoff=''

 # A value to add to the year (coupler time) when reading AGCM specified boundary conditions
 # (GT, SIC, SICN) from a file to get a different year from the file
 # specified_bc_year_offset is added to the current year, as determined by the coupler,
 # so a negative value will be subtracted
 specified_bc_year_offset=''

 #Specify the type of remapping used to remap windstress
 windstress_remap=''

 # Check to ensure that landfrac computed in coupler and restart are the same (retain behavior for p1)
 landfrac_bug=''

 # --- NEMO related parameters ---
 # If use_nemo = on then the NEMO ocean will be coupled with the AGCM
 use_nemo=$use_nemo

 # If defined, nemo_rebuild_rsin is the name of a NEMO restart tarball that will be
 # used to initialize fields that are sent from the coupler to the agcm on the first
 # coupling interval. This restart will be rebuilt on the global ORCA grid prior to model
 # execution and then read by the coupler to extract the relevant fields.
 nemo_rebuild_rsin=''

 # nemo_exec, nemo_ver, nemo_repo, nemo_build_opts are only used when nemo_compile = on
 # If nemo_exec is defined then a nemo executable by that name must be saved on DATAPATH
 # and this executable will be accessed and use when nemo_compile = off
 # If nemo_exec is not defined then a nemo executable will be compiled using information
 # from the variables nemo_ver, nemo_repo and nemo_build_opts when nemo_compile = on
 nemo_exec=''
 nemo_ver=''
 nemo_repo=''
 # Add or remove cpp keys when compiling nemo
 nemo_add_cpp_keys=''
 nemo_del_cpp_keys=''
 nemo_build_opts="arch=xlf_aix-cancpl refcfg=CCC_CANCPL_ORCA1_LIM cfg=CCC_CANCPL_ORCA1_LIM"
 nemo_compile=off

 # nemo_config identifies a particular configuration (e.g. CCC_CANCPL_ORCA1_LIM)
 nemo_config=''

 # Namelists for NEMO IO
 # nemo_iodef=cancpl_orca1_lim_iodef.xml
 # output_level is NEMO priority level of output variables
 # nemo_xmlio_server_def=cancpl_orca1_lim_xmlio_server.def
 nemo_iodef=''
 output_level=''
 nemo_xmlio_server_def=''

 nemo_jpni=''
 nemo_jpnj=''
 nemo_jpnij=''

 # output the initial state (nemo_nn_istate = 1) or not (nemo_nn_istate = 0)
 nemo_nn_istate=''

 # time steps between creation of NEMO restart files (modulo referenced to 1)
 nemo_nn_stock=''

 # nemo_from_rest is used to flag starting nemo from rest rather than a restart
 # If nemo_from_rest = on then nemo_restart must be undefined
 # If nemo_from_rest = on then nemo_namelist and nemo_namelist_ice must be defined
 nemo_from_rest=''

 # The name of a tar file containing the NEMO restart files
 # This must be set for the first job of a run unless nemo_from_rest = on
 # Restart files created by the submission job will have names of the form
 #     ${uxxx}_${runid}_YYYYMMDD_restart.tar
 nemo_restart=''

 # nemo_carbon = off means use physical ocean only
 # nemo_carbon = on  means include PISCES
 nemo_carbon=off

 # nemo_trc = off means no passive tracers
 # nemo_trc = on  means include passive tracers (TOP).
 nemo_trc=off

 # nemo_cmoc = off means use PISCES
 # nemo_cmoc = on means use CMOC
 nemo_cmoc=off

 # nemo_cfc = off means CFCs are disabled
 # nemo_cfc = on means CFCs are enabled
 nemo_cfc=off

 # nemo_pisces_offline = off means use online model
 # nemo_pisces_offline = on  means use offline model with prescribed velocities
 nemo_pisces_offline=off

 # Identify files containing namelist input for NEMO (namelist) and LIM or CICE (namelist_ice)
 # These namelist files are only used when starting from rest or when nemo_force_namelist = on
 # These files must be saved on DATAPATH
 # nemo_namelist=cancpl_orca1_lim_namelist
 # nemo_namelist_ice=cancpl_orca1_lim_namelist_ice
 nemo_namelist=''
 nemo_namelist_ice=''

 # If nemo_force_namelist = on then
 #   if nemo_namelist or nemo_namelist_ice are defined then use these files found on disk
 #   else look for namelist files in the current nemo repos config directory
 # else
 #   use naemlist files found in the restart
 # endif
 nemo_force_namelist=on

 nemo_ln_rnf=.true.
 nemo_ln_rnf_emp=.true.
 nemo_runoff_core_monthly=''

 nemo_hist_file_suffix_list=""
 nemo_hist_file_freq_list=""
 nemo_hist_file_suffix_list_save=""
 nemo_hist_file_freq_list_save=""

 # Settings for NEMO AR6 diagnostics
 nemo_ln_diaptr=.true.
 nemo_ln_diaznl=.false.
 nemo_ln_subbas=.true.
 nemo_ln_ptrcomp=.true.
 nemo_nn_fwri=24

 # nemo_steps_in_job is the number of NEMO time steps to run
 # This number is determined internally and so is not normally set here
 # but it may be used for debugging (caveat lector)
 nemo_steps_in_job=''

 # Save NEMO history files to DATAPATH
 nemo_save_hist=on

 # Save NEMO restart files to DATAPATH
 nemo_save_rs=on

 # Dump NEMO restart archives to cfs
 nemo_dump_rs=off

 # Delete the previous nemo restart tar archive from DATAPATH.
 nemo_del_rs=off

 # NEMO time step in seconds
 nemo_rn_rdt=3600

 # remove (nemo_nn_closea = 0) or keep (nemo_nn_closea = 1) closed seas and lakes (ORCA)
 nemo_nn_closea=0

 # The index of the first NEMO time step
 nemo_nn_it000='1'

 # nemo_nn_ice identifies the ice model used in NEMO
 #   nemo_nn_ice = 0 mean no sea ice
 #   nemo_nn_ice = 2 mean LIM2
 #   nemo_nn_ice = 4 mean CICE
 nemo_nn_ice=2

 # nemo_ln_ctl toggles printing of diagnostic messages from NEMO
 # nemo_ln_ctl must be either .false. or .true. (ie a fortran logical constant)
 # since it is read from a fortran namelist
 nemo_ln_ctl=.true.

 # nn_fsbc is the number of NEMO time steps between each call to the surface
 # boundary condition routines (including the sea ice model)
 nemo_nn_fsbc=3

 # nemo_nn_msh  determines if NEMO will create (=1) a mesh file or not (=0)
 nemo_nn_msh=1

 # These variables are set when the job string is created
   previous_year=NotSet
  previous_month=NotSet
    current_year=NotSet
   current_month=NotSet
       next_year=NotSet
      next_month=NotSet
  run_start_year=NotSet
 run_start_month=NotSet
   run_stop_year=NotSet
  run_stop_month=NotSet

  run_start_time=NotSet
   run_stop_time=NotSet

### condef ###

#  * ............................ Condef Parameters ............................

 nextjob=on
 samerun=on
 parc_check=off
 float1=on
 initsp=off
 myrssti=off
 openmp=on
 slab=off
 flake=off
 coupled=on
 parallel_io=on # on, write model output in separate files for each task
 noprint=on
 nolist=off
 acctcom=on
 xmu=off
 pakjob=off
 debug=off
 noxlfimp=off
 noxlfqinitauto=on
 f90mod=on
 plaforce=off
 relax=off

###

#  * ............................. Deck Definition .............................

. gcmrun.dk

#end_of_job
