Impose max limit on in-cloud water-content in pc2_checks#402
Impose max limit on in-cloud water-content in pc2_checks#402MichaelWhitall wants to merge 21 commits intoMetOffice:mainfrom
Conversation
…es required for passing pressure on rho-levels into pc2_checks from various places).
…ecks are now switched on elsewhere.
…ring as in psyclone's autogenerated call.
… on/off the bug-fix.
… option to call it before convection is independent from the option to call the cloud-scheme before convection.
|
In the first of these, I have followed the existing ubiquitous practice of copying data between arrays with different precision (there are literally thousands of similar existing warnings generated across the code-base). This compiler warning could be removed by explicitly converting precision when copying the data, e.g.: But all the other existing kernels I've looked at don't bother to do this, so I would be departing from standard practice. Can the code reviewer advise whether this should in fact be done? In the 2nd warning, the compiler is complaining that |
| sort-key=Panel-A09b | ||
| type=logical | ||
|
|
||
| [namelist:cloud=l_pc2_checks_cfffix] |
There was a problem hiding this comment.
I presume from the fact you've included this as a logical, you discovered that it did change KGO in most of the rose-stem tests? I think I'd still be keen to put it in as a fix without a logical, so will set some GC6 runs going over the weekend to check what impact it has...
There was a problem hiding this comment.
These are running as dy165 and dy166 - should have results on Monday
There was a problem hiding this comment.
Yes that's right, it did change many of the KGOs for global runs, so the bug must be being exposed on-trunk for my fix to be changing the answers. I didn't want to risk breaking the TOA tuning in GC6 by slightly changing the mean ice-cloud fractions, so thought I'd put this under a logical just to be safe!
Thanks lots for trying out a global model test to see what difference this fix makes; happy to remove the switch from the branch if this doesn't make any noticeable difference afterall...
There was a problem hiding this comment.
To document here, results from cases and AMIP run are:
- https://wwwspice/~ian.boutle/GES/GC6_GAL10b3_cfffix/imt/page.html?DDV
- https://wwwspice/~ian.boutle/autoassess/u-dy165_vs_u-dx491/index.html
Martin W confirmed he was happy to remove the logical and accept the KGO change.
There was a problem hiding this comment.
The code has now been updated accordingly: 45bb0c1
The logical controlling the bug-fix has been deleted, and the fix is now hard-coded in pc2_checks.
I've then rerun the all group tests to catch the many rose-stem tests which now change answers due to the fixed bug, and updated the dev branch KGOs using the latest output: b885c9a
There was a problem hiding this comment.
Thanks Mike - looks good to me!
science/physics_schemes/source/large_scale_cloud/pc2_checks.F90
Outdated
Show resolved
Hide resolved
I think it's better practice to cast the precision from r_um to r_def, despite what the code does elsewhere... I generally try to use nlayers (being the lfric variable) rather than model_levels (being the UM variable) in kernels, but in practice it makes no difference. |
…use nlayers instead of model_levels (makes no difference but removes compiler warning about nlayers not being used).
…use nlayers instead of model_levels (makes no difference but removes compiler warning about nlayers not being used).
science/gungho/source/algorithm/timestepping/semi_implicit_timestep_alg_mod.X90
Outdated
Show resolved
Hide resolved
Yep I've changed the Just testing changing these 2 kernels to also explicitly convert the precision when copying between ...and adding the explicit precision conversions in the Now rerunning the test branch rose-stem to get updated KGO checksums for the 32-bit comorph runs which will likely have changed answers with this change in ...but actually, having copied the new checksum files into the dev branch, this resulted in no changes, so the explicit precision conversion in the |
…tch surrounding code.
…tch surrounding code.
… kernel explicit, to remove compiler warnings.
… kernel explicit, to remove compiler warnings.
PR Summary
Sci/Tech Reviewer: Paul Barrett (@paul-barrett)
Code Reviewer: Lottie Turner (@mo-lottieturner)
Various numerical issues can cause the in-cloud water content (qcl/cf_liq) to go to silly large values (e.g. the transport scheme is not bound to keep the two fields qcl, cf_liq consistent with eachother). Such instances can cause unrealistic behaviours in microphysics schemes and in CoMorph's convective triggering calculation. We make the following changes:
The cloud and precip fractions were already limited to avoid in-cloud water contents exceeding a hardwired threshold of 5 g kg-1 on input to (and output from) CoMorph, in subroutine
fracs_consistency, called from conv_comorph_kernel_mod.F90. But these checks were only done if using CoMorph; it makes more sense for the checks to form part of the cloud / precip fraction schemes themselves. The call tofracs_consistencyon input to CoMorph is now skipped if the new checking code is on. The new in-cloud water content limiting in pc2_checks.F90 and lsp_precfrac_checks.F90 calculates a variable max limit (instead of a fixed 5 g kg-1); the max limit now scales with the cloud or precip fraction, so that it is lower when the fraction is extremely small. This better-targets the limiting at tiny "noise" values of water-content and fraction, while leaving physical large in-cloud water contents intact. Also, the max limit now scales with the mean total water content in the layer below, avoiding the need for an ad-hoc dimensional constant (using the mean value below instead of just the value on the current model-level avoids overly-strict limiting where convection detrains high water-contents into very dry air at high altitude).Note that the subroutine lsp_precfrac_checks.F90 (called to impose another sanity-limit on the prognostic precip fraction at the end of the timestep) already existed in the UM and was used in CoMA9, but had simply not been ported to LFRic yet. This PR introduces this subroutine call near end-of-timestep in semi_implicit_timestep_alg_mod.X90 consistent with the UM, and so will change KGO for all configurations that use the prognostic precip fraction.
Branch at vn3.1: vn3.1_max_in_cloud_checks
Test branch: max_in_cloud_checks_test
closes #243
Code Quality Checklist
****See comment below Re compiler warnings generated by the added code. Following the below discussions on this, those compiler warngings have now been fixed.**Thecheck_cr_approvedCI test is inevitably not going to succeed until code-review has been approved! there is also avalidate_symlinksCI test which seems to be stuck in a pending state. Can the code reviewer advise what this is / whether I should be concerned?Testing
***I have switched all the new functionality on in the existingcomorph_devrose-stem tests to ensure it is tested. Therefore this app is expected to change KGO. Also the addition of the call tolsp_precfrac_checksnear the end of the timestep insemi_implicit_timestep_algintroduces a new check on the prognostic precip fraction which is not protected by the new namelist switches, and so is newly active in thecoma9andcoma9_tbrose-stem apps (which use prognostic precip fraction).Following discussions and approval from Martin Willett Re the impact on GC6, the bug-fix affecting ice-cloud fraction in
pc2_checksis now hard-coded instead of protecting it with a logical switch. Therefore numerouslfric_atmglobal jobs (which use PC2) have intentionally changed KGO.trac.log
Test Suite Results - lfric_apps - max_in_cloud_checks_test/run1
Suite Information
Task Information
❌ failed tasks - 34
⌛ waiting tasks - 2
Note: I have intentionally left the update of KGO checksums out of the test branch, so that those tests which change KGO show-up above as failures in the
check_lfric_atmtasks for clarity. These tasks would not fail on the dev branch as the KGO files have been updated there.Security Considerations
NANAPerformance Impact
**Added new subroutine calls and calculations expected to slightly increase computational cost if the new functionality is switched on (no impact expected when off).AI Assistance and Attribution
Documentation
Documentation pending...
PSyclone Approval
Sci/Tech Review
(Please alert the code reviewer via a tag when you have approved the SR)
Code Review