Skip to content

Casim ARG activation - #709

Open
iboutle wants to merge 17 commits into
MetOffice:mainfrom
iboutle:casim_arg_activation
Open

Casim ARG activation#709
iboutle wants to merge 17 commits into
MetOffice:mainfrom
iboutle:casim_arg_activation

Conversation

@iboutle

@iboutle iboutle commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

PR Summary

Sci/Tech Reviewer: paulfield2024
Code Reviewer: Erica Neininger (@ericaneininger)

Implements activation of UCKA aerosol into Casim prognostic drop numbers. This is the one-way coupling only, there is no processing of the aerosol inside Casim (yet). The 2 routines in physics_schemes/source/large_scale_precipitation/CASIM are direct imports from the UM code (i.e. only code styling and a minor bugfix has been made)

Linked to MetOffice/casim#19

Valnote: Autoassess

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

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)

trac.log

Test Suite Results - lfric_apps - casim_arg_activation/run1

Suite Information

Item Value
Suite Name casim_arg_activation/run1
Suite User ian.boutle
Workflow Start 2026-08-13T13:46:58
Groups Run developer', 'lfric_atm_extra
Dependency Reference Main Like
casim iboutle/casim@activation_fix True
jules MetOffice/jules@2026.07.1 True
lfric_apps iboutle/lfric_apps@casim_arg_activation False
lfric_core MetOffice/lfric_core@2026.07.1 True
moci MetOffice/moci@2026.07.1 True
SimSys_Scripts MetOffice/SimSys_Scripts@2026.07.1 True
socrates MetOffice/socrates@2026.07.1 True
socrates-spectral MetOffice/socrates-spectral@2026.07.1 True
ukca MetOffice/ukca@2026.07.1 True

✅ succeeded tasks - 1376

Security Considerations

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

Performance Impact

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

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)

Documentation

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

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

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

Ubuntu and others added 7 commits August 6, 2026 09:57
Bring the UM routines needed for CASIM mechanistic (ARG) activation on
one-way UKCA aerosol input into the lfric_apps CASIM directory:

  aerosol_extract_convert_mod.F90
    aerosol_extract_convert     - UKCA tracers to CASIM modal mass,
                                  number and Bk for the main CASIM call
  casim_activation_in_um_mod.F90
    examine_ukca_aerosol_column - UKCA tracers to the CASIM internal
                                  aerosol arrays
    activate_column_ukca        - activation of cloud made by physics
                                  outside CASIM

Both files are copied from src/atmosphere/large_scale_precipitation/CASIM
in the UM unaltered apart from the lfric_apps code styling (lower case
Fortran keywords and intrinsics). Only the routines needed for
casim_iopt_act = 3 with casim_aerosol_couple_choice = ukca_aerosol_in
have been taken; the murk, tracer and two-way UKCA variants are left
behind, and the public list of casim_activation_in_um_mod is trimmed to
match.

The UM routines are dimensioned over tdims. lfric_apps runs the UM
physics with row_length = rows = 1 inside column kernels, so tdims
covers a single column and the routines can be used unchanged.

Some of the content of this change has been produced with the assistance of Anthropic Claude Opus 5 (Claude Code).
The copied UM CASIM routines declare their UKCA tracer arguments with
the UM module variable tr_ukca and index them with nmr_index_um and
mmr_index_um, so both have to be available in lfric_apps.

Add tr_ukca to nlsizes_namelist_mod and set it in set_ukca_field_lists,
alongside the call that asks UKCA for its tracer list.

nmr_index_um and mmr_index_um were only set up when plume scavenging was
active, which ties them to the choice of convection scheme. They are now
set up whenever UKCA is initialised.

Some of the content of this change has been produced with the assistance of Anthropic Claude Opus 5 (Claude Code).
Introduce namelist:microphysics=casim_activation with values 'fixed' (the
existing behaviour, casim_iopt_act = fixed_number) and 'arg' (mechanistic
activation following Abdul-Razzak and Ghan, casim_iopt_act = 3).

The 'arg' option requires the UKCA GLOMAP modal aerosol, so it errors if
glomap_mode is anything other than glomap_mode_ukca.

casim_set_dependent_switches only selects soluble_insoluble_modes when the
ice nucleation scheme asks for the insoluble modes, and LFRic fixes
casim_iopt_inuc at 1. Since LFRic supplies the full set of soluble and
insoluble GLOMAP modes, casim_aerosol_option is overridden after the call.
This is safe because the value is not passed to CASIM until the later call
to set_mphys_switches.

casim_cdnc_opt is now triggered by casim_activation == 'fixed', as it has no
meaning when the droplet number is derived mechanistically from the aerosol.

Some of the content of this change has been produced with the assistance of
Anthropic Claude Opus 5 (Claude Code).
The CASIM Abdul-Razzak and Ghan activation needs the soluble and
insoluble aerosol modes, which were previously hardwired to zero in the
CASIM kernel. Add a helper which gathers the LFRic GLOMAP prognostics
into a UKCA tracer array column, and use the UM aerosol_extract_convert
to fill the CASIM aerosol arrays from it.

Some of the content of this change has been produced with the assistance
of Anthropic Claude Opus 5 (Claude Code).
Liquid cloud can be created or removed by physics outside CASIM. With
the Abdul-Razzak and Ghan activation, the droplet number for any newly
created cloud is worked out from the GLOMAP modal aerosol using the UM
activate_column_ukca, and removed again where the cloud has gone. Keep
copies of the liquid cloud from before the fast physics so that the
change can be diagnosed, and take the in-cloud number for radiation from
CASIM whenever the activation is mechanistic.

Note that the activation holds the column aerosol in module level
storage, so the activation algorithm is not thread safe.

Some of the content of this change has been produced with the assistance
of Anthropic Claude Opus 5 (Claude Code).
@github-actions github-actions Bot added the cla-modified The CLA has been modified as part of this PR - added by GA label Aug 12, 2026
@iboutle iboutle added this to the Autumn 2026 milestone Aug 12, 2026
Ubuntu and others added 4 commits August 12, 2026 11:46
The GLOMAP mode number and component mass indices set up by
ukca_set_conv_indices were previously built only for plume scavenging, and
were made unconditional so that the CASIM aerosol interface could use them
too. Running the setup in every UKCA configuration is wider than needed and
exposes configurations that never called it to the ereport in
ukca_set_conv_indices for an unrecognised component suffix.

Gate it instead on the circumstances that actually need it: plume scavenging
as before, or CASIM running with Abdul-Razzak and Ghan activation. The
switches are taken from the microphysics namelist rather than the derived
casim_iopt_act, which is only assigned inside the CASIM branch of
um_physics_init.

The copy in aerosol_ukca_dust_only_init reverts to the original plume
scavenging test, as Abdul-Razzak and Ghan activation requires the full
GLOMAP aerosol and so never reaches the dust-only path.

Some of the content of this change has been produced with the assistance of Anthropic Claude Opus 5 (Claude Code).
@iboutle iboutle added the Linked Casim This PR is linked to a MetOffice/casim PR label Aug 13, 2026
@iboutle iboutle mentioned this pull request Aug 13, 2026
25 tasks
@github-actions

Copy link
Copy Markdown

⚠️ Hello iboutle!

Your CLA signature was found on the base branch, but you appear to have modified the CONTRIBUTORS.md file in this PR.

Please do not edit the CONTRIBUTORS.md file. If you have already signed the CLA, revert changes to the file and your signature will be picked up.

@iboutle iboutle added KGO This PR contains changes to KGO macro This PR contains a metadata upgrade macro labels Aug 14, 2026
@iboutle
iboutle marked this pull request as ready for review August 14, 2026 12:22
@iboutle
iboutle requested review from a team and thomasmelvin as code owners August 14, 2026 12:22
@iboutle
iboutle requested review from Ricky Wong (mo-rickywong) and removed request for a team August 14, 2026 12:22
@iboutle iboutle added the Linked UM This PR is linked to a MetOffice/um PR label Aug 14, 2026

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 / rose-stem changes looks good

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

Labels

cla-modified The CLA has been modified as part of this PR - added by GA KGO This PR contains changes to KGO Linked Casim This PR is linked to a MetOffice/casim PR Linked UM This PR is linked to a MetOffice/um PR macro This PR contains a metadata upgrade macro

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants