.. _Control_file: ============ Control file ============ **Control file** is a plain-text file that defins all model settings, including simulation periods, file paths, routing option and more. Each setting is called **contriol keys** or **control variables** and is specified using a variable name enclosed in angle brackets (````). These control keys are read at the start of the simulation (see ``./route/build/src/read_control.f90``) and stored in fortran's public variables defined in ``./route/build/src/public_var.f90``. 🔧Features: * Control keys can be defined in any order in the control file, but grouping variables thematically improve readibility. * Control keys with default values can be also included to override those defaults. * All the control key names match the corresponding Fortran variable names in ``./route/build/src/public_var.f90``. 📌Syntax Rules: * Lines starting or after exclamation mark (``!``) are treated as comments and ignored. * Each line must follow the Format: `` value ! comments``. A exclamation mark (``!``) must appear after the value even if you don't put any comment text; otherwise getting error. * **DO NOT include empty lines**-this will cause runtime errors. .. _Basic_routing_setup: Basic routing setup ------------------------------------------ It is difficult to tell exactly which control keys every user needs to include, becase configurations can vary widely depending on user's goal of simulation, e.g., turn on/off lakes, water management, floodplain etc. For a river routing without lake or water management with cold start and runoff input provided at the same catchment as the river network, a user can get started with following control keys. See :ref:`Control file basic examples `. Also, an example control file including additional control keys (for advanced features) are provided under ``./route/settings/SAMPLE.control``. In the table below, control keys with None in default value must be defined with the appropriate value. The netCDF variables (e.g., runoff and river data netCDFs) have their default names; if their netCDF variables do not match the default names, a user needs to define in the control file. Please see :doc:`Input files `. Additional control variables, needed for more advanced simulations, are listed after this basic set of the control keys. For lake model option, See :doc:`Lake model option `. For water management option, See :doc:`Water management option `. .. list-table:: Control keys to setup basic routing :header-rows: 1 :widths: 20 15 15 50 :name: basic routing configuration * - Control key - Type - Default - Description * - ```` - char - None - simulation case name. This used for output netCDF, and restart netCDF name * - ```` - char - None - Directory that contains ancillary data (river netowrk, remapping, and parameter namelist) * - ```` - char - None - Directory that contains runoff data * - ```` - char - None - Directory where history netCDFs are output * - ```` - char - None - time of simulation start. format: yyyy-mm-dd or yyyy-mm-dd hh:mm:ss * - ```` - char - None - time of simulation end. format: yyyy-mm-dd or yyyy-mm-dd hh:mm:ss * - ```` - char - None - name of input netCDF for River Network. see Note 1 * - ```` - char - None - either a single runoff netCDF name, multiple netCDFs with wild card, or a text file listing netCDFs. See Note 2 * - ```` - char - None - units of input runoff. depth/time where depth: m or mm, time: second, sec or s ,hour, hr or h ,day or d * - ```` - real - None - time interval of runoff input in second. e.g., 86400 sec for daily step * - ```` - char - None - calenar used in runoff input netCDF. See Note 3 * - ```` - char - None - time units used in runoff input netCDF. See Note 4 * - ```` - char - start - time stamp used in runoff input - start (default), middle, or end, otherwise error * - ```` - char - None - time frequency used for temporal aggregation of output variables. See Note 5 * - ```` - char - None - frequency for new history files (daily, monthly, yearly, single). See Note 5 * - ```` - real - 0 - time stamp offset [second] from a start of time step * - ```` - int - 1 - routing schem options: 0->Sum, 1->IRF, 2->KWT, 3->KW, 4->MC, 5->DW, otherwise error. See :doc:`River routing configuration ` * - ```` - int - None - time interval of simulation in second. e.g., 86400 sec for daily step * - ```` - char - None - Spatially constant parameter namelist. should be stored in . See Note 6 1. NetCDF variable and dimension names in river data has their default names, but a user can use different names than defaults. In this case, variable or/and dimension names can be speficied in control file as well. See :ref:`River parameters `. 2. The same as Note 1 except for runoff input netCDF. See :ref:`Runoff input files `. 3. Calendar in runoff input time should be read from netCDF, but If runoff input netCDF does not have calendar attribute for some reason, it can be specified. Make sure time variable in runoff data use either ``noleap``, ``standard``, ``gregorian``, or ``proleptic_gregorian``. case insensitive 4. Like Calendar, If runoff input netCDF does not have time unit attribute, it can be specified. format should be since yyyy-mm-dd (hh:mm:ss). () can be omitted. can be days, hours, minutes, seconds. 5. Restrictions related to history output: dt_qsim, outputFrequency and newFileFrequency * ``dt_qsim`` (simulation time step) must be less than 86400 sec (one day). Muskingum-Cunge method will run at much shorter time step. Other methods can run at this time step, but Diffusive wave routing produce the results with less errors at shorter time step. * ``dt_qsim`` can be different time step than input time step. * ``outputFrequency`` can be integer numeric (e.g, 1, 2 etc), which is interpreted as a number of simulation time steps for temporal aggregation of the history flux variables, or literal (daily, monthly yearly). The numeric outputFrequency can be used for sub-daily dt_qsim, and remainder of 86400 divided by numeric x ``dt_qsim`` must be zero. For example, if ``dt_qsim`` is 10800 sec (=3hr), accepted ``outputFrequency`` are 1, 2, 4, 8 * ``newFileFrequency`` must be the same (output netcdf contains only one time step) as or longer than ``outputFrequency``. For example, with monthly ``outputFrequency``, ``newFileFrequency`` must be monthly, yearly or single * The abovementioned restrictions are check in the code, so any violations are notified as error and the program is terminated. 6. Spatially constant parameters are provided in a namelist. See :ref:`Spatially-constant parameter namelist `. Use the namelist provided in github as a template. .. _Control_file_basic_examples: Control file basic examples ---------------------------- These are examples for three cases of runoff input (see :ref:`Runoff file(s) ` for runoff input cases). These examples are provided in testCase (:ref:`testCase `). For a example of more comple set of the control keys, see ``./route/settings/SAMPLE.control`` Option 1 - runoff input is given at river network HRUs :: ! ************************************************************************************************************************* ! ***** DEFINITION OF MODEL CONTROL INFORMATION *************************************************************************** ! ************************************************************************************************************************* ! Note: lines starting with "!" are treated as comment lines -- there is no limit on the number of comment lines. ! lines starting with are read till "!" ! Do not leave lines without "!" at the beginning of the lines ! ! ************************************************************************************************************************* ! DEFINE DIRECTORIES ! -------------------------- ./ancillary_data/ ! directory containing ancillary data (river network, remapping netCDF) ./input/ ! directory containing input data (runoff netCDF) ./output/ ! directory containing output data ! ************************************************************************************************************************* ! DEFINE SIMULATION CONTROLS ! -------------------------------------------- cameo_case1 ! simulation name - used for output netcdf name 1950-01-01 00:00:00 ! time of simulation start. year-month-day (hh:mm:ss) 1950-12-31 00:00:00 ! time of simulation end. year-month-day (hh:mm:ss) 3600 ! simulation time interval [sec] monthly ! history file frequency - daily, monthly, yearly or single daily ! time frequency used for temporal aggregation of output variables - numeric or daily, monthyly, or yearly ! **************************************************************************************************************************** ! ROUTE options ! -------------------------- 012345 ! option for routing schemes 0-> SUM, 1->IRF, 2->KWT, 3->KW, 4->MC, 5->DW, otherwise error 1 ! basin routing? 0-> no, 1-> basin UH ! ************************************************************************************************************************** ! DEFINE RIVER DATA ! --------------------------------------- ntopo_nhdplus_cameo_pfaf.nc ! name of netCDF containing river segment data ! ************************************************************************************************************************** ! DEFINE RUNOFF FILE ! ---------------------------------- RUNOFF_case1.nc ! name of netCDF containing the runoff mm/s ! units of runoff 86400 ! time interval of the runoff ! ************************************************************************************************************************** ! DEFINE RUNOFF MAPPING FILE ! ---------------------------------- F ! logical to indicate runnoff needs to be mapped to river network HRU ! ************************************************************************************************************************** ! Namelist file name ! --------------------------- param.nml.default ! spatially constant model parameters ! ************************************************************************************************************************** Option 2 - runoff input is given at hydrologic model HRUs (not the same as river network HRUs). Runoff and mapping netCDF variables are shown just to show how netCDFs are structured, and commented out in this example, since they are the same as the default names. :: ! ************************************************************************************************************************* ! ***** DEFINITION OF MODEL CONTROL INFORMATION *************************************************************************** ! ************************************************************************************************************************* ! ************************************************************************************************************************* ! Note: lines starting with "!" are treated as comment lines -- there is no limit on the number of comment lines. ! lines starting with are read till "!" ! Do not leave lines without "!" at the beginning of the lines ! ! ************************************************************************************************************************* ! DEFINE DIRECTORIES ! -------------------------- ./ancillary_data/ ! directory containing ancillary data (river network, remapping netCDF) ./input/ ! directory containing input data (runoff netCDF) ./output/ ! directory containing output data ! ************************************************************************************************************************* ! DEFINE SIMULATION CONTROLS ! -------------------------------------------- cameo_case2 ! simulation name - used for output netcdf name 1950-01-01 00:00:00 ! time of simulation start. year-month-day (hh:mm:ss) 1950-12-31 00:00:00 ! time of simulation end. year-month-day (hh:mm:ss) 3600 ! simulation time interval [sec] monthly ! history file frequency - daily, monthly, yearly or single daily ! time frequency used for temporal aggregation of output variables - numeric or daily, monthyly, or yearly ! **************************************************************************************************************************** ! ROUTE options ! -------------------------- 012345 ! option for routing schemes 0-> SUM, 1->IRF, 2->KWT, 3->KW, 4->MC, 5->DW, otherwise error 1 ! basin routing? 0-> no, 1-> basin UH ! ************************************************************************************************************************** ! DEFINE RIVER DATA ! --------------------------------------- ntopo_nhdplus_cameo_pfaf.nc ! name of netCDF containing river segment data ! ************************************************************************************************************************** ! DEFINE RUNOFF FILE ! ---------------------------------- RUNOFF_case2.nc ! name of netCDF containing the HRU runoff ! runoff ! variable name of HRU runoff ! time ! variable name of time in the runoff file ! hru ! variable name of runoff HRU ID ! time ! dimension name of time ! hru ! dimension name of HM_HRU mm/s ! units of runoff 86400 ! time interval of the runoff ! ************************************************************************************************************************** ! DEFINE RUNOFF MAPPING FILE ! ---------------------------------- T ! logical to indicate runnoff needs to be mapped to RN_HRU spatialweights_grid12km_nhdplus-cameo.nc ! name of netCDF for HM_HRU-RN_HRU mapping data ! polyid ! variable name of RN_HRU in the mapping file ! weight ! variable name of areal weights of overlapping HM_HUs for each RN_HRU ! overlapPolyId ! variable name of HM_HRU ID ! overlaps ! variable name of numbers of HM_HRUs for each RN_HRU ! polyid ! dimension name of RN_HRU (in the mapping file) ! data ! dimension name of ragged HM_HR ! ************************************************************************************************************************** ! Namelist file name ! --------------------------- param.nml.default ! spatially constant model parameters ! ************************************************************************************************************************** Option 3 - runoff input is given at grid Runoff and mapping netCDF variables are shown just to show how netCDFs are structured, and commented out in this example, since they are the same as the default names. :: ! ************************************************************************************************************************* ! ***** DEFINITION OF MODEL CONTROL INFORMATION *************************************************************************** ! ************************************************************************************************************************* ! ************************************************************************************************************************* ! Note: lines starting with "!" are treated as comment lines -- there is no limit on the number of comment lines. ! lines starting with are read till "!" ! Do not leave lines without "!" at the beginning of the lines ! ! ************************************************************************************************************************* ! DEFINE DIRECTORIES ! -------------------------- ./ancillary_data/ ! directory containing ancillary data (river network, remapping netCDF) ./input/ ! directory containing input data (runoff netCDF) ./output/ ! directory containing output data ! ************************************************************************************************************************* ! DEFINE SIMULATION CONTROLS ! -------------------------------------------- cameo_case3 ! simulation name - used for output netcdf name 1950-01-01 00:00:00 ! time of simulation start. year-month-day (hh:mm:ss) 1950-12-31 00:00:00 ! time of simulation end. year-month-day (hh:mm:ss) 3600 ! simulation time interval [sec] monthly ! history file frequency - daily, monthly, yearly or single daily ! time frequency used for temporal aggregation of output variables - numeric or daily, monthyly, or yearly ! ************************************************************************************************************************* ! ROUTE options ! -------------------------- 012345 ! option for routing schemes 0-> SUM, 1->IRF, 2->KWT, 3->KW, 4->MC, 5->DW, otherwise error 1 ! basin routing? 0-> no, 1-> basin UH ! ************************************************************************************************************************** ! DEFINE RIVER DATA ! --------------------------------------- ntopo_nhdplus_cameo_pfaf.nc ! name of netCDF containing river segment data ! ************************************************************************************************************************** ! DEFINE RUNOFF FILE ! ---------------------------------- RUNOFF_case3.nc ! name of netCDF containing the HRU runoff ! runoff ! variable name of HRU runoff ! time ! variable name of time in the runoff file ! time ! dimension name of time ! lon ! dimension name of x(j) ! lat ! dimension name of y(i) mm/s ! units of runoff 86400 ! time interval of the runoff ! ************************************************************************************************************************** ! DEFINE RUNOFF MAPPING FILE ! ---------------------------------- T ! logical to indicate runnoff needs to be mapped to RN_HRU spatialweights_grid12km_nhdplus-cameo.nc ! name of netCDF for HM_HRU-RN_HRU mapping data ! polyid ! variable name of RN_HRU in the mapping file ! weight ! variable name of areal weights of overlapping HM_HUs for each RN_HRU ! i_index ! variable name of ylat index ! j_index ! variable name of xlon index ! overlaps ! variable name of numbers of HM_HRUs for each RN_HRU ! polyid ! dimension name of RN_HRU (in the mapping file) ! data ! dimension name of ragged HM_HRU ! ************************************************************************************************************************** ! Namelist file name ! --------------------------- param.nml.default ! spatially constant model parameters ! **************************************************************************************************************************