Skip to content

Commit

Permalink
fix entrainment and detrainment in TKE equation
Browse files Browse the repository at this point in the history
  • Loading branch information
szy21 committed Dec 21, 2023
1 parent c621bcb commit 1bb83b6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/prognostic_equations/edmfx_tke.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,14 @@ function edmfx_tke_tendency!(
# entrainment and detraiment
# using ᶜu⁰ and local geometry results in allocation
for j in 1:n
ᶜρaʲ_colidx =
turbconv_model isa PrognosticEDMFX ?
Y.c.sgsʲs.:($j).ρa[colidx] : p.precomputed.ᶜρaʲs.:($j)[colidx]
@. Yₜ.c.sgs⁰.ρatke[colidx] +=
ᶜρa⁰[colidx] * (
ᶜentrʲs.:($$j)[colidx] * 1 / 2 * norm_sqr(
ᶜρaʲ_colidx * (
ᶜdetrʲs.:($$j)[colidx] * 1 / 2 * norm_sqr(
ᶜinterp(ᶠu³⁰[colidx]) - ᶜinterp(ᶠu³ʲs.:($$j)[colidx]),
) - ᶜdetrʲs.:($$j)[colidx] * ᶜtke⁰[colidx]
) - ᶜentrʲs.:($$j)[colidx] * ᶜtke⁰[colidx]
)
end
# pressure work
Expand Down

0 comments on commit 1bb83b6

Please sign in to comment.