Skip to content

Address Issues with Face Selectors#349

Open
Thomas Bendall (tommbendall) wants to merge 5 commits intoMetOffice:mainfrom
tommbendall:TBendall/face_selectors
Open

Address Issues with Face Selectors#349
Thomas Bendall (tommbendall) wants to merge 5 commits intoMetOffice:mainfrom
tommbendall:TBendall/face_selectors

Conversation

@tommbendall
Copy link
Copy Markdown
Contributor

@tommbendall Thomas Bendall (tommbendall) commented Apr 28, 2026

PR Summary

Sci/Tech Reviewer:
Code Reviewer: Yaswant Pradhan (@yaswant)

This PR revamps the face_selector infrastructure, which ensure that when looping over facse within columns, faces are only looped over once. This PR fixes a number of flaws and deficiencies with them. It does this by changing how the face_selector fields are computed, and changing the values they can take.

In particular:

  • columns previously always iterated over W and S faces. Now they can just iterate over N, E or no faces if necessary
  • every face will now only be iterated over once, irrespective of the MPI decomposition (there were previously decompositions in which faces were iterated over twice)

This fixes a number of problems:

Linked-To

Details

  • components/science/source/kernel/algebra/sci_face_selector_support_mod.F90:
    • introduces new method for making face_selector
    • adds a routine for decoding the face_selector values, to be used in kernels that loop over faces within a column
  • components/science/source/kernel/algebra/sci_face_selector_kernel_mod.F90: rewritten to use the new method (from the support module)
  • components/science/source/kernel/algebra/sci_face_selector_halo_kernel_mod.F90: a new kernel to allow calculation of face_selector fields into halo regions
  • components/science/source/psy/sci_psykal_light_mod.f90: adds a simple deep_int_setval_c routine, setting the value of an integer field into the halos. This could hypothetically be done as an adjustment to int_setval_c through a psyclone optimisation script, but as this is not an optimisation and is necessary scientifically, I chose to add a specific psykal_light routine
  • components/science/source/algorithm/sci_geometric_constants_mod.x90: updated for the new computation of the face selectors
  • other kernels: use the new method to decode the face selectors

Documentation

The old and new methods are summarised and illustrated in the attached PDF:
main.pdf

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 - face_selectors_core/run3

Suite Information

Item Value
Suite Name face_selectors_core/run3
Suite User thomas.bendall
Workflow Start 2026-04-28T10:55:51
Groups Run developer
Dependency Reference Main Like
lfric_core tommbendall/lfric_core@TBendall/face_selectors False
SimSys_Scripts MetOffice/SimSys_Scripts@2025.12.1 True

Task Information

✅ succeeded tasks - 384

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 Thomas Bendall (tommbendall) marked this pull request as ready for review April 30, 2026 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

2 participants