Skip to content

Commit 7ec5f00

Browse files
Merge pull request #3721 from CliMA/as/diff-mass-terms
exclude contributions from condensate, precip diffusion in mass tendency
2 parents 8f18bb2 + 36be068 commit 7ec5f00

File tree

6 files changed

+23
-7
lines changed

6 files changed

+23
-7
lines changed

NEWS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ removed from the configurable options.
1212
v0.29.1
1313
-------
1414

15+
### Remove contribution from condensate, precip diffusion in mass tendency
16+
PR[#3721](https://github.com/CliMA/ClimaAtmos.jl/pull/3721)
17+
Diffusion of condensate (liq, ice) and precip (rai, sno) vars no longer
18+
contributes to the mass tendency terms (updates in vert diffusion boundary layer,
19+
smag-lilly, implicit solver terms)
20+
1521
### Add support for non-zero `t_start`
1622

1723
Passing a non zero `t_start` is useful in conditions where one wants to have a

src/parameterized_tendencies/les_sgs_models/smagorinsky_lilly.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ function vertical_smagorinsky_lilly_tendency!(Yₜ, Y, p, t, ::SmagorinskyLilly)
166166
ᶜ∇ᵥρD∇χₜ = @. ᶜtemp_scalar = ᶜdivᵥ_ρχ(-(ᶠρ * ᶠD_smag * ᶠgradᵥ(ᶜχ)))
167167
@. ᶜρχₜ -= ᶜ∇ᵥρD∇χₜ
168168
# Rain and snow does not affect the mass
169-
if χ_name (:q_rai, :q_sno)
169+
if χ_name == :q_tot
170170
@. Yₜ.c.ρ -= ᶜ∇ᵥρD∇χₜ
171171
end
172172
end

src/prognostic_equations/hyperdiffusion.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,12 @@ NVTX.@annotate function apply_tracer_hyperdiffusion_tendency!(Yₜ, Y, p, t)
295295
ν₄_scalar,
296296
)
297297
@. ᶜρχₜ -= ν₄_scalar * wdivₕ(Y.c.ρ * gradₕ(ᶜ∇²χ))
298-
@. Yₜ.c.ρ -= ν₄_scalar * wdivₕ(Y.c.ρ * gradₕ(ᶜ∇²χ))
298+
299+
# Exclude contributions from hyperdiffusion of condensate,
300+
# precipitating species from mass tendency.
301+
if χ_name == :q_tot
302+
@. Yₜ.c.ρ -= ν₄_scalar * wdivₕ(Y.c.ρ * gradₕ(ᶜ∇²χ))
303+
end
299304
end
300305
if turbconv_model isa PrognosticEDMFX
301306
(; ᶜ∇²q_totʲs) = p.hyperdiff

src/prognostic_equations/implicit/implicit_solver.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,6 @@ function ImplicitEquationJacobian(
264264
(ρatke_if_available..., @name(c.uₕ)),
265265
)...,
266266
)
267-
268267
end
269268

270269
sgs_scalar_names = (
@@ -813,6 +812,7 @@ function update_implicit_equation_jacobian!(A, Y, p, dtγ, t)
813812
dtγ * ᶜdiffusion_h_matrix DiagonalMatrixRow(1 / ᶜρ)
814813
end
815814

815+
816816
MatrixFields.unrolled_foreach(tracer_info) do (ρq_name, q_name, _)
817817
MatrixFields.has_field(Y, ρq_name) || return
818818
ᶜq = MatrixFields.get_field(ᶜspecific, q_name)
@@ -823,8 +823,7 @@ function update_implicit_equation_jacobian!(A, Y, p, dtγ, t)
823823
ᶜdiffusion_h_matrix_scaled,
824824
ᶜdiffusion_h_matrix,
825825
)
826-
@. ∂ᶜρq_err_∂ᶜρ =
827-
dtγ * ᶜtridiagonal_matrix_scalar DiagonalMatrixRow(-(ᶜq) / ᶜρ)
826+
@. ∂ᶜρq_err_∂ᶜρ = zero(typeof(∂ᶜρq_err_∂ᶜρ))
828827
@. ∂ᶜρq_err_∂ᶜρq +=
829828
dtγ * ᶜtridiagonal_matrix_scalar DiagonalMatrixRow(1 / ᶜρ)
830829
end

src/prognostic_equations/surface_flux.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ function surface_flux_tendency!(Yₜ, Y, p, t)
6565
end
6666
btt = boundary_tendency_scalar(ᶜχ, ρ_flux_χ)
6767
@. ᶜρχₜ -= btt
68-
@. Yₜ.c.ρ -= btt
68+
if χ_name == :q_tot
69+
@. Yₜ.c.ρ -= btt
70+
end
6971
end
7072
end

src/prognostic_equations/vertical_diffusion_boundary_layer.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ function vertical_diffusion_boundary_layer_tendency!(
5454
@. ᶜρχₜ_diffusion =
5555
ᶜdivᵥ_ρχ(-(ᶠinterp(Y.c.ρ) * ᶠinterp(ᶜK_h_scaled) * ᶠgradᵥ(ᶜχ)))
5656
@. ᶜρχₜ -= ᶜρχₜ_diffusion
57-
@. Yₜ.c.ρ -= ᶜρχₜ_diffusion
57+
# Exclude contributions from diffusion of condensate, precipitation
58+
# in mass tendency
59+
if χ_name == :q_tot
60+
@. Yₜ.c.ρ -= ᶜρχₜ_diffusion
61+
end
5862
end
5963
end

0 commit comments

Comments
 (0)