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

+(*)Get the offline tracer mode working again #37

Merged
merged 12 commits into from
Dec 29, 2021

Conversation

Hallberg-NOAA
Copy link
Member

This PR includes a series of targeted changes to get the offline tracer mode
to work once again, and equally importantly to get it to reproduce across
processor layouts and with dimensional rescaling. (MOM6 would have encountered
a segmentation fault in this mode since about July 3, 2019, and may not have
worked before this.) It also includes a substantial refactoring of the offline
tracer code, including the addition of new arguments to a number of routines,
revisions to improve some of the algorithms, comments documenting each real
variable and robustly tested rescaling of the offline tracer variables for
dimensional consistency testing.

There is also a corresponding PR to MOM6-examples (NOAA-GFDL/MOM6-examples#345)
that updates some of the parameter input and diag_table files that were there to test the
offline-tracer capabilities in MOM6-examples/ice_ocean_SIS2/Baltic_ALE_z_offline_tracers.

All answers and output are bitwise identical in any cases that worked before,
and the offline tracer mode is once more working and reproducing answers when
dimensional consistency test are active. The commits in this PR include:

  • 0895fe3a1 Merge branch 'dev/gfdl' into offline_tracer_fix
  • 112ac4998 +(*)Revised offline tracer algorithms
  • fcfd238ab +Refactored and rescaled the offline tracer code
  • 05edb63da (*)Offline tracer read bug fix
  • 231913920 Correct out of bounds index (por_face_areaU) bug
  • 3364af1b8 Update indexing of array passed to data_override.
  • 90739bea1 Correct comments describing advect_tracer args
  • 5172c495c Warn if opacity_from_chl is called without fluxes
  • d7337145e (*)Fix extract_diabatic_member

  Corrected the comments describing the optional arguments to advect_tracer and
fixed a few spelling errors in comments.  All answers are bitwise identical.
  Corrected bugs in the offline tracer code that were preventing it from
reproducing across processor counts (and perhaps working sensibly at all). All
answers and output in the MOM6-examples regression suite are bitwise identical.
Although answers with the offline tracer code will change because of the bug
fix, because of some bugs that were fixed in another recent commit, it was
previously impossible to have run the offline tracer cases at all.
  Substantially refactored the offline tracer code.  This refactoring includes
adding grid and unit_scale_type arguments to several routines related to the
offline tracer code.  An offline tracer advection test case is now consistent
across processor layouts and pass the dimensional rescaling tests (including the
chksums in debug mode), and there are comments describing all the real variables
and their dimensions in the offline tracer routines.  All answers and output are
bitwise identical.
  Minorly revised the algorithms used for offline tracer advection for
rotational consistency, and for exact reproducibility across PE layouts by using
reproducing sums to detect convergence.  This also includes some changes to use
roundoff to detect convergence instead of fixed values.   Also replaced some
divisions with multiplication by a reciprocal.  In addition, some of the
optional arguments to advect_tracer that are only used for offline tracer
advection were renamed or revised for clarity and reordered for the convenience
of the non-offline-tracer code.

  Although answers with the offline tracer code will change slightly because of
this refactoring, because of some bugs that were fixed in another recent commit,
it was previously impossible to have run the offline tracer cases at all.  All
answers and output in the MOM6-examples regression suite are bitwise identical.
@Hallberg-NOAA
Copy link
Member Author

Each of the commits in this PR has been carefully tested to work, and may be a significant way-point should there need to be any future debugging of these capabilities, so please do not do a squash-merge on this PR.

@codecov
Copy link

codecov bot commented Dec 11, 2021

Codecov Report

Merging #37 (e5a5407) into dev/gfdl (2b2214d) will decrease coverage by 0.00%.
The diff coverage is 1.35%.

Impacted file tree graph

@@             Coverage Diff              @@
##           dev/gfdl      #37      +/-   ##
============================================
- Coverage     28.91%   28.91%   -0.01%     
============================================
  Files           242      242              
  Lines         71252    71260       +8     
============================================
+ Hits          20605    20606       +1     
- Misses        50647    50654       +7     
Impacted Files Coverage Δ
config_src/drivers/solo_driver/MOM_driver.F90 68.01% <0.00%> (ø)
src/ALE/MOM_ALE.F90 34.68% <0.00%> (ø)
src/core/MOM.F90 58.74% <0.00%> (ø)
src/tracer/MOM_offline_aux.F90 0.00% <0.00%> (ø)
src/tracer/MOM_offline_main.F90 0.00% <0.00%> (ø)
src/tracer/MOM_tracer_advect.F90 31.22% <62.50%> (+0.14%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2b2214d...e5a5407. Read the comment docs.

  Corrected the reported unit conversions in two comments describing variables
in MOM_offline_aux.F90.  All answers and output are bitwise identical.
Copy link

@ashao ashao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Hallberg-NOAA for cleaning up this portion of the code. I especially like the changes made to the advect_tracer API. Once this PR is in, I'll go ahead and set aside some time to excise this code from the MOM.F90 and make a separate offline driver (now that I'm older and wiser).

src/tracer/MOM_offline_aux.F90 Show resolved Hide resolved
src/parameterizations/vertical/MOM_opacity.F90 Outdated Show resolved Hide resolved
src/tracer/MOM_offline_aux.F90 Outdated Show resolved Hide resolved
src/tracer/MOM_offline_main.F90 Show resolved Hide resolved
  Commented out the problematic lines that Andrew Shao flagged in his review of
MOM6 dev/gfdl PR mom-ocean#37.  The model runs perfectly well in short offline-tracer
test runs, and even gives bitwise identical output, perhaps because no layers
were being abruptly flooded to 10^13 times their previous values.  These omitted
lines could change answers in some cases, so the lines in question have been
retained in case the offline tracer code needs to be debugged layer and these
mysterious (and seemingly unhelpful) lines turn out to have been necessary.  All
answers in the non-offline-tracer runs are bitwise identical.
@ashao
Copy link

ashao commented Dec 22, 2021

I've looked over the changes again and this PR looks good to me. I haven't had the chance to test the Baltic_offline test case yet.

  Deleted four lines in the offline tracer code that had recently been commented
out, along with the comments describing them.  Further conversations had led to
a consensus that these lines served no useful purpose, and are not worth keeping
in the code, even in comments.  Several excess spaces were also eliminated in
MOM_offline_aux.F90.  All answers and output are bitwise identical.
@Hallberg-NOAA
Copy link
Member Author

This PR has been favorably reviewed by Andrew Shao, and all code conflicts have been resolved. I believe that this PR is now ready for acceptance, once TC and pipeline testing are complete.

Copy link
Member

@marshallward marshallward left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving on behalf of @ashao

@marshallward
Copy link
Member

Gaea regression: https://gitlab.gfdl.noaa.gov/ogrp/MOM6/-/pipelines/14453 ✔️

This PR cannot be rebased, so will include merge commits.

@marshallward marshallward merged commit 71cf831 into NOAA-GFDL:dev/gfdl Dec 29, 2021
@Hallberg-NOAA Hallberg-NOAA deleted the offline_tracer_fix branch January 3, 2022 13:33
@Hallberg-NOAA Hallberg-NOAA added answer-changing A change in results (actual or potential) bug Something isn't working enhancement New feature or request labels Feb 1, 2022
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.

3 participants