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 is to make the driver's stencil_depth argument an array of stencil_depths, corresponding to the different meshes.

Linked to: MetOffice/lfric_apps#174

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_core - multi_stencil_depths/run3

Suite Information

Item Value
Suite Name multi_stencil_depths/run3
Suite User thomas.bendall
Workflow Start 2026-01-22T18:09:39
Groups Run developer
Dependency Reference Main Like
lfric_core tommbendall/lfric_core@TBendall/MultiStencilDepths False
SimSys_Scripts MetOffice/[email protected] True

Task Information

✅ succeeded tasks - 372

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

@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
@tommbendall tommbendall added the Linked Apps This PR is linked to a MetOffice/lfric_apps PR label Jan 22, 2026
@github-actions github-actions bot removed the cla-required The CLA has not yet been signed by the author of this PR - added by GA label Jan 22, 2026
@tommbendall tommbendall added this to the Spring 2026 milestone Jan 22, 2026
@tommbendall tommbendall added the enhancement New feature or request label Jan 22, 2026
@tommbendall tommbendall marked this pull request as ready for review January 23, 2026 09:58
Copy link
Collaborator

@stevemullerworth stevemullerworth left a comment

Choose a reason for hiding this comment

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

Impacts of this change on the code I own are trivial and acceptable.

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.

I've left a small comment on aligning the & in one file. I'm happy with everything else, and I'm happy with the results shown in the linked lfric apps ticket. This passes science review.

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

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

@github-actions github-actions bot added the cla-signed The CLA has been signed as part of this PR - added by GA label Jan 26, 2026
Copy link
Contributor

@mike-hobson mike-hobson left a comment

Choose a reason for hiding this comment

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

I'm really not a fan of having the stencil_depth() array that has to magically line up with the mesh_names() array, even though there is no connection between the arrays in the design structure. But having discussed the problem at length with AndyC, we can't think of a better way that doesn't involve a refactor of the mesh code - and that would be a different piece of work. So (with just a little reluctance) I'm happy for this to go on.

@mo-rickywong
Copy link
Contributor

mo-rickywong commented Jan 27, 2026

About to have a look at this, though has there been any work in developing this change on the impact if any on the Intergrid maps? I'm assuming that there is none as I don't think (if I recall correctly) that the intergrid maps extend into outer halos.

Having had look at this, I'd agree with Mike and AndyC, I don't like the way that the stencil depth has to be the same size as the mesh_names array in one case or has to be an array of 1 in the other. There are some ways to improved the current change, though ultimately it would need a re-assessing and refactoring, so it probably wouldn't be worth the effort. So I wouldn't block this change, (though also reluctantly).

Note: This won't work with pre-partitioned meshes as they only take one input for the max stencil depth.

I think that there are a few things that would make refactoring easier (though not a small amount of work)

  • InterGrid maps need to move away from using identifiers that depend on the order the meshes where loaded.
  • Base Mesh namelist needs to move to just a Mesh namelist, which is allowed to have multiple instances, each of which associate to ...
  • ... A named partitioning namelist, which will allow the required/generated stencil depth to be specified (This also benefits other tools which may require more than one partitioning strategy)

@tommbendall
Copy link
Contributor Author

About to have a look at this, though has there been any work in developing this change on the impact if any on the Intergrid maps? I'm assuming that there is none as I don't think (if I recall correctly) that the intergrid maps extend into outer halos.

You're right, I haven't needed to touch the integrid mesh maps, as these don't extend into outer halos

Copy link
Contributor

@mo-rickywong mo-rickywong left a comment

Choose a reason for hiding this comment

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

As code owner, the change is functional, although not ideal. To refactor this area would mean that further suggestions on this change would likely be a waste of effort.

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 Linked Apps This PR is linked to a MetOffice/lfric_apps PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants