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

+Simplify rescaling by US%L_to_Z #806

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

Conversation

Hallberg-NOAA
Copy link
Member

This PR consists of three commits that eliminate 46 instances where there was a need to multiply by US%L_to_Z during run-time. There are 9 instances where there are compensating additions of factors of US%L_to_Z to scale or conversion arguments that are used during model initialization.

The first commit introduces a newly rescaled version of the gravitational acceleration, GV%g_Earth_Z_T2, to the verticalGrid_type as a copy of GV%g_Earth that uses dimensional rescaling of [Z T-2 ~> m s-2] instead of [L2 Z-1 T-2 ~> m s-2]. GV%g_Earth_Z_T2 is more convenient for single-column energy calculations (for which horizontal scales should be irrelevant), but the two variables will only differ by an integer power of two when dimensional rescaling is applied. This new version of the gravitational acceleration is used in 15 files.

Another US%L_to_Z**2 rescaling factor was eliminated from the code in ePBL_column() by folding it into MKE_to_TKE_effic.

The second commit revises the internal rescaling of turbulent kinetic energies in MOM_bulk_mixed_layer to work in units of [H Z2 T-2] instead of [H L2 T-2], for greater consistency with the rescaling of TKE elsewhere. These changes included using GV%g_Earth_Z_T2 instead of GV%g_Earth in 16 places that contribute to potential energy calculations. In 5 lines, the unit scaling factors were eliminated, while in 2 others the rescaling factors were revised. In addition, the rescaling factors to go from the units of mean kinetic energy to those of turbulent kinetic energy were folded into the internal representation of the bulk Richardson numbers. The units in comments describing 58 variables and the conversion arguments for 10 diagnostics were updated accordingly.

The third commit rescales the internal representation of the FGNV_STRAT_FLOOR variable and thickness_diffuse%N2_floor in MOM_mixedlayer_restrat to include appropriate factors of US%Z_to_L to reflect the scaling of aspect ratios. This leads to the elimination of one rescaling factor in thickness_diffuse_full() and its replacement by another in a scale factor for a get_param() call.

All answers and output are bitwise identical, but there is a new element in a transparent type. The specific commits in this PR include:

  Added the new gravitational acceleration element GV%g_Earth_Z_T2 to the
verticalGrid_type as a copy of GV%g_Earth that uses dimensional rescaling of
[Z T-2 ~> m s-2] instead of [L2 Z-1 T-2 ~> m s-2].   GV%g_Earth_Z_T2 is more
convenient for single-column energy calculations, but the two will only differ
by an integer power of two when dimensional rescaling is applied.  In addition,
the apparently unused element GV%mks_g_Earth was commented out, and it will be
eliminated in several months if there are no concerns raised by MOM6 users whose
code is not on any of the primary development branches of MOM6.

  Explicitly rescaled versions of GV%g_Earth were replaced by GV%g_Earth_Z_T2 in
38 places in 14 files, leading to the elimination of 38 US%L_to_Z**2
dimensional rescaling factors.

  Another US%L_to_Z**2 rescaling factor was eliminated from the code in
ePBL_column by folding it into MKE_to_TKE_effic.

  All answers are bitwise identical, but there are changes to the contents of a
transparent type.
  Revised the internal rescaling of turbulent kinetic energies in
MOM_bulk_mixed_layer to work in units of [H Z2 T-2] instead of [H L2 T-2], for
greater consistency with the rescaling of TKE elsewhere.  These changes included
using GV%g_Earth_Z_T2 instead of GV%g_Earth in 16 places that contribute to
potential energy calculations.  In 5 lines, the unit scaling factors were
eliminated, while in 2 others the rescaling factors were revised.  In addition,
the rescaling factors to go from the units of mean kinetic energy to those of
turbulent kinetic energy were folded into the internal representation of the
bulk Richardson numbers.  The units in comments describing 58 variables
and the conversion arguments for 10 diagnostics were updated accordingly.  All
answers and output are bitwise identical.
  Rescaled the internal representation of the FGNV_STRAT_FLOOR variable and
thickness_diffuse%N2_floor to include appropriate factors of US%Z_to_L to
reflect the scaling of aspect ratios.  This leads to the elimination of one
rescaling factor in thickness_diffuse_full() and its replacement by another
in a scale factor for a get_param call.  All answers are bitwise identical.
@Hallberg-NOAA Hallberg-NOAA added the refactor Code cleanup with no changes in functionality or results label Jan 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Code cleanup with no changes in functionality or results
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant