MOM6

From lzwei196/KISS-Knowledge-Infrastructure-for-Scientific-Simulation · View interactive version

MOM6 is an AI agent skill from the GitHub repository lzwei196/KISS-Knowledge-Infrastructure-for-Scientific-Simulation. > **MANDATORY EXECUTION POLICY** — READ BEFORE PROCEEDING

How to use this skill

Skill file

MANDATORY EXECUTION POLICY — READ BEFORE PROCEEDING

You MUST run the actual model binary or package described in this document.

If the model fails to import, compile, or execute, you MUST:

1. Check diagnostics/triplets.yaml for a matching error pattern

2. Try the fix suggested in the triplet's remedy section

3. If still failing, report the error to the user with full details

You MUST NOT substitute a simplified Python formula, regression equation,

or hand-coded approximation in place of the real model.

Before starting, run: python preflight_check.py (in this KI directory)

to verify that the model binary/package and required data are available.

DEBUGGING PROTOCOL — When something goes wrong, follow this order:

1. Check triplets — diagnostics/triplets.yaml may already cover this error

2. Read official docs — The model's own documentation for expected formats/units

3. Find working examples — Check outputs/ or the model's shipped test data

4. Fix the tool — With knowledge of what "correct" looks like

Do NOT write custom debug scripts. The answers are in the docs and examples.

<!-- KI-MAP:BEGIN (projected by generate_skill_map.py — edit the KI, not this table) -->

KI map — what to read, and when

| when you need | read | why |

|---|---|---|

| FIRST, always | preflight_check.py | run it (python preflight_check.py): proves env/binary/data are usable and emits a machine-readable PREFLIGHT_REPORT= line. Do not debug a run that never had a healthy environment. |

| to run the pipeline stages | tools/ (4 tools) | the executable pipeline. Read each tool's argparse (--help) before composing a command; SKILL.md's stage table says which tool serves which stage. |

| on ANY error, before debugging | diagnostics/triplets.yaml (16 entries) | symptom → diagnosis → remedy for this model's known failure modes. Check here FIRST; the answer usually exists. Never renumber or rewrite entries. |

| to know what an output IS | dag.yaml | the model's identity: every output's medium, units, validation_rank (1 = the headline variable) and observability. Scoring and obs-binding read THIS — when asked 'what does this model predict', the dag is the answer, not a guess. |

| when building inputs / parsing outputs | docs/format_spec.yaml | exact I/O shapes + known_issues, projected from dag + triplets. Regenerate with ki_tools_common/generate_format_spec.py after changing either — never hand-edit. |

| to judge a run's skill | docs/validation_convention.yaml | how this model's field judges it validated: per-dag_variable metrics, directions and CITED pass-bands. A run is graded against these, not against intuition. |

| for claims and thresholds | docs/gathered_papers.json (20 papers) + docs/papers_index.md | the literature this KI is judged by; each entry's text_path is fetched full text in the central paper cache. role: benchmark marks the model's own skill paper. |

| for a machine-readable summary | knowledge_infrastructure.yaml | the manifest (package, pipeline, validation tier, counts) — projected by ki_tools_common/generate_ki_manifest.py; regenerate after structural changes, never hand-edit. |

Projected 2026-08-17 from the KI's actual contents — 8 components present. Refresh: python3 ki_tools_common/generate_skill_map.py --ki_dir <this KI>.

<!-- KI-MAP:END -->

<!-- KI-TOOL-INDEX:BEGIN (projected by generate_skill_map.py — the discoverability contract: every public tool, exact path; PURPOSE stays human-authored elsewhere) -->

Executable tool index (projected — complete by construction)

Every public tool in this KI, by exact path. What each is FOR lives in the

human-written Tool Inventory above; --help on any of these prints its arguments.

| tool (exact path) | invocation |

|---|---|

| tools/forcing_converter.py | KISSPATH_PYTHON_ENV/bin/python {KI}/tools/forcing_converter.py --help |

| tools/output_parser.py | KISSPATH_PYTHON_ENV/bin/python {KI}/tools/output_parser.py --help |

| tools/run_mom6.py | KISSPATH_PYTHON_ENV/bin/python {KI}/tools/run_mom6.py --help |

| tools/topography_converter.py | KISSPATH_PYTHON_ENV/bin/python {KI}/tools/topography_converter.py --help |

4 public tools; _-prefixed helpers and packaging files excluded.

<!-- KI-TOOL-INDEX:END -->

MOM6 Ocean Model — Knowledge Infrastructure

1. Model Overview

MOM6 (Modular Ocean Model, version 6) is a numerical ocean model developed by

NOAA-GFDL for simulating large-scale ocean circulation, thermodynamics, and tracer

transport. It solves the hydrostatic primitive equations on an Arakawa C-grid using

the Arbitrary Lagrangian-Eulerian (ALE) vertical coordinate framework.

| Property | Value |

|---------------------|------------------------------------------------|

| Developer | NOAA-GFDL (Geophysical Fluid Dynamics Lab) |

| Language | Fortran 90/95 + C (FMS infrastructure) |

| License | LGPL v3 |

| Repository | https://github.com/NOAA-GFDL/MOM6 |

| Documentation | https://mom6.readthedocs.io |

| Build System | Autoconf + Make (with FMS dependency) |

| Parallelism | MPI domain decomposition + optional OpenMP |

| I/O Format | NetCDF4 (via FMS I/O layer) |

| Vertical Coordinate | ALE: z*, sigma, isopycnal, hybrid |

| Horizontal Grid | Arakawa C-grid (structured, curvilinear) |

| Time Integration | Split-explicit barotropic/baroclinic RK2 |

Key Capabilities


Data Preparation

Forcing data

Data Sources: Use from ki_tools_common.load_forcing import load_daily_forcing for CMFD/MSWX/NASA POWER.

Data Validation Reference: See data_ki/CMFD/SKILL.md for atmospheric forcing documentation.

See data_ki/NOAA_Tides/SKILL.md for tidal observation data.

See data_ki/NDBC/SKILL.md for wave buoy observations.

2. Installation and Build

2.1 Dependencies

| Dependency | Version | Purpose |

|----------------|------------|--------------------------------------|

| Fortran compiler | GFortran 9+ or Intel | Core compilation |

| MPI | OpenMPI/MPICH | Domain-decomposed parallelism |

| netCDF-Fortran | 4.5+ | I/O for grid, forcing, output files |

| netCDF-C | 4.7+ | Underlying C library for netCDF |

| FMS | 2023.03+ | GFDL framework (diagnostics, I/O) |

| autoconf | 2.69+ | Build configuration |

| mkmf | latest | GFDL Makefile generator |

2.2 Build Steps (Ocean-Only)

# 1. Clone with submodules
git clone --recursive https://github.com/NOAA-GFDL/MOM6.git
cd MOM6

# 2. Build FMS dependency
cd ac/deps
make -j

# 3. Configure MOM6
cd ../../ac
autoreconf -i
mkdir -p ../build && cd ../build
../ac/configure --with-driver=solo_driver

# 4. Compile
make -j $(nproc)
# Output: build/MOM6

2.3 Build Variants

| Variant | Flag | Use Case |

|--------------|-------------------------------|-----------------------------|

| Symmetric | (default) | Production runs |

| Asymmetric | --enable-asymmetric | Reduced memory footprint |

| OpenMP | --enable-openmp | Shared-memory parallelism |

| FMS_cap | --with-driver=FMS_cap | Coupled model integration |

| NUOPC | --with-driver=nuopc_cap | CESM/UFS coupling |

| Unit tests | --with-driver=unit_tests | Component testing |


3. Pipeline Stages

Stage 0: Grid Generation

Create the horizontal grid (supergrid) and vertical coordinate definition.

Stage 1: Topography / Bathymetry

Prepare ocean bottom depth from global datasets (GEBCO, ETOPO, SRTM).

Stage 2: Atmospheric Forcing

Convert atmospheric reanalysis (ERA5, JRA55, CORE) to MOM6 surface boundary.

Stage 3: Initial Conditions

Set initial temperature, salinity, and velocity fields.

Stage 4: Open Boundary Conditions (Optional)

Prescribe lateral boundary data for regional domains.

Stage 5: Parameter Configuration

Write MOM_input, MOM_override, input.nml, and diag_table.

Stage 6: Model Execution

Run the MOM6 binary with MPI.

Stage 7: Output Analysis

Extract and analyze model diagnostics.


4. Unit Conversion Table

This unit table documents the common conversions and sign conventions that must

be checked before building MOM6 inputs or judging diagnostic outputs. Exact I/O

shapes live in docs/format_spec.yaml; regenerate that projected spec after dag

or triplet changes rather than hand-editing it.

4.1 Unit Trap Table

Units are the most common source of silent errors. MOM6 uses SI internally but

input data often arrives in different units.

| Variable | MOM6 Internal Unit | Common Source Unit | Conversion Factor | Trap ID |

|--------------------|------------------------|-----------------------|--------------------------|---------|

| Temperature | degC (potential) | K (Kelvin) | T_C = T_K - 273.15 | dt_001 |

| Temperature | Conservative (TEOS10) | Potential temp | Use gsw_CT_from_pt() | dt_002 |

| Salinity | PSU (practical) | g/kg (absolute) | S_psu ≈ S_abs / 1.00472 | dt_003 |

| Salinity | PSU | ppm | S_psu = S_ppm / 1000 | dt_004 |

| Depth/Topography | m (positive down) | m (positive up) | depth = -elevation | dt_005 |

| Thickness (Bouss.) | m | kg/m² | h_m = h_kgm2 / rho_0 | dt_006 |

| Wind stress | Pa (N/m²) | dyn/cm² | tau_Pa = tau_dyn * 0.1 | dt_007 |

| Heat flux | W/m² (+ into ocean) | W/m² (+ out of ocean) | Q_in = -Q_out | dt_008 |

| Precipitation | kg/m²/s | mm/day | P = P_mm / 86400 | dt_009 |

| Pressure | Pa | dbar | P_Pa = P_dbar * 1e4 | dt_010 |

| Evaporation | kg/m²/s (negative) | mm/day (positive) | E = -E_mm / 86400 | dt_011 |

| Shortwave rad. | W/m² (+ into ocean) | W/m² (+ downward) | Usually same sign | dt_012 |

| Longwave rad. | W/m² (net, + into) | W/m² (downwelling) | LW_net = LW_down - ε σ T⁴| dt_013 |

| Time step (DT) | seconds | hours/minutes | DT_s = DT_h * 3600 | dt_014 |

| Coriolis | s⁻¹ | rad/s | Same unit | dt_015 |


5. Configuration Reference

5.1 MOM_input Key Parameters

! --- Grid ---
NIGLOBAL = 360            ! Global grid points in x [count]
NJGLOBAL = 180            ! Global grid points in y [count]
NK = 75                   ! Number of vertical layers [count]
NIHALO = 4                ! Halo width x [count]
NJHALO = 4                ! Halo width y [count]

! --- Time Stepping ---
DT = 900.0                ! Baroclinic dynamics timestep [s]
DT_THERM = 3600.0         ! Thermodynamics timestep [s]
DTBT = -0.98              ! Barotropic timestep [s]; negative = auto CFL
BE = 0.6                  ! Barotropic time-stepping implicitness [nondim]

! --- Physics ---
EQUATION_OF_STATE = "WRIGHT"  ! EOS choice: WRIGHT, TEOS10, UNESCO, LINEAR
RHO_0 = 1035.0            ! Reference density [kg/m³]
C_P = 3925.0              ! Heat capacity [J/(degC·kg)]
G_EARTH = 9.80            ! Gravitational acceleration [m/s²]
ENABLE_THERMODYNAMICS = True

! --- Vertical Coordinate ---
COORD_CONFIG = "file"     ! Vertical coordinate source
REGRIDDING_COORDINATE_MODE = "ZSTAR"  ! ALE target: ZSTAR, SIGMA, RHO, HYCOM
ALE_COORDINATE_CONFIG = "FILE:vcoord.nc,interfaces=zeta"

! --- Lateral Mixing ---
LAPLACIAN = True          ! Laplacian horizontal viscosity
KH = 600.0               ! Horizontal viscosity [m²/s]
SMAGORINSKY_AH = True     ! Smagorinsky biharmonic viscosity
SMAG_BI_CONST = 0.06      ! Smagorinsky coefficient [nondim]
THICKNESSDIFFUSE = True    ! GM thickness diffusion

! --- Vertical Mixing ---
KD = 1.0e-5              ! Background diapycnal diffusivity [m²/s]
KV = 1.0e-4              ! Background kinematic viscosity [m²/s]
BOTTOMDRAGLAW = True       ! Quadratic bottom drag
CDRAG = 0.003              ! Bottom drag coefficient [nondim]
BULKMIXEDLAYER = False     ! Use KPP instead
USE_KPP = True             ! KPP boundary layer scheme

! --- I/O ---
ENERGYSAVEDAYS = 1.0       ! Energy stats output interval [days]
RESTINT = 365.0            ! Restart write interval [days]
RESTART_CONTROL = 3        ! 1=generic, 2=timestamped, 3=both
SAVE_INITIAL_CONDS = True  ! Save IC file

5.2 input.nml Key Namelists

&ocean_solo_nml
  months = 0
  days = 365
  hours = 0
  date_init = 1990, 1, 1, 0, 0, 0
  calendar = 'NOLEAP'
/

&MOM_input_nml
  output_directory = './'
  input_filename = 'n'        ! 'n' = new run, 'r' = restart
  parameter_filename = 'MOM_input', 'MOM_override'
/

&diag_manager_nml
  max_axes = 100
  max_num_axis_sets = 50
  max_files = 40
  max_output_fields = 300
/

&fms_nml
  domains_stack_size = 710000
  stack_size = 0
/

5.3 diag_table Format

"MOM6 Diagnostics"
1990 1 1 0 0 0

"ocean_daily",   1, "days",  1, "days", "time"
"ocean_month",  30, "days",  1, "days", "time"
"ocean_annual",365, "days",  1, "days", "time"

# field_name, module, output_file, time_sampling, reduction, regional, packing
"temp",  "ocean_model", "ocean_daily", "all", .true., "none", 2
"salt",  "ocean_model", "ocean_daily", "all", .true., "none", 2
"ssh",   "ocean_model", "ocean_daily", "all", .true., "none", 2
"u",     "ocean_model", "ocean_month", "all", .true., "none", 2
"v",     "ocean_model", "ocean_month", "all", .true., "none", 2
"KE",    "ocean_model", "ocean_month", "all", .true., "none", 2
"MLD_003","ocean_model","ocean_month", "all", .true., "none", 2

6. Output Description

This section restates dag.yaml for the reader. The dag is the model identity:

if this section and dag.yaml disagree, dag.yaml wins.

Headline output (validation_rank: 1 in dag.yaml):

SSH — Sea surface height / dynamic free surface. (m)

Other dag outputs: SST, thetao, SSS, MLD_003, u,

ocean_heat_content.

| Output variable (dag var) | Rank | Unit | Description |

|-----------------------------|------|------|-------------|

| SSH | 1 | m | Sea surface height / dynamic free surface. |

| SST | dag output | see dag.yaml | listed in dag outputs |

| thetao | dag output | see dag.yaml | listed in dag outputs |

| SSS | dag output | see dag.yaml | listed in dag outputs |

| MLD_003 | dag output | see dag.yaml | listed in dag outputs |

| u | dag output | see dag.yaml | listed in dag outputs |

| ocean_heat_content | dag output | see dag.yaml | listed in dag outputs |

6.1 Key Variables and Diagnostics

6.1.1 Prognostic Variables (State)

| Variable | Symbol | Units | Grid Point | Description |

|----------|--------|------------|------------|--------------------------------|

| temp | T | degC | T-point | Potential/conservative temp |

| salt | S | PSU/g·kg⁻¹| T-point | Practical/absolute salinity |

| h | h | m | T-point | Layer thickness |

| u | u | m/s | u-point | Zonal velocity |

| v | v | m/s | v-point | Meridional velocity |

6.1.2 Key Diagnostic Variables

| Variable | Units | Description |

|------------|---------|----------------------------------------|

| ssh | m | Sea surface height (dynamic) |

| SST | degC | Sea surface temperature |

| SSS | PSU | Sea surface salinity |

| MLD_003 | m | Mixed layer depth (0.03 kg/m³ crit.) |

| KE | m²/s² | Kinetic energy per unit mass |

| PE_to_KE | W/m² | PE-to-KE conversion rate |

| uh | m³/s | Zonal volume flux |

| vh | m³/s | Meridional volume flux |

| e | m | Interface heights (layer boundaries) |

| Kd_itides | m²/s | Internal-tide driven diffusivity |

6.1.3 ocean.stats Format
  Step, Day, Truncs, Energy/Mass, Maximum CFL, Mean Sea Level, ...
     0,   0.000,  0, En 0.0000000E+00, CFL  0.000, SL -0.000E+00, ...
    96,   1.000,  0, En 1.2345678E-04, CFL  0.123, SL  1.234E-03, ...

7. Equation of State Options

| EOS Name | Parameter String | Input T Type | Input S Type | Accuracy |

|----------|------------------|--------------------|----------------------|----------|

| TEOS10 | "TEOS10" | Conservative [degC]| Absolute [g/kg] | Highest |

| Wright | "WRIGHT" | Potential [degC] | Practical [PSU] | High |

| UNESCO | "UNESCO" | Potential [degC] | Practical [PSU] | Standard |

| Linear | "LINEAR" | Any [degC] | Any [PSU] | Lowest |

Critical trap: If EQUATION_OF_STATE = "TEOS10", temperature MUST be conservative

temperature and salinity MUST be absolute salinity. Using potential temperature with

TEOS10 introduces a ~0.2 degC bias that is nearly invisible in short runs but

accumulates over decades.


8. Vertical Coordinate Modes

| Mode | Config String | Description | Best For |

|----------|---------------|------------------------------------------|--------------------|

| Z* | "ZSTAR" | Quasi-geopotential, free surface | General purpose |

| Sigma | "SIGMA" | Terrain-following | Shallow coastal |

| RHO | "RHO" | Isopycnal (density-following) | Deep ocean |

| HYCOM | "HYCOM1" | Hybrid isopycnal-z | Global production |

| Sigma-z | "SIGMA_SHELF_ZSTAR" | Sigma nearshore, z* offshore | Coastal-open ocean |


9. Common Workflows

9.1 Quick Smoke Test (Solo Driver)

cd run_directory
ln -s /path/to/build/MOM6 .
# Place MOM_input, input.nml, diag_table, INPUT/ files
mpirun -np 4 ./MOM6
# Check ocean.stats for energy conservation

9.2 Restart a Simulation

# In input.nml, change:
#   input_filename = 'r'   (was 'n')
# Copy RESTART/*.nc to INPUT/
cp RESTART/MOM.res.nc INPUT/
mpirun -np 4 ./MOM6

9.3 Regional Downscaling

  1. Generate regional grid with FRE-NCtools or gridtools-py
  2. Cut topography from GEBCO to regional domain
  3. Extract OBC segments from parent model
  4. Set OBC_SEGMENT_* parameters in MOM_input
  5. Run with REENTRANT_X = False, REENTRANT_Y = False

10. Tool Reference

| Tool Script | Stage | Purpose |

|------------------------------|-------|--------------------------------------------|

| forcing_converter.py | S2 | Convert atmospheric forcing to MOM6 NetCDF |

| topography_converter.py | S1 | Process bathymetry for MOM6 grid |

| run_mom6.py | S6 | Execute MOM6 with preflight checks |

| output_parser.py | S7 | Parse diagnostics to CSV + compute metrics |

All tools follow the validate → process → validate pattern:

  1. Pre-validate: Check input file existence, variable names, units
  2. Process: Perform conversion/execution with unit safeguards
  3. Post-validate: Verify output integrity, physical bounds, NaN checks

11. Validated Results

11.1 Physical Bounds for Validation

| Variable | Valid Range | Alarm Threshold |

|-----------------|------------------------|-----------------------|

| Temperature | -2.0 to 40.0 degC | < -3 or > 42 degC |

| Salinity | 0.0 to 42.0 PSU | < -0.1 or > 50 PSU |

| SSH | -10.0 to 10.0 m | |SSH| > 15 m |

| Velocity (u,v) | -5.0 to 5.0 m/s | |vel| > 8 m/s |

| Layer thickness | 0.0 to 8000.0 m | h < -0.001 m |

| MLD | 0.0 to 5000.0 m | MLD > depth |

| KE | 0.0 to 10.0 m²/s² | KE > 20 m²/s² |

| Bottom drag | 0.001 to 0.01 nondim | > 0.05 |

11.2 Convention Bars and Pending Results

Validated run metrics are pending for this KI body campaign. Until a run table

is generated, judge MOM6 outputs against the cited field convention in

docs/validation_convention.yaml, not against intuition or uncited thresholds.

Performance Metrics -- Convention Bars

The dag rank-1 output is SSH. These bars restate the convention entries and

their citation keys exactly as supplied for this KI.

| Dag variable | Metric | Direction | Very good | Good | Satisfactory | Citation keys |

|--------------|--------|-----------|-----------|------|--------------|---------------|

| SSH | rmse | minimize | 7.0 (lellouche2013, ross2023, tsujino2020) | 8.0 (lellouche2013, ross2023, tsujino2020) | 8.67 (lellouche2013, ross2023, tsujino2020) | lellouche2013, ross2023, tsujino2020 |

| SSH | corr | maximize | 0.97 (ross2023) | 0.9 (ross2023) | 0.5 (ross2023) | ross2023 |

| SSH | mss | maximize | 1.0 (lellouche2013) | 0.5 (lellouche2013) | 0.0 (lellouche2013) | lellouche2013 |

| SST | rmse | minimize | 0.4 (seelanki2025, tsujino2020, lellouche2013) | 0.467 (seelanki2025, tsujino2020, lellouche2013) | 0.6 (seelanki2025, tsujino2020, lellouche2013) | seelanki2025, tsujino2020, lellouche2013 |

| SST | bias | zero_centered | 0.23 (ross2023, tsujino2020) | 0.4 (ross2023, tsujino2020) | 0.5 (ross2023, tsujino2020) | ross2023, tsujino2020 |

| Dag variable | Achieved metric values | Status |

|--------------|------------------------|--------|

| SSH | no validated run metrics stated in this SKILL body | pending |

| SST | no validated run metrics stated in this SKILL body | pending |

Data Replacement Tracking

| Component | Source | Status | Notes |

|-----------|--------|--------|-------|

| Forcing | Pipeline | Pending | Use ki_tools_common.load_forcing and the referenced data KIs before running. |

| Grid/topography | Pipeline | Pending | Validate INPUT/ocean_hgrid.nc, INPUT/vcoord.nc, and INPUT/topog.nc. |

| Initial conditions | Pipeline | Pending | Validate INPUT/MOM_IC.nc or restart source fields. |

| Open boundaries | Pipeline, optional | Pending | Required only for regional domains with OBC segments. |

| Diagnostics | MOM6 output parser | Pending | Bind outputs through dag.yaml; rank-1 validation target is SSH. |


12. Failure Domains

  1. Unit Conversion: Temperature K↔C, salinity PSU↔g/kg, depth sign, flux sign
  2. Grid Mismatch: Symmetric vs asymmetric, halo size, domain decomposition
  3. EOS Mismatch: Wrong T/S type for chosen equation of state
  4. Timestep Instability: CFL violation, barotropic blowup, negative thickness
  5. I/O Errors: Missing INPUT files, wrong variable names, dimension mismatch
  6. Forcing Errors: Temporal interpolation gaps, land-sea mask inconsistency
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.