Skip to content

+Diag_mediator enhancements from ice shelf version#1067

Open
Hallberg-NOAA wants to merge 1 commit intoNOAA-GFDL:dev/gfdlfrom
Hallberg-NOAA:diag_mediator_cleanup
Open

+Diag_mediator enhancements from ice shelf version#1067
Hallberg-NOAA wants to merge 1 commit intoNOAA-GFDL:dev/gfdlfrom
Hallberg-NOAA:diag_mediator_cleanup

Conversation

@Hallberg-NOAA
Copy link
Copy Markdown
Member

Added diag_mediator capabilities that had been developed and used in the SIS2 and MOM_ice_shelf versions of the diag mediator, in preparation for some of these separate versions to be combined into a single version. This includes adding an overload to the register_scalar_field() interface so that scalars can be registered with or without providing a null axis, retaining the existing interface while adding the one that is widely used with the ice shelf code. The previous routine register_scalar_field() is now register_scalar_field_CS(), but it has the same public interface.

This commit also adds the new public interface MOM_diag_send_complete() that calls the FMS routine that flushes the IO buffers. Although this call can be too expensive for production runs, it can be very useful for debugging.

Internally, register_diag_field() now checks for standard axes for 2-d fields, analogously to what was previously done for 3-d fields, thereby avoiding the allocation of a separate axis group for each 2-d diagnostic. This has been the case for ice-shelf code for some time, and it will save memory will giving identical results.

The testing for incompatible mask and array sizes was consolidated into a single call each in post_data_2d_low() and post_data_3d_low(), paving the way for adding the option of masking static fields.

Several comments that were confusing to me were revised for clarity. Also corrected multiple instances of spelling errors or non-standard use of white space in comments.

All solutions are bitwise identical and diagnostic output (including metadata) is identical to what was previously output.

@Hallberg-NOAA Hallberg-NOAA added enhancement New feature or request refactor Code cleanup with no changes in functionality or results labels Mar 25, 2026
@Hallberg-NOAA Hallberg-NOAA force-pushed the diag_mediator_cleanup branch from b3cd4b1 to a4294f8 Compare March 26, 2026 21:58
@Hallberg-NOAA Hallberg-NOAA force-pushed the diag_mediator_cleanup branch from a4294f8 to 5caadbc Compare March 28, 2026 11:03
  Added diag_mediator capabilities that had been developed and used in the SIS2
and MOM_ice_shelf versions of the diag mediator, in preparation for some of
these separate versions to be combined into a single version.  This includes
adding an overload to the register_scalar_field() interface so that scalars can
be registered with or without providing a null axis, retaining the existing
interface while adding the one that is widely used with the ice shelf code.  The
previous routine register_scalar_field() is now register_scalar_field_CS(), but
it has the same public interface.

  This commit also adds the new public interface MOM_diag_send_complete() that
calls the FMS routine that flushes the IO buffers.  Although this call can be
too expensive for production runs, it can be very useful for debugging.

  Internally, register_diag_field() now checks for standard axes for 2-d fields,
analogously to what was previously done for 3-d fields, thereby avoiding the
allocation of a separate axis group for each 2-d diagnostic.  This has been the
case for ice-shelf code for some time, and it will save memory will giving
identical results.

  The testing for incompatible mask and array sizes was consolidated into a
single call each in post_data_2d_low() and post_data_3d_low(), paving the way
for adding the option of masking static fields.

  All solutions are bitwise identical and diagnostic output (including metadata)
is identical to what was previously output, but there are two new public
interfaces.
@Hallberg-NOAA Hallberg-NOAA force-pushed the diag_mediator_cleanup branch from 5caadbc to 4b01668 Compare April 1, 2026 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request refactor Code cleanup with no changes in functionality or results

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant