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

Intent out halos #847

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

Conversation

Hallberg-NOAA
Copy link
Member

+(*)Set initialized state halos & intent out halos

This PR consists of 3 commits that set the halo regions of several intent(out) variables that are subsequently used in halo update or checksum calls or could otherwise be used to set other variables, such as those related to open boundary conditions.

To achieve this, the new overloaded interfaces reset_h_var_halo_vals() and reset_vector_halo_vals() have been added to the MOM_debugging module to reset the halo regions of a 2-d or 3-d tracer-cell array or the components of a 2-d or 3-d C-grid vector to specified values. When the new runtime parameter RESET_STATE_HALOS_POST_INIT is set to true, these are used to set the 5 state variable halos (h, u, v, T and S) to sensible values before a pass var is done on htem. Enabling this option does change answers with the Baltic_OM4_05 test case and perhaps others, but it is not enabled by default.

The halos of 7 other intent out variables that are used in halo updates or checksums but do not appear to changes answers (probably because their previously unset halo points are masked out by landmasks when they would not be reset by a halo update) are also explicitly set. The impacted arrays are u_cor and v_cor in continuity_PPM(), h_MLD in convert_MLD_to_ML_thickness(), MLD in energetic_PBL_get_MLD() and LmixScale, bottomFac2 and barotrFac2 in MEKE_lengthScales(). This commit does change the values in the debugging checksum output for some cases to more nearly reproduce under dimensional rescaling and rotation.

By default, all answers in the MOM6-examples test suite are bitwise identical. However, it is possible that there are cases where the answers change, but if so the existing answers should probably be considered to be incorrect. There are two new public interfaces, and a new entry in the MOM_parameter_doc files. The commits in this PR include:

  • 27e8cbd24 +Reset state var halo values after initialization
  • 5c361958b +Add reset_h_var_halo_vals and reset_vector_halo_vals
  • 6d5fbc241 (*)Initialize halos for 7 intent out arrays

  Initialize the halos of 7 intent out arrays to 0 so that they will not have
uninitialized data in their halo regions.  The impacted arrays are u_cor and
v_cor in continuity_PPM, h_MLD in convert_MLD_to_ML_thickness, MLD in
energetic_PBL_get_MLD and LmixScale, bottomFac2 and barotrFac2 in
MEKE_lengthScales.  This does not change solutions in any of the MOM6-examples
test cases, but it is conceivable that could, and it does change the values
in the debugging checksum output for some cases to more nearly reproduce
under dimensional rescaling and rotation.
  Added the new interfaces reset_h_var_halo_vals and reset_vector_halo_vals to
the MOM_debugging module to reset the halo regions of a 2-d or 3-d tracer-cell
array or the components of a 2-d or 3-d C-grid vector to specified values.  This
can be useful when working with arrays that have had their halo values replaced
with random values being used for intent(out) arrays, and for debugging bad
values along side checksum calls.  All answers are bitwise identical,
but there are two new public interfaces.
  Reset 5 state variable halo values after initialization to compensate for
unintended values that may have been set via intent(out) arrays in the
initialization routines, when the new runtime parameter
RESET_STATE_HALOS_POST_INIT is set to true.  A subsequent halo update will
replace these values in many cases, but enabling this option does change answers
in the Baltic_OM4_05 test case and perhaps others.  By default all answers are
bitwise identical, but there is a new runtime parameter.
@Hallberg-NOAA Hallberg-NOAA added the Parameter change Input parameter changes (addition, removal, or description) label Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Parameter change Input parameter changes (addition, removal, or description)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant