-
Notifications
You must be signed in to change notification settings - Fork 32
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
Sign error for mean PV gradient Qy
in MultiLayerQG
module
#328
Comments
thanks @mjclobo!! Note, if you write your post like below (with an empty line between txt and link to code), the code will appear in the post.
(You can edit your post and see.) |
Regarding the sign error: Here's the code that computes GeophysicalFlows.jl/src/multilayerqg.jl Lines 365 to 369 in c0c42ce
In #327 you suggested changing
But then this is inconsistent with layers Do you agree with the equations in the docs. If yes, then it seems to me that the sign error is on the
Right? |
Qy
in MultiLayerQG
module
Yes, I was realizing last night that we might be using the Boussinesq approximation under the hood in the buoyancy frequency definition. I'm trying to clear this up. |
Shoot, you're right. Thanks for the catch! The results are the same for the constant shear/stratification case, but will definitely not be the same generally. I closed the pull request. Is this the correct thing to do? Should I open a new one, or will you do it? Thanks for the help! |
Open a new one only with the sign error fix? Let's leave the reference density discussion for a different PR. |
Try to keep the PR clean (i.e., don't include example scripts of your own in the PR as a suggestion to be merged in the main branch). You can always post code as part of a comment on the PR or here! :) |
Thanks for the advice @navidcy. I just opened PR #329. Is it okay to have the interim commits in the pull request, since the actual difference between the codes ends up only being the one line? Or should I make sure to only have commits relevant to the issue shown? I couldn't figure out how to do the latter, but am happy to keep trying if it's preferable. |
That's alright :) When we merge we can do "Squash and merge" and that will compress all the commits into one. |
PR #329 dealt with the sign error! |
Yes, my bad! I realized that I conflated the two separate issues here..I will add plots related to the reduced gravity definition only to #325 later today. |
This is an issue made to accompany my pull request (#329 ) for this bug.
There is a sign error in the multilayerqg.jl calculation of Qy:
GeophysicalFlows.jl/src/multilayerqg.jl
Line 367 in c0c42ce
The first minus sign should be a plus sign. This creates erroneously large interior PV gradients.
The following figures can be reproduced using this script and my forked version of GeophysicalFlows.jl. For each figure the left plot is of the meridional PV gradient and the right plot is of the vertical structure of the most unstable mode. The reduced gravity error mentioned here is brought up in discussion #325 .
The first figure shows results when using density values of O(1), as in the Phillips model example. The sign error leads to a large erroneous positive interior PV gradient and a deep Charney-type instability that arises from interactions between the negative bottom PV gradient and the positive interior PV gradient. The reduced gravity error creates an erroneous negative interior PV gradient, that then interacts with the positive surface PV gradient to manifest a surface-intensified Charney-like instability. Fixing both errors leads to no instability since the Eady edge waves are too far apart (given the current background conditions) to interact and create an Eady-type instability.
@Wendazhang33, my office mate, pointed out that when you use realistic ocean density values, of O(1000), then the reduced gravity definition ceases to matter. In this case the orange line falls directly under the green line. Ironically, when O(rho)>>O(delta rho), the Boussinesq assumption applies, which means that a constant reference density should still be used in the denominator of the definition of reduced gravity. Regardless, the sign error is of the same order of consequence as when using O(1) density values, as is shown in the second plot, below. Also note that with realistic ocean density values, the corrected code leads to a nice Eady instability, as expected.
The text was updated successfully, but these errors were encountered: