Skip to content

+OBC grid rotation debugging code#904

Merged
Hallberg-NOAA merged 3 commits into
NOAA-GFDL:dev/gfdlfrom
Hallberg-NOAA:OBC_debugging
May 21, 2025
Merged

+OBC grid rotation debugging code#904
Hallberg-NOAA merged 3 commits into
NOAA-GFDL:dev/gfdlfrom
Hallberg-NOAA:OBC_debugging

Conversation

@Hallberg-NOAA
Copy link
Copy Markdown
Member

This PR consists of three commits that add diagnostic capabilities the to help diagnose the models' (in)ability to rotate (single-processor) configurations that use open boundary conditions and obtain bitwise identical solutions.

The changes include the introduction of the new publicly visible routines write_OBC_info() and chksum_OBC_segments() that write extensive debugging information about the OBC fields, and which were used to identify the various bugs that will be corrected in a subsequent pull request. Calls to these routines are enabled via the new runtime parameters DEBUG_OBCS andNK_OBC_DEBUG. The new function rotate_OBC_segment_direction() is now available to convert the directions of OBC segments when there is grid rotation.

A fatal error message that previously prevented cases with OBCs from running with arbitrary rotation has been removed.

The previous runtime parameter DEBUG_OBC has been renamed to OBC_DEBUGGING_TESTS (while retaining DEBUG_OBC as the old name for backward compatibility) to avoid confusion with other debugging calls that do not actually change the model state.

Apart from the minor refactoring of transferring some code into the small publicly visible routine rotate_OBC_segment_direction(), only debugging code was add or modified. All solutions are bitwise identical, although some cases that were previously blocked by a fatal error message will now work. However, there are several new or renamed runtime parameters and three new publicly visible interfaces. The specific commits in this PR include:

  • 06c63f52f +Add DEBUG_OBCS and OBC_DEBUGGING_TESTS
  • 6d0dc7c85 +Add chksum_OBC_segments and write_OBC_info
  • 4ccfb173b +Add rotate_OBC_segment_direction

  Added the new function rotate_OBC_segment_direction that returns an integer
indicating the direction of an OBC segment on rotated grid, given its direction
on the current grid and the number of turns by which that grid has been
rotated.  A negative number of turns undoes the rotation.  For now this new
routine is used in rotate_OBC_segment_config, but additional uses will follow
with subsequent commits.  All answers are bitwise identical, but there is a new
publicly visible function.
  Added the new publicly visible subroutines write_OBC_info() and
chksum_OBC_segments() for writing verbose information for debugging open
boundary conditions.  Write_OBC_info() writes extensive information about the
settings and the contents of arrays in the ocean_OBC_type, modifying the output
so that it should be largely invariant to rotation.  Chksum_OBC_segments() does
a checksum on all allocated elements of the open boundary condition segments and
optionally writes out a number of layers of segment data, with the order of
output chosen to appear as it would if the data were for an eastern open
boundary.  Because write_OBC_info() is rather verbose, it should probably only
be used for intensive debugging, while the nk argument to chksum_OBC_segments()
helps to manage its verbosity and makes it a candidate for inclusion in more
wide-spread debugging.  This commit also adds scalar_pair arguments to 5
uvchksum calls for radiation and oblique open boundary conditions and tracer
reservoirs.  Only diagnostic debugging code is added here, and all solutions are
bitwise identical, but there are two new publicly visible interfaces for writing
information for debugging open boundary conditions.
@Hallberg-NOAA Hallberg-NOAA added enhancement New feature or request Parameter change Input parameter changes (addition, removal, or description) labels May 20, 2025
@kshedstrom
Copy link
Copy Markdown

It is logical to separate the answer-changing commits from the rest. I approve this part.

@theresa-cordero theresa-cordero self-requested a review May 21, 2025 13:48
Copy link
Copy Markdown

@theresa-cordero theresa-cordero left a comment

Choose a reason for hiding this comment

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

Approved on behalf of Kate

  Added the new runtime parameter DEBUG_OBCS that triggers verbose diagnostic
output about the contents of the open boundary condition type via calls to the
new routines write_OBC_info() and chksum_OBC_segments(), along with the new
runtime parameter NK_OBC_DEBUG to regulate the volume of diagnostic output.  It
also renames the previous runtime parameter DEBUG_OBC to OBC_DEBUGGING_TESTS to
trigger the code that resets the normal velocities at OBC segments to zero and
the thicknesses and tangential velocities behind OBC segments to silly values
for testing, with DEBUG_OBC retained for now as the old name.  This latter
change follows the pattern elsewhere in the code in which other DEBUG parameters
do not actually change any values.  This commit also eliminates a fatal error
message if open boundary conditions are applied with rotations of 180 or 270
degrees.  All solutions in cases that worked previously are bitwise identical,
but there are new runtime parameters.
@Hallberg-NOAA
Copy link
Copy Markdown
Member Author

This PR has passed pipeline testing at https://gitlab.gfdl.noaa.gov/ogrp/mom6ci/MOM6/-/pipelines/27503 with the expected warnings about new debugging parameters.

@Hallberg-NOAA Hallberg-NOAA merged commit 748178c into NOAA-GFDL:dev/gfdl May 21, 2025
52 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request Parameter change Input parameter changes (addition, removal, or description)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants