Skip to content

Detailed Instructions

Alper Altuntas edited this page Oct 3, 2024 · 26 revisions

Contents:

1. Downloading CESM with MOM6

2. Creating a MOM6 case

3. Running a MOM6 case

4. Customizing MOM6 cases


1. Downloading CESM with MOM6

Prerequisite: Make sure that CESM is already ported to your machine.

MOM6 is included in CESM3 as the ocean component. The following instructions describe how to download an alpha version of CESM3.

  • Clone a local copy of CESM as follows:

    git clone -b cesm3_0_alpha03d https://github.com/ESCOMP/CESM.git
    
    
  • After having cloned CESM, run the git-fleximod tool to download all of the individual CESM components:

    (cd CESM/; ./bin/git-fleximod update)
    

2. Creating a MOM6 case:

  • Run CESM's create_newcase script to create a MOM6 case instance. The script expects the following three required arguments: --compset, --res, and --case. As the names suggest, --compset and --res arguments are to specify the component set and the model resolution, respectively. The third argument, --case, specifies the name of the case to be created. In the below example, we name our case g.e22.G_JRA.TL319_t232.001. When naming a case, users are advised to adhere to CESM naming conventions.

    CESM/cime/scripts/create_newcase --res TL319_t232 --compset G_JRA --case g.e22.G_JRA.TL319_t232.001
    

    Some of the other useful create_newcase options when creating a MOM6 case:

    • --walltime: Set the wallclock limit, e.g., --walltime 01:00:00
    • --project: Specify a project id for the case
    • --compiler, e.g., --compiler gnu

    Available compsets and resolutions

    See What's-Available.

3. Running MOM6 cases:

  • After having initialized the case, cd into the case root and run ./case.setup to prepare the case for the compilation: (The above command will create user_nl_mom text file, which is to be used for customizing the case. More on that later...)

    cd g.e22.G_JRA.TL319_t232.001
    ./case.setup
    
  • Within the case root, run /case.build to compile MOM6+CESM executable. Depending on the compset and the compiler of your choice, this step may take ~10 minutes.

    ./case.build
    

    Note: derecho users need to run this command on a compute node using the qcmd command.

  • Finally, submit the job to the batch queue using the case.submit script:

    ./case.submit
    

    Locating input and output files:

  • MOM_RPS module in CESM stages and places all runtime MOM6 parameter files in the run directory (RUNDIR) as well as under CaseDocs subdirectory within your case directory.

  • Once the run finishes, you can access the output files in the short term archive directory if short term archiving is turned on. To find out whether short term archiving is on, run the following command in your case root.

    ./xmlquery DOUT_S
    

    To query your short term archive directory (DOUT_S_ROOT), run the following command:

    ./xmlquery DOUT_S_ROOT
    

    If the short term archiver is turned off, the output files are located in your case run directory along with the input files.

4. Customizing MOM6 cases:

The available mechanisms for customizing MOM6 cases within CESM are:

  1. xmlchange
  2. user_nl_mom
  3. SourceMods

4.1 xmlchange

  • Users can control some general case variables defined in case *.xml files using the xmlchange tool in the case root. The variables that can be changed via xmlchange usually correspond to general, component-agnostic settings. Some examples:

    ./xmlchange DOUT_S=FALSE       # Turn off short term archiving
    ./xmlchange STOP_OPTION=nmonth 
    ./xmlchange STOP_N=3           # set run length to 3 months
    ./xmlchange NCPL_OCN=48        # set ocn coupling frequency to 48 (a day)
    
  • Additionally, users can change the following two xml variables that control MOM6 diagnostics on a high level.

    • OCN_DIAG_MODE: This variable is used to choose from a set of predefined ocean diagnostics configurations. Each configuration corresponds to a different combination of frequency, precision, and field lists. Predefined onfigurations ordered in increasing scope/frequency: "spinup", "production", "development". Further customization of diagnostics may be done by copying an edited version of diag_table file in SourceMods/src.mom/
    • OCN_DIAG_SECTIONS: Flag to turn on/off the MOM6 sections diagnostics.

    Examples:

    ./xmlchange OCN_DIAG_MODE="spinup"
    ./xmlchange OCN_DIAG_SECTIONS=FALSE
    

    The current value of any xml variable may be checked via xmlquery, e.g.:

    ./xmlquery NTASKS_OCN
    

4.2 user_nl_mom

Users can override out-of-the-box MOM6 runtime parameters via the user_nl_mom file located in the case root. An empty user_nl_mom file gets created when the user runs the ./case.setup script. If users add entries in this file, MOM_RPS module in CESM creates a corresponding MOM_override file in the run directory. While this MOM_override file is the actual input file to be read by MOM6, any changes made in this file will be overriden by the MOM_RPS module. Thus, all parameter changes must be specified via user_nl_mom (or via SourceMods).

The syntax of user_nl_mom entries is as follows:

! some optional comment line here
VARNAME = NEWVAL

Examples:

DT = 900.0
DT_THERM = 1800.0

If the parameter to be overridden belongs to a module, e.g., KPP, the change is specified as follows. Example:

KPP%
MATCH_TECHNIQUE = MatchGradient
%KPP

Note: Unlike original MOM input files, user_nl_mom does not require #override keyword. MOM_RPS module adds this keyword in automatically generated MOM_override file if needed.

To check out the out-of-the-box MOM6 parameter values in CESM, run ./case.setup and ./preview_namelist commands. This will create the MOM_input file in the run directory. This file contains

4.3 SourceMods

Warning: This mechanism is for development purposes only. End users are strongly advised to use user_nl_mom for changing runtime parameters. Note, however, that currently the only mechanism for low-level control of diagnostics is via SourceMods. For high-level control of diagnostics, see xmlchange.

You can place your own versions of the following four MOM6 runtime input files in SourceMod/src.mom to override out-of-the-box CESM configuration:

  • MOM_input
  • MOM_override
  • diag_table
  • input.nml

Note: You can run ./case.setup and ./preview_namelist commands to generate out-of-the-box versions of these files in the run directory. You can then copy them intoSourceMod/src.mom and edit them.

See the following documentation on how to prepare/edit diag_table: https://mom6.readthedocs.io/en/dev-gfdl/api/generated/pages/Diagnostics.html