Avoid panel_decomposition_mod causing a divide-by-zero#227
Merged
mike-hobson merged 5 commits intoMetOffice:mainfrom Jan 20, 2026
Merged
Avoid panel_decomposition_mod causing a divide-by-zero#227mike-hobson merged 5 commits intoMetOffice:mainfrom
panel_decomposition_mod causing a divide-by-zero#227mike-hobson merged 5 commits intoMetOffice:mainfrom
Conversation
29 tasks
| @@ -879,7 +879,7 @@ function calc_mapping_factor( global_mesh_collection, global_mesh ) result(mp) | |||
| ! If no meshes were found, return 1. This is relevant for JEDI where mesh | |||
| ! initialisation is run twice. | |||
There was a problem hiding this comment.
I think it's worth modifying this comment to capture the changes in the code, i'd suggest "If no meshes were found, or this_panel_width < shortest_panel_width, then return 1. This is relevant for JEDI where mesh..."
Contributor
Author
There was a problem hiding this comment.
Good point, thank you! Change made.
thomasmelvin
left a comment
There was a problem hiding this comment.
One minor suggestion for adding to the existing comment, otherwise I'm happy with the changes
thomasmelvin
approved these changes
Jan 20, 2026
29 tasks
mike-hobson
requested changes
Jan 20, 2026
Contributor
mike-hobson
left a comment
There was a problem hiding this comment.
This is a simple fix and I have no issues with it (except for the unnecessary comment).
Response to CR Co-authored-by: Mike Hobson <26921912+mike-hobson@users.noreply.github.com>
Contributor
Author
|
@mike-hobson change made. Thanks for the quick review! |
mike-hobson
approved these changes
Jan 20, 2026
Contributor
mike-hobson
left a comment
There was a problem hiding this comment.
Great, thanks. I'm happy for this to PASS code review, now.
29 tasks
EdHone
pushed a commit
to EdHone/lfric_core
that referenced
this pull request
Jan 26, 2026
Co-authored-by: Mike Hobson <26921912+mike-hobson@users.noreply.github.com>
EdHone
pushed a commit
to EdHone/lfric_core
that referenced
this pull request
Jan 26, 2026
Co-authored-by: Mike Hobson <26921912+mike-hobson@users.noreply.github.com>
29 tasks
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
PR Summary
Sci/Tech Reviewer: @thomasmelvin
Code Reviewer: @mike-hobson
This issue was found in development of the JADA benchmark.
Other changes made meant that
jedi_lfric_testswas crashing due to a divide by zero here:lfric_core/infrastructure/source/mesh/panel_decomposition_mod.f90
Line 252 in a4caea1
mpis initialised here:lfric_core/infrastructure/source/mesh/panel_decomposition_mod.f90
Lines 879 to 885 in a4caea1
The solution is to instead set
mp = max(1, this_panel_width / shortest_panel_width).Please note, I did not find this issue or develop the fix - I just need it for the linked PR below, and there wasn't a PR yet.
linked Align jedi_lfric_tests linear model/adjoint testing to adjoint_tests and linear_model lfric_apps#156
closes Avoid
panel_decomposition_modcausing a divide-by-zero #226Code Quality Checklist
(Some checks are automatically carried out via the CI pipeline)
style guidelines
readability of the code
Testing
using this branch
acceptable (e.g. kgo changes)
tests, unit tests, etc.)
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
I can't find my
trac.log! It might be because I ran with--no-run-name? Here's the Cylc Review: https://cylchub/services/cylc-review/taskjobs/tom.hill/?suite=fix_jelf_divide_by_zero-develop.Security Considerations
Performance Impact
performance measurements have been conducted
AI Assistance and Attribution
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
confirmed that it builds correctly
PSyclone Approval
interface, optimisation scripts, LFRic data structure code) then please
contact the
tooscollabdevteam@metoffice.gov.uk
Sci/Tech Review
Please alert the code reviewer via a tag when you have approved the SR
Code Review