Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to get diagnostics manager controlled physics diagnostics #18

Merged
merged 6 commits into from
Dec 6, 2023

Conversation

spencerkclark
Copy link
Member

@spencerkclark spencerkclark commented Nov 30, 2023

In FV3GFS, I included the diagnostics manager controlled physics diagnostics within the same data structure as the non-diagnostics-manager controlled physics diagnostics, while in SHiELD, I created a separate data structure for clarity. To enable getting diagnostics manager controlled diagnostics in the SHiELD-wrapper, some backend modifications are needed to work around this split. The frontend API remains identical, however.

In the fv3net prognostic run, we happen to always get a diagnostics manager controlled diagnostic within the time loop. This is not strictly necessary—we could introduce model specific logic in the time loop to work around this, as we did in ai2cm/fv3net#2350—but since this diagnostic does exist in SHiELD, we might as well enable getting it so that the fv3net prognostic run time loop (and testing logic) can remain as clean as possible.

Note that this does require a minor upstream change in the SHiELD_physics repository to make some additional objects public: NOAA-GFDL/SHiELD_physics#33, which has now been merged.

Backend changes

  • Subroutines get_metadata_diagnostics, get_diagnostic_2d, and get_diagnostic_3d within coupler_lib.F90 now take an additional boolean argument denoting whether one would like to get data from a diag_manager_controlled diagnostic or not.
  • The dictionary returned by _get_diagnostic_info now uses tuple-valued keys (module_name, name) instead of integer keys, since the index no longer uniquely defines a diagnostic. diag_manager_controlled and index are now added as attributes to the DiagnosticInfo named tuple. Not only is this more general than what was implemented previously, it also makes for simpler querying of whether the requested diagnostic exists within get_diagnostic_metadata_by_name.

@spencerkclark spencerkclark force-pushed the get-diag-manager-controlled-diagnostics branch 2 times, most recently from 447dce9 to 8cc67dd Compare November 30, 2023 14:29
wrapper/lib/coupler_lib.F90 Show resolved Hide resolved
@spencerkclark spencerkclark merged commit 48c83c9 into main Dec 6, 2023
1 check passed
@spencerkclark spencerkclark deleted the get-diag-manager-controlled-diagnostics branch December 6, 2023 14:20
spencerkclark added a commit to ai2cm/fv3net that referenced this pull request Dec 8, 2023
This PR builds on #2365 and makes the changes necessary to add
`predictor` and `nudging` regression tests for SHiELD-wrapper-based
prognostic runs. In so doing it refactors `test_regression.py` to
parametrize over the wrapper type, and move the base fortran configs
into YAML files in their own subdirectory.

Note that unlike in #2350 no changes are required to the time loop of
the prognostic run, thanks to ai2cm/SHiELD-wrapper#18, which has now
been merged upstream. I updated the SHiELD-wrapper submodule accordingly
in this PR.

Significant internal changes:
- Added a `wrapper` parameter to `file_configs_to_namelist_settings`,
since one of the namelist parameters used to control the output
frequency of physics diagnostics in SHiELD is different than that in
FV3GFS.
- Moved the base fortran config for the FV3GFS prognostic run regression
tests into a YAML file in a subdirectory alongside the base fortran
config for the SHiELD prognostic run regression tests.

- [x] Tests added
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