From d1c0f4f776f0b1d027296c67abf3d6f0be82cffc Mon Sep 17 00:00:00 2001 From: Helen Kershaw <20047007+hkershaw-brown@users.noreply.github.com> Date: Tue, 6 Jan 2026 14:40:53 -0500 Subject: [PATCH] feat: add clamping variables to MOM6 fixes #1028 --- models/MOM6/model_mod.f90 | 8 ++++---- models/MOM6/readme.rst | 21 +++++++++++++++------ models/MOM6/work/input.nml | 10 +++++----- 3 files changed, 24 insertions(+), 15 deletions(-) diff --git a/models/MOM6/model_mod.f90 b/models/MOM6/model_mod.f90 index 7121b5402..a2f3f6668 100644 --- a/models/MOM6/model_mod.f90 +++ b/models/MOM6/model_mod.f90 @@ -60,8 +60,8 @@ module model_mod init_time => fail_init_time, & init_conditions => fail_init_conditions, & convert_vertical_obs, adv_1step, & - parse_variables, & - MAX_STATE_VARIABLE_FIELDS + parse_variables_clamp, & + MAX_STATE_VARIABLE_FIELDS_CLAMP implicit none private @@ -127,7 +127,7 @@ module model_mod character(len=256) :: ocean_geometry = 'ocean_geometry.nc' integer :: assimilation_period_days = 1 integer :: assimilation_period_seconds = 0 -character(len=vtablenamelength) :: model_state_variables(MAX_STATE_VARIABLE_FIELDS) = ' ' +character(len=vtablenamelength) :: model_state_variables(MAX_STATE_VARIABLE_FIELDS_CLAMP) = ' ' character(len=NF90_MAX_NAME) :: layer_name = 'Layer' logical :: use_pseudo_depth = .false. ! use pseudo depth instead of sum(layer thickness) for vertical location @@ -178,7 +178,7 @@ subroutine static_init_model() ! parse_variables converts the character table that was read in from ! model_nml:model_state_variables to a state_var_type that can be passed ! to add_domain -dom_id = add_domain(template_file, parse_variables(model_state_variables)) +dom_id = add_domain(template_file, parse_variables_clamp(model_state_variables)) model_size = get_domain_size(dom_id) diff --git a/models/MOM6/readme.rst b/models/MOM6/readme.rst index e8bc5d6a5..144c29a6e 100644 --- a/models/MOM6/readme.rst +++ b/models/MOM6/readme.rst @@ -74,12 +74,12 @@ The namelist options for DART-MOM6 are as follows: &model_nml template_file = 'mom6.r.nc', ocean_geometry = 'ocean_geometry.nc', - static_file = 'c.e22.GMOM.T62_g16.nuopc.001.mom6.static.nc', - model_state_variables = 'Salt ', 'QTY_SALINITY ', 'UPDATE', - 'Temp ', 'QTY_POTENTIAL_TEMPERATURE', 'UPDATE', - 'u ', 'QTY_U_CURRENT_COMPONENT ', 'UPDATE', - 'v ', 'QTY_V_CURRENT_COMPONENT ', 'UPDATE', - 'h ', 'QTY_LAYER_THICKNESS ', 'UPDATE', + static_file = 'static.nc', + model_state_variables = 'Salt ', 'QTY_SALINITY ', 'NA', 'NA', 'UPDATE', + 'Temp ', 'QTY_POTENTIAL_TEMPERATURE', 'NA', 'NA', 'UPDATE', + 'u ', 'QTY_U_CURRENT_COMPONENT ', 'NA', 'NA', 'UPDATE', + 'v ', 'QTY_V_CURRENT_COMPONENT ', 'NA', 'NA', 'UPDATE', + 'h ', 'QTY_LAYER_THICKNESS ', 'NA', 'NA', 'UPDATE', assimilation_period_days = 1 assimilation_period_seconds = 0 use_pseudo_depth = .false. ! use pseudo depth instead of sum(layer thickness) for vertical location @@ -104,6 +104,15 @@ The namelist options for DART-MOM6 are as follows: geolat_v(:,:) Latitude of meridional velocity (Cv) point +* ``model_state_variables`` defines the list of model variables from the MOM6 restart file that will be included in the DART state. Each row in the table should have the following fields: + + - **NetCDF variable name**: Name of the variable in the MOM6 restart file (e.g., 'Salt'). + - **DART Quantity**: The DART quantity associated with the variable (e.g., 'QTY_SALINITY'). + - **Clamping lower bound**: Minimum allowed value for the variable when writing out restarts (use 'NA' for no bound). + - **Clamping upper bound**: Maximum allowed value for the variable when writing out restarts (use 'NA' for no bound). + - **UPDATE or NO_COPY_BACK**: Use 'UPDATE' to allow DART to update this variable during assimilation, or 'NO_COPY_BACK' to prevent updates (variable will be read but not written back). + + Vertical Coordinate ------------------- diff --git a/models/MOM6/work/input.nml b/models/MOM6/work/input.nml index 875e70cc5..7c6c32700 100644 --- a/models/MOM6/work/input.nml +++ b/models/MOM6/work/input.nml @@ -142,11 +142,11 @@ template_file = 'mom6.r.nc', static_file = 'mom6.static.nc', ocean_geometry = 'ocean_geometry.nc', - model_state_variables = 'Salt ', 'QTY_SALINITY ', 'UPDATE', - 'Temp ', 'QTY_POTENTIAL_TEMPERATURE', 'UPDATE', - 'u ', 'QTY_U_CURRENT_COMPONENT ', 'UPDATE', - 'v ', 'QTY_V_CURRENT_COMPONENT ', 'UPDATE', - 'h ', 'QTY_LAYER_THICKNESS ', 'UPDATE', + model_state_variables = 'Salt ', 'QTY_SALINITY ', 'NA', 'NA', 'UPDATE', + 'Temp ', 'QTY_POTENTIAL_TEMPERATURE', 'NA', 'NA', 'UPDATE', + 'u ', 'QTY_U_CURRENT_COMPONENT ', 'NA', 'NA', 'UPDATE', + 'v ', 'QTY_V_CURRENT_COMPONENT ', 'NA', 'NA', 'UPDATE', + 'h ', 'QTY_LAYER_THICKNESS ', 'NA', 'NA', 'UPDATE', / &utilities_nml