diff --git a/src/parameterized_tendencies/sponge/viscous_sponge.jl b/src/parameterized_tendencies/sponge/viscous_sponge.jl index fcfc409849..c576f65ba4 100644 --- a/src/parameterized_tendencies/sponge/viscous_sponge.jl +++ b/src/parameterized_tendencies/sponge/viscous_sponge.jl @@ -46,3 +46,10 @@ function viscous_sponge_tendency_tracer(ᶜρ, ᶜχ, s) zmax = z_max(axes(ᶠz)) return @. lazy(β_viscous(s, ᶜz, zmax) * wdivₕ(ᶜρ * gradₕ(ᶜχ))) end + +function viscous_sponge_tendency_sgs(ᶜχ, s) + s isa Nothing && return NullBroadcasted() + (; ᶜz, ᶠz) = z_coordinate_fields(axes(ᶜχ)) + zmax = z_max(axes(ᶠz)) + return @. lazy(β_viscous(s, ᶜz, zmax) * wdivₕ(gradₕ(ᶜχ))) +end diff --git a/src/prognostic_equations/remaining_tendency.jl b/src/prognostic_equations/remaining_tendency.jl index 3fe38dcdd5..d4de88b226 100644 --- a/src/prognostic_equations/remaining_tendency.jl +++ b/src/prognostic_equations/remaining_tendency.jl @@ -182,6 +182,20 @@ NVTX.@annotate function additional_tendency!(Yₜ, Y, p, t) end end + if p.atmos.turbconv_model isa PrognosticEDMFX + n = n_mass_flux_subdomains(p.atmos.turbconv_model) + for j in 1:n + vst_mse = + viscous_sponge_tendency_sgs(Y.c.sgsʲs.:($j).mse, viscous_sponge) + vst_q_tot = viscous_sponge_tendency_sgs( + Y.c.sgsʲs.:($j).q_tot, + viscous_sponge, + ) + @. Yₜ.c.sgsʲs.:($$j).mse += vst_mse + @. Yₜ.c.sgsʲs.:($$j).q_tot += vst_q_tot + end + end + # Held Suarez tendencies @. Yₜ.c.uₕ += hs_tendency_uₕ @. Yₜ.c.ρe_tot += hs_tendency_ρe_tot