Skip to content

Conversation

Hallberg-NOAA
Copy link
Member

Collected the conversion factors for the 4 salt tendency diagnostics diabatic_salt_tendency, diabatic_salt_tendency_2d, boundary_forcing_salt_tendency and boundary_forcing_heat_tendency_2d out of the calculation of the diagnostics before they are posted and into the conversion argument in their register_diag_field() calls. This change simplifies the code where the diagnostics are calculated, but although all expressions are mathematically equivalent, there is a change in the order of arithmetic with which these 4 diagnostics are calculated, so answers will change at roundoff, although this is unlikely to be detected if the diagnostics are being written as 32 bit floats. All model solutions are bitwise identical.

  Collected the conversion factors for the 4 salt tendency diagnostics
diabatic_salt_tendency, diabatic_salt_tendency_2d, boundary_forcing_salt_tendency
and boundary_forcing_heat_tendency_2d out of the calculation of the diagnostics
before they are posted and into the conversion argument in their
register_diag_field calls.  This change simplifies the code where the
diagnostics are calculated, but although all expressions are mathematically
equivalent, there is a change in the order of arithmetic with which these 4
diagnostics are calculated, so answers will change at roundoff, although this is
unlikely to be detected if the diagnostics are being written as 32 bit floats.
All model solutions are bitwise identical.
@Hallberg-NOAA Hallberg-NOAA added refactor Code cleanup with no changes in functionality or results answer-changing A change in results (actual or potential) labels Feb 23, 2025
Copy link

codecov bot commented Feb 23, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 38.10%. Comparing base (809d56e) to head (f486837).

Additional details and impacted files
@@             Coverage Diff              @@
##           dev/gfdl     #840      +/-   ##
============================================
- Coverage     38.11%   38.10%   -0.01%     
============================================
  Files           298      298              
  Lines         87642    87640       -2     
  Branches      16416    16416              
============================================
- Hits          33401    33399       -2     
  Misses        48219    48219              
  Partials       6022     6022              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@marshallward
Copy link
Member

Moving the S to ppt scaling from calculation to diagnostic streamlines the calculation but also causes a change in the bit repro.

Since they are unlikely to show up on a bin32 float, this is probably OK to merge. But we will have to report this in the future PR to main.

@marshallward marshallward merged commit 9d800c8 into NOAA-GFDL:dev/gfdl May 29, 2025
79 of 114 checks passed
@Hallberg-NOAA Hallberg-NOAA deleted the salt_tendency_diag_conversion branch June 17, 2025 16:15
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) refactor Code cleanup with no changes in functionality or results
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants