Customizing the CLM configuration

The "Creating a Case" section of the CCSM4.0 Scripts User's-Guide gives instructions on creating a case. What is of interest here is how to customize your use of CLM for the case that you created. In this section we discuss how to customize your case before the first step -- the "configure -case" step is done. In the next section we will discuss how to customize your CLM namelist after "configure -case" has already been done.

For CLM when "configure -case" is called there are two steps that take place:

  1. The CLM "configure" script is called to setup the build-time configuration for CLM (more information on configure is given in the Section called More information on the CLM configure script).

  2. The CLM "build-namelist" script is called to generate the initial run-time namelist for CLM (more information on build-namelist is given below in the Section called Definition of Namelist items and their default values.

When customizing your case at the configure step you are able to modify the process by effecting either one or both of these steps. The CLM "configure" and "build-namelist" scripts are both available in the "models/lnd/clm/bld" directory in the distribution. Both of these scripts have a "-help" option that is useful to examine to see what types of options you can give either of them.

There are five different types of customization for the configuration that we will discuss: CCSM4.0 CLM configuration items, Configure time User Namelist, other noteworthy CCSM configuration items, the CLM configure script options, and the CLM build-namelist script options.

Information on all of the script, configuration, build and run items is found under scripts/ccsm_utils/Case.template in the config_definition.xml file.

CLM Script configuration items

Below we list each of the CCSM configuration items that are specific to CLM. All of these are available in your: env_conf.xml file.

CLM_CONFIG_OPTS
CLM_NAMELIST_OPTS
CLM_FORCE_COLDSTART
CLM_NML_USE_CASE
CLM_1PT_NAME
CLM_USRDAT_NAME
CLM_CO2_TYPE

The first item CLM_CONFIG_OPTS has to do with customizing the CLM configuration options for your case, the rest all have to do with generating the initial namelist.

CLM_CONFIG_OPTS

The option CLM_CONFIG_OPTS is all about passing command line arguments to the CLM configure script. It is important to note that some compsets, may already put a value into the CLM_CONFIG_OPTS variable. You can still add more options to your CLM_CONFIG_OPTS but make sure you add to what is already there rather than replacing it. Hence, it may be best to edit the env_conf.xml file to do this rather than use the xmlchange script. In the the Section called More information on the CLM configure script below we will go into more details on options that can be customized in the CLM "configure" script. It's also important to note that the CLM template may already invoke certain CLM configure options and as such those command line options are NOT going to be available to change at this step (nor would you want to change them). The options to configure are given with the "-help" option which is given in the Section called More information on the CLM configure script.

CLM_NML_USE_CASE

CLM_NML_USE_CASE is used to set a particular set of conditions that set multiple namelist items, all centering around a particular usage of the model. To list the valid options do the following:


> cd models/lnd/clm/doc
> ../bld/build-namelist -use_case list

The output of the above command is:


build-namelist - use cases: 1850-2100_rcp2.6_transient 1850-2100_rcp6_transient 1850_control 2000-2100_rcp8.5_transient 2000_control 20thC_transient pergro pergro0
Use cases are:...

1850-2100_rcp2.6_transient = Simulate transient land-use, and aerosol deposition changes with historical data from 1850 to 2005 and then with the RCP2.6 scenario from IMAGE

1850-2100_rcp6_transient = Simulate transient land-use, and aerosol deposition changes with historical data from 1850 to 2005 and then with the RCP6 scenario from AIM

   1850_control = Conditions to simulate 1850 land-use
2000-2100_rcp8.5_transient = Simulate transient land-use, and aerosol deposition changes with historical data from 2000 to 2005 and then with the RCP8.5 scenario from MESSAGE

   2000_control = Conditions to simulate 2000 land-use
20thC_transient = Simulate transient land-use, and aerosol deposition changes from 1850 to 2005
         pergro = Perturbation error growth test with initial conditions perturbed by roundoff level
        pergro0 = Perturbation error growth test with unperturbed initial conditions

CLM_NAMELIST_OPTS

The option CLM_NAMELIST_OPTS is for passing namelist items into the "clm_inparm" namelist. Any items that are set in CLM_NAMELIST_OPTS will be set in your namelist after "configure -case" is done.

Important: For character namelist items you need to use "'" as quotes for strings so that the scripts don't get confused with other quotes they use.

Example, you want to set hist_dov2xy to .false. so that you get vector output to your history files. To do so edit env_conf.xml and add a setting for hist_dov2xy. So do the following:


> xmlchange -file env_conf.xml -id CLM_NAMELIST_OPTS \
-val hist_dov2xy=.false.

Example, you want to set hist_fincl1 to add the variable 'HK' to your history files. To do so edit env_conf.xml and add a setting for hist_fincl1. So do the following:


> xmlchange -file env_conf.xml -id CLM_NAMELIST_OPTS \
 -val "hist_fincl1='HK'"

CLM_CO2_TYPE

CLM_CO2_TYPE sets the type of input CO2 for either "constant", "diagnostic" or prognostic". If "constant" the value from CCSM_CO2_PPMV will be used. If "diagnostic" or "prognostic" the values MUST be sent from the atmosphere model. For more information on how to send CO2 from the data atmosphere model see the Section called Running stand-alone CLM with transient historical CO2 concentration in Chapter 4.

CLM_FORCE_COLDSTART

CLM_FORCE_COLDSTART when set to on, requires that your simulation do a cold start from arbitrary initial conditions. If this is NOT set, it will use an initial condition file if it can find an appropriate one, and otherwise do a cold start. CLM_FORCE_COLDSTART is a good way to ensure that you are doing a cold start if that is what you want to do.

CLM_1PT_NAME

CLM_1PT_NAME is used ONLY for a pt1_pt1 resolution simulation to set the name of the single-point files to use. To see a list of the valid resolutions do this:


> cd models/lnd/clm/doc
> ../bld/build-namelist -res list

The output of the above command is:


build-namelist - valid values for res: default 128x256 64x128 48x96 32x64 8x16 94x192 0.23x0.31 0.47x0.63 0.9x1.25 1.9x2.5 2.65x3.33 4x5 10x15 5x5_amazon 1x1_tropicAtl 1x1_camdenNJ 1x1_vancouverCAN 1x1_mexicocityMEX 1x1_asphaltjungleNJ 1x1_brazil 1x1_urbanc_alpha
                  default = 1.9x2.5
                  (NOTE: resolution and mask and other settings may influence what the default is)

the valid resolutions that can be used with CLM_1PT_NAME are the ones that have city or nation names such as: 5x5_amazon, 1x1_vancouverCAN 1x1_mexicocityMEX, or 1x1_brazil. The "1x1_" prefix means the file is for a single-point, while "5x5_" prefix means it's for a region of five points in latitude by five points in longitude. Both regional and single point datasets can be used for CLM_1PT_NAME.

CLM_USRDAT_NAME

CLM_USRDAT_NAME provides a way to enter your own datasets into the initial namelist setup at "configure -case". The files you create must be named with specific naming conventions outlined in: the Section called Creating your own single-point/regional surface datasets in Chapter 5. To see what the expected names of the files are, use the queryDefaultNamelist.pl to see what the names will need to be. For example if your CLM_USRDAT_NAME will be "1x1_boulderCO", with a "navy" land-mask, constant simulation year range, for 1850, the following will list what your filenames should be:


> cd models/lnd/clm/bld
> queryDefaultNamelist.pl -usrname "1x1_boulderCO" -options \
mask=navy,sim_year=1850,sim_year_range="constant"  -csmdata $CSMDATA

Configure time User Namelist

CLM_NAMELIST_OPTS as described above allows you to set any extra namelist items you would like to appear in your namelist after first configured. However, it only allows you a single line to enter namelist items, and strings must be quoted with ' which is a bit awkward. If you have a long list of namelist items you want to set (such as a long list of history fields) a convenient way to do it is to create a user_nl_clm that contains just the list of namelist variables you want to add to your initial namelist. The user_nl_clm will only be used when configure is run, so if you change it after configure -- it won't change anything. The file needs to be in valid FORTRAN namelist format, and the configure step will abort if there are syntax errors. It merely needs to be named correctly user_nl_clm and placed in your case directory (where your other env_*.xml files are). The namelist name actually doesn't have to be valid, but all the variable names must be. Here's an example user_nl_clm namelist that sets a bunch of history file related items, to create output history files monthly, daily, every six and 1 hours.

Example 1-1. Example user_nl_clm namelist file


&clmexp
 hist_fincl2    = 'TG','TBOT','FIRE','FIRA','FLDS','FSDS',
                  'FSR','FSA','FGEV','FSH','FGR','TSOI',
                  'ERRSOI','BUILDHEAT','SABV','SABG',
                  'FSDSVD','FSDSND','FSDSVI','FSDSNI',
                  'FSRVD','FSRND','FSRVI','FSRNI',
                  'TSA','FCTR','FCEV','QBOT','RH2M','H2OSOI',
                  'H2OSNO','SOILLIQ','SOILICE', 
                  'TSA_U', 'TSA_R',
                  'TREFMNAV_U', 'TREFMNAV_R',
                  'TREFMXAV_U', 'TREFMXAV_R',
                  'TG_U', 'TG_R',
                  'RH2M_U', 'RH2M_R',
                  'QRUNOFF_U', 'QRUNOFF_R',
                  'SoilAlpha_U',
                  'Qanth', 'SWup', 'LWup', 'URBAN_AC', 'URBAN_HEAT'
  hist_fincl3 = 'TG:I', 'FSA:I', 'SWup:I', 'URBAN_AC:I', 'URBAN_HEAT:I',
                'TG_U:I', 'TG_R:I',
  hist_fincl4 = 'TG', 'FSA', 'SWup', 'URBAN_AC', 'URBAN_HEAT'
  hist_mfilt  = 1, 30,  28, 24
  hist_nhtfrq = 0, -24, -6, -1
/

Note: In the above example we use an invalid namelist name &clmexp -- but it works anyway because the CLM build-namelist knows the namelist that specific variable names belong to, and it puts them there.

Obviously, all of this would be difficult to put in the CLM_NAMELIST_OPTS variable, especially having to put ' around all the character strings. For more information on the namelist variables being set here and what they mean, see the section on CLM namelists below, as well as the namelist definition that gives details on each variable.

Other noteworthy configuration items

For running "I" cases there are several other noteworthy configuration items that you may want to work with. Most of these involve settings for the DATM, but one CCSM_CO2_PPMV applies to all models. If you are running an B, E, or F case that doesn't use the DATM obviously the DATM_* settings will not be used. All of the settings below are in your env_conf.xml file

CCSM_CO2_PPMV
DATM_MODE
DATM_CLMNCEP_YR_ALIGN
DATM_CLMNCEP_YR_START
DATM_CLMNCEP_YR_END

CCSM_CO2_PPMV

CCSM_CO2_PPMV sets the mixing ratio of CO2 in parts per million by volume for ALL CCSM components to use. Note that most compsets already set this value to something reasonable. Also note that some compsets may tell the atmosphere model to override this value with either historic or ramped values. If the CCSM_BGC variable is set to something other than "none" the atmosphere model will determine CO2, and CLM will listen and use what the atmosphere sends it. On the CLM side the namelist item co2_type tells CLM to use the value sent from the atmosphere rather than a value set on it's own namelist.

DATM_MODE

DATM_MODE sets the mode that the DATM model should run in this determines how data is handled as well as what the source of the data will be. Many of the modes are setup specifically to be used for ocean and/or sea-ice modeling. The modes that are designed for use by CLM are:

CLM_QIAN
CLM_1PT_NAME

CLM_QIAN is for the standard mode of using global atmospheric data that was developed by Qian et. al. for CLM using NCEP data from 1948 to 2004. CLM1PT is for the special cases where we have single-point tower data for particular sites. Right now we only have data for three urban locations: MexicoCity Mexico, Vancouver Canada, and the urban-c alpha site. This is non-standard functionality and we recommend that users stick with the CLM_QIAN mode of operation.

Warning

Currently the urban locations are NOT functional, because the surface datasets need to be updated.

DATM_CLMNCEP_YR_START

DATM_CLMNCEP_YR_START sets the beginning year to cycle the atmospheric data over for the CLM_QIAN mode.

DATM_CLMNCEP_YR_END

DATM_CLMNCEP_YR_END sets the ending year to cycle the atmospheric data over for the CLM_QIAN mode.

DATM_CLMNCEP_YR_ALIGN

DATM_CLMNCEP_YR_START and DATM_CLMNCEP_YR_END determine the range of years to cycle the atmospheric data over, and DATM_CLMNCEP_YR_ALIGN determines which year in that range of years the simulation will start with.

Customizing via the template files

The final thing that the user may wish to do before configure is run is to edit the template files which determine the configuration and initial namelist. The variables in env_conf.xml typically mean you will NOT have to edit the template. But, there are rare instances where it is useful to do so. Appendix A gives the details on how to do this. The template files are copied to your case directory and are available under Tools/Templates. The list of template files you might wish to edit are:

clm.cpl7.template
datm.cpl7.template
cpl.template

More information on the CLM configure script

The configure script defines the details of a clm configuration and summarizes it into a config_cache.xml file. The config_cache.xml will be placed in your case directory under Buildconf/clmconf. The config_definition.xml in models/lnd/clm/bld/config_files gives a definition of each clm configuration item. Many of these items are things that you would NOT change, but looking through the list gives you the valid options, and a good description of each. Coupling this with looking at the options to configure with "-help" as below will enable you to understand how to set the different options.


> cd models/lnd/clm/bld
> configure -help

The output to the above command is as follows:


SYNOPSIS
     configure [options]
OPTIONS
     User supplied values are denoted in angle brackets (<>).  Any value that contains
     white-space must be quoted.  Long option names may be supplied with either single
     or double leading dashes.  A consequence of this is that single letter options may
     NOT be bundled.

     -ad_spinup <name>   Turn on AD_SPINUP mode for bgc setting of CN [on | off] (default is off).
     -bgc <name>         Build CLM with bgc package [ none | cn | casa | cndv ] (default is none).
                         NOTE: When set to cn or casa -- also turns on the CLAMP CPP macro.
     -c13 <name>         Turn on C13 mode for bgc setting of CN [on | off] (default is off).
     -cache <file>       Name of output cache file (default: config_cache.xml).
     -cachedir <file>    Name of directory where output cache file is written (default: CLM build directory).
     -clm_root <dir>     Root directory of clm source code (default: directory above location of this script)
     -cppdefs <string>   A string of user specified CPP defines.  Appended to
                         Makefile defaults.  E.g. -cppdefs '-DVAR1 -DVAR2'
     -comp_intf <name>   Component interface to use (ESMF, MCT or cpl_$COMP) (default MCT)
     -defaults <file>    Specify full path to a configuration file which will be used to supply defaults instead of
                         the defaults in bld/config_files.  This file is used to specify model
                         configuration parameters only.  Parameters relating to the build which
                         are system dependent will be ignored.
     -dust <name>        Turn on DUST [on | off] (default is on).
     -exit_spinup <name> Turn on EXIT_SPINUP mode for bgc setting of CN [on | off] (default is off).
     -help [or -h]       Print usage to STDOUT.
     -mach <name>        Machine name to use for CCSM build.
     -maxpft <n>         Value of maxpatch_pft (default is numpft+1) 
                         (required to be numpft+1 for CN or CNDV or transient cases)
     -mode <name>        CLM mode [ccsm_seq | ext_ccsm_seq]
     -nofire             Turn off wildfires for bgc setting of CN (default includes fire for CN)
     -pergro <name>      Switch enables building CLM for perturbation growth tests. [on | off] (default is off)
     -prog_seasalt<name> Turn on prognostic sea-salt (PROGSSLT cppdef token) [on | off] (default is on)
     -rtm <name>         Turn on RTM  [on | off] (default is on)
     -silent [or -s]     Turns on silent mode - only fatal messages issued.
     -snicar_frc <name>  Turn on SNICAR radiative forcing calculation. [on | off] (default is off)
     -[no]smp            Switch on [off] SMP parallelism.
     -[no]spmd           Switch on [off] SPMD parallelism.
     -target_os          Override the os setting for cross platform compilation [aix | darwin | dec_osf | irix | 
                         linux | solaris | super-ux | bgl | bgp ].  Default: OS on which configure is
			 executing as defined by the perl $OSNAME variable.
     -[no]test           Switch on [off] testing of Fortran compiler and external libraries.
     -usr_src <dir1>[,<dir2>[,<dir3>[...]]]
                         Directories containing user source code.
     -verbose [or -v]    Turn on verbose echoing of settings made by configure.
     -version            Echo the SVN tag name used to check out this CLM distribution.


OPTIONS used ONLY for clm standalone testing: (i.e. ONLY used when mode=ccsm_seq)

    The CCSM scripts already take care of everything here. These options exist for
    use with the CLM standalone testing in the models/lnd/clm/test/system directory.

     -ccsm_bld <name>    Turn use of CCSM build and makefiles. [on | off] (default is off)
                         Can ONLY be turned on for mode=ccsm_seq.
     -cc <name>          User specified C compiler (linux or darwin only).  Overrides Makefile default.
     -cflags <string>    A string of user specified C compiler options.  Appended to
                         Makefile defaults.
     -debug              Switch to turn on building CLM with debugging compiler options.
     -esmf_libdir <dir>  Directory containing ESMF library and esmf.mk file.
     -fc <name>          User specified Fortran compiler.  Overrides Makefile default.
     -fflags <string>    A string of user specified Fortran compiler flags.  Appended to
                         Makefile defaults.  See -fopt to override optimization flags.
     -fopt <string>      A string of user specified Fortran compiler optimization flags.  
                         Overrides Makefile defaults.
     -gmake <name>       Name of the GNU make program on your system.  Supply the absolute
                         pathname if the program is not in your path (or fix your path).
     -ldflags <string>   A string of user specified load options.  Appended to
                         Makefile defaults.
     -linker <name>      User specified linker.  Overrides Makefile default of $(FC).
     -mpi_inc <dir>      Directory containing MPI include files.
     -mpi_lib <dir>      Directory containing MPI library.
     -nc_inc <dir>       Directory containing netCDF include files.
     -nc_lib <dir>       Directory containing netCDF library.
     -nc_mod <dir>       Directory containing netCDF module files.
     -voc <name>         Turn on passing of Volatile Organic Compounds (VOC's) to driver [on | off] (default is on)

We've given details on how to use the options in env_conf.xml to interact with the CLM "configure" and "build-namelist" scripts, as well as giving a good understanding of how these scripts work and the options to them. In the next section we give further details on the CLM namelist. You could customize the namelist for these options after "configure -case" is run.