Skip to content

Commit 70f051f

Browse files
Apply more suggestions
1 parent 492e90b commit 70f051f

File tree

2 files changed

+11
-14
lines changed

2 files changed

+11
-14
lines changed

src/parameterized_tendencies/les_sgs_models/smagorinsky_lilly.jl

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -156,15 +156,13 @@ function vertical_smagorinsky_lilly_tendency!(Yₜ, Y, p, t, ::SmagorinskyLilly)
156156
@. Yₜ.c.ρe_tot -= ᶜdivᵥ_ρe_tot(-(ᶠρ * ᶠD_smag * ᶠgradᵥ(ᶜh_tot)))
157157

158158
## Tracer diffusion and associated mass changes
159-
foreach_scalar(Yₜ, Y) do ᶜρχₜ, ᶜρχ, is_ρq_tot
160-
ᶜχ = @. lazy(specific(ᶜρχ, Y.c.ρ))
161-
162-
ᶜdivᵥ_ρχ = Operators.DivergenceF2C(;
163-
top = Operators.SetValue(C3(FT(0))),
164-
bottom = Operators.SetValue(C3(FT(0))),
165-
)
159+
ᶜdivᵥ_ρχ = Operators.DivergenceF2C(;
160+
top = Operators.SetValue(C3(FT(0))),
161+
bottom = Operators.SetValue(C3(FT(0))),
162+
)
166163

167-
ᶜ∇ᵥρD∇χₜ = @. lazy(ᶜdivᵥ_ρχ(-(ᶠρ * ᶠD_smag * ᶠgradᵥ(ᶜχ))))
164+
foreach_scalar(Yₜ, Y) do ᶜρχₜ, ᶜρχ, is_ρq_tot
165+
ᶜ∇ᵥρD∇χₜ = @. lazy(ᶜdivᵥ_ρχ(-(ᶠρ * ᶠD_smag * ᶠgradᵥ(specific(ᶜρχ, Y.c.ρ)))))
168166
@. ᶜρχₜ -= ᶜ∇ᵥρD∇χₜ
169167
# Rain and snow does not affect the mass
170168
if is_ρq_tot

src/prognostic_equations/vertical_diffusion_boundary_layer.jl

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,19 +96,18 @@ function vertical_diffusion_boundary_layer_tendency!(
9696

9797
ᶜρχₜ_diffusion = p.scratch.ᶜtemp_scalar
9898
ᶜK_h_scaled = p.scratch.ᶜtemp_scalar_2
99+
ᶜdivᵥ_ρχ = Operators.DivergenceF2C(
100+
top = Operators.SetValue(C3(0)),
101+
bottom = Operators.SetValue(C3(0)),
102+
)
99103
foreach_scalar(Yₜ, Y) do ᶜρχₜ, ᶜρχ, is_ρq_tot
100-
ᶜχ = @. lazy(specific(ᶜρχ, Y.c.ρ))
101104
if ρχ_name in (:ρq_rai, :ρq_sno, :ρn_rai)
102105
@. ᶜK_h_scaled = α_vert_diff_tracer * ᶜK_h
103106
else
104107
@. ᶜK_h_scaled = ᶜK_h
105108
end
106-
ᶜdivᵥ_ρχ = Operators.DivergenceF2C(
107-
top = Operators.SetValue(C3(0)),
108-
bottom = Operators.SetValue(C3(0)),
109-
)
110109
@. ᶜρχₜ_diffusion =
111-
ᶜdivᵥ_ρχ(-(ᶠinterp(Y.c.ρ) * ᶠinterp(ᶜK_h_scaled) * ᶠgradᵥ(ᶜχ)))
110+
ᶜdivᵥ_ρχ(-(ᶠinterp(Y.c.ρ) * ᶠinterp(ᶜK_h_scaled) * ᶠgradᵥ(specific(ᶜρχ, Y.c.ρ))))
112111
@. ᶜρχₜ -= ᶜρχₜ_diffusion
113112
# Only add contribution from total water diffusion to mass tendency
114113
# (exclude contributions from diffusion of condensate, precipitation)

0 commit comments

Comments
 (0)