+OBC grid rotation debugging code#904
Merged
Merged
Conversation
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.
|
It is logical to separate the answer-changing commits from the rest. I approve this part. |
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.
06c63f5 to
8abcf2d
Compare
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. |
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.
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()andchksum_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 parametersDEBUG_OBCSandNK_OBC_DEBUG. The new functionrotate_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_OBChas been renamed toOBC_DEBUGGING_TESTS(while retainingDEBUG_OBCas 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: