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

Keep track of whether runoff has been added to stf #246

Merged
merged 1 commit into from
Dec 16, 2022

Conversation

andrew-c-ross
Copy link

@andrew-c-ross andrew-c-ross commented Nov 17, 2022

This PR is my attempt to fix the issue #217, which affected generic tracers that had fluxes into the ocean from runoff. During a thermodynamics time step, MOM6 adds the river tracer flux to the surface tracer flux stf. If more than one thermodynamics time step is done per coupler time step, the river input gets added to stf multiple times. This PR fixes this bug by checking each tracer for a new logical flag runoff_added_to_stf. If this flag is false, the runoff is added to stf and then the flag is set to true.

For this PR to work in configurations using generic tracers, it will need to be paired with a PR I have to ocean_BGC (NOAA-GFDL/ocean_BGC#20) that adds runoff_added_to_stf to g_tracer_type and resets the flag to false after updates to stf using g_tracer_set_2D or g_tracer_set_real. For configurations not using generic tracers, this PR to MOM6 also adds the runoff_added_to_stf flag to g_tracer_type in config_src/external/GFDL_ocean_BGC/generic_tracer_utils.F90, so things should compile as before and no answers should change.

I have submitted this as a draft PR to see if the solution makes sense, and so the ocean_BGC PR can be merged first if so.

@MJHarrison-GFDL
Copy link

@andrew-c-ross This seems reasonable, but appears to be missing a call to reset this flag to False after coupler updates.

@andrew-c-ross
Copy link
Author

I reset it to False over on the ocean_BGC side (https://github.com/NOAA-GFDL/ocean_BGC/pull/20/files#diff-ae60cbf2eb5c7a9f11effd4929dde30efc21183655cdc945d067bb67a19d6eceR2247); is there a place in MOM6 that I've missed where it should also be set to False (or do you think it is better to do it entirely within MOM6)?

@MJHarrison-GFDL
Copy link

After discussions with @andrew-c-ross and with input from @nikizadehgfdl , the recommendation is to move this PR forward. Existing GFDL-based ocean_BGC configuratons (ESM2G) are not impacted by this change (dt_therm>=dt_cpld). We were unable to identify other existing configurations which would be impacted by this bugfix. The proposed fix would correctly insert the runoff tracer fluxes into the ocean_BGC arrays, and those tracer fluxes would be applied as a surface flux through the tridiagnoal solver. It is worth noting that the ocean_BGC river tracer fluxes are not being vertically distributed when DO_RIVERMIX=True (as is the case for physical tracers ).

@MJHarrison-GFDL
Copy link

MJHarrison-GFDL commented Dec 6, 2022

Correction regarding DO_RIVERMIX = True. In this case, the diffusive entrainment velocities reflect mixing due to the rivermixing routine, so the ocean_BGC tracers should be vertically mixed consistently with the physical tracers (per @Hallberg-NOAA communication).

@andrew-c-ross andrew-c-ross marked this pull request as ready for review December 13, 2022 16:26
@codecov
Copy link

codecov bot commented Dec 16, 2022

Codecov Report

Merging #246 (7da2f87) into dev/gfdl (8ddd854) will decrease coverage by 0.00%.
The diff coverage is 0.00%.

❗ Current head 7da2f87 differs from pull request most recent head d0c656a. Consider uploading reports for the commit d0c656a to get more accurate results

@@             Coverage Diff              @@
##           dev/gfdl     #246      +/-   ##
============================================
- Coverage     37.13%   37.13%   -0.01%     
============================================
  Files           263      263              
  Lines         73443    73444       +1     
  Branches      13674    13674              
============================================
- Hits          27272    27271       -1     
- Misses        41146    41147       +1     
- Partials       5025     5026       +1     
Impacted Files Coverage Δ
...c/external/GFDL_ocean_BGC/generic_tracer_utils.F90 0.00% <ø> (ø)
src/tracer/MOM_generic_tracer.F90 0.00% <0.00%> (ø)
src/framework/MOM_document.F90 74.10% <0.00%> (-0.23%) ⬇️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

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.

This parsimonious PR appears to properly address the problems noted in #217, as noted in the review by @MJHarrison-GFDL. At some point, though, it might make sense to revise the generic tracer code to avoid having a variable (g_tracer%runoff_added_to_stf) that is set and then reset in code from two separate repositories (MOM6 and ocean_BGC).

This PR has passed TC testing and pipeline testing at https://gitlab.gfdl.noaa.gov/ogrp/MOM6/-/pipelines/17711.

@adcroft
Copy link
Member

adcroft commented Dec 16, 2022

It appears we needed to wait for NOAA-GFDL/ocean_BGC#20 before accepting this. @nikizadehgfdl any chance you can handles the ocean_BGC PRs?

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.

4 participants