+*Fix OBCs with generic tracers and rotate OBC segment initialization#966
Merged
Hallberg-NOAA merged 6 commits intoSep 3, 2025
Merged
Conversation
Returned the functionality of open_boundary_setup_vert() to a separate routine, and no longer have initialize_segment_data() carry out these initialization steps. These routines had previously been combined in the expectation that they would always occur at about the same point in the code but this turns out not to be the case for generic tracers with open boundary conditions. This renewed routine is called directly form initialize_MOM. All answers are bitwise identical but there is one added public OBC interface.
Add separate OBC_for_remap and OBC_for_bug arguments to MOM_initialize_state() to clarify the distinct roles of the two arguments, to make it clear that one can not be used without rotation, and to prepare for the eventual obsoleting of OBC_RESERVOIR_INIT_BUG. This commit also simplifies the logic setting ntstep when do_thermo is false. All answers are bitwise identical, but there is a new optional argument to MOM_initialize_state and another argument has been renamed.
Added the new subroutine chksum_OBC_segment_data() from the contents of the loop over the segments in chksum_OBC_segments, as this can be useful when called separately for debugging some of the constructs that will be coming in subsequent commits. Also added rotate_OBC_segment_values_needed() to copy over the values_needed and _index variables between segments, and to avoid the need for duplicate code blocks in rotate_OBC_segment_data() and rotate_OBC_config(). There is also some minor revisions to rename segnam to segname for greater clarity. This commit also makes greater use of the I0 format that was introduced with Fortran 95 to simplify or shorten some error messages. All answers are bitwise identical but there are two new internal subroutines in the MOM_open_boundary module.
Call initialize_segment_data() with the rotated OBC type. This includes the addition of a new turns arguments to initialize_segment_data() and the elimination of the ocean_grid_type argument to this routine. This includes the addition of the new function rotated_field_name() to swap the names of u- and v- velocity fields when the grid is rotated, avoiding the duplication of code. Internally in initialize_segment_data(), num_fields was renamed to reflect the fact that it is actually the number of tracer or other fields that are initialized via the OBC manifest string (which does not include generic OBGC tracers), and not the total number of fields on a segment. Code was also added to allow for rotate_OBC_config() to be called either before or after initialize_segment_data(). With these changes, the call to initialize_segment_data() can be moved much later in the order of the initialization calls to address issues with the initialization of OBGC tracers with open boundary conditions. All answers are bitwise identical, but there are changes to the arguments of the publicly visible routine initialize_segment_data().
Move call to initialize_segment_data() after the call to call_tracer_register_obc_segments() to correct an answer changing bug in models with OBGC tracers and open boundaries that was causing the dev/CEFI branch answers not to reproduce with dev/gfdl. This commit will change answers (and restore previous answers) in cases that use open boundary conditions with biogeochemical tracers, such as those in COBALT.
The temporary blocks of code allowing for initialize_segment_data either before or after rotate_OBC_config() were eliminated, as was the now unused subroutine rotate_OBC_segment_data(). All of the functionality of rotate_OBC_segment_data had already been merged into initialize_segment_data. All answers are bitwise identical, but there is one less internal subroutine, and the order of calls to initialize the open boundary conditions is now less flexible.
c30a97c to
0fac41f
Compare
|
Both @uwagura and I have tested this PR with the NWA12+COBALT and find that it does preserve the previous answers. |
theresa-cordero
approved these changes
Sep 2, 2025
theresa-cordero
left a comment
There was a problem hiding this comment.
These changes restore old solutions. Thank you!
Member
Author
|
This PR has passed pipeline testing at https://gitlab.gfdl.noaa.gov/ogrp/mom6ci/MOM6/-/pipelines/28702 with leftover warnings about changes to MOM_parameter_doc files. |
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 series of 6 commits restores the previous (correct) answers in cases that use open boundary conditions with generic tracers. It also initializes the OBC segments directly on the rotated open boundary condition type and it adds new debugging capabilities for the individual OBC segments. Once these changes are merged into dev/gfdl, it is expected that the CEFI configurations will once again be able to use the dev/gfdl (and main) branches of MOM6 and obtain the correct answers.
As a part of these changes, there is a new publicly visible interface to the OBC code (
open_boundary_setup_vert()), and several internal subroutines in the OBC code have been eliminated (rotate_OBC_segment_data()) or added (rotate_OBC_segment_values_needed(),rotated_field_name()andchksum_OBC_segment_data()). There is also a new optional argument toMOM_initialize_state().The specific commits in this PR include: