@@ -25,17 +25,10 @@ function viscous_sponge_cache(Y, viscous_sponge::ViscousSponge)
2525 return (; ᶜβ_viscous, ᶠβ_viscous)
2626end
2727
28- function add_viscous_sponge_energy_tendency! (Yₜ, Y, p, t)
29- (; ᶜβ_viscous) = p. viscous_sponge
30- (; ᶜh_tot) = p. precomputed
31- ᶜρ = Y. c. ρ
32- @. Yₜ. c. ρe_tot += ᶜβ_viscous * wdivₕ (ᶜρ * gradₕ (ᶜh_tot))
33- end
34-
3528function viscous_sponge_tendency! (Yₜ, Y, p, t, :: ViscousSponge )
3629 (; ᶜβ_viscous, ᶠβ_viscous) = p. viscous_sponge
30+ (; ᶜh_tot, ᶜspecific) = p. precomputed
3731 ᶜuₕ = Y. c. uₕ
38- add_viscous_sponge_energy_tendency! (Yₜ, Y, p, t)
3932 @. Yₜ. c. uₕ +=
4033 ᶜβ_viscous * (
4134 wgradₕ (divₕ (ᶜuₕ)) - Geometry. project (
@@ -45,4 +38,11 @@ function viscous_sponge_tendency!(Yₜ, Y, p, t, ::ViscousSponge)
4538 )
4639 @. Yₜ. f. u₃. components. data.:1 +=
4740 ᶠβ_viscous * wdivₕ (gradₕ (Y. f. u₃. components. data.:1 ))
41+
42+ @. Yₜ. c. ρe_tot += ᶜβ_viscous * wdivₕ (Y. c. ρ * gradₕ (ᶜh_tot))
43+ for (ᶜρχₜ, ᶜχ, χ_name) in matching_subfields (Yₜ. c, ᶜspecific)
44+ χ_name == :e_tot && continue
45+ @. ᶜρχₜ += ᶜβ_viscous * wdivₕ (Y. c. ρ * gradₕ (ᶜχ))
46+ @. Yₜ. c. ρ += ᶜβ_viscous * wdivₕ (Y. c. ρ * gradₕ (ᶜχ))
47+ end
4848end
0 commit comments