Safely compute height fields for continuous function spaces#284
Safely compute height fields for continuous function spaces#284tommbendall wants to merge 8 commits intoMetOffice:mainfrom
Conversation
jameskent-metoffice
left a comment
There was a problem hiding this comment.
This ticket fixes an issue with getting the height for continuous function spaces. The code is all correct and the new unit test tests both branches of the new kernel.
I've made a few very small comments, including one on a bit of code that hasn't been changed in this ticket, so will leave it to the developer to decide if any changes need to be made. Other than that, I'm happy to approve.
There was a problem hiding this comment.
This isn't part of the code you changed, but looking through this file, should the case (W2H) inventory name be "height_w2h_fe"?
| ) & | ||
| ) | ||
|
|
||
| case default |
There was a problem hiding this comment.
It might be helpful to put a comment here saying that this is for continuous spaces (or continuous horizontal spaces, hence wtheta using the discontinuous kernel)
| ) & | ||
| ) | ||
|
|
||
| case default |
There was a problem hiding this comment.
As above, maybe a comment about continuous spaces
PR Summary
Sci/Tech Reviewer: @jameskent-metoffice
Code Reviewer: @allynt
The
sci_get_height_kernelis used to compute the height of DoFs for all function spaces. However, it is not safe for continuous fields (which share DoFs between columns).The
heightfield has theGH_WRITEandANY_DISCONTINUOUS_SPACE_1metadata, which is only appropriate if only one column will ever write to the DoF. However the kernel is written such that both columns write to shared DoFs, which is very dangerous because when using threading, there is no guarantee which thread will write last.Until now we have not seen an error because neighbouring columns have fortuitously always agreed on the calculation on this kernel. However #238 and LFRic-Apps #179 were the unlucky PRs to expose this. The result was that for threaded tests, KGOs became unreproducible.
This PR fixes that issue, by having separate kernels to compute the height fields for continuous and discontinuous spaces, with appropriate metadata and access patterns for those fields. However this does change KGOs for almost all LFRic-Apps tests.
Details
sci_get_height_kernelhas been been renamed tosci_height_discontinuous_kernel(and the corresponding unit-test)sci_height_discontinuous_kernelhas been written k-innermost to run more efficientlysci_height_continuous_kernelhas been written, to cover continuous spaces such as W2sci_height_continuous_kernelhas been added, with parameters to test both spherical and planar geometriesplanet_radius,geometry,coord_system) are all passed through the namelist rather than being importedsci_geometric_constants_mod, the interface to calculate the height fields has changed to pick up the new kernels. Note that:rmultiplicityfield needs computing locallyheight_w*fields give the height above the Earth's mean radius (and not the height above the surface!)Linked-To
Blocks
Code Quality Checklist
Testing
trac.log
Test Suite Results - lfric_core - height_continuous_core/run2
Suite Information
Task Information
✅ succeeded tasks - 384
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