-
Notifications
You must be signed in to change notification settings - Fork 52
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 barotropic streamfunction calculation #1069
Conversation
TestingI ran this analysis on a 6-year climatology from a G-case with the SORRMr3 mesh. I had previously noticed that the streamfunction produced for this mesh didn't make sense, particularly in the FRIS area (see #1068). I looked at the transport computed from the BSF compared with the original transport, and they differed by and unacceptably large factors, indicating problems with the methodology even after the fix in #1063. With the rewrite described above, I'm seeing the results in: After playing around with colorbars and colormaps quite a bit, I think this linear colormap with an unusual color sequence (the one we often use for resolution plots from Compass) is a better choice than the one from #1063. The fix here increases the maximum value of the BSF (in the middle of the Weddell Gyre) even more than previously, resulting in a completely saturated colormap in Antarctica if we stay with the symmetric-log approach. By effectively having the blue range of the colormap only used in Antarctica, we can have a second linear (divergent) segment that is appropriate for that region. Thoughts are welcome. |
@maltrud and @milenaveneziani, it seems like I messed up again in #1063 and I'll need you to give this another look. Sorry I'm not doing my best work. This new approach is based on a proper definition of the BSF: where |
I want to solve for the divergent contribution to |
Just my 2c but the global plot looks really good to me: good Drake Passage transport, well-defined fronts in Agulhas retroflection and Southern Ocean. I find the new colorbar to be easily readable, well done. |
Thanks so much, @alicebarthel! |
I also ran the test suite and everything looked fine: |
@xylar : would you be OK with me taking a closer look at this towards the end of this week? My plate is full until at least Th morning, but I am definitely interested/invested in having a correct BSF calculation and thus help with this. One quick comment I have is about the colorbar: I am personally using the cmocean 'curl' for BSF, but this one looks nice as well. My only suggestion is about flipping the colors. Positive values: orange and reds, negative values: greens and blues (similar to our color association with pos/neg anomalies --> reds/blues). What do you think? |
@milenaveneziani, I will wait as long as I can but we are getting close to a new unified release and I need this to be included. I will see what I can do about the color map but the fact is that we have positive values that are twice as high as negative and green/blue takes up 2/3 of this colormap. So we would need to create a new colormap for what you request. |
@milenaveneziani, here's what I came up with for an alternative colormap: To my eyes, this is not as aesthetic as the one I used above but it does satisfy the desire to have warm colors for positive and cool for negative. I also tried green instead of blue and purple instead of brown but none of these other combinations looked very good. Feel free to play around yourself at https://sciviscolor.org/color-moves-app/ and suggest an alternative if you want to take the time. (But I do need to have this done soon for Unified 1.11.0.) |
I computed the vertically integrated divergence, and from that I computed the velocity potential. The vertically integrated velocity (VIV) should be the gradient of the potential plus the normal cross the gradient of the barotropic streamfunction. For whatever reason I'm not quite getting this -- the contribution from the velocity potential is actually larger than the difference between the VIV and the piece computed as k cross grad psi. I'd like to understand this better but I'm running out of time I can spare for this work. I think for now I'm content to know that k x grad psi does a very good job now of predicting the VIV field, and the residual is small. |
@maltrud, @milenaveneziani and @irenavankova, I've made some more changes to this branch since I asked you to review yesterday, so please take that into account when you review. Sorry for the moving target. I believe I'm done until I get further feedback. |
@@ -1578,7 +1577,7 @@ seasons = ['ANN'] | |||
comparisonGrids = ['latlon', 'subpolar_north_atlantic'] | |||
|
|||
# list of tuples(pairs) of depths (min, max) to integrate horizontal transport over | |||
depthRanges = [(0.0, -10000.0), (0.0, -2000.0)] | |||
depthRanges = [(10.0, -10000.0), (10.0, -2000.0)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It turns out that zero is not a safe upper bound because this cuts off a few parts of the ocean where the SSH is more than 1 m high (where the middle of the 2-m top layer can be above zero).
c73596b
to
b02414a
Compare
Thanks for the plots, @irenavankova.
There is an arbitrary integration constant in the streamfunction. The only thing that has a physical meaning are differences or gradients in the stream function. So the over all high value (over 150 Sv at the Antarctic coast) tells you that we have that much transport between Antarctica and coastlines to the North (so presumably across Drake Passage). It isn't possible to interpret positive vs. negative signs of the streamfunction as positive vs. negative circulation unless you reference it to the value of the streamfunciton locally (e.g. at the grounding line of FRIS). Unfortunately, that's not possible to do globally. |
@irenavankova, following up, it probably makes sense to have a way to plot the streamfunction referenced to the mean value around Antarctica, rather than around the continents north of 45 south. I'll think about how to do that. I think that situation would require a different colormap, too. |
comparisonFrisResolution = 10. | ||
comparisonFrisResolution = 4. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@irenavankova, I think we should make the FRIS comparison grid higher resolution. It seems a little blocky in the plots I was looking at when it's 10 km. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is fine, as long as there aren't any artifacts popping up from interpolating low res to high res (I have seen that in some field before but here it looks fine)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We always use linear interpolation in MPAS-Analysis and that should always be fine from coarse to fine. The main place it's noticeable is at the coastline (when it doesn't match cartopy) and it isn't a ton better with higher res. But it also improves the streamline a little bit (less jagged).
@@ -611,7 +611,78 @@ yLim = [-600., -5.] | |||
|
|||
# comparison grid(s) on which to plot analysis | |||
comparisonGrids = ['latlon', 'arctic_extended', 'antarctic_extended', | |||
'subpolar_north_atlantic'] | |||
'subpolar_north_atlantic', 'fris'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@irenavankova, I think we might as well add FRIS plots of the BSF to polar regions. Again, what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I didn't realize that needed to be done explicitly for bsf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, we don't add any of the projection plots implicitly anywhere. If there are other FRIS plots you want to have on by default, they need to be added as well (but not in this PR).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looks great, I don't see any issues. Thanks for digging into the inconsistencies and fixing them.
@irenavankova, great, thanks for the review! |
@milenaveneziani, please have a look when you have time. It seems the Unified release isn't that eminent -- E3SM-Diags and zstash are both still debugging issues. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@xylar: this was a lot of work! Thanks for making these big changes: they make sense to me. I also went through the compute_streamfunction code and things look good to me. Great work!
@maltrud, didn't hear from you so will assume you didn't have anything to add. |
@milenaveneziani, @alicebarthel and @irenavankova, thanks so much for the input! |
Thanks for posting these! |
Yes, I added the same changes for both regions. But any further changes have to be made in both config sections if we want them to look the same. |
Woops! Looks like my last commit didn't get pushed. My Internet connection is bad. |
I think the changes are perfect for the subpolar region. I will test some adjustment to the ArcticExtended region and get back to you, but for now it's great that you added the two sections in the polar_regions config file. |
Sounds good. |
This merge is a port of: MPAS-Dev/MPAS-Analysis#1069 Instead of computing the BSF using a least-squares solve based on the transport between vertices, the new approach inverts a Poisson equation for the BSF based on the (vertically integrated) vorticity. Using a SORRM G-Case simulation, the vertically integrated vorticity computed from the streamfunciton is within machine precision of the original vertically integrated vorticity. The velocity produced by the streamfunciton has errors that are on the order of 1e-3 compared with the original vertically integrated velocity (likely caused by the field not being perfectly divergence free).
This merge is a port of: MPAS-Dev/MPAS-Analysis#1069 Instead of computing the BSF using a least-squares solve based on the transport between vertices, the new approach inverts a Poisson equation for the BSF based on the (vertically integrated) vorticity. Using a SORRM G-Case simulation, the vertically integrated vorticity computed from the streamfunciton is within machine precision of the original vertically integrated vorticity. The velocity produced by the streamfunciton has errors that are on the order of 1e-3 compared with the original vertically integrated velocity (likely caused by the field not being perfectly divergence free).
This merge is a port of: MPAS-Dev/MPAS-Analysis#1069 Instead of computing the BSF using a least-squares solve based on the transport between vertices, the new approach inverts a Poisson equation for the BSF based on the (vertically integrated) vorticity. Using a SORRM G-Case simulation, the vertically integrated vorticity computed from the streamfunciton is within machine precision of the original vertically integrated vorticity. The velocity produced by the streamfunciton has errors that are on the order of 1e-3 compared with the original vertically integrated velocity (likely caused by the field not being perfectly divergence free).
This merge is a port of: MPAS-Dev/MPAS-Analysis#1069 Instead of computing the BSF using a least-squares solve based on the transport between vertices, the new approach inverts a Poisson equation for the BSF based on the (vertically integrated) vorticity. Using a SORRM G-Case simulation, the vertically integrated vorticity computed from the streamfunciton is within machine precision of the original vertically integrated vorticity. The velocity produced by the streamfunciton has errors that are on the order of 1e-3 compared with the original vertically integrated velocity (likely caused by the field not being perfectly divergence free).
Instead of computing the BSF using a least-squares solve based on the transport between vertices, the new approach inverts a Poisson equation for the BSF based on the (vertically integrated) vorticity.
I have proven that this produces more accurate results. The vertically integrated vorticity computed from the streamfunciton is within machine precision of the original vertically integrated vorticity. The velocity produced by the streamfunciton has errors that are on the order of 1e-3 compared with the original vertically integrated velocity (likely caused by the field not being perfectly divergence free).
Checklist
Testing
comment in the PR documents testing used to verify the changesFixes #1068