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

Fix for using tidal amplitude when determining the BBL thickness #595

Merged
merged 2 commits into from
Apr 18, 2024

Conversation

adcroft
Copy link
Member

@adcroft adcroft commented Apr 5, 2024

Setting BBL_USE_TIDAL_BG in OM5_b003 revealed non-conservation and non-reproducibility across layouts. A local scalar variable was correctly being set based on the tidal amplitude but was being re-used after a break between loops.

  • Replaced the scalar variable U_bg_sq with a vector u2_bg(:) that is set to either a constant or the square of the tidal amplitude.
  • The module parameter CS%drag_bg_vel was not set if using the tidal amplitude but WAS being used for conditionals. We now set it to 1e30 because it should NOT be used or impact the solution. Setting it to zero, or anything meaningful would allow code to use it inadvertently. This "constant" does not need to satisfy any dimensional testing.

Copy link

codecov bot commented Apr 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 37.12%. Comparing base (3a3baf1) to head (d71ed45).

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

Additional details and impacted files
@@             Coverage Diff              @@
##           dev/gfdl     #595      +/-   ##
============================================
+ Coverage     37.07%   37.12%   +0.04%     
============================================
  Files           271      271              
  Lines         80968    80804     -164     
  Branches      15118    15084      -34     
============================================
- Hits          30021    30000      -21     
+ Misses        45324    45203     -121     
+ Partials       5623     5601      -22     

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

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.

Overall this is a valuable addition that addresses a real bug in the code. I am happy with this change, provided that a comment is added to line 2983 reminding someone looking at the code why the enormous hard-coded value does not actually break dimensional consistency (as was already explained in the description of the PR).

@Hallberg-NOAA Hallberg-NOAA added the bug Something isn't working label Apr 15, 2024
Setting `BBL_USE_TIDAL_BG` in OM5_b003 revealed non-conservation and
non-reproducibility across layouts. A scalar variable was correctly
being set based on the tidal amplitude but was being used after a break
between loops.

- Replaced the scalar variable U_bg_sq with a vector u2_bg(:) that
  is set to either a constant or the square of the tidal amplitude.
- The module parameter CS%drag_bg_vel was not set if using the tidal
  amplitude but WAS being used for conditionals. We now set it to
  1e30 because it should NOT be used or impact the solution. Setting
  it to zero, or anything meaningful would allow code to use it
  inadvertently. This "constant" does not need to satisfy any
  dimensional testing.
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.

With the recent minor change, I am now happy to approve this PR.

@marshallward
Copy link
Member

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

@marshallward marshallward merged commit 6c44c5f into NOAA-GFDL:dev/gfdl Apr 18, 2024
9 of 10 checks passed
@adcroft adcroft deleted the bbl-tideamp-fix branch October 24, 2024 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants