Beware Earth radius in single precision#326
Open
iboutle wants to merge 9 commits intoMetOffice:mainfrom
Open
Conversation
Adrian-Lock
reviewed
Mar 6, 2026
interfaces/physics_schemes_interface/source/kernel/bl_exp_kernel_mod.F90
Show resolved
Hide resolved
Adrian-Lock
approved these changes
Mar 6, 2026
Contributor
Adrian-Lock
left a comment
There was a problem hiding this comment.
Thanks, lots of nice tidying up too.
MichaelWhitall
approved these changes
Mar 6, 2026
MichaelWhitall
left a comment
There was a problem hiding this comment.
Thanks Ian, this looks fine to me, thanks lots for fixing this and reinstating the comorph_dev rose stem test :)
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.
PR Summary
Sci/Tech Reviewer: @Adrian-Lock
Code Reviewer: @mo-alistairp
When represented at single precision, the radius from the centre of the Earth to any model level is only accurate to 0.5m. This is not sufficient accuracy for calculations in the explicit boundary layer scheme, which often calculate delta_z values based off this to higher precision.
To address this, we try to remove as many instances of the use of r_theta_levels and r_rho_levels as possible, focussing instead on height from the surface where possible. If the total distance needs to be retained, it is done so at double precision.
This PR addresses #282
Code Quality Checklist
Testing
trac.log
Test Suite Results - lfric_apps - spbl_fixes/run4
Suite Information
Task Information
✅ succeeded tasks - 1314
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