Skip to content

+*Fix OBCs with generic tracers and rotate OBC segment initialization#966

Merged
Hallberg-NOAA merged 6 commits into
NOAA-GFDL:dev/gfdlfrom
Hallberg-NOAA:more_OBC_refactoring
Sep 3, 2025
Merged

+*Fix OBCs with generic tracers and rotate OBC segment initialization#966
Hallberg-NOAA merged 6 commits into
NOAA-GFDL:dev/gfdlfrom
Hallberg-NOAA:more_OBC_refactoring

Conversation

@Hallberg-NOAA
Copy link
Copy Markdown
Member

@Hallberg-NOAA Hallberg-NOAA commented Aug 31, 2025

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() and chksum_OBC_segment_data()). There is also a new optional argument to MOM_initialize_state().

The specific commits in this PR include:

  • 0fac41fa8 Eliminate rotate_OBC_segment_data
  • badeacf3d *Call initialize_segment_data after call_tracer_register_obc_segments
  • 04ab2bd4f +Call initialize_segment_data with rotated OBCs
  • 3f8de40f6 +Add chksum_OBC_segment_data
  • 70b37225b +Separate OBC_for_remap and OBC_for_bug arguments
  • 57ea17b16 +Restore open_boundary_setup_vert

  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().
@Hallberg-NOAA Hallberg-NOAA added bug Something isn't working enhancement New feature or request answer-changing A change in results (actual or potential) labels Aug 31, 2025
  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.
@theresa-cordero
Copy link
Copy Markdown

Both @uwagura and I have tested this PR with the NWA12+COBALT and find that it does preserve the previous answers.

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.

These changes restore old solutions. Thank you!

@Hallberg-NOAA
Copy link
Copy Markdown
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.

@Hallberg-NOAA Hallberg-NOAA merged commit eccd5bb into NOAA-GFDL:dev/gfdl Sep 3, 2025
84 of 96 checks passed
@Hallberg-NOAA Hallberg-NOAA deleted the more_OBC_refactoring branch March 20, 2026 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

answer-changing A change in results (actual or potential) bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants