#!/bin/sh
#     keyword :: canesm_ogcm
# description :: OGCM 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 be defined in the cppdefs_file
 use_nemo=on
 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=OMIP
 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

 # 6-node configuration (CanAM: 3 nodes, CanCPL - 1 node shared with AGCM, CanNEMO: 3 nodes)
 phys_node=6
 nproc_a=2
 nnode_a=32
 nproc_o=1
 nnode_o=144
 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=': -n 144 -N 36 -d 1 -cc none ./nemo.exe '
 cmd_runp3=' '

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

###

 # --- 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=on

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

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

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

 # offset_cfc_year = an offset between the atmospheric history file and the model year
 offset_cfc_year=''

 # ln_co2int=.true.  means interpolate the CO2 value from data read from a file.
 # ln_co2int=.false. means use a constant value (0.)
 ln_co2int=.false.

 # ln_c14int=.true.  means interpolate the c14 fractionation over the historical period
 # ln_c14int=.false. means use a constant value (0.)
 ln_c14int=.false.

 # Check for FAFMIP related quantities
 ln_faftau=.false.
 ln_fafemp=.false.
 ln_fafhflx=.false.
 ln_fafheat=.false.

 # 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


##    COREv2 interannual forcing (1949-2009)                                                                                                                                                  
      nemo_forcing=bulk_iaf
##      The below setting correspond to a "start" (above) of 1. Adjust iaf_year_offset accordingly for a different start.                                                                     
      iaf_year_offset=1947
      iaf_loop_year=2009


 # 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
 noprint=on
 nolist=off
 debug=off
 noxlfimp=off
 noxlfqinitauto=on

###

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

. ogcmrun.dk

#end_of_job
