Fix rare issue with transport of tracers when substepping#380
Open
Thomas Bendall (tommbendall) wants to merge 5 commits intoMetOffice:mainfrom
Open
Fix rare issue with transport of tracers when substepping#380Thomas Bendall (tommbendall) wants to merge 5 commits intoMetOffice:mainfrom
Thomas Bendall (tommbendall) wants to merge 5 commits intoMetOffice:mainfrom
Conversation
James Kent (jameskent-metoffice)
approved these changes
Mar 30, 2026
Contributor
James Kent (jameskent-metoffice)
left a comment
There was a problem hiding this comment.
I have followed through the code and I can see that it now divides the total_flux by the number of substeps, to give an average flux at each substep if the number of substeps is different for tracers and for density.
This bit of code is not tested in the test-suite as it is a rare issue, but as the developer has run the all suite this should have run the C224/C896 lfric_atm tests (if not, I suggest running these just to check everything runs smoothly). I approve this PR.
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: James Kent (@jameskent-metoffice)
Code Reviewer: Yaswant Pradhan (@yaswant)
This PR fixes a rare issue in the transport of tracers, in the situation that tracers are transported consistently (using the dry density flux) but using a new transport controller, because the dry flux used to transport the tracers has been summed over different transport steps. This happens when transporting tracers (a) using the cheap update, (b) on a coarse mesh, or (c) using the TR-BDF2 timestepper introduced in #379.
If the 3D Lipschitz number for the tracer transport is greater than 1, this can trigger the logic to substep the transport. However, this appeared to not be working correctly: the
flux_precomputationsobject should store aref_fieldandref_fluxfor each stage of the substepped transport (e.g. there would be 6 stages for 2 substeps with VHV splitting), but the model was returning the error:To fix this:
total_dry_fluxis split into smaller fluxes for different steps, the number of substeps is included to ensure that the factor is appropriatetotal_dry_fluxis set for theflux_precomputationsobject in case it needs calling in futuretotal_dry_fluxscaled for a single substep, and the resulting fluxes are then set for all future substepsThis situation does not occur in the test suite, so this PR does not change KGOs.
Code Quality Checklist
Testing
trac.log
Test Suite Results - lfric_apps - substep_tracer_fix/run1
Suite Information
Task Information
✅ succeeded tasks - 1511
Security Considerations
Performance Impact
AI Assistance and Attribution
Documentation
PSyclone Approval
Sci/Tech Review
(Please alert the code reviewer via a tag when you have approved the SR)
Code Review