Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fake PR for QG Leith Visc bug fix #10

Open
wants to merge 2 commits into
base: dev/gfdl
Choose a base branch
from

Conversation

Hallberg-NOAA
Copy link
Owner

This PR is for discussion only of the changes needed for the QG Leith viscosity to reproduce across PE count, layouts and restarts to address mom-ocean#1590.

An actual PR would go instead via the NOAA-GFDL: dev/gfdl, but some cleanup and conflict resolution is needed before this could occur.

 VarMix_CS%slope_x was being set with units of [Z L-1 ~> nondim], but described
in comments as though it was simply [nondim], and then used in the (apparently
unused?) calculate_slopes=.false. branch in calc_slope_functions_using_just_e as
though its units actually were [nondim].  This commit corrects this
inconsistency, while also rescaling the internal slope variables in that routine
to also have the proper units of [Z L-1 ~> nondim].  In so doing, several
rescaling factors could be eliminated from the calculations.  In addition, the
slopes used in calc_QG_Leith_viscosity were also being rescaled with the wrong
factor or had dimensionally incorrect tiny values in some denominators, and this
has been corrected as well.  In testing this rescaling fix, a number of other
bugs were identified with USE_QG_LEITH_VISC=True (as described at
github.com/mom-ocean/issues/1590), so a fatal error message was added if
this option is enabled.  All answers in the MOM6-examples test suite are bitwise
identical, but the code will now give a fatal error if USE_QG_LEITH_VISC=.true.
  This commit includes a series of changes that get MOM6 to reproduce across
processor counts, layouts and restarts when USE_QG_LEITH_VISC = True.  These
changes include:

  - Expanding the halos to 2 in updates for h, tv%T and tv%S

  - Adding a thermo_var_ptrs and a timestep argument to to the interfaces to
    horizontal_viscosity and initialize_dyn_split_RK2

  - Adding the new publicly visible routine calc_QG_slopes

  - Adding the arguments slope_x and slope_y to calc_QG_Leith_viscosity and
    avoiding the use of the VarMix%slope_[xy] elements in that routine

  - Increasing some loop extents in calc_QG_Leith_viscosity

Note that several of the expansions of the halo sizes in updates or in some
of the calculations are not necessary if an extra halo update is included for
slope_x and slope_y after the call to calc_QG_slopes in horizontal_viscosity.
This extra halo update has also been included.  As it stands, this commit is a
working draft intended for discussion; once there is a collective decision about
how to handle some of the options here, there should be some clean-up before
this code is merged into the main branch of MOM6.  This commit includes several
changes to publicly visible interfaces, and it will change answers with
USE_QG_LEITH_VISC = True, but answers and output are bitwise identical in other
cases.
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