ClimaAtmos.jl
ClimaAtmos.jl copied to clipboard
Fix kinetic energy conservation with topography
Purpose
This PR introduces some changes that should allow us to conserve kinetic energy in the presence of topography.
To-do
- Add a test for exact conservation of kinetic energy in the presence of topography.
- Update the relevant Jacobian terms for the test.
Content
- Replace
ᶠwinterp(ᶜJ, ᶜρ)
in the vertical transport equation withᶠinterp(ᶜJ * ᶜρ) / ᶠJ
, sinceᶠdiv
internally multiplies its argument byᶠJ
. - Replace
dot(uₕ, CTh(uₕ)) + 2 * dot(ᶜinterp(uᵥ), CT3(uₕ))
in the kinetic energy equation withdot(uₕ, CTh(uₕ) + CTh(ᶜinterp(uᵥ))) + dot(ᶜinterp(uᵥ), CT3(uₕ))
, which makes it so that∫ ᶜρₜ * ᶜK * dz = -∫ ᶜρ * ᶜKₜ * dz
. - Update the relevant Jacobian terms.
- [ ] I have read and checked the items on the review checklist.
Thanks @dennisYatunin; I can test this against the dss
update branch as well.