Improve calculation of geopotential at single precision#570
Draft
Thomas Bendall (tommbendall) wants to merge 7 commits into
Draft
Improve calculation of geopotential at single precision#570Thomas Bendall (tommbendall) wants to merge 7 commits into
Thomas Bendall (tommbendall) wants to merge 7 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The geopotential field is calculated in our model (when using shallow gravity) as
g*z, wherezis the height above the Earth's radiusR.We have been calculating
zas the radial coordinaterand then subtractingR. At single precision, this method for calculatingzcan be very imprecise, and can create further errors if we ever need to calculate the difference between the geopotential at two different heights.This PR changes the calculation of the geopotential to use the precomputed
height_w3field rather than thechifields, which should not suffer from these problems at single precision when using spherical coordinate systems. The same change is made to the "deep" gravity option, and allows the planar and spherical geometry branches of code to be combined.This calculation should now also be more efficient because it avoids accessing the
chiarrays and performing a coordinate conversion.PR Summary
Sci/Tech Reviewer:
Code Reviewer:
Code Quality Checklist
Testing
trac.log
Security Considerations
Performance Impact
AI Assistance and Attribution
Documentation
PSyclone Approval
Sci/Tech Review
(Please alert the code reviewer via a tag when you have approved the SR)
Code Review