-
Notifications
You must be signed in to change notification settings - Fork 48
Remove base mesh dependency in compute sample kernel #313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Juan Manuel Castillo Sanchez (ukmo-juan-castillo)
wants to merge
8
commits into
MetOffice:main
Choose a base branch
from
ukmo-juan-castillo:base_mesh_compute_sample_kernel
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
4aff176
Obtain geometry and topology information for mapping from the mesh
ukmo-juan-castillo c21acf9
Modify test not to use 'magic' variables
ukmo-juan-castillo 6a2a993
Fix a typo
ukmo-juan-castillo dc23584
Add name to contributors list
ukmo-juan-castillo d7eb78c
Pass the integer values of geometry and topology to the kernel instead
ukmo-juan-castillo a5fa24a
Minor fixes
ukmo-juan-castillo 93e07d4
Some more small fixes
ukmo-juan-castillo 3a107d4
Merge branch 'main' into base_mesh_compute_sample_kernel
ukmo-juan-castillo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,26 +1,28 @@ | ||
| # Contributors | ||
|
|
||
| | GitHub user | Real Name | Affiliation | Date | | ||
| | ---------------- | ---------------------- | ----------- | ---------- | | ||
| | andrewcoughtrie | Andrew Coughtrie | Met Office | 2025.12.12 | | ||
| | james-bruten-mo | James Bruten | Met Office | 2025-12-09 | | ||
| | jedbakerMO | Jed Baker | Met Office | 2025-12-29 | | ||
| | jennyhickson | Jenny Hickson | Met Office | 2025-12-10 | | ||
| | mo-marqh | Mark Hedley | Met Office | 2025-12-11 | | ||
| | mo-rickywong | Ricky Wong | Met Office | 2025-01-30 | | ||
| | mike-hobson | Mike Hobson | Met Office | 2025-12-17 | | ||
| | MatthewHambley | Matthew Hambley | Met Office | 2025-12-15 | | ||
| | mo-lottieturner | Lottie Turner | Met Office | 2025-12-16 | | ||
| | tommbendall | Thomas Bendall | Met Office | 2026-01-23 | | ||
| | yaswant | Yaswant Pradhan | Met Office | 2025-12-16 | | ||
| | stevemullerworth | Steve Mullerworth | Met Office | 2026-01-08 | | ||
| | harry-shepherd | Harry Shepherd | Met Office | 2026-01-08 | | ||
| | EdHone | Ed Hone | Met Office | 2026-01-09 | | ||
| | tom-j-h | Tom Hill | Met Office | 2026-01-19 | | ||
| | mo-alistairp | Alistair Pirrie | Met Office | 2026-01-12 | | ||
| | t00sa | Sam Clarke-Green | Met Office | 2026-01-27 | | ||
| | MetBenjaminWent | Benjamin Went | Met Office | 2026-01-30 | | ||
| | jcsmeto | James Cunningham-Smith | Met Office | 2026-02-06 | | ||
| | thomasmelvin | Thomas Melvin | Met Office | 2026-01-15 | | ||
| | ericaneininger | Erica Neininger | Met Office | 2026-03-02 | | ||
| | mo-lucy-gordon | Lucy Gordon | Met Office | 2026-03-18 | | ||
| | GitHub user | Real Name | Affiliation | Date | | ||
| | ------------------- | ---------------------- | ----------- | ---------- | | ||
| | andrewcoughtrie | Andrew Coughtrie | Met Office | 2025.12.12 | | ||
| | james-bruten-mo | James Bruten | Met Office | 2025-12-09 | | ||
| | jedbakerMO | Jed Baker | Met Office | 2025-12-29 | | ||
| | jennyhickson | Jenny Hickson | Met Office | 2025-12-10 | | ||
| | mo-marqh | Mark Hedley | Met Office | 2025-12-11 | | ||
| | mo-rickywong | Ricky Wong | Met Office | 2025-01-30 | | ||
| | mike-hobson | Mike Hobson | Met Office | 2025-12-17 | | ||
| | MatthewHambley | Matthew Hambley | Met Office | 2025-12-15 | | ||
| | mo-lottieturner | Lottie Turner | Met Office | 2025-12-16 | | ||
| | tommbendall | Thomas Bendall | Met Office | 2026-01-23 | | ||
| | yaswant | Yaswant Pradhan | Met Office | 2025-12-16 | | ||
| | stevemullerworth | Steve Mullerworth | Met Office | 2026-01-08 | | ||
| | harry-shepherd | Harry Shepherd | Met Office | 2026-01-08 | | ||
| | EdHone | Ed Hone | Met Office | 2026-01-09 | | ||
| | tom-j-h | Tom Hill | Met Office | 2026-01-19 | | ||
| | mo-alistairp | Alistair Pirrie | Met Office | 2026-01-12 | | ||
| | t00sa | Sam Clarke-Green | Met Office | 2026-01-27 | | ||
| | MetBenjaminWent | Benjamin Went | Met Office | 2026-01-30 | | ||
| | jcsmeto | James Cunningham-Smith | Met Office | 2026-02-06 | | ||
| | thomasmelvin | Thomas Melvin | Met Office | 2026-01-15 | | ||
| | ericaneininger | Erica Neininger | Met Office | 2026-03-02 | | ||
| | mo-lucy-gordon | Lucy Gordon | Met Office | 2026-03-18 | | ||
| | ukmo-juan-castillo | Juan M. Castillo | Met Office | 2026-03-24 | | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm worried that this confuses the mesh's geometry and topology with the model's -- which is why you've had to add a conversion to get the enumerators in the kernel. Can't you pass the
geometryandtopologyenumerators frombase_mesh_config_modas arguments to the kernel?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I see, the point is that you don't want to use the
base_meshnamelist so are trying to hack a way around it, since you can figure this out based on the mesh object.Maybe what you've done is the only solution. I'm a bit anxious that there are two underlying problems:
geometryandtopologyinformation: both the mesh and thebase_meshnamelist have independent definitionsI'm also a bit concerned if we start having some kernels that get their geometry/topology information from the mesh, and some that get their information from the namelist, that we could end up with a lot of inconsistency and confusion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I've now realised that these changes don't completely avoid the
base_mesh_config, since you've had to import the enumerators intocompute_sample_u_ops_kernel.So now I think I'm back to my first suggestion: can't we have
geometryandtopologyarguments to the kernel, andlfric2lfriccan have its own logic based on the mesh to work out whichgeometryandtopologyenumerators to pass to the kernel?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is another option I was considering: passing the geometry and topology integer arguments to the kernel. This option is slightly more complicated because this information lies in the local_mesh and not the mesh object, but it is doable.
Ricky was looking into removing the base_mesh dependencies in the science code, and we just agreed that he will be reviewing this PR. Any comments are welcome though. I will wait for Ricky's opinion on what the best way to pass the parameters to the kernel is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it is possible to pass through the
geometryandtopologyintegers, I think that would be a better solution here in isolation. But if there are other plans to remove thebase_meshnamelist somehow (I'm not sure I'd understand why!) then I agree it would make sense for this PR to be consistent with those plans!There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding the problematic parameters to the subroutine parameters, is something that has been done in the past to fix lfric2lfric issues due to lack of flexibility of lfric_core. Why doing it here is a 'hacky' solution? What 'proper' solution do you propose? I would be happy to implement it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The branch I'm working on does this (as intended for kernels) in the removal of namelist variables from module scope. The branch has already implemented this for compute_sample_u_ops_code. This PR conflicts and is a hack.
As it stands, if it is needed to progress, use it as a branch until
compute_sample_u_ops_codeis updated, but it will not go on trunk.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need a solution in the trunk. When do you reckon your branch will go to trunk? If it is going to take a long time, I would propose adding what you call the 'hack' in trunk and then you can modify it and do it properly in your branch. Is this reasonable? I can help you coding if you do not have much time, and if you give me details on how you want to do it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was clearly a bit of misunderstanding in the above. I spoke with Ricky to clarify. Ricky was not saying that you should wait for his branch, he intended to say that you could use the solution that is in his branch, which is to use base_mesh_config_mod.
So, Ricky and Tom agree: base_mesh configurations of
topologyandgeometryshould be passed in rather than the values from the mesh object.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, this is what we proposed to do, but despite asking several times I did not receive confirmation. I push the proposed new code, asking now if you would prefer extracting the geometry and topology parameters further in the subroutine call chain. I will update the trac log when it is ready, as well as the linked branch in lfric_apps.