Skip to content

CAM 6.2 The build namelist utility

erika72 edited this page Jan 30, 2017 · 3 revisions

The build-namelist utility builds namelists (and on occasion other types of input files) which specify run-time details for CAM and the components it's running with in standalone mode. When executed from the CESM scripts it only produces a namelist file for the CAM component (in the file atm_in), and a namelist file for control of dry deposition which is shared by CAM and CLM (in the file drv_flds_in).

The task of constructing a correct namelist has become extremely complex due to the large number of configurations supported by CAM. Editing namelists by hand is an extremely fragile process due to the number of variables that need to be set, and to the many interdependencies among them. We strongly discourage editing namelists by hand. All customizations of the CAM namelist are possible by making use of the build-namelist command line options.

Some of the important features of build-namelist are:

All valid namelist variables are known to build-namelist. So an invalid variable specified by the user (supplied either by the -infile or -namelist options) will cause build-namelist to fail with an error message telling which namelist variable is invalid. This is a big improvement over a runtime failure caused by an invalid variable which typically gives no hint as to which variable caused the problem.

In addition to knowing all valid variable names and their types, build-namelist also knows which namelist group each variable belongs to. This means that the user only needs to specify variable names to build-namelist and not the group names. The -infile and -namelist options still require valid namelist syntax as input, but the group name is ignored. So all variables can be put in a single group with an arbitrary name, for example, "&xxx ... /" where "xxx" is the namelist group name.

Since build-namelist knows all namelist variables specified by the user it is able to do consistency checking. In general however, build-namelist assumes that the user is the expert and will not override a user specification unless there is a major inconsistency, for example if variables have been set to use parameterizations which can not be run at the same time.

All configurations have namelist variables that must be specified, and build-namelist has a mechanism to provide default values for these variables. When an appropriate default value cannot be found then build-namelist will fail with an informative message.

When running a configuration for the first time there are often many input datasets that may not be in the local input data directory. In order to facilitate getting the required datasets build-namelist has an option, -test, that can be used to produce a complete list of required datasets and report status of whether or not they are present in the local directory. This list can then be used to obtain the needed datasets from the CESM SVN input data repository.

One required input for build-namelist is a configuration cache file produced by a previous invocation of configure (config_cache.xml by default). build-namelist looks at this file to determine the features of the CAM executable, such as the dynamical core and horizontal resolution, that affect the default specifications for namelist variables. The default values themselves are specified in the file $CAM_ROOT/models/atm/cam/bld/namelist_files/namelist_defaults_cam.xml, and in the use case files located in the directory $CAM_ROOT/models/atm/cam/bld/namelist_files/use_cases/.

The other required input for build-namelist is the root directory for the input datasets. This is required since nearly all input files must be specified using absolute filepaths, but the defaults are stored as filepaths which are relative to the root directory. It is expected that the actual location of the root directory is something that will be resolved at runtime. The way this is done is to either specify it using the -csmdata argument, or to set the environment variable CSMDATA.

The methods for setting the values of namelist variables, listed from highest to lowest precedence, are:

  1. using specific command-line options, e.g., -case and -runtype,
  2. using the -namelist option,
  3. setting values in a file specified by -infile,
  4. specifying a -use_case option,
  5. setting values in the namelist defaults file.

The first four of these methods for specifying namelist variables are the ones available to the user without requiring code modification. Any namelist variable recognized by CAM can be modified using method 2 or 3. The final two methods represent defaults that are hard coded as part of the code base.