Skip to content

Commit c2610e0

Browse files
authored
Add average bulk microphyiscs 1m tendency based on linearized microphysics with optional sub-stepping: donor-based linearization (sinks as D*q, vapor sources constant); add operator construction and average tendency solve. (#711)
1 parent 91a04fe commit c2610e0

File tree

7 files changed

+1282
-1
lines changed

7 files changed

+1282
-1
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "CloudMicrophysics"
22
uuid = "6a9e3e04-43cd-43ba-94b9-e8782df3c71b"
3-
version = "0.34"
3+
version = "0.35"
44
authors = ["Climate Modeling Alliance"]
55

66
[deps]

docs/make.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ Guides = [
7171
pages = Any[
7272
"Home" => "index.md",
7373
"Parameterizations" => Parameterizations,
74+
"Bulk tendencies" => "BulkTendencies.md",
7475
"Thermodynamics interface" => "Thermodynamics.md",
7576
"How to guides" => Guides,
7677
"Models" => Models,

docs/src/API.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ BulkMicrophysicsTendencies.Microphysics0Moment
133133
BulkMicrophysicsTendencies.Microphysics1Moment
134134
BulkMicrophysicsTendencies.Microphysics2Moment
135135
BulkMicrophysicsTendencies.bulk_microphysics_tendencies
136+
BulkMicrophysicsTendencies.average_bulk_microphysics_tendencies
136137
BulkMicrophysicsTendencies.bulk_microphysics_derivatives
137138
BulkMicrophysicsTendencies.bulk_microphysics_cloud_derivatives
138139
```

docs/src/BulkTendencies.md

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
# Bulk Tendencies
2+
3+
## Linearized average tendencies
4+
5+
Microphysical source terms can be stiff, especially for depletion processes such as evaporation, sublimation, and melting. To improve stability and allow larger timesteps, we introduce a **linearized implicit formulation** for computing *time-averaged bulk tendencies*.
6+
7+
The idea is to approximate the nonlinear microphysics tendencies locally as a linear system:
8+
9+
```math
10+
\frac{dq}{dt} \approx M q + e
11+
```
12+
13+
where $q = (q_{\mathrm{lcl}}, q_{\mathrm{icl}}, q_{\mathrm{rai}}, q_{\mathrm{sno}})$, and the matrix $M$ and vector $e$ are constructed from the instantaneous tendencies.
14+
15+
### Donor-based linearization
16+
17+
Each microphysical process is linearized with respect to its **donor species**:
18+
19+
- Transfer processes (e.g. accretion, conversion):
20+
```math
21+
S \;\rightarrow\; D \, q_{\text{donor}}, \quad D = \frac{S}{\max(\epsilon, q_{\text{donor}})}
22+
```
23+
24+
- Vapor → condensate sources are treated as **constant sources** (added to $e$)
25+
26+
- Condensate → vapor sinks are treated as **linear sinks**:
27+
```math
28+
S \;\rightarrow\; -D q
29+
```
30+
31+
With this formulation, sink terms take the form:
32+
33+
```math
34+
\frac{dq}{dt} = -D q
35+
```
36+
37+
which corresponds to **exponential decay over the timestep**, providing strong numerical stability.
38+
39+
---
40+
41+
## Linearized implicit solve
42+
43+
For a timestep $\Delta t$, we solve the linearized system implicitly:
44+
45+
```math
46+
\frac{q^\star - q^0}{\Delta t} = M q^\star + e
47+
```
48+
49+
which gives:
50+
51+
```math
52+
\left(I/\Delta t - M\right) q^\star = e + q^0/\Delta t
53+
```
54+
55+
The average tendency is then:
56+
57+
```math
58+
\overline{T} = \frac{q^\star - q^0}{\Delta t}
59+
```
60+
61+
---
62+
63+
## Sparse 4×4 structure
64+
65+
The system has a fixed sparse structure:
66+
67+
```math
68+
\begin{bmatrix}
69+
a_{11} & 0 & 0 & 0 \\
70+
0 & a_{22} & 0 & 0 \\
71+
a_{31} & 0 & a_{33} & a_{34} \\
72+
a_{41} & a_{42} & a_{43} & a_{44}
73+
\end{bmatrix}
74+
```
75+
76+
This allows an efficient solve:
77+
78+
- $q_{\mathrm{lcl}}$ and $q_{\mathrm{icl}}$ are solved independently (scalar solves)
79+
- $q_{\mathrm{rai}}$ and $q_{\mathrm{sno}}$ are solved as a **2×2 system**
80+
81+
This avoids forming or inverting a full dense matrix and is efficient on both CPU and GPU.
82+
83+
---
84+
85+
## Substepping
86+
87+
A single linearization assumes the operator $M$ is constant over the timestep. To better capture nonlinear effects and regime changes (e.g. near freezing), we apply **substepping**:
88+
89+
- Split the timestep into `nsub` substeps
90+
- At each substep:
91+
- rebuild $M$ and $e$ from the updated state
92+
- solve the linearized system
93+
- update $q$ and temperature
94+
95+
As `nsub` increases, the solution approaches the nonlinear evolution of the system.
96+
97+
---
98+
99+
## Thermodynamic assumption
100+
101+
Within each timestep, we assume that **thermodynamic variables such as density and energy remain approximately constant**. As a result, temperature changes are modeled solely through latent heating:
102+
103+
```math
104+
\frac{dT}{dt}
105+
=
106+
\frac{L_v}{c_p} \left(\dot{q}_{\mathrm{lcl}} + \dot{q}_{\mathrm{rai}}\right)
107+
+
108+
\frac{L_s}{c_p} \left(\dot{q}_{\mathrm{icl}} + \dot{q}_{\mathrm{sno}}\right)
109+
```
110+
111+
This is consistent with the microphysics-only update and avoids coupling to a full thermodynamic solve.
112+
113+
---
114+
115+
## Example figures
116+
117+
```@example
118+
include("plots/BulkTendencies_plots.jl")
119+
```
120+
121+
![](bulk_microphysics_linearized_convergence.svg)
122+
123+
The figure compares:
124+
125+
- a **nonlinear reference solution**, obtained using a finely substepped explicit integration
126+
- the **linearized implicit method** with different numbers of substeps (`nsub`)
127+
- a **single explicit update** using the instantaneous tendency at $t=0$
128+
- **explicit updates**, using the instantaneous tendency with $10$ substeps
129+
130+
### Initial conditions
131+
132+
- $\rho = 1\,\mathrm{kg/m^3}$
133+
- $q_{\mathrm{tot}} = 13\,\mathrm{g/kg}$
134+
- $q_{\mathrm{lcl}} = q_{\mathrm{rai}} = 1\,\mathrm{g/kg}$
135+
- $q_{\mathrm{icl}} = q_{\mathrm{sno}} = 0.5\,\mathrm{g/kg}$
136+
- $T = 278\,\mathrm{K}$
137+
138+
These conditions activate multiple processes simultaneously (liquid, ice, rain, and snow interactions) and are close to freezing, making the case strongly nonlinear.
139+
140+
### Interpretation
141+
142+
- `nsub = 1` corresponds to a **single linearization over the full step**, which is the least accurate but cheapest approximation.
143+
- Increasing `nsub` improves the solution by updating the linearization more frequently.
144+
- For sufficiently large `nsub`, the solution approaches the nonlinear reference trajectory. Even `nsub = 2` agrees well with the nonlinear solution.
145+
- The dashed line (instantaneous tendency) shows a simple explicit Euler step, which can significantly deviate from the true evolution.
146+
- The yellow dash-dotted line shows an integration using instantaneous tendencies with 10 substeps and exhibits significant instabilities. Thus, without the linearized model, even 10 substeps do not converge.
147+
148+
This demonstrates that the linearized implicit substepping method provides a controllable trade-off between **cost and accuracy**, while maintaining stability.
149+
150+
---
151+
152+
## Current limitations
153+
154+
- Average (implicit) bulk tendencies are currently implemented **only for the one-moment microphysics scheme**.
155+
- For other microphysics schemes, only **instantaneous bulk tendencies** are available at present.

0 commit comments

Comments
 (0)