Fix interior OBC indexing bug in tracer advection #1013
Merged
+15
−17
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes a bug that can occur in some marginal cases with an interior OBC.
In subroutine
advect_x, the masking that avoids tracer points right outside of OBC to be updated,do_i, is not applied to the last valid point in the zonal direction. This indexing bug causes problems when the interior OBC is right on the edge of a processor's computational domain, or any of the the marching stencil boundaries during the iteration. This also means the answer is sensitive to PE layout.Two comments/questions:
I did not include a bug flag as I would imagine this bug rarely happens. Not sure how many people are actively using interior OBC. And the bugs is only triggered by interior OBC placed right on the boundary of a processor. Let me know if a bug flag is warranted.
The patch fixes my unlucky case and passes the TC tests. But I am not sure if it breaks or changes answers to any other OBC runs. So any help with additional tests is appreciated.