Skip to content

Commit f3aca88

Browse files
committed
feat(edmfx): add horizontal diffusion of prognostic EDMFX updrafts
Diffuse the prognostic updraft variables horizontally, mirroring `edmfx_vertical_diffusion` with the mixing length limited by the horizontal node spacing: moist static energy and total specific humidity at `K_h`, and the updraft SGS tracers at `α_vert_diff_tracer · K_h`, all weighted by the updraft density. The updraft dry-air mass is unchanged by the water flux, so `ρa` receives the counterpart tendency `ρa/(1 - q_tot)` times the `q_tot` tendency, mirroring the hyperdiffusion treatment. Always explicit; enabled by the opt-in `edmfx_horizontal_diffusion` config option (default false). Extend the tests: horizontally uniform updraft fields produce no tendency, perturbed fields produce one with the stated `ρa`/`q_tot` pairing, and the single-column tendency is identically zero.
1 parent af87d86 commit f3aca88

9 files changed

Lines changed: 168 additions & 42 deletions

File tree

NEWS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ ClimaAtmos.jl Release Notes
33

44
main
55
----
6-
- [#4657](https://github.com/CliMA/ClimaAtmos.jl/pull/4657) ![][badge-✨feature/enhancement] Add a horizontal component to the EDMFX SGS diffusive flux, enabled by the opt-in `edmfx_sgs_horizontal_diffusive_flux` config option (default `false`), for high-resolution box configurations: scalar and TKE fluxes, the momentum stress `τ = -2 K_u S` with the full strain rate, the corresponding TKE shear production from horizontal gradients, and diagnostics `lmixh`, `edth`, and `evuh`.
6+
- [#4657](https://github.com/CliMA/ClimaAtmos.jl/pull/4657) ![][badge-✨feature/enhancement] Add a horizontal component to the EDMFX SGS diffusive flux, enabled by the opt-in `edmfx_sgs_horizontal_diffusive_flux` config option (default `false`), for high-resolution box configurations: scalar and TKE fluxes, the momentum stress `τ = -2 K_u S` with the full strain rate, the corresponding TKE shear production from horizontal gradients, and diagnostics `lmixh`, `edth`, and `evuh`. Horizontal diffusion of the prognostic EDMFX updrafts (moist static energy, total specific humidity with its area-weighted density counterpart, and SGS tracers) is available behind the separate opt-in `edmfx_horizontal_diffusion` config option (default `false`).
77
- [#4699](https://github.com/CliMA/ClimaAtmos.jl/pull/4699) ![][badge-🔥behavioralΔ] Select the tracers that receive the `α_vert_diff_tracer` eddy-diffusivity scaling in the boundary-layer vertical diffusion from the shared `gs_sedimenting_tracer_candidates` list instead of a hardcoded tuple of species. The tracer diffusivity scaling is now consistent across the boundary-layer diffusion, the EDMFX SGS flux, the EDMFX updraft vertical diffusion, and the implicit Jacobian.
88

99
0.42.0

config/default_configs/default_config.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,9 @@ edmfx_nh_pressure:
434434
edmfx_vertical_diffusion:
435435
help: "If set to true, it switches on vertical diffusion of prognostic EDMFX updrafts. [`true`, `false` (default)]"
436436
value: false
437+
edmfx_horizontal_diffusion:
438+
help: "If set to true, it switches on horizontal diffusion of prognostic EDMFX updrafts, with the mixing length limited by the horizontal node spacing. Intended for high-resolution box runs. [`true`, `false` (default)]"
439+
value: false
437440
edmfx_entr_model:
438441
help: "EDMFX entrainment closure. [`nothing` (default), `PiGroups`, `Generalized`]"
439442
value: ~
Lines changed: 53 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,94 +1,111 @@
11
# Horizontal EDMF diffusion
22

3-
The EDMFX environment sub-grid scale (SGS) diffusive flux is, by default, vertical only: it parameterizes turbulent transport along the column with an eddy-diffusivity closure and applies the resulting tendency to the grid mean. The horizontal component adds the analogous horizontal down-gradient flux. It is enabled with the configuration option `edmfx_sgs_horizontal_diffusive_flux` (default `false`).
3+
The EDMFX sub-grid scale (SGS) diffusive closure is, by default, vertical only: it parameterizes turbulent transport along the column with an eddy-diffusivity closure and applies the resulting tendency to the grid mean (and, under `edmfx_vertical_diffusion`, to the prognostic updrafts). Two opt-in configuration options add the analogous horizontal down-gradient terms, both defaulting to `false`:
44

5-
## Formulation
5+
- `edmfx_sgs_horizontal_diffusive_flux` adds the horizontal component of the grid-mean environment SGS diffusive flux;
6+
- `edmfx_horizontal_diffusion` adds horizontal diffusion of the prognostic EDMFX updraft variables.
67

7-
The horizontal flux uses the same TKE-based eddy diffusivity as the vertical flux,
8+
Both terms are always explicit: they are applied in the explicit remainder tendency, independently of `diff_mode`, and never enter the implicit column solve. Each requires a horizontal discretization, so both return immediately on single columns.
9+
10+
## Horizontal eddy diffusivity
11+
12+
The horizontal eddy viscosity and diffusivity use the same TKE-based closure as the vertical flux,
813

914
```math
10-
K = c_m \, l \, \sqrt{e} \,/\, \mathrm{Pr}_t ,
15+
K_u = c_m \, l \, \sqrt{e}, \qquad K_h = K_u \,/\, \mathrm{Pr}_t ,
1116
```
1217

13-
where ``l`` is the environment mixing length, ``e`` is the environment turbulent kinetic energy (TKE), ``c_m`` is the eddy-diffusivity coefficient, and ``\mathrm{Pr}_t`` the turbulent Prandtl number. The grid-mean tendencies are, on cell centers,
18+
where ``l`` is the horizontal mixing length (see [Mixing length](@ref)), ``e`` is the environment turbulent kinetic energy (TKE), ``c_m`` is the eddy-diffusivity coefficient, and ``\mathrm{Pr}_t`` the turbulent Prandtl number. `set_horizontal_diffusivities!` evaluates ``K_u`` and ``K_h`` at cell centers on each update of the explicit precomputed cache, storing them in `ᶜK_u_h` and `ᶜK_h_h`. Both horizontal tendencies and the diagnostics read these cached fields.
19+
20+
Unlike the vertical face pipeline (`set_face_diffusivities!`), the horizontal diffusivities do not include the interfacial entrainment diffusivity ``K_e``: that term parameterizes vertical entrainment across an unresolved inversion face (``K_e = \gamma \, w_e \, \Delta z``) and has no horizontal analogue. Its exclusion here mirrors its exclusion from the updraft-internal vertical diffusion.
21+
22+
## Grid-mean flux
23+
24+
The grid-mean tendencies from `edmfx_sgs_horizontal_diffusive_flux` are, on cell centers,
1425

1526
```math
1627
\partial_t (\rho e_\text{tot}) \mathrel{+}= \nabla_h \cdot \left[ \rho \, K_h \left( \nabla_h s_\text{d} + \sum_{\mu} (h_\mu + \Phi) \, \nabla_h q_\mu \right) \right],
1728
```
1829

1930
```math
20-
\partial_t (\rho \chi) \mathrel{+}= \nabla_h \cdot (\rho \, K_h \, \nabla_h \chi),
31+
\partial_t (\rho q_\text{tot}) \mathrel{+}= \nabla_h \cdot (\rho \, K_h \, \nabla_h q_\text{tot}),
2132
\qquad
22-
\partial_t (\rho e) \mathrel{+}= \nabla_h \cdot (\rho \, K_u \, \nabla_h e),
33+
\partial_t (\rho \chi) \mathrel{+}= \nabla_h \cdot (\rho \, \alpha_\chi \, K_h \, \nabla_h \chi),
2334
```
2435

25-
where ``\nabla_h`` and ``\nabla_h\cdot`` are the horizontal gradient and weak divergence, ``s_\text{d}`` is the dry static energy, ``h_\mu`` and ``q_\mu`` are the specific enthalpy and specific humidity of the water species ``\mu \in \{\text{vap}, \text{liq}, \text{ice}\}``, ``\Phi`` is the geopotential, ``K_u`` is the eddy viscosity and ``K_h = K_u/\mathrm{Pr}_t``. The total enthalpy uses the dry-static-energy + water-enthalpy decomposition of the vertical flux, which avoids the spurious enthalpy flux that diffusing ``h_\text{tot}`` directly would carry with the dry-air mass. The tracer ``\chi`` ranges over the total specific humidity and the environment SGS tracers — the microphysics species (cloud, precipitation, and, for two-moment schemes, number concentrations) and any passive tracers — i.e. the same set the vertical flux diffuses. Sedimenting microphysics species are scaled by the tracer diffusion factor ``\alpha`` (`α_vert_diff_tracer`); other tracers use the unscaled ``K_h``, matching the vertical flux. The total-specific-humidity flux additionally enters the air-mass tendency ``\partial_t \rho``; condensate and precipitation fluxes do not.
36+
where ``\nabla_h`` and ``\nabla_h\cdot`` are the horizontal gradient and weak divergence, ``s_\text{d}`` is the dry static energy, ``h_\mu`` and ``q_\mu`` are the specific enthalpy and specific humidity of the water species ``\mu \in \{\text{vap}, \text{liq}, \text{ice}\}``, and ``\Phi`` is the geopotential. The total enthalpy uses the dry-static-energy + water-enthalpy decomposition of the vertical flux, which avoids the spurious enthalpy flux that diffusing ``h_\text{tot}`` directly would carry with the dry-air mass. The four constituents (dry static energy, vapor, liquid, ice) are assembled in separate broadcasts; a regression test asserts that the ``\rho e_\text{tot}`` tendency equals their sum.
2637

27-
The momentum tendency is the horizontal weak divergence of the subgrid-scale stress ``\tau = -2 K_u \mathcal{S}``, with ``\mathcal{S}`` the full three-dimensional strain rate of the grid-mean velocity,
38+
The tracer ``\chi`` ranges over the grid-mean SGS tracers — microphysics species (cloud, precipitation, and, for two-moment schemes, number concentrations) and any passive tracers. Sedimenting microphysics species carry the tracer diffusion factor ``\alpha_\chi = \alpha`` (`α_vert_diff_tracer`); all other tracers use the unscaled ``K_h`` (``\alpha_\chi = 1``), matching the vertical flux. The total-specific-humidity flux additionally enters the moist-air-mass tendency,
2839

2940
```math
30-
\partial_t u_h \mathrel{-}= \frac{1}{\rho} \nabla_h \cdot (\rho \, \tau),
31-
\qquad
32-
\partial_t u_3 \mathrel{-}= \frac{1}{\rho} \nabla_h \cdot (\rho \, \tau),
41+
\partial_t \rho \mathrel{+}= \nabla_h \cdot (\rho \, K_h \, \nabla_h q_\text{tot}),
3342
```
3443

35-
evaluated on cell centers for the horizontal wind and on cell faces for the vertical wind, mirroring the Smagorinsky-Lilly stress split by divergence direction; the vertical stress divergence is handled by the vertical diffusion pathway.
44+
while the condensate and precipitation fluxes do not.
3645

37-
The corresponding shear production of TKE uses the strain rate built from horizontal gradients only, ``\mathcal{S}_h``,
46+
When prognostic TKE is active, the horizontal flux transports TKE and adds the horizontal shear production,
3847

3948
```math
40-
\partial_t (\rho e) \mathrel{+}= 2 \rho \, K_u \, \mathcal{S}_h : \mathcal{S}_h ,
49+
\partial_t (\rho e) \mathrel{+}= \nabla_h \cdot (\rho \, K_u \, \nabla_h e) + 2 \rho \, K_u \, \mathcal{S}_h : \mathcal{S}_h ,
4150
```
4251

43-
which is positive definite; the production from vertical gradients and its stencil are unchanged. This mirrors the decoupled Smagorinsky-Lilly split, in which each directional norm is built from that direction's gradients.
52+
with ``\mathcal{S}_h`` the strain rate built from horizontal gradients only. The shear production is positive definite; the production from vertical gradients and its stencil are applied by the vertical TKE tendency.
53+
54+
The momentum tendency is the horizontal weak divergence of the SGS stress ``\tau = -2 K_u \mathcal{S}``, with ``\mathcal{S}`` the full three-dimensional strain rate of the grid-mean velocity,
4455

45-
The horizontal flux mirrors the vertical EDMFX diffusive flux: the same variables, the same tracer set, and the same scaling, with horizontal rather than vertical operators.
56+
```math
57+
\partial_t u_h \mathrel{-}= \frac{1}{\rho} \nabla_h \cdot (\rho \, \tau),
58+
\qquad
59+
\partial_t u_3 \mathrel{-}= \frac{1}{\rho} \nabla_h \cdot (\rho \, \tau),
60+
```
4661

47-
## Anisotropic length scale
62+
evaluated on cell centers for the horizontal wind and on cell faces for the vertical wind. The vertical divergence of the stress is handled by the vertical diffusion pathway.
4863

49-
The eddy diffusivity depends on direction only through the mixing length ``l``: the TKE ``e`` is isotropic. In the Lopez-Gomez et al. (2020) closure the mixing length is the smooth minimum of physical scales (wall distance, TKE production–dissipation balance, static stability), limited from above by a grid scale,
64+
## Updraft horizontal diffusion
65+
66+
The option `edmfx_horizontal_diffusion` switches on horizontal diffusion of the prognostic updraft variables, mirroring the vertical updraft diffusion of `edmfx_vertical_diffusion` with the horizontal mixing length. For each updraft ``j``,
5067

5168
```math
52-
l = \min(l_\text{phys}, \, \Delta).
69+
\partial_t \chi^j \mathrel{+}= \frac{1}{\rho^j} \nabla_h \cdot (\rho^j \, \alpha_\chi \, K_h \, \nabla_h \chi^j),
5370
```
5471

55-
Unlike the Smagorinsky-Lilly closure, whose length scale is purely geometric (``l = c_s \Delta``), the EDMF length is physically based; only its grid-scale limiter is geometric. The vertical and horizontal fluxes therefore share the same physical length but use different limiters — the cell thickness ``\Delta z`` for the vertical flux and the horizontal node spacing ``\Delta x`` for the horizontal flux:
72+
for the moist static energy, the total specific humidity, and the updraft SGS tracers (with ``\alpha_\chi = \alpha`` for sedimenting species and ``1`` otherwise). The updraft dry-air mass is unchanged by the water flux, so the area-weighted density ``\rho a^j`` receives the counterpart tendency ``\rho a^j / (1 - q_\text{tot}^j)`` times the ``q_\text{tot}^j`` tendency, mirroring the hyperdiffusion treatment.
73+
74+
## Mixing length
75+
76+
The eddy diffusivity depends on direction only through the mixing length ``l``: the TKE ``e`` is isotropic. The horizontal mixing length is the full physical mixing length ``l_\text{phys}`` of the Lopez-Gomez et al. (2020) closure — the smooth minimum of the wall, TKE-balance, and static-stability (from ``N^2_\text{eff}``) scales, unchanged from the vertical closure — limited from above by a grid scale. It differs from the vertical (master) mixing length only in that grid limiter: the horizontal length uses the spectral-element node scale ``\Delta x_h`` (`horizontal_filter_scale`), whereas the vertical pipeline uses the resolvability filter scale ``\Delta_f = \max(\Delta x_h, \Delta z)`` (`resolvability_filter_scale`),
5677

5778
```math
58-
l_v = \min(l_\text{phys}, \, \Delta z),
79+
l_h = \min(l_\text{phys}, \, \Delta x_h),
5980
\qquad
60-
l_h = \min(l_\text{phys}, \, \Delta x).
81+
l = \min(l_\text{phys}, \, \Delta_f).
6182
```
6283

63-
This mirrors the Smagorinsky-Lilly horizontal/vertical split, in which the two length scales are ``c_s \Delta x`` and ``c_s \Delta z``. Two limits follow:
64-
65-
- where ``l_\text{phys} < \min(\Delta x, \Delta z)`` (for example small near-surface
66-
eddies), ``l_h = l_v = l_\text{phys}`` and the diffusivity is isotropic;
67-
- where ``l_\text{phys} > \max(\Delta x, \Delta z)``, the ratio ``l_h / l_v = \Delta x / \Delta z`` recovers the Smagorinsky grid anisotropy.
84+
Wherever ``\Delta x_h \ge \Delta z`` — single columns and GCM resolutions — the two limiters coincide (``\Delta_f = \Delta x_h``), so ``l_h = l`` and the horizontal diffusivity equals the one built from the master mixing length. They differ only where ``\Delta z > \Delta x_h`` (gray-zone and LES aspect ratios): there ``\Delta_f = \Delta z`` while the horizontal length remains limited by ``\Delta x_h``, giving the shorter horizontal scale ``l_h \le l`` and the ratio ``l_h / l = \Delta x_h / \Delta z`` wherever ``l_\text{phys}`` exceeds both spacings.
6885

6986
## When to enable it
7087

71-
Horizontal EDMF diffusion is intended for box configurations whose horizontal grid spacing is comparable to or smaller than the physical mixing length, so that the horizontal limiter ``\min(l_\text{phys}, \Delta x)`` binds. This is the high-resolution and gray-zone regime, where the horizontal grid is fine enough for an anisotropic SGS length scale to matter.
88+
Horizontal EDMF diffusion is intended for box configurations whose horizontal node scale ``\Delta x_h`` is comparable to or smaller than the physical mixing length, so that the horizontal limiter ``\min(l_\text{phys}, \Delta x_h)`` binds. This is the high-resolution and gray-zone regime, where an anisotropic SGS length scale matters.
7289

73-
At coarse horizontal resolution (for example global runs with ``\Delta x`` of tens of kilometers) the horizontal limiter rarely binds, the horizontal diffusivity reduces to the isotropic environment value, and the term is typically negligible next to resolved horizontal transport. The option is off by default for that reason.
90+
At coarse horizontal resolution (for example global runs with ``\Delta x_h`` of tens of kilometers) the horizontal limiter rarely binds, the horizontal diffusivity reduces to the isotropic environment value, and the term is typically negligible next to resolved horizontal transport. Both options are off by default for that reason.
7491

75-
The horizontal term is a grid-mean closure applied independently of the vertical flux and of the diffusion mode: it is always explicit, since the horizontal operators are not part of the column implicit solve, while the vertical flux remains implicit when `implicit_diffusion` is set. The Smagorinsky-Lilly and anisotropic-minimum-dissipation closures already supply horizontal SGS diffusion of the same fields, so combining either with this option is rejected at model construction.
92+
The Smagorinsky-Lilly and anisotropic-minimum-dissipation closures already supply horizontal SGS diffusion of the same fields, so combining `edmfx_sgs_horizontal_diffusive_flux` with either is rejected at model construction.
7693

77-
Because the term is explicit, it adds a horizontal diffusive stability limit on the timestep, ``\Delta t \lesssim \Delta x^2 / (2 K_h)``. At the fine horizontal resolutions where this closure is intended, the timestep is in practice already set by the explicit horizontal acoustic limit ``\Delta t \lesssim \Delta x / c_s``, which is the more restrictive of the two.
94+
Because the term is explicit, it adds a horizontal diffusive stability limit on the timestep, ``\Delta t \lesssim \Delta x_h^2 / (2 K_h)``. At the fine horizontal resolutions where this closure is intended, the timestep is in practice already set by the explicit horizontal acoustic limit ``\Delta t \lesssim \Delta x_h / c_s``, which is the more restrictive of the two.
7895

7996
## Configuration
8097

8198
```yaml
8299
edmfx_sgs_horizontal_diffusive_flux: true # default: false
100+
edmfx_horizontal_diffusion: true # default: false
83101
```
84102
85103
## Diagnostics
86104
87105
Three diagnostic variables expose the horizontal closure fields:
88106
89-
- `lmixh`: the mixing length with the grid-scale limit set by the horizontal node
90-
spacing, ``l_h`` [m];
91-
- `edth`: the horizontal eddy diffusivity for scalars, ``K_h`` [m² s⁻¹];
92-
- `evuh`: the horizontal eddy viscosity, ``K_u`` [m² s⁻¹].
107+
- `lmixh`: the horizontal mixing length ``l_h`` [m], recomputed lazily with the grid-scale limit set by the horizontal node spacing;
108+
- `edth`: the horizontal eddy diffusivity for scalars ``K_h`` [m² s⁻¹], read from the cached `ᶜK_h_h`;
109+
- `evuh`: the horizontal eddy viscosity ``K_u`` [m² s⁻¹], read from the cached `ᶜK_u_h`.
93110

94111
The vertical counterparts are `lmix`, `edt`, and `evu`.

src/cache/precomputed_quantities.jl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,8 @@ function precomputed_quantities(Y, atmos)
202202
# node spacing; written by `set_horizontal_diffusivities!`.
203203
(
204204
atmos.edmfx_model.sgs_diffusive_flux_horizontal isa
205-
Val{true} ?
205+
Val{true} ||
206+
atmos.edmfx_model.horizontal_diffusion isa Val{true} ?
206207
(;
207208
ᶜK_u_h = similar(Y.c, FT),
208209
ᶜK_h_h = similar(Y.c, FT),
@@ -733,8 +734,10 @@ NVTX.@annotate function set_explicit_precomputed_quantities!(Y, p, t)
733734
# from the covariance/cloud-fraction update above.
734735
set_face_diffusivities!(Y, p)
735736

736-
if turbconv_model isa AbstractEDMF &&
737-
p.atmos.edmfx_model.sgs_diffusive_flux_horizontal isa Val{true}
737+
if turbconv_model isa AbstractEDMF && (
738+
p.atmos.edmfx_model.sgs_diffusive_flux_horizontal isa Val{true} ||
739+
p.atmos.edmfx_model.horizontal_diffusion isa Val{true}
740+
)
738741
set_horizontal_diffusivities!(Y, p)
739742
end
740743

src/config/model_getters.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -782,6 +782,7 @@ function AtmosTurbconv(config::AtmosConfig, params, ::Type{FT}) where {FT}
782782
sgs_diffusive_flux_horizontal = pa["edmfx_sgs_horizontal_diffusive_flux"],
783783
nh_pressure = pa["edmfx_nh_pressure"],
784784
vertical_diffusion = pa["edmfx_vertical_diffusion"],
785+
horizontal_diffusion = pa["edmfx_horizontal_diffusion"],
785786
filter = pa["edmfx_filter"],
786787
scale_blending_method,
787788
)

0 commit comments

Comments
 (0)