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 a bug in porous barriers #734

Merged
merged 2 commits into from
Oct 11, 2024
Merged

Conversation

herrwang0
Copy link

This PR fixes a minor bug in porous barriers module.

It may change answers for some very rare cases in barotropic runs. For an example I tested with barotropic tides, the answer is unchanged at bit level.

(PS: this is a redo of PR #726, leaving out the default parameter change part).

Fix a bug that layer/interface weights may not be reset to 1.0 if no
calculations are needed. The bug has negligible impact for barotropic
applications but may affect baroclinic runs which are yet to performed.
@Hallberg-NOAA
Copy link
Member

These changes seem innocuous to me, but I do not understand the nature of the bug that is being fixed. It looks to me as though the various fields that are being set more explicitly now were already being set properly before. Please describe the bug more explicitly in the descriptive comments.

@herrwang0
Copy link
Author

These changes seem innocuous to me, but I do not understand the nature of the bug that is being fixed. It looks to me as though the various fields that are being set more explicitly now were already being set properly before. Please describe the bug more explicitly in the descriptive comments.

The logical for the current algorithm is as follows: If the top interface height in layer k is above the highest topography (D_max), then variable do_I is changed to false, so that calculations for all layers above layer k are skipped, as these layers are above the topography and their porous barrier coefficients are unity.

Without the fix, it can potentially problematic when a layer starts with a smaller-than-one coefficient but subsequently moves above the highest topography. In the case, the coefficient of this layer would never get reset back to unity.

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.

Thank you, @herrwang0, for the clarification in the discussion of the nature of the bug that is being fixed. I understand this issue now. I now agree that these changes are both useful and necessary.

@Hallberg-NOAA Hallberg-NOAA added the bug Something isn't working label Oct 7, 2024
@marshallward
Copy link
Member

@marshallward marshallward merged commit 80d8b5f into NOAA-GFDL:dev/gfdl Oct 11, 2024
10 checks passed
@herrwang0 herrwang0 deleted the fix_pb_bug_1 branch October 25, 2024 01:24
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