Skip to content

P3 microphysics#4566

Draft
haakon-e wants to merge 5 commits into
mainfrom
he/2m-p3-numerics
Draft

P3 microphysics#4566
haakon-e wants to merge 5 commits into
mainfrom
he/2m-p3-numerics

Conversation

@haakon-e

@haakon-e haakon-e commented Jun 9, 2026

Copy link
Copy Markdown
Member

Purpose

To-do

Content


  • I have read and checked the items on the review checklist.

@haakon-e haakon-e mentioned this pull request Jun 9, 2026
1 task
agent and others added 5 commits June 9, 2026 16:34
…ics2M

Collapse the separate 2M (warm rain + cloud ice) and 2MP3 (grid-mean only)
schemes into one NonEquilibriumMicrophysics2M that always runs P3 ice, so there
is a single 2-moment config path (the 2MP3 type is removed throughout). The P3
ice prognostics are carried in precip_variables and sedimented implicitly; the
P3 state is built via the regularised state_from_prognostic so the unified
grid-mean path is finite at init. Builds against CloudMicrophysics 0.37.
Extend the unified 2M+P3 microphysics to the prognostic EDMF updraft
subdomains and environment, mirroring the validated grid-mean path
(single updraft only; DiagnosticEDMFX 2M+P3 stays unimplemented).

- prognostic_variables.jl: carry n_ice/q_rim/b_rim on each subdomain.
- precomputed_quantities.jl: per-subdomain ᶜwnᵢʲs/ᶜlogλʲs and env
  ᶜwnᵢ⁰/ᶜwᵢ⁰/ᶜlogλ⁰ scratch.
- microphysics_cache.jl:
  - velocity method: build each subdomain's/env's P3 state via the
    regularized state_from_prognostic, compute per-subdomain logλ and
    mass/number-weighted ice velocities; the grid-mean ᶜwᵢ/ᶜwnᵢ are the
    ρa-weighted averages of env + subdomain velocities (number-weighting
    in a second pass to reuse the ᶜρχ accumulator).
  - tendency cache: replace the warm-rain-only updraft/env calls with the
    full 14-arg BMT P3 call + _to_mp23_tendency projection + inline
    coupled-sink limiting (preserves dn_ice_dt); env aerosol activation
    now uses q_icl only (matching grid mean).
- tendency.jl: EDMF tendency apply advances grid-mean and per-subdomain
  ρn_ice/ρq_rim/ρb_rim.
- advection.jl: horizontal advection + vertical sedimentation of the new
  subdomain P3 fields (n_ice rides the number-weighted ice velocity;
  q_rim/b_rim ride the mass-weighted ice velocity).
- hyperdiffusion.jl, edmfx_sgs_flux.jl, edmfx_entr_detr.jl,
  manual_sparse_jacobian.jl: register n_ice/q_rim/b_rim in the
  hyperdiffusion buffers, SGS mass/diffusive flux coupling, entrainment/
  detrainment, and the implicit Jacobian sedimentation/diffusion blocks.

Validated: get_simulation + precompute on a prognostic-EDMFX Rico 2M
column runs without error; env and subdomain BMT tendencies are finite.
(Rico is warm, so the ice path runs guarded with ~zero ice; the ice EDMF
validation is TRMM, after the Phase D numerics.) Full time-stepping
stability needs the substep/non-negativity numerics (next branch).
Stabilize the explicit 2M+P3 path. The bulk BMT tendency for this scheme is
correct but stiff (large condensation/deposition rates), so a single explicit
step overshoots; these are the numerics that tame it.

- tendency_limiters.jl:
  - apply_2m_satadj_limit: cap the net condensation/deposition tendencies so a
    step cannot overshoot liquid/ice saturation (sign-preserving, Explicit-only).
  - bulk_2m_tendencies_substepped: forward-Euler the 8-field tendency over
    n_substeps of dt/n_substeps with the satadj cap and coupled-sink limiter at
    each substep (logλ fixed, q_tot conserved, local T evolves via latent
    heating); returns the dt-averaged tendency. Reduces to the single-shot
    limited tendency at n_substeps == 1.
  - _explicit_2m_tendency_limits now carries dn_ice_dt (8-field MP23_NT-safe).

- microphysics_cache.jl: the grid-mean tendency cache calls
  bulk_2m_tendencies_substepped (consuming NonEquilibriumMicrophysics2M.
  n_substeps). Both 2M tendency-cache methods are split into a guarded wrapper
  (`set_microphysics_tendency_cache!`) and an unguarded `_fill_*` worker so the
  optional substep callback can fill the cache once per step (skipping the
  per-stage fill) for a constant explicit forcing across IMEX stages.

- types.jl / model_getters.jl / default_config.yml: add the
  `microphysics_substep_callback` option (default false).
- get_callbacks.jl: register `microphysics_substep_callback!` (calls the
  `_fill_*` workers) when the option is on for a 2M model.

OU-SIF / inpc_log_shift are dropped. The grid-mean 2M+P3 column is now stable
(no overshoot blowup over the validated window); the TRMM_LBA 2M+P3 column
validation case is provided as a self-contained runscript (later in this stack).
Non-negativity of the precip fields is handled by the coupled-sink limiter in
the substep loop plus the configured tracer nonnegativity limiter (no
unconditional state-clipping).
The unified 2M+P3 path uses CM's BulkMicrophysicsTendencies 2M+P3 entry and
state_from_prognostic, which land in CloudMicrophysics 0.37.
Self-contained programmatic runscript (no yaml, no ENV) that builds the
prognostic-EDMF 2M+P3 TRMM_LBA column and asserts it runs to t_end with finite
state; wired as a fast Buildkite smoke gate. The earlier example yaml is dropped
in favour of this self-contained runscript.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants