CoMorph convection scheme refactoring#292
CoMorph convection scheme refactoring#292MichaelWhitall wants to merge 9 commits intoMetOffice:mainfrom
Conversation
There was a problem hiding this comment.
I'm not entirely sure I follow this - can you explain?
- how does this not change answers in existing tests where cca/ccw are inputs to Comorph, or are they just not used if so?
- I'm not sure you need to set them in comorph_kernel above n_conv_levs every timestep - they should just stay at their originally initialised value of 0 here
- if Comorph sets every point below this, then I'm not sure this pre-initialisation is needed at all?
- For the current implicit_bl placement things should be okay, as it's working on the output of the convection anyway. If this setting to 0 needs to happen in the implicit_bl before convection case, would it be better as part of my branch?
There was a problem hiding this comment.
Hi thanks Ian, that was quick! (maybe I was meant to open this in "draft mode" so I could finish documenting it before reviews begin!) I'll try and scribble some more explanations:
- CoMorph itself doesn't have any dependence on cca, ccw; it just sets them (on levels 1, n_conv_levels only).
- The issue is that under the rearrangements, the cca, ccw passed into CoMorph are now just local arrays (
cca_3d,ccw_3d) which have not been pre-populated with the input values of the prognostics (ascca_3d0,ccw_3d0are). Subroutinecomorph_conv_cloud_extrasthen setscca_3d0,ccw_3d0to the max out of their existing input values and thecca_3d,ccw_3doutput by CoMorph. It does this on all levels, so the local arrayscca_3d,ccw_3dneed to be set on all levels, but CoMorph doesn't set anything on the top level. - Under this arrangement, the prognostics need to be initialised to zero somewhere in the timestep, otherwise any conv cloud created by either comorph or forced cu will just hang around for the next timestep and forevermore!
- Removing the initialisation to zero (currently in
fast_physics_alg) from my branch will make conv cloud persist forever, changing answers, so needs to be in my branch.
The point of the rearrangement (making CoMorph set local copies instead of setting the prognostics directly) is to make CoMorph agnostic to whether another scheme has already added contributions to the cca, ccw prognostics before it. CoMorph should supplement them not overwrite them.
Cheers!
Mike
There was a problem hiding this comment.
Thanks - that makes sense. In which case, I wonder if it's worth wrapping this code inside an "if-comorph" test, so that it's not being done for the 6A scheme where it isn't really needed?
There was a problem hiding this comment.
Yep no problem, I've put the cca, ccw initialisation in fast_physics_alg inside an if test on comorph as suggested: fast_physics_alg_mod.X90
|
|
||
| ! Set convective cloud fields to zero above the top convection level | ||
| ! (comorph only sets them up to n_conv_levels) | ||
| cca_3d(:,:,n_conv_levels+1:nlayers) = 0.0_r_um |
There was a problem hiding this comment.
Is this really needed? As the copying back of cca/ccw only happens up to n_conv_levels, so I'm not really sure why we ever need to worry about what's happening above this here?
There was a problem hiding this comment.
I agree its not needed in terms of what gets copied into the prognostics, but the rigorous compile jobs in rose stem were failing due to referencing uninitialised values where cca_3d, ccw_3d, cca_bulk are used inside subroutine comorph_conv_cloud_extras. That's what prompted me to add this code. An alternative solution would be to change the k-loops inside comorph_conv_cloud_extras so they only go up to n_conv_levels instead of model_levels. Would that be preferable?
There was a problem hiding this comment.
That would seem sensible, then Comorph isn't really worried about what happens above n_conv_levels - this is just left alone?
There was a problem hiding this comment.
Yep done (I misremembered, it was actually just the k-loop inside conv_update_precfrac.F90 that needed to be changed to only loop up to n_conv_levels). With that I've now deleted the initialisation of cca_3d, ccw_3d on the top model-level and the tests look OK:
2529025
Cheers!
Mike
|
Hello @MichaelWhitall! 👋 Thank you for your contribution. Since this is your first time contributing to this repository, we ask that you sign our Contributor Licence Agreement (CLA). To agree to the CLA, please add your details (GitHub username, Real Name, Affiliation, and Date) to the CONTRIBUTORS.md file (create one, if required) in the development branch for this PR. After signing the CLA, you won't need to do this again for future PRs. |
PR Summary
Sci/Tech Reviewer: @AlisonStirling
Code Reviewer: @t00sa
closes #178
This aims to lodge the first tranch of changes to the CoMorph convection scheme code-base for CoMorph B. In preparation for numerous other tickets yet to come to lodge new science, this one just restructures various things to lay the ground work.
The key aim here is to lodge the numerous changes in code-structure from the comorph_dev branch, independent from the new science and the various changes / fixes which affect KGO. This will allow those subsequent things to be viewed as clean diffs against the trunk, making them easier to review and lodge in subsequent pull requests. While the changes to CoMorph for this pull request may look hideously large and widespread, the key thing is that they don't change answers, so they have identically preserved the existing science and technical implementation of CoMorph.
Please see linked issue #178 for full details.
Code Quality Checklist
Testing
****All rose stem tests pass.**This pull request imports the existing set of unit tests for CoMorph and some of its components, that were already present in the UM copy of CoMorph but hadn't been lodged in LFRic yet. These tests are best run simply at the command-line rather than integrated into rose-stem or CI.trac.log
Test Suite Results - lfric_apps - comorph_refact/run1
Suite Information
Task Information
✅ succeeded tasks - 1195
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