Skip to content

Revise MOM_CVMix_KPP to restore MOM/main answers#431

Open
Hallberg-NOAA wants to merge 1 commit into
NCAR:dev/ncarfrom
Hallberg-NOAA:CVMix_KPP_bugflag
Open

Revise MOM_CVMix_KPP to restore MOM/main answers#431
Hallberg-NOAA wants to merge 1 commit into
NCAR:dev/ncarfrom
Hallberg-NOAA:CVMix_KPP_bugflag

Conversation

@Hallberg-NOAA
Copy link
Copy Markdown

Added options to the MOM_CVMix_KPP module to allow for previous answers to be recovered. This includes adding the flag KPP%KPP_OBL_DEPTH_BOUNDS_BUG that can be set to true to recover the current answers on dev/ncar or last to recover the answers on main. The default is to give the main-branch answers.

This commit also adds code using KPP%ANSWER_DATE to select whether to use older code doing divisions for dates before 20260101, but replacing them with multiplication by reciprocals for higher values.

The code setting CS%Lam2 was revised to avoid any chance of division by zero and to correct for inconsistently scaled variables.

In 3 places GV%g_Earth_Z_T2 is being used again in place of US%L_to_Z**2*GV%g_Earth. This change had been made previously on the main branch of MOM6, but older code without this change was reintroduced on dev/ncar.

Two h arguments in one call to Compute_StokesDrift() were replaced with the equivalent values of dz for dimensional consistency. In unscaled Boussinesq mode these are equivalent, but in non-Boussinesq mode the mixing of depth and thickness units would lead to nonsensical results.

Notes were added around the calls to cvmix_kpp_compute_StokesXi() pointing out the inconsistent dimensional scaling of some of its velocity arguments.

There are other minor changes in this module, including adding or correcting the descriptions of the units of the variables in Compute_StokesDrift(), and correcting some spelling errors or other inconsistencies in comments.

To recover answers from dev/ncar, set KPP%KPP_OBL_DEPTH_BOUNDS_BUG = .true. and KPP%ANSWER_DATE = 20260101 or higher, either directly or via DEFAULT_ANSWER_DATE. To recover answers that are currently on main, set KPP%KPP_OBL_DEPTH_BOUNDS_BUG = .false. (the default), and KPP%ANSWER_DATE = 20251231 or lower. This commit does change the entries in the MOM_parameter_doc files.

  Added options to the MOM_CVMix_KPP module to allow for previous answers to be
recovered.  This includes adding the flag `KPP%KPP_OBL_DEPTH_BOUNDS_BUG` that
can be set to true to recover the current answers on dev/ncar or last to recover
the answers on main.  The default is to give the main-branch answers.

  This commit also adds code using `KPP%ANSWER_DATE` to select whether to use
older code doing divisions for dates before 20260101, but replacing them with
multiplication by reciprocals for higher values.

  The code setting `CS%Lam2` was revised to avoid any chance of division by zero
and to correct for inconsistently scaled variables.

  In 3 places `GV%g_Earth_Z_T2` is being used again in place of
`US%L_to_Z**2*GV%g_Earth`.  This change had been made previously on the main
branch of MOM6, but older code without this change was reintroduced on dev/ncar.

  Two `h` arguments in one call to `Compute_StokesDrift()` were replaced with the
equivalent values of `dz` for dimensional consistency.  In unscaled Boussinesq
mode these are equivalent, but in non-Boussinesq mode the mixing of depth and
thickness units would lead to nonsensical results.

  Notes were added around the calls to `cvmix_kpp_compute_StokesXi()` pointing
out the inconsistent dimensional scaling of some of its velocity arguments.

  There are other minor changes in this module, including adding or correcting
the descriptions of the units of the variables in `Compute_StokesDrift()`, and
correcting some spelling errors or other inconsistencies in comments.

  To recover answers from dev/ncar, set `KPP%KPP_OBL_DEPTH_BOUNDS_BUG = .true.`
and `KPP%ANSWER_DATE = 20260101` or higher, either directly or via
`DEFAULT_ANSWER_DATE`.  To recover answers that are currently on main, set
`KPP%KPP_OBL_DEPTH_BOUNDS_BUG = .false.` (the default), and `KPP%ANSWER_DATE =
20251231` or lower. This commit does change the entries in the MOM_parameter_doc
files.
uE_H(k) = U_H(k) - 0.5 * (Waves%US_x(I,j,k)+Waves%US_x(I-1,j,k))
vE_H(k) = V_H(k) - 0.5 * (Waves%US_y(i,J,k)+Waves%US_y(i,J-1,k))

! ToDo: Explore whether it is problematic that most of the velocities are being passed
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I spent some time looking into cvmix_kpp_compute_StokesXi(), and because it includes a hard-coded dimensional floor of 0.0001 m s-1 on the friction velocity (see https://github.com/mom-ocean/CVMix-src/blob/fce422195a0c58f15a55946b5ed517ba4365e232/src/shared/cvmix_kpp.F90#L3464), all arguments to cvmix_kpp_compute_StokesXi() must be in MKS units. But for this single hard-coded floor, it might have been possible to work in rescaled units, with some rescaling of arguments using US%L_to_Z. As written I am certain that this code will fail dimensional consistency testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant