P3 microphysics#4566
Draft
haakon-e wants to merge 5 commits into
Draft
Conversation
…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.
035f2aa to
cfc96b2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
To-do
Content