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.
Gustavo Marques noticed that with
LEITH_CK = 0.0
we were still getting negative Laplacian viscosity coefficients southwest of land. I.e. we're getting backscatter when we shouldn't be, which is a bug.This code is designed to limit the magnitude of the backscatter so that it doesn't overcome the biharmonic damping:
Note that
CS%m_const_leithy
has a factor ofCS%c_K
in the definition. When c_K = 0.0 and when smoothed vorticity at the q point is zero, this if statement ironically causesm_leithy
to equal its largest possible value. (Note that the backscatter coefficient ism_leithy
times the biharmonic coefficient.) Smoothed vorticity at the q point is always zero on land, so cells whose northwest corner are on land always have the max backscatter coefficient (which then gets smoothed into the interior). This commit zeros out the backscatter in those cells.I have run one month of alpha05c with this to verify that it zeros out the offending backscatter coefficient. On Derecho see
In simulations where backscatter is turned on (
c_K>0
) the current code setsm_leithy
to its max value in points southwest of land, which is not intended behavior. We do want backscatter, but not the max value. The bugfix zeros outm_leithy
in points southwest of land. This is at least consistent with having small values of backscatter near land, which is what we want. (All the theory behind Leith+E is about eddies, not boundary currents.)PS, one might be tempted to just change the if statement to
The problem there is that if both sides are equal to 0 then you use an expression that produces a NaN.