Skip to content

fix(les): diffuse total enthalpy with the dry-static-energy decomposition - #4704

Open
haakon-e wants to merge 1 commit into
he/edmf-vertical-diffusion-helpersfrom
he/smag-amd-enthalpy-decomposition
Open

fix(les): diffuse total enthalpy with the dry-static-energy decomposition#4704
haakon-e wants to merge 1 commit into
he/edmf-vertical-diffusion-helpersfrom
he/smag-amd-enthalpy-decomposition

Conversation

@haakon-e

@haakon-e haakon-e commented Jul 17, 2026

Copy link
Copy Markdown
Member

Diffuses total enthalpy in the Smagorinsky-Lilly and AMD tendencies, vertical and horizontal, with the dry-static-energy + water-enthalpy decomposition already used by the boundary-layer and EDMFX diffusion, instead of diffusing h_tot directly. Diffusing h_tot contributes a spurious enthalpy flux with the dry-air mass gradient and additionally diffuses kinetic energy through the energy flux. The decomposition removes both, making the energy-moisture coupling of the LES closures consistent with the other diffusion models.

Behavioral for every Smagorinsky/AMD configuration (reference counter bumped).

@haakon-e
haakon-e force-pushed the he/smag-amd-enthalpy-decomposition branch from fce1021 to 6628c12 Compare July 17, 2026 00:30
@github-actions

Copy link
Copy Markdown
Contributor

📖 Docs preview for this PR: https://clima.github.io/ClimaAtmos.jl/previews/PR4704/

@haakon-e
haakon-e force-pushed the he/smag-amd-enthalpy-decomposition branch 2 times, most recently from 7d09e5f to acd293d Compare July 23, 2026 22:10
@haakon-e
haakon-e changed the base branch from main to he/edmf-vertical-diffusion-helpers July 23, 2026 22:27
@haakon-e

Copy link
Copy Markdown
Member Author

@haakon-e
haakon-e force-pushed the he/smag-amd-enthalpy-decomposition branch from acd293d to de6b04d Compare July 23, 2026 22:27
@haakon-e
haakon-e force-pushed the he/edmf-vertical-diffusion-helpers branch from 77cb1db to 2dc3e74 Compare July 24, 2026 17:40
@haakon-e
haakon-e force-pushed the he/smag-amd-enthalpy-decomposition branch from de6b04d to c3aadd2 Compare July 24, 2026 17:41
@haakon-e
haakon-e marked this pull request as ready for review July 24, 2026 19:53
@haakon-e haakon-e added the Launch Buildkite Add to launch buildkite run label Jul 24, 2026
@haakon-e
haakon-e force-pushed the he/edmf-vertical-diffusion-helpers branch from 2dc3e74 to 1027e64 Compare July 25, 2026 22:22
@haakon-e
haakon-e force-pushed the he/smag-amd-enthalpy-decomposition branch from c3aadd2 to 3e6d72c Compare July 25, 2026 22:22
@haakon-e
haakon-e requested a review from akshaysridhar July 26, 2026 15:31
…tion

Diffuse total enthalpy in the Smagorinsky-Lilly and AMD tendencies,
vertical and horizontal, with the dry-static-energy + water-enthalpy
decomposition used by the boundary-layer and EDMFX diffusion, instead of
diffusing h_tot directly. Diffusing h_tot carries a spurious enthalpy
flux with the dry-air mass gradient and diffuses kinetic energy through
the energy flux. The vertical fluxes use ᶠtotal_enthalpy_gradientᵥ; the
horizontal fluxes use the materialized ᶜtotal_enthalpy_gradientₕ!. AMD
keeps evaluating its energy diffusivities from the total-enthalpy
gradient; only the flux assembly changes. A unit test asserts the
Smagorinsky horizontal and vertical energy tendencies equal the sum of
their four constituent fluxes.
@haakon-e
haakon-e force-pushed the he/smag-amd-enthalpy-decomposition branch from 3e6d72c to 9a8437e Compare July 26, 2026 16:51
@haakon-e

haakon-e commented Jul 26, 2026

Copy link
Copy Markdown
Member Author

This PR bumps the ref counter. The only affected reproducibility test is a single, short, test that runs RCEMIP with Smagorinsky. Some additional Claude-assisted figures of the ref counter bump is provided below

click here to see explanation and figures Justification for the reference counter bump, since that is the main thing to check before merging.

What changed: the Smagorinsky-Lilly and AMD energy tendencies now diffuse total enthalpy through the dry-static-energy + water-enthalpy decomposition instead of diffusing h_tot directly. One job in the reproducibility suite is affected, rcemipii_box_CRM_1M, which is the only reproducibility configuration that enables smagorinsky_lilly. amd_les defaults to false and no configuration sets it, so AMD contributes no reference change.

The difference between the two formulations is exact and can be written down. At uniform temperature and uniform kinetic energy,

∇h_tot - (∇s_d + Σ_μ (h_μ + Φ) ∇q_μ) = -s_d ∇q_tot,   μ ∈ {vap, liq, ice}

so the old formulation includes an additional flux proportional to the dry-air mass gradient. I checked this numerically in the small box the unit tests use: the two formulations agree to 2e-14 relative when q_tot is uniform, and differ by exactly the term above, to 3e-13 relative, when it is not. In that state the spurious term is 1.6 percent of the horizontal energy tendency and 0.6 percent of the vertical one. The unit test in this PR asserts both cases, in both directions.

The first figure is the reproducibility metric itself, the relative RMS of the final prognostic state after 4 simulated hours. The thermodynamic fields are preserved: density to 3e-6, total energy to 9e-5, total water to 1e-4. The velocities are fully decorrelated, at a relative RMS near √2, which is what two uncorrelated fields of the same magnitude give. That is the expected response of a convecting box to any perturbation of its state.

fig1_prog_state_rms

The second figure shows the horizontal-mean profiles, which tell the same story. Temperature, specific humidity, potential temperature, total enthalpy and relative humidity overlay to between 3e-6 and 3e-5 relative. The visible difference is in the domain RMS of vertical velocity, which is the turbulent field, and it differs in phase rather than in magnitude.

fig2_profiles

One caveat: this case forms no condensate in 4 hours. Cloud liquid, cloud ice, rain and snow are identically zero in both runs, so the reproducibility comparison exercises only the dry and vapour parts of the decomposition. The liquid and ice constituents are covered by the unit test rather than by this job.

So the counter bump is the reference tracking a small and exactly characterised change to the energy flux, and the simulated climate of the case is preserved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Launch Buildkite Add to launch buildkite run

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant