Skip to content

Commit 53b8dbb

Browse files
authored
Merge pull request #3912 from CliMA/sa/bugfix_edmf_sources_and_cloud_condensation
Bugfix: microphysics sources when running with edmf
2 parents 36e29c1 + d15ffef commit 53b8dbb

File tree

5 files changed

+62
-14
lines changed

5 files changed

+62
-14
lines changed

src/parameterized_tendencies/microphysics/cloud_condensate.jl

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
##### DryModel, EquilMoistModel
33
#####
44

5-
cloud_condensate_tendency!(Yₜ, Y, p, _, _) = nothing
5+
cloud_condensate_tendency!(Yₜ, Y, p, _, _, _) = nothing
66

77
#####
88
##### NonEquilMoistModel
@@ -14,6 +14,7 @@ function cloud_condensate_tendency!(
1414
p,
1515
::NonEquilMoistModel,
1616
::Union{NoPrecipitation, Microphysics0Moment},
17+
_,
1718
)
1819
error(
1920
"NonEquilMoistModel can only be run with Microphysics1Moment or Microphysics2Moment precipitation",
@@ -26,6 +27,7 @@ function cloud_condensate_tendency!(
2627
p,
2728
::NonEquilMoistModel,
2829
::Microphysics1Moment,
30+
_,
2931
)
3032
(; ᶜts) = p.precomputed
3133
(; params, dt) = p
@@ -69,6 +71,7 @@ function cloud_condensate_tendency!(
6971
p,
7072
::NonEquilMoistModel,
7173
::Microphysics2Moment,
74+
_,
7275
)
7376
(; ᶜts) = p.precomputed
7477
(; params, dt) = p
@@ -170,3 +173,38 @@ function cloud_condensate_tendency!(
170173
)
171174
@. Yₜ.c.ρn_liq += Y.c.ρ * Snₗ
172175
end
176+
177+
#####
178+
##### PrognosticEDMF and DiagnosticEDMF
179+
#####
180+
181+
function cloud_condensate_tendency!(
182+
Yₜ,
183+
Y,
184+
p,
185+
::NonEquilMoistModel,
186+
::Union{NoPrecipitation, Microphysics0Moment},
187+
::Union{PrognosticEDMFX, DiagnosticEDMFX},
188+
)
189+
nothing
190+
end
191+
function cloud_condensate_tendency!(
192+
Yₜ,
193+
Y,
194+
p,
195+
::NonEquilMoistModel,
196+
::Microphysics1Moment,
197+
::Union{PrognosticEDMFX, DiagnosticEDMFX},
198+
)
199+
nothing
200+
end
201+
function cloud_condensate_tendency!(
202+
Yₜ,
203+
Y,
204+
p,
205+
::NonEquilMoistModel,
206+
::Microphysics2Moment,
207+
::Union{PrognosticEDMFX, DiagnosticEDMFX},
208+
)
209+
nothing
210+
end

src/prognostic_equations/edmfx_precipitation.jl

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -78,17 +78,10 @@ function edmfx_precipitation_tendency!(
7878
# TODO what about the mass end energy outflow via bottom boundary?
7979

8080
for j in 1:n
81-
@. Yₜ.c.sgsʲs.:($$j).q_liq +=
82-
ᶜSqₗᵖʲs.:($$j) * (1 - Y.c.sgsʲs.:($$j).q_liq)
83-
84-
@. Yₜ.c.sgsʲs.:($$j).q_ice +=
85-
ᶜSqᵢᵖʲs.:($$j) * (1 - Y.c.sgsʲs.:($$j).q_ice)
86-
87-
@. Yₜ.c.sgsʲs.:($$j).q_rai +=
88-
ᶜSqᵣᵖʲs.:($$j) * (1 - Y.c.sgsʲs.:($$j).q_rai)
89-
90-
@. Yₜ.c.sgsʲs.:($$j).q_sno +=
91-
ᶜSqₛᵖʲs.:($$j) * (1 - Y.c.sgsʲs.:($$j).q_sno)
81+
@. Yₜ.c.sgsʲs.:($$j).q_liq += ᶜSqₗᵖʲs.:($$j)
82+
@. Yₜ.c.sgsʲs.:($$j).q_ice += ᶜSqᵢᵖʲs.:($$j)
83+
@. Yₜ.c.sgsʲs.:($$j).q_rai += ᶜSqᵣᵖʲs.:($$j)
84+
@. Yₜ.c.sgsʲs.:($$j).q_sno += ᶜSqₛᵖʲs.:($$j)
9285
end
9386
return nothing
9487
end

src/prognostic_equations/implicit/implicit_tendency.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ NVTX.@annotate function implicit_tendency!(Yₜ, Y, p, t)
1717
p,
1818
p.atmos.moisture_model,
1919
p.atmos.microphysics_model,
20+
p.atmos.turbconv_model,
2021
)
2122
end
2223

src/prognostic_equations/remaining_tendency.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ NVTX.@annotate function additional_tendency!(Yₜ, Y, p, t)
241241
p,
242242
p.atmos.moisture_model,
243243
p.atmos.microphysics_model,
244+
p.atmos.turbconv_model,
244245
)
245246
end
246247

test/parameterized_tendencies/microphysics/precipitation.jl

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ import Test: @test
7575
p,
7676
moisture_model,
7777
microphysics_model,
78+
turbconv_model,
7879
) isa Nothing
7980
end
8081

@@ -153,7 +154,14 @@ end
153154
@assert iszero(ᶜYₜ.c.ρ)
154155

155156
# test nonequilibrium cloud condensate
156-
CA.cloud_condensate_tendency!(ᶜYₜ, Y, p, moisture_model, microphysics_model)
157+
CA.cloud_condensate_tendency!(
158+
ᶜYₜ,
159+
Y,
160+
p,
161+
moisture_model,
162+
microphysics_model,
163+
turbconv_model,
164+
)
157165
@assert !any(isnan, ᶜYₜ.c.ρq_liq)
158166
@assert !any(isnan, ᶜYₜ.c.ρq_ice)
159167

@@ -250,7 +258,14 @@ end
250258
@assert iszero(ᶜYₜ.c.ρ)
251259

252260
# test nonequilibrium cloud condensate
253-
CA.cloud_condensate_tendency!(ᶜYₜ, Y, p, moisture_model, microphysics_model)
261+
CA.cloud_condensate_tendency!(
262+
ᶜYₜ,
263+
Y,
264+
p,
265+
moisture_model,
266+
microphysics_model,
267+
turbconv_model,
268+
)
254269
@assert !any(isnan, ᶜYₜ.c.ρq_liq)
255270
@assert !any(isnan, ᶜYₜ.c.ρq_ice)
256271
@assert !any(isnan, ᶜYₜ.c.ρn_liq)

0 commit comments

Comments
 (0)