Skip to content

Conversation

@tommbendall
Copy link
Contributor

@tommbendall tommbendall commented Jan 22, 2026

PR Summary

Sci/Tech Reviewer: @jameskent-metoffice
Code Reviewer: @allynt

Our current infrastructure sets a single maximum halo depth for all meshes, irrespective of their relative resolution. This isn't is necessary and doesn't match the use of the meshes. In typical atmospheric configurations, the finest mesh needs a depth appropriate for the transport scheme, which is set by the expected maximum Courant number (e.g. 10). In contrast, the coarser meshes used for multigrid generally only need a halo depth of 2, and yet we still set their depth to 10. For these multigrid meshes, this means the halos can end up extending beyond the adjacent partitions (unnecessarily!)

This is a linked PR, which addresses this by allowing different halo depths to be set for different meshes. The change in this PR is:

  • make get_required_stencil_depth a subroutine, returning the value for a particular mesh
  • removing get_required_stencil_depth and replacing it with mesh%get_halo_depth() in appropriate science code
  • picking up the change in API to the LFRic-Core init_mesh routine, so that stencil_depth is a rank-1 array (with different values passed for different meshes)

This changes the KGO of the Schar mountain test. This is because this test has a width in the y-direction of 8 cells, but uses a maximum halo depth of 4 -- meaning that the furthest cell in both positive and negative directions is the same. This triggers issue #175. A separate PR should change those vertical slice tests to avoid this issue.

Linked to: MetOffice/lfric_core#237

Plot of test with changed KGO:
schar_stencil_depths

Code Quality Checklist

  • I have performed a self-review of my own code
  • My code follows the project's style guidelines
  • Comments have been included that aid understanding and enhance the readability of the code
  • My changes generate no new warnings
  • All automated checks in the CI pipeline have completed successfully

Testing

  • I have tested this change locally, using the LFRic Core rose-stem suite
  • If required (e.g. API changes) I have also run the LFRic Apps test suite using this branch
  • If any tests fail (rose-stem or CI) the reason is understood and acceptable (e.g. kgo changes)
  • I have added tests to cover new functionality as appropriate (e.g. system tests, unit tests, etc.)
  • Any new tests have been assigned an appropriate amount of compute resource and have been allocated to an appropriate testing group (i.e. the developer tests are for jobs which use a small amount of compute resource and complete in a matter of minutes)

trac.log

Test Suite Results - lfric_apps - stencil_depths/run8

Suite Information

Item Value
Suite Name stencil_depths/run8
Suite User thomas.bendall
Workflow Start 2026-01-22T21:03:01
Groups Run all
Dependency Reference Main Like
casim MetOffice/casim@2025.12.1 True
jules MetOffice/jules@2025.12.1 True
lfric_apps tommbendall/lfric_apps@TBendall/StencilDepths False
lfric_core tommbendall/lfric_core@TBendall/MultiStencilDepths True
moci MetOffice/moci@2025.12.1 True
SimSys_Scripts MetOffice/SimSys_Scripts@2025.12.1 True
socrates MetOffice/socrates@2025.12.1 True
socrates-spectral MetOffice/socrates-spectral@2025.12.1 True
ukca MetOffice/ukca@2025.12.1 True

Task Information

✅ succeeded tasks - 1456

Security Considerations

  • I have reviewed my changes for potential security issues
  • Sensitive data is properly handled (if applicable)
  • Authentication and authorisation are properly implemented (if applicable)

Performance Impact

  • Performance of the code has been considered and, if applicable, suitable performance measurements have been conducted

AI Assistance and Attribution

  • Some of the content of this change has been produced with the assistance of Generative AI tool name (e.g., Met Office Github Copilot Enterprise, Github Copilot Personal, ChatGPT GPT-4, etc) and I have followed the Simulation Systems AI policy (including attribution labels)

Documentation

  • Where appropriate I have updated documentation related to this change and confirmed that it builds correctly

PSyclone Approval

  • If you have edited any PSyclone-related code (e.g. PSyKAl-lite, Kernel interface, optimisation scripts, LFRic data structure code) then please contact the TCD Team

Sci/Tech Review

  • I understand this area of code and the changes being added
  • The proposed changes correspond to the pull request description
  • Documentation is sufficient (do documentation papers need updating)
  • Sufficient testing has been completed

(Please alert the code reviewer via a tag when you have approved the SR)

Code Review

  • All dependencies have been resolved
  • Related Issues have been properly linked and addressed
  • CLA compliance has been confirmed
  • Code quality standards have been met
  • Tests are adequate and have passed
  • Documentation is complete and accurate
  • Security considerations have been addressed
  • Performance impact is acceptable

@tommbendall tommbendall added the Linked Core This PR is linked to a MetOffice/lfric_core PR label Jan 22, 2026
@github-actions github-actions bot added the cla-required The CLA has not yet been signed by the author of this PR - added by GA label Jan 22, 2026
@github-actions github-actions bot added cla-signed The CLA has been signed as part of this PR - added by GA and removed cla-required The CLA has not yet been signed by the author of this PR - added by GA labels Jan 22, 2026
@tommbendall tommbendall added the enhancement New feature or request label Jan 22, 2026
@tommbendall tommbendall added this to the Spring 2026 milestone Jan 22, 2026
@tommbendall tommbendall added the KGO This PR contains changes to KGO label Jan 22, 2026
@tommbendall tommbendall marked this pull request as ready for review January 23, 2026 09:58
@tommbendall tommbendall mentioned this pull request Jan 23, 2026
29 tasks
Copy link

@jameskent-metoffice jameskent-metoffice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This work allows the different meshes to have different maximum halo depths. This means that the multigrid meshes do not have to have the same size halo depths as meshes used for transport.

There is a check whether the coarser meshes will be used for aerosol transport, which is good. The rest of the code is good. There is one small suggested alignment which I've put in the code.

The plot for the kgo changing test looks good, as does the explanation about the halo size in the 2D X-Z tests. I am happy this passes science review.

@github-actions github-actions bot requested a review from allynt January 26, 2026 16:25
@tommbendall
Copy link
Contributor Author

Thanks for the science review. @allynt this is now ready for code review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The CLA has been signed as part of this PR - added by GA enhancement New feature or request KGO This PR contains changes to KGO Linked Core This PR is linked to a MetOffice/lfric_core PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants