Revise MOM_CVMix_KPP to restore MOM/main answers#431
Open
Hallberg-NOAA wants to merge 1 commit into
Open
Conversation
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.
63c5ea4 to
5f068ae
Compare
Hallberg-NOAA
commented
May 12, 2026
| 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 |
Author
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_BUGthat 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_DATEto 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%Lam2was revised to avoid any chance of division by zero and to correct for inconsistently scaled variables.In 3 places
GV%g_Earth_Z_T2is being used again in place ofUS%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
harguments in one call toCompute_StokesDrift()were replaced with the equivalent values ofdzfor 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.andKPP%ANSWER_DATE = 20260101or higher, either directly or viaDEFAULT_ANSWER_DATE. To recover answers that are currently on main, setKPP%KPP_OBL_DEPTH_BOUNDS_BUG = .false.(the default), andKPP%ANSWER_DATE = 20251231or lower. This commit does change the entries in the MOM_parameter_doc files.