Skip to content

Conversation

@andrew-c-ross
Copy link

In NOAA-GFDL/CEFI-regional-MOM6#250, @CGjelstrup reported an issue where enabling the generic tracer sponge/nudging caused a crash due to an unregistered sponge tendency diagnostic. The issue was caused by the order in which the registration code for the sponge diagnostics and generic tracers is called--the sponge diags are registered before the generic tracers are set up, so the generic tracer sponge tendency diagnostics are never registered.

This PR fixes the issue by relocating the call to init_ALE_sponge_diags so that it is after tracer_flow_control_init. It also makes sure that the array of sponge tendency diag ids, id_sp_tendency, is immediately initialized to -1s to help avoid any future bugs.

For immediately initializing id_sp_tendency to -1s, I did

integer, dimension(MAX_FIELDS_) :: id_sp_tendency = reshape([-1], [MAX_FIELDS_], [-1])

I don't think this hack with reshape is done anywhere else in MOM6, but it was the best/only way I could figure out to initialize within a type declaration. If there's any issues with this just let me know.

Also, I have this same PR open in the CEFI fork of MOM6---if you'd prefer it to go through CEFI first we could do that.

Copy link
Member

@Hallberg-NOAA Hallberg-NOAA 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 look sensible to me, although it should be noted that this change will probably change the order of entries in the available_diags file.

@Hallberg-NOAA
Copy link
Member

This PR has passed pipeline testing at https://gitlab.gfdl.noaa.gov/ogrp/mom6ci/MOM6/-/pipelines/29653.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants