-
Notifications
You must be signed in to change notification settings - Fork 42
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
StructuredColumns FixupHaloForVectors
method interferes with SphericalVector
interpolation
#174
Comments
Hi @wdeconinck I've drafted this PR that demonstrates a workaround for the I'm happy to add an option to the |
Through a bit of experimentation, I found that that using the halo "longitudes" in the complex weight generation almost completely cancels out the factor of minus one applied by
The error on this approximation is of order tl;dr, if was okay with very tiny inaccuracies, we can simply use the p.s. I'm surprised this tripped me up at all first time around... |
That's great @odlomax , could you show a zoomed in picture around the Pole to show the difference in error visually? |
I suspect I've gotten my maths slightly wrong. Either the error is machine precision or very tiny, as stated above. I might have to pull apart this equation with a pencil a paper to give a definitive answer. |
I did some maths! Basically, an exact phase difference of This caught me off guard, because tl;dr; there is no additional error (as far as I can tell). I got cocky with trigonometry and it bit me! I can post some TeX here later if you want to see what happened. |
Following the conventions here, we can define: Examining the great-circle course equation: If we recall the following trigonometric identities, and we substitute If our owned-point interpolation weight is |
Thanks for the extensive explanations! This is now merged. |
What happened?
StructuredColumns
contains a struct templateFixupHaloForVectors
which is applied to fields which havetype
set tovector
in their metadata. This multiplies field values beyond the poles by-1
directly after a halo exchange.The
SphericalVector
interpolation scheme also checks fortype == vector
before applying the vector interpolation method. However, the factor of-1
applied byFixupHaloForVectors
corrupts the interpolation at the poles (see below).The work-around, currently used in the
atlas_test_interpolation_spherical_vector
ctest is to make sure that thedirty
value in the field metadata is set tofalse
. This produces a clean interpolation at the poles (see below), but it's clearly not useful in the general case where halo-exchanges are required.What are the steps to reproduce the bug?
The bug can be reproduced by commenting out this line from the interpolation test.
Version
develop
Platform (OS and architecture)
All builds
Relevant log output
No response
Accompanying data
No response
Organisation
Met Office
The text was updated successfully, but these errors were encountered: