Skip to content

Add stencil support for LFRic domain kernels (#1948) - #3572

Open
arporter wants to merge 20 commits into
masterfrom
1948_stencils_for_domain
Open

Add stencil support for LFRic domain kernels (#1948)#3572
arporter wants to merge 20 commits into
masterfrom
1948_stencils_for_domain

Conversation

@arporter

@arporter arporter commented Aug 27, 2026

Copy link
Copy Markdown
Member

This PR implements stencil support for LFRic domain kernels (issue #1948). It removes the previous restriction that rejected stencil arguments for domain kernels and updates argument passing so domain kernels receive full stencil arrays (rank-3/4) rather than column-indexed slices.

Domain kernels (operates_on = domain) can now use stencil arguments on
read-only field inputs. The PSy layer generates full stencil arrays for
the entire domain, and these are now correctly passed to domain kernels
instead of being rejected at parse time.

Changes:
- Remove parser restriction that rejected stencils in domain kernels
  (lfric_arg_descriptor.py)
- Add domain-specific stencil methods in kern_call_arg_list.py:
  * stencil_unknown_extent_domain()
  * stencil_2d_unknown_extent_domain()
  * stencil_2d_max_extent_domain()
  * stencil_domain()
  * stencil_2d_domain()
- Update argument ordering in arg_ordering.py to dispatch to appropriate
  stencil methods based on kernel type (domain vs column)
- Update test: rename test_no_stencil_domain_kernel() to
  test_stencil_domain_kernel() to verify stencils now work

Key difference from column kernels:
- Column kernels: receive scalar/indexed stencil values per column
- Domain kernels: receive full stencil arrays for all domain cells

All 106 related tests pass successfully.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@arporter arporter self-assigned this Aug 27, 2026
@arporter arporter added LFRic Issue relates to the LFRic domain in progress labels Aug 27, 2026
@arporter
arporter marked this pull request as draft August 27, 2026 12:48
@codecov

codecov Bot commented Aug 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (3dd19f4) to head (7c9f78f).

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #3572   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          399       399           
  Lines        56173     56192   +19     
=========================================
+ Hits         56173     56192   +19     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@arporter

Copy link
Copy Markdown
Member Author

This is my first attempt at using AI (copilot) to do feature development. I've now burnt my monthly free allocation so it's back to the old way...

@arporter

Copy link
Copy Markdown
Member Author

I'm in the process of extending eg5 to include a domain kernel and also making it compile. I'm still having some trouble determining what the ranks of the various stencil-related args should be.

@arporter

arporter commented Sep 1, 2026

Copy link
Copy Markdown
Member Author

This is now ready for review. My experiment with the free copilot functionality was pretty much a failure - I didn't like the way it had implemented things so re-wrote it.
This is a good one for @LonelyCat124 as it's a relatively small change to some LFRic functionality. (It looks like quite a few files changed but a significant number of these are because I took the opportunity to make one of the existing LFRic examples actually compile.)

@arporter
arporter marked this pull request as ready for review September 1, 2026 13:49
@arporter

arporter commented Sep 1, 2026

Copy link
Copy Markdown
Member Author

Once this has had a first review, @alanjhewitt may want to try it out to check that it works as expected.

@alanjhewitt

Copy link
Copy Markdown

Once this has had a first review, @alanjhewitt may want to try it out to check that it works as expected.

Thanks Andy.

I dont work on Jules myself, but will get @HelenRJohnson to try this out

@alanjhewitt

Copy link
Copy Markdown

Once this has had a first review, @alanjhewitt may want to try it out to check that it works as expected.

Thanks Andy.

I dont work on Jules myself, but will get @HelenRJohnson to try this out

Helen has a development targeting the September deadline, so i will try to test it.

I will have a go at making a branch, pointing at your psyclone branch, removing psycallite from the jules kernel, maybe some other pipework stuff, then run rose-stem.

How can I tell lfric_apps to look at this branch?
psyclone does not appear in the dependencies file
https://github.com/MetOffice/lfric_apps/blob/main/dependencies.yaml

I can have a look this Thursday.

@arporter

arporter commented Sep 2, 2026

Copy link
Copy Markdown
Member Author

I will have a go at making a branch, pointing at your psyclone branch, removing psycallite from the jules kernel, maybe some other pipework stuff, then run rose-stem.

How can I tell lfric_apps to look at this branch?

Thanks Alan. I'm afraid I don't know the answer to that in the Met Office environment. Your best bet is to ask @christophermaynard, @MetBenjaminWent or @mo-alistairp.

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

Labels

LFRic Issue relates to the LFRic domain ready for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants