Skip to content

Improved PC2 "smooth" initiation option#404

Open
MichaelWhitall wants to merge 11 commits intoMetOffice:mainfrom
MichaelWhitall:pc2_init_logic_cflim
Open

Improved PC2 "smooth" initiation option#404
MichaelWhitall wants to merge 11 commits intoMetOffice:mainfrom
MichaelWhitall:pc2_init_logic_cflim

Conversation

@MichaelWhitall
Copy link
Copy Markdown

@MichaelWhitall MichaelWhitall commented Mar 27, 2026

PR Summary

Sci/Tech Reviewer:
Code Reviewer: Alistair Pirrie (@mo-alistairp)

In the PC2 cloud-scheme, "initiation" is the process of creating new cloud based on a call to the diagnostic cloud-scheme. Under the existing "smooth" initiation option, the cloud liquid water content from the diagnostic scheme is taken as a minimum limit on the prognostic cloud water each timestep (so the diagnostic scheme only applies if the prognosed cloud-water falls below the diagnostic scheme's prediction). However, the cloud fraction was only relaxed partially towards the diagnostic scheme's prediction, as a function of how much cloud water has been added by initiation. This led to a problem where initiation would systematically increase cloud-water by a larger proportion than cloud-fraction, so that in-cloud water content spuriously increases.

The new PC2 initiation option avoids this problem by imposing the diagnostic cloud-scheme's predicted cloud-fraction as a hard limit on the prognosed cloud-fraction instead of relaxing partially towards it, so that cloud water content and fraction are both handled consistently.

Branch at vn3.1: vn3.1_pc2_init_logic_cflim

Test branch: pc2_init_logic_cflim_test

closes #249

Code Quality Checklist

  • I have performed a self-review of my own code
  • My code follows the project's style guidelines
  • Comments have been included that aid understanding and enhance the readability of the code
  • My changes generate no new warnings *
  • All automated checks in the CI pipeline have completed successfully **

* I checked this by searching for the names of files I modified in the job.err file from the build_lfric_atm_azspice_gnu_full-debug-32bit compile in rose-stem. I could only find compiler warnings related to pre-existing issues (numerous instances of Possible change of value in conversion from REAL(8) to REAL(4) where arrays are copied in bl_imp2_kernel_mod).

** The check_cr_approved CI check is clearly not going to complete successfully until the code review has been approved.

Testing

  • I have tested this change locally, using the LFRic Apps rose-stem suite
  • If any tests fail (rose-stem or CI) the reason is understood and acceptable (e.g. kgo changes) *
  • I have added tests to cover new functionality as appropriate (e.g. system tests, unit tests, etc.) *
  • Any new tests have been assigned an appropriate amount of compute resource 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)

* The new pc2_init_logic option has been switched on in the comorph_dev rose-stem app to test the new functionality. Therefore all the rose-stem tests of this configuration have changes answers.

trac.log

Test Suite Results - lfric_apps - pc2_init_logic_cflim_test/run1

Suite Information

Item Value
Suite Name pc2_init_logic_cflim_test/run1
Suite User michael.whitall
Workflow Start 2026-03-27T22:51:20
Groups Run developer', 'lfric_atm_nwp_ex1a_extra', 'lfric_atm_nwp_azspice_extra
Dependency Reference Main Like
casim MetOffice/casim@2026.03.1 True
jules MetOffice/jules@2026.03.1 True
lfric_apps MichaelWhitall/lfric_apps@pc2_init_logic_cflim False
lfric_core MetOffice/lfric_core@2026.03.1 True
moci MetOffice/moci@2026.03.1 True
SimSys_Scripts MetOffice/SimSys_Scripts@2026.03.1 True
socrates MetOffice/socrates@2026.03.1 True
socrates-spectral MetOffice/socrates-spectral@2026.03.1 True
ukca MetOffice/ukca@2026.03.1 True

Task Information

❌ failed tasks - 6
Task State
check_lfric_atm_nwp_comorph_dev-C12_ex1a_cce_fast-debug-32bit-crun1 failed
check_lfric_atm_scm_comorph_dev_bomex-BiP2x2-50000x50000_azspice_gnu_fast-debug-32bit failed
check_lfric_atm_scm_comorph_dev_bomex-BiP2x2-50000x50000_ex1a_cce_fast-debug-32bit failed
check_lfric_atm_scm_comorph_dev_toga-BiP2x2-50000x50000_azspice_gnu_fast-debug-32bit failed
check_lfric_atm_scm_comorph_dev_toga-BiP2x2-50000x50000_ex1a_cce_fast-debug-32bit failed
kgo_groups_checker failed
✅ succeeded tasks - 1242
⌛ waiting tasks - 2
Task State
housekeep_azspice waiting
housekeep_ex1a waiting

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_atm tasks for clarity. These tasks would not fail on the dev branch as the KGO files have been updated there.

Security Considerations

  • I have reviewed my changes for potential security issues
  • Sensitive data is properly handled (if applicable) NA
  • Authentication and authorisation are properly implemented (if applicable) NA

Performance Impact

  • Performance of the code has been considered and, if applicable, suitable performance measurements have been conducted

Not expecting any significant performance impact.

AI Assistance and Attribution

  • Some of the content of this change has been produced with the assistance 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)

NOTE: I initially tried to get Met Office Github Copilot to port the code-changes I had already made in a UM branch into the lfric_apps branch for this PR. Copilot's attempt at this can be seen in the first 2 commits in the branch, 87c9ffc and eed3190 (hence those commits are not verified). However, this was a failure; copilot inexplicably deleted most of the contents of one file, and then did not attempt the rest of the changes. I made the 3rd commit 7b102da which simply reverts the changes made by Copilot, and then ported the changes manually in the subsequent commits.

Documentation

  • Where appropriate I have updated documentation related to this change and confirmed that it builds correctly

Documentation pending...

PSyclone Approval

  • If you have edited any PSyclone-related code (e.g. PSyKAl-lite, Kernel interface, optimisation scripts, LFRic data structure code) then please contact the TCD Team 'NA'

Sci/Tech Review

  • I understand this area of code and the changes being added
  • The proposed changes correspond to the pull request description
  • Documentation is sufficient (do documentation papers need updating)
  • Sufficient testing has been completed

(Please alert the code reviewer via a tag when you have approved the SR)

Code Review

  • All dependencies have been resolved
  • Related Issues have been properly linked and addressed
  • CLA compliance has been confirmed
  • Code quality standards have been met
  • Tests are adequate and have passed
  • Documentation is complete and accurate
  • Security considerations have been addressed
  • Performance impact is acceptable

@MichaelWhitall MichaelWhitall added this to the Summer 2026 milestone Mar 27, 2026
@MichaelWhitall MichaelWhitall self-assigned this Mar 27, 2026
@MichaelWhitall MichaelWhitall added KGO This PR contains changes to KGO macro This PR contains a metadata upgrade macro labels Mar 27, 2026
@github-actions github-actions bot added the cla-required The CLA has not yet been signed by the author of this PR - added by GA label Mar 27, 2026
@github-actions github-actions bot added cla-signed The CLA has been signed as part of this PR - added by GA and removed cla-required The CLA has not yet been signed by the author of this PR - added by GA labels Mar 27, 2026
compulsory=true
description=Options for where to allow PC2 initiation to operate
!enumeration=true
help=(1) Original logic;
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This meta-data was copied from the UM previously. I just spotted that it still refers to the allowed integer values for this multi-option switch in the UM. The LFRic namelists now accept character strings for multi-option switches instead of the integers. So I've replaced the confusing integers with the appropriate character strings here.

@@ -437,11 +438,11 @@ subroutine pc2_bm_initiate( &

alphl=repsilon*lc/r

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have re-imported this file into lfric_apps from my equivalent UM branch and then ran the lfric code-styling script to make the code-style consistent (i.e. lower-case the UM's capitalised fortran keywords). However, clearly the lfric code-styling script has been modified since the original import of this file from the UM. The styling script formerly lower-cased fortran keywords within OMP directives (but not the other OMP keywords). But it now just leaves OMP directives alone. This means my re-import and rerunning of the styling script has re-capitalised the fortran keywords in OMP directives. But I've decided to just leave this as-is; the OMP directives are clearer if consistently all capitalised, rather than having a confusing mix of lower / upper case for different words!)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Macro approved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The CLA has been signed as part of this PR - added by GA KGO This PR contains changes to KGO macro This PR contains a metadata upgrade macro

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improved PC2 "smooth" initiation option

4 participants