<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="1.8.15">
  <compounddef id="Runtime_Parameter_System" kind="page">
    <compoundname>Runtime_Parameter_System</compoundname>
    <title>Run-time Parameter System</title>
    <briefdescription>
<para>How run-time parameters work in MOM6. </para>
    </briefdescription>
    <detaileddescription>
<para>How run-time parameters work in MOM6</para>
<para>MOM6 has an extensive set of parameters that are set at run-time by parsing an input file. Many parameters have default values and are not required to be in the input file, although there are a number of parameters that must be set for the model to run. The numerous examples provided with the MOM6 code mostly differ in their run-time parameters (although some add other components, like sea-ice), and comparison between these examples is an excellent way to get a broad overview of many of MOM6&apos;s parameters and how they might be set.</para>
<sect1 id="Runtime_Parameter_System_1reading_params">
<title>Getting parameters into MOM6</title>
<para>Run-time parameters are provided to the model in two phases:</para>
<para><orderedlist>
<listitem><para>A very small set of logistical parameters are read as namelist variables from the FMS parameter file <computeroutput>input.nml</computeroutput>. One of these logistical parameters is a list of ascii files that contain all the other run-time parameters.</para>
</listitem><listitem><para>All of the above-named parameter files are scanned for MOM6 model parameters, default values assigned and replaced, conflicts detected and various parameter summaries logged to files and/or the standard output.</para>
</listitem></orderedlist>
</para>
<sect2 id="Runtime_Parameter_System_1mom6_namelist">
<title>Namelist parameters (&lt;tt&gt;input.nml&lt;/tt&gt;)</title>
<para>All FMS derived MOM6 parameters reside in the namelist <computeroutput>MOM_input_nml</computeroutput> in the file <computeroutput>input.nml</computeroutput>. The parameters are:<itemizedlist>
<listitem><para><computeroutput>input_filename</computeroutput> - If equal to &quot;n&quot; will run a new run (i.e. will not read a restart file). If equal to &quot;r&quot; MOM6 will attempt to read a restart file.</para>
</listitem><listitem><para><computeroutput>parameter_filename</computeroutput> - A list of file names containing the MOM6 internal run-time parameters. Typically <computeroutput>param_files=&quot;MOM6_input&quot;,&quot;MOM6_override&quot;</computeroutput> where the file MOM6_input contains all the non-default parameters that define a &quot;baseline&quot; experiment and MOM6_override will be either empty (for baseline) or contain a few parameters that define a &quot;derived&quot; experiment (that differs from the baseline). This helps keep the parameter lists concise and enables easy comparison of parameters in related experiments.</para>
</listitem><listitem><para><computeroutput>restart_input_dir</computeroutput>, <computeroutput>restart_output_dir</computeroutput>, and <computeroutput>output_directory</computeroutput> - These specify the directories for reading input files, writing restart files, and writing many non-restart files.</para>
</listitem></itemizedlist>
</para>
</sect2>
<sect2 id="Runtime_Parameter_System_1fms_params">
<title>Other MOM6-relevant FMS parameters</title>
<para>The namelist ocean_solo_nml may have the integer parameters secs, hours, days, months and years, which dictate how long the FMS ocean driver will try to run the model each run-segment.</para>
</sect2>
<sect2 id="Runtime_Parameter_System_1param_syntax">
<title>MOM6 parameter file syntax</title>
<para>The general syntax for an entry in a MOM6 parameter file is <programlisting filename=".unparsed"><codeline><highlight class="normal">[!]#[override]<sp/>PARAMETER_NAME<sp/>=<sp/>value[,value][...][!comments]</highlight></codeline>
</programlisting></para>
<para>Parameter names must be constructed from the characters <computeroutput>[A-Za-z0-9_]</computeroutput> and by soft convention are upper case. The <computeroutput>!</computeroutput> character is a remark or comment indicator; all subsequent text on that line is ignored.</para>
<para>Parameters that are not specified in the parameter files may assume a default value. It is not an error to specify a parameter more than once with the same value. It is an error to specify different values.</para>
<para>The keyword #override indicates that this parameter specification takes precedence over other specifications. It is <bold>not</bold> an error to have two #override specifications for a single parameter with the same values. It is an error to have two #override statements with different values.</para>
<para>Some illustrations: <programlisting filename=".unparsed"><codeline><highlight class="normal">DO_THIS<sp/>=<sp/>True<sp/><sp/>!<sp/>Set<sp/>the<sp/>Boolean<sp/>to<sp/>.TRUE.</highlight></codeline>
<codeline><highlight class="normal">DO_THAT<sp/>=<sp/>False<sp/>!<sp/>Set<sp/>the<sp/>Boolean<sp/>to<sp/>.FALSE.</highlight></codeline>
<codeline><highlight class="normal">NXYZ<sp/>=<sp/>5<sp/><sp/>!<sp/>Set<sp/>the<sp/>value<sp/>to<sp/>NXYZ<sp/>to<sp/>5</highlight></codeline>
<codeline><highlight class="normal">HALF<sp/>=<sp/>0.5<sp/><sp/>!<sp/>Set<sp/>the<sp/>value<sp/>of<sp/>HALF<sp/>to<sp/>0.5</highlight></codeline>
<codeline><highlight class="normal">NAME<sp/>=<sp/>&quot;abc&quot;<sp/><sp/>!<sp/>Set<sp/>the<sp/>string<sp/>NAME<sp/>to<sp/>&apos;abc&apos;</highlight></codeline>
<codeline><highlight class="normal">VECTOR<sp/>=<sp/>1.0,2.0<sp/><sp/>!<sp/>Set<sp/>the<sp/>array<sp/>VECTOR<sp/>to<sp/>[1.0,<sp/>2.0]</highlight></codeline>
<codeline><highlight class="normal">NAMES<sp/>=<sp/>&apos;abc&apos;,&apos;xyz&apos;<sp/>!<sp/>Set<sp/>the<sp/>strings<sp/>NAMES<sp/>to<sp/>&apos;abc&apos;,&apos;xyz&apos;</highlight></codeline>
<codeline><highlight class="normal">#override<sp/>DO_THIS<sp/>=<sp/>False<sp/>!<sp/>Set<sp/>the<sp/>Boolean<sp/>to<sp/>.FALSE.,<sp/>ignoring<sp/>the<sp/>above<sp/>specification</highlight></codeline>
<codeline><highlight class="normal">#override<sp/>HALF<sp/>=<sp/>0.25<sp/>!<sp/>Set<sp/>the<sp/>value<sp/>of<sp/>HALF<sp/>to<sp/>0.25,<sp/>ignoring<sp/>the<sp/>above<sp/>value</highlight></codeline>
<codeline><highlight class="normal">#override<sp/>HALF<sp/>=<sp/>0.25<sp/>!<sp/>Same<sp/>as<sp/>the<sp/>above<sp/>value<sp/>of<sp/>HALF<sp/>to<sp/>0.25<sp/>so<sp/>is<sp/>accepted</highlight></codeline>
</programlisting></para>
</sect2>
<sect2 id="Runtime_Parameter_System_1param_logging">
<title>Logging of parameters</title>
<para>The subroutine that reads MOM6 parameters has also serves to log every parameter to a file set by DOCUMENT_FILE, usually &quot;MOM6_parameter_doc&quot;. In addition to the name of the variable being read, these calls contain a brief description, along with a description of the units and the default value (if any) or an indication that there is no default and that the variable must be present. For example, <computeroutput>DT</computeroutput> is always required to be present: <programlisting filename=".f90"><codeline><highlight class="comment">call<sp/>get_param(param_file,<sp/>module,<sp/>&quot;DT&quot;,<sp/>CS%dt,<sp/>&amp;</highlight><highlight class="normal"></highlight></codeline>
<codeline><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="stringliteral">&quot;The<sp/>(baroclinic)<sp/>dynamics<sp/>time<sp/>step.<sp/><sp/>The<sp/>time-step<sp/>that<sp/>\n&quot;</highlight><highlight class="comment">//&amp;</highlight></codeline>
<codeline><highlight class="comment"></highlight><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="stringliteral">&quot;is<sp/>actually<sp/>used<sp/>will<sp/>be<sp/>an<sp/>integer<sp/>fraction<sp/>of<sp/>the<sp/>\n&quot;</highlight><highlight class="normal">//&amp;</highlight></codeline>
<codeline><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="stringliteral">&quot;forcing<sp/>time-step<sp/>(DT_FORCING<sp/>in<sp/>ocean-only<sp/>mode<sp/>or<sp/>the<sp/>\n&quot;</highlight><highlight class="comment">//&amp;</highlight></codeline>
<codeline><highlight class="comment"></highlight><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/></highlight><highlight class="stringliteral">&quot;coupling<sp/>timestep<sp/>in<sp/>coupled<sp/>mode.)&quot;</highlight><highlight class="normal">,<sp/>units=</highlight><highlight class="stringliteral">&quot;s&quot;</highlight><highlight class="normal">,<sp/>&amp;</highlight></codeline>
<codeline><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>fail_if_missing=.true.)</highlight></codeline>
</programlisting></para>
<para>At run-time, two levels of logging are performed, depending on the value of the parameter <computeroutput>MINIMAL_DOCUMENTATION</computeroutput>:</para>
<para><itemizedlist>
<listitem><para>(TRUE) The end result of the combination of default values, assignments and overrides are recorded with default and current values, description and units, for all parameters.</para>
</listitem><listitem><para>(FALSE) The minimal list of required and non-default value parameters are recorded with current values, description and units only for those parameters needed to reproduce the configuration.</para>
</listitem></itemizedlist>
</para>
<para>Either of the generated logging files can be used as inputs and yield the same configuration.</para>
<para>In addition, there are also calls that log derived quantities (e.g., a time-step that is derived from a CFL number, or the full path to an input file) without reading anything in.</para>
</sect2>
<sect2 id="Runtime_Parameter_System_1param_checking">
<title>Error checking of parameters and parameter files</title>
<para>There are several techniques that are used for error checking on MOM6 parameters:</para>
<para><itemizedlist>
<listitem><para>Some parameters have internal error messages if they are set to nonsensical values.</para>
</listitem><listitem><para>No parameter can be set twice inconsistently without an explicit #override specification.</para>
</listitem><listitem><para>If the run-time parameter REPORT_UNUSED_PARAMS is true, a warning will be issued for any entries in the input parameter files that are not read in, for instance if they are misspelled.</para>
</listitem><listitem><para>Setting the run-time parameter FATAL_UNUSED_PARAMS to true causes a fatal error that will bring down the model if there are any unused entries in the input parameter files. </para>
</listitem></itemizedlist>
</para>
</sect2>
</sect1>
    </detaileddescription>
  </compounddef>
</doxygen>
