-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Labels
Description
There is significant architectural debt in the microphysics integration. This issue tracks remaining cleanup work, roughly ordered by priority.
- Remove
call_cloud_diagnostics_per_stage option: Treat as always true. The per-stage path is the only physically correct one; carrying two code paths adds complexity for no benefit. (The computational expense reasons are no longer a concern.) - We are supporting the following models:
- equilibrium + 0M
- non-equilibrium + 1M
- non-equilibrium + 2M + P3
We should remove the separate moisture_model and microphysics_model choices, since they are never separate.
- Consolidate microphysics cache into a single file: Currently, microphysics tendencies and terminal velocities are computed in three separate files:
precipitation_precomputed_quantities.jl(grid-mean / quadrature path)diagnostic_edmf_precomputed_quantities.jl(diagnostic EDMF environment)prognostic_edmf_precomputed_quantities.jl(prognostic EDMF environment)
Move all microphysics cache computations (tendencies + terminal velocities) into a singlemicrophysics_cache.jl, dispatching on turbconv model type. This eliminates cross-file duplication and makes the microphysics boundary explicit.
- Remove duplicate cache allocations for tendency results:
ᶜmp_tendency(a NamedTuple field) and the individual tendency fields (ᶜSqₗᵐ,ᶜSqᵢᵐ,ᶜSqᵣᵐ, ᶜSqₛᵐetc.) store the same data. Useᶜmp_tendencydirectly downstream and remove individual fields. - Remove wrapping of parameter structs such as
(cmc,),cmc.activation,)to make them tuples; this won't be necessary with CloudMicrophysics.jl v0.15.5, which makes all those structs broadcastable - Rename tendency fields for readability: Replace subscript/superscript Unicode names with readable ASCII:
| Current | Proposed |
|---------|----------|
|ᶜSqₗᵐ|ᶜdqlcl_dt|
|ᶜSqᵢᵐ|ᶜdqicl_dt|
|ᶜSqᵣᵐ|ᶜdqrai_dt|
|ᶜSqₛᵐ|ᶜdqsno_dt| - Harmonize variable names: We use
ᶜq_tot_safefor clippedq_tot, butq_liq_rai,q_ice_snoare also clipped. - Make microphysics tendencies implicit: Add an approximate Jacobian with only diagonal elements for the condensate species (targeting the fastest timescales, e.g., condensation/evaporation). This would improve stability. (Use
implicit_microphysicstoggle to enable option.) - Remove remaining two uses of
PhaseEquilin utility functions and tests, so Thermodynamics API use is entirely functional. - Evaluate terminal velocities lazily: Terminal velocities (
ᶜwₗ,ᶜwᵢ,ᶜwᵣ,ᶜwₛ) are pointwise functions of local state. Move them out of the cache and evaluate lazily to reduce memory footprint and cache pressure. - Move toward a functional microphysics API: Reduce reliance on mutating cache writes and
if/type-based dispatch in favor of:- Pure functions that return results (like
apply_1m_tendency_limits) - Method dispatch on microphysics scheme types
- Composable helpers over monolithic
set_*!functions
This reduces code duplication across EDMF variants and simplifies testing.
- Pure functions that return results (like
- Extend SGS quadrature to 2-moment microphysics: Currently,
microphysics_tendencies_quadrature_2monly supportsGridMeanSGS. Full bivariate quadrature integration (as implemented for 1M) should be extended to 2M schemes.
Reactions are currently unavailable