Skip to content

Commit 70c4296

Browse files
committed
debug
1 parent 82462e9 commit 70c4296

20 files changed

+258
-180
lines changed

src/cache/cloud_fraction.jl

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,8 @@ NVTX.@annotate function set_cloud_fraction!(
6464
else
6565
q_liq = @. lazy(specific(Y.c.ρq_liq, Y.c.ρ))
6666
q_ice = @. lazy(specific(Y.c.ρq_ice, Y.c.ρ))
67-
@. cloud_diagnostics_tuple = make_named_tuple(
68-
ifelse(
69-
q_liq + q_ice > 0,
70-
1,
71-
0,
72-
),
73-
q_liq,
74-
q_ice,
75-
)
67+
@. cloud_diagnostics_tuple =
68+
make_named_tuple(ifelse(q_liq + q_ice > 0, 1, 0), q_liq, q_ice)
7669
end
7770
end
7871

@@ -96,8 +89,8 @@ NVTX.@annotate function set_cloud_fraction!(
9689
ᶜstrain_rate_norm,
9790
ᶠu³⁰,
9891
ᶠu³,
99-
ᶜentrʲs,
100-
ᶜdetrʲs,
92+
ᶜentrʲs,
93+
ᶜdetrʲs,
10194
ᶠu³ʲs,
10295
) = p.precomputed
10396
ᶜρa⁰ = @.lazy(ρa⁰(Y.c))

src/cache/diagnostic_edmf_precomputed_quantities.jl

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,19 @@ NVTX.@annotate function set_diagnostic_edmf_precomputed_quantities_bottom_bc!(
100100
(; ᶠu³⁰, ᶜK⁰) = p.precomputed
101101

102102
(; params) = p
103-
103+
104104
thermo_params = CAP.thermodynamics_params(params)
105105
turbconv_params = CAP.turbconv_params(params)
106106
ᶜts = p.precomputed.ᶜts #TODO replace
107107

108108
q_tot = specific(Y.c.ρq_tot, Y.c.ρ)
109-
ᶜh_tot = @. lazy(TD.total_specific_enthalpy(thermo_params, ᶜts, specific(Y.c.ρe_tot, Y.c.ρ)))
109+
ᶜh_tot = @. lazy(
110+
TD.total_specific_enthalpy(
111+
thermo_params,
112+
ᶜts,
113+
specific(Y.c.ρe_tot, Y.c.ρ),
114+
),
115+
)
110116

111117
ρ_int_level = Fields.field_values(Fields.level(Y.c.ρ, 1))
112118
uₕ_int_level = Fields.field_values(Fields.level(Y.c.uₕ, 1))
@@ -1125,4 +1131,4 @@ NVTX.@annotate function set_diagnostic_edmf_precomputed_quantities_env_precipita
11251131
# thermo_params,
11261132
#)
11271133
return nothing
1128-
end
1134+
end

src/cache/precomputed_quantities.jl

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#####
44
import Thermodynamics as TD
55
import ClimaCore: Spaces, Fields
6+
using Base.Broadcast: materialize
67

78
"""
89
implicit_precomputed_quantities(Y, atmos)
@@ -40,10 +41,9 @@ function implicit_precomputed_quantities(Y, atmos)
4041
ᶠu = similar(Y.f, CT123{FT}),
4142
ᶜK = similar(Y.c, FT),
4243
ᶜts = similar(Y.c, TST),
43-
ᶜp = similar(Y.c, FT)
44+
ᶜp = similar(Y.c, FT),
4445
)
45-
sgs_quantities =
46-
turbconv_model isa AbstractEDMF ? (;) : (;)
46+
sgs_quantities = turbconv_model isa AbstractEDMF ? (;) : (;)
4747
prognostic_sgs_quantities =
4848
turbconv_model isa PrognosticEDMFX ?
4949
(;
@@ -372,21 +372,20 @@ function thermo_state(
372372
end
373373

374374
function thermo_vars(moisture_model, precip_model, Y_c, K, Φ)
375-
# Compute specific quantities on-the-fly
376-
e_tot = @. lazy(specific(Y_c.ρe_tot, Y_c.ρ))
375+
e_tot = materialize(@. lazy(specific(Y_c.ρe_tot, Y_c.ρ)))
377376
energy_var = (; e_int = e_tot - K - Φ)
378-
377+
379378
moisture_var = if moisture_model isa DryModel
380379
(;)
381380
elseif moisture_model isa EquilMoistModel
382-
q_tot = @. lazy(specific(Y_c.ρq_tot, Y_c.ρ))
381+
q_tot = materialize(@. lazy(specific(Y_c.ρq_tot, Y_c.ρ)))
383382
(; q_tot)
384383
elseif moisture_model isa NonEquilMoistModel
385-
q_tot = @. lazy(specific(Y_c.ρq_tot, Y_c.ρ))
386-
q_liq = @. lazy(specific(Y_c.ρq_liq, Y_c.ρ))
387-
q_ice = @. lazy(specific(Y_c.ρq_ice, Y_c.ρ))
388-
q_rai = @. lazy(specific(Y_c.ρq_rai, Y_c.ρ))
389-
q_sno = @. lazy(specific(Y_c.ρq_sno, Y_c.ρ))
384+
q_tot = materialize(@. lazy(specific(Y_c.ρq_tot, Y_c.ρ)))
385+
q_liq = materialize(@. lazy(specific(Y_c.ρq_liq, Y_c.ρ)))
386+
q_ice = materialize(@. lazy(specific(Y_c.ρq_ice, Y_c.ρ)))
387+
q_rai = materialize(@. lazy(specific(Y_c.ρq_rai, Y_c.ρ)))
388+
q_sno = materialize(@. lazy(specific(Y_c.ρq_sno, Y_c.ρ)))
390389
q_pt_args = (q_tot, q_liq + q_rai, q_ice + q_sno)
391390
(; q_pt = TD.PhasePartition(q_pt_args...))
392391
end
@@ -439,7 +438,6 @@ NVTX.@annotate function set_implicit_precomputed_quantities!(Y, p, t)
439438
thermo_params = CAP.thermodynamics_params(p.params)
440439
thermo_args = (thermo_params, moisture_model, precip_model)
441440

442-
ᶜspecific .= ᶜspecific_gs_tracers(Y)
443441
@. ᶠuₕ³ = $compute_ᶠuₕ³(Y.c.uₕ, Y.c.ρ)
444442

445443
# TODO: We might want to move this to dss! (and rename dss! to something

src/cache/prognostic_edmf_precomputed_quantities.jl

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,19 @@ NVTX.@annotate function set_prognostic_edmf_precomputed_quantities_environment!(
2121
thermo_params = CAP.thermodynamics_params(p.params)
2222
(; turbconv_model) = p.atmos
2323
(; ᶜΦ,) = p.core
24-
(; ᶜp,ᶜK) = p.precomputed
24+
(; ᶜp, ᶜK) = p.precomputed
2525
(; ᶠu₃⁰, ᶜu⁰, ᶠu³⁰, ᶜK⁰, ᶜts⁰) = p.precomputed
2626

2727
ᶜρa⁰ = @.lazy(ρa⁰(Y.c))
28-
@. ᶜtke⁰ = specific_tke(Y.c.sgs⁰, Y.c, turbconv_model)
28+
ᶜtke⁰ = @. lazy(specific_tke(Y.c.sgs⁰, Y.c, turbconv_model))
2929
set_sgs_ᶠu₃!(u₃⁰, ᶠu₃⁰, Y, turbconv_model)
3030
set_velocity_quantities!(ᶜu⁰, ᶠu³⁰, ᶜK⁰, ᶠu₃⁰, Y.c.uₕ, ᶠuₕ³)
3131
# @. ᶜK⁰ += ᶜtke⁰
3232
ᶜq_tot⁰ = @.lazy(specific_env_value(:q_tot, Y.c, turbconv_model))
33+
34+
ᶜmse⁰ = p.scratch.ᶜtemp_scalar_2
35+
ᶜmse⁰ .= specific_env_mse(Y.c, p)
36+
3337
if p.atmos.moisture_model isa NonEquilMoistModel &&
3438
p.atmos.precip_model isa Microphysics1Moment
3539
ᶜq_liq⁰ = @.lazy(specific_env_value(:q_liq, Y.c, turbconv_model))
@@ -39,16 +43,12 @@ NVTX.@annotate function set_prognostic_edmf_precomputed_quantities_environment!(
3943
@. ᶜts⁰ = TD.PhaseNonEquil_phq(
4044
thermo_params,
4145
ᶜp,
42-
specific_env_mse(Y.c, p) - ᶜΦ,
46+
ᶜmse⁰ - ᶜΦ,
4347
TD.PhasePartition(ᶜq_tot⁰, ᶜq_liq⁰ + ᶜq_rai⁰, ᶜq_ice⁰ + ᶜq_sno⁰),
4448
)
4549
else
46-
@. ᶜts⁰ = TD.PhaseEquil_phq(
47-
thermo_params,
48-
ᶜp,
49-
specific_env_mse(Y.c, p) - ᶜΦ,
50-
ᶜq_tot⁰,
51-
)
50+
51+
@. ᶜts⁰ = TD.PhaseEquil_phq(thermo_params, ᶜp, ᶜmse⁰ - ᶜΦ, ᶜq_tot⁰)
5252
end
5353
return nothing
5454
end
@@ -132,7 +132,7 @@ NVTX.@annotate function set_prognostic_edmf_precomputed_quantities_bottom_bc!(
132132
turbconv_params = CAP.turbconv_params(p.params)
133133

134134
(; ᶜΦ,) = p.core
135-
(; ᶜp, ᶜK, ᶜtsʲs, ᶜρʲs) = p.precomputed
135+
(; ᶜp, ᶜK, ᶜtsʲs, ᶜρʲs, ᶜts) = p.precomputed
136136
(; ustar, obukhov_length, buoyancy_flux) = p.precomputed.sfc_conditions
137137

138138
for j in 1:n
@@ -176,8 +176,15 @@ NVTX.@annotate function set_prognostic_edmf_precomputed_quantities_bottom_bc!(
176176
# TODO: replace this with the actual surface area fraction when
177177
# using prognostic surface area
178178
@. ᶜaʲ_int_val = FT(turbconv_params.surface_area)
179-
ᶜh_tot = @. lazy(TD.total_specific_enthalpy(thermo_params, ᶜtsʲ, specific(Y.c.ρe_tot, Y.c.ρ)))
180-
ᶜh_tot_int_val = Fields.field_values(Fields.level(ᶜh_tot, 1))
179+
ᶜh_tot = @. lazy(
180+
TD.total_specific_enthalpy(
181+
thermo_params,
182+
ᶜts,
183+
specific(Y.c.ρe_tot, Y.c.ρ),
184+
),
185+
)
186+
ᶜh_tot_int_val =
187+
Fields.field_values(Fields.level(Base.materialize(ᶜh_tot), 1))
181188
ᶜK_int_val = Fields.field_values(Fields.level(ᶜK, 1))
182189
ᶜmseʲ_int_val = Fields.field_values(Fields.level(ᶜmseʲ, 1))
183190
@. ᶜmseʲ_int_val = sgs_scalar_first_interior_bc(
@@ -193,8 +200,10 @@ NVTX.@annotate function set_prognostic_edmf_precomputed_quantities_bottom_bc!(
193200
)
194201

195202
# ... and the first interior point for EDMFX ᶜq_totʲ.
203+
204+
ᶜq_tot = @. lazy(specific(Y.c.ρq_tot, Y.c.ρ))
196205
ᶜq_tot_int_val =
197-
Fields.field_values(Fields.level(specific(Y.c.ρq_tot, Y.c.ρ), 1))
206+
Fields.field_values(Fields.level(Base.materialize(ᶜq_tot), 1))
198207
ᶜq_totʲ_int_val = Fields.field_values(Fields.level(ᶜq_totʲ, 1))
199208
@. ᶜq_totʲ_int_val = sgs_scalar_first_interior_bc(
200209
ᶜz_int_val - z_sfc_val,
@@ -359,6 +368,8 @@ NVTX.@annotate function set_prognostic_edmf_precomputed_quantities_explicit_clos
359368
ᶜdz = Fields.Δz_field(axes(Y.c))
360369
ᶜlg = Fields.local_geometry_field(Y.c)
361370
ᶠlg = Fields.local_geometry_field(Y.f)
371+
ᶜtke⁰ = @. lazy(specific_tke(Y.c.sgs⁰, Y.c, turbconv_model))
372+
ᶜρa⁰ = @. lazy(ρa⁰(Y.c))
362373

363374
ᶜvert_div = p.scratch.ᶜtemp_scalar
364375
ᶜmassflux_vert_div = p.scratch.ᶜtemp_scalar_2
@@ -480,7 +491,7 @@ NVTX.@annotate function set_prognostic_edmf_precomputed_quantities_explicit_clos
480491
(1 / 2 * norm_sqr(ᶜinterp(ᶠu³⁰) - ᶜinterp(ᶠu³ʲs.:($$j))) - ᶜtke⁰)
481492
end
482493

483-
sfc_tke = Fields.level(ᶜtke⁰, 1)
494+
sfc_tke = Fields.level(Base.materialize(ᶜtke⁰), 1)
484495
@. ᶜmixing_length_tuple = mixing_length(
485496
p.params,
486497
ustar,
@@ -503,7 +514,7 @@ NVTX.@annotate function set_prognostic_edmf_precomputed_quantities_explicit_clos
503514
@. ᶜK_h = eddy_diffusivity(ᶜK_u, ᶜprandtl_nvec)
504515

505516
ρatke_flux_values = Fields.field_values(ρatke_flux)
506-
ρa_sfc_values = Fields.field_values(Fields.level(ᶜρa⁰, 1)) # TODO: replace by surface value
517+
ρa_sfc_values = Fields.field_values(Fields.level(Base.materialize(ᶜρa⁰), 1)) # TODO: replace by surface value
507518
ustar_values = Fields.field_values(ustar)
508519
sfc_local_geometry_values = Fields.field_values(
509520
Fields.level(Fields.local_geometry_field(Y.f), half),

src/diagnostics/Diagnostics.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ import ..PrognosticSurfaceTemperature
5858
import ..draft_area
5959
import ..compute_gm_mixing_length!
6060
import ..horizontal_integral_at_boundary
61+
import ..ρa⁰
62+
import ..specific_tke
6163

6264
# We need the abbreviations for symbols like curl, grad, and so on
6365
include(joinpath("..", "utils", "abbreviations.jl"))

src/diagnostics/edmfx_diagnostics.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ compute_aren!(_, _, _, _, turbconv_model::T) where {T} =
633633

634634
function compute_aren!(out, state, cache, time, turbconv_model::PrognosticEDMFX)
635635
thermo_params = CAP.thermodynamics_params(cache.params)
636-
ᶜρa⁰ = @.lazy(ρa⁰(state.c))
636+
ᶜρa⁰ = @. lazy(ρa⁰(state.c))
637637
if isnothing(out)
638638
return draft_area.(
639639
ᶜρa⁰,
@@ -1139,18 +1139,18 @@ compute_tke!(out, state, cache, time) =
11391139
compute_tke!(_, _, _, _, turbconv_model::T) where {T} =
11401140
error_diagnostic_variable("tke", turbconv_model)
11411141

1142-
function compute_tke!(
1142+
function compute_tke!(
11431143
out,
11441144
state,
11451145
cache,
11461146
time,
11471147
turbconv_model::Union{EDOnlyEDMFX, PrognosticEDMFX, DiagnosticEDMFX},
11481148
)
1149-
1149+
ᶜtke = @. lazy(specific_tke(state.c.sgs⁰, state.c, turbconv_model))
11501150
if isnothing(out)
1151-
return specific_tke(state.c.sgs⁰, state.c, turbconv_model)
1151+
return Base.materialize(ᶜtke)
11521152
else
1153-
out .= specific_tke(state.c.sgs⁰, state.c, turbconv_model)
1153+
out .= ᶜtke
11541154
end
11551155
end
11561156

src/parameterized_tendencies/les_sgs_models/smagorinsky_lilly.jl

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,21 @@ horizontal_smagorinsky_lilly_tendency!(Yₜ, Y, p, t, ::Nothing) = nothing
9696
vertical_smagorinsky_lilly_tendency!(Yₜ, Y, p, t, ::Nothing) = nothing
9797

9898
function horizontal_smagorinsky_lilly_tendency!(Yₜ, Y, p, t, ::SmagorinskyLilly)
99-
(; ᶜτ_smag, ᶠτ_smag, ᶜD_smag) = p.precomputed
99+
(; ᶜτ_smag, ᶠτ_smag, ᶜD_smag, ᶜts) = p.precomputed
100100

101101
## Momentum tendencies
102102
ᶠρ = @. p.scratch.ᶠtemp_scalar = ᶠinterp(Y.c.ρ)
103103
@. Yₜ.c.uₕ -= C12(wdivₕ(Y.c.ρ * ᶜτ_smag) / Y.c.ρ)
104104
@. Yₜ.f.u₃ -= C3(wdivₕ(ᶠρ * ᶠτ_smag) / ᶠρ)
105105

106106
## Total energy tendency
107-
ᶜh_tot = @. lazy(TD.total_specific_enthalpy(thermo_params, ᶜts, specific(Y.c.ρe_tot, Y.c.ρ)))
107+
ᶜh_tot = @. lazy(
108+
TD.total_specific_enthalpy(
109+
thermo_params,
110+
ᶜts,
111+
specific(Y.c.ρe_tot, Y.c.ρ),
112+
),
113+
)
108114
@. Yₜ.c.ρe_tot += wdivₕ(Y.c.ρ * ᶜD_smag * gradₕ(ᶜh_tot))
109115

110116
## Tracer diffusion and associated mass changes
@@ -125,9 +131,9 @@ import UnrolledUtilities as UU
125131
function vertical_smagorinsky_lilly_tendency!(Yₜ, Y, p, t, ::SmagorinskyLilly)
126132
FT = eltype(Y)
127133
(; sfc_temp_C3, ᶠtemp_scalar) = p.scratch
128-
(; ᶜτ_smag, ᶠτ_smag, ᶠD_smag, sfc_conditions) =
129-
p.precomputed
134+
(; ᶜτ_smag, ᶠτ_smag, ᶠD_smag, sfc_conditions) = p.precomputed
130135
(; ρ_flux_uₕ, ρ_flux_h_tot) = sfc_conditions
136+
(; ᶜts) = p.precomputed
131137

132138
# Define operators
133139
ᶠgradᵥ = Operators.GradientC2F() # apply BCs to ᶜdivᵥ, which wraps ᶠgradᵥ
@@ -154,7 +160,13 @@ function vertical_smagorinsky_lilly_tendency!(Yₜ, Y, p, t, ::SmagorinskyLilly)
154160
@. Yₜ.f.u₃ -= C3(ᶠdivᵥ(Y.c.ρ * ᶜτ_smag) / ᶠρ)
155161

156162
## Total energy tendency
157-
ᶜh_tot = @. lazy(TD.total_specific_enthalpy(thermo_params, ᶜts, specific(Y.c.ρe_tot, Y.c.ρ)))
163+
ᶜh_tot = @. lazy(
164+
TD.total_specific_enthalpy(
165+
thermo_params,
166+
ᶜts,
167+
specific(Y.c.ρe_tot, Y.c.ρ),
168+
),
169+
)
158170
@. Yₜ.c.ρe_tot -= ᶜdivᵥ_ρe_tot(-(ᶠρ * ᶠD_smag * ᶠgradᵥ(ᶜh_tot)))
159171

160172
## Tracer diffusion and associated mass changes

src/parameterized_tendencies/radiation/radiation.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,4 +566,4 @@ function radiation_tendency!(Yₜ, Y, p, t, radiation_mode::RadiationISDAC)
566566
)) # = -∂F/∂z = ρ cₚ ∂T/∂t (longwave radiation)
567567

568568
return nothing
569-
end
569+
end

src/prognostic_equations/advection.jl

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ Modifies `Yₜ.c.ρ`, `Yₜ.c.ρe_tot`, `Yₜ.c.uₕ`, and EDMFX-related fields
3636
NVTX.@annotate function horizontal_dynamics_tendency!(Yₜ, Y, p, t)
3737
n = n_mass_flux_subdomains(p.atmos.turbconv_model)
3838
(; ᶜΦ) = p.core
39-
(; ᶜu, ᶜK, ᶜp) = p.precomputed
39+
(; ᶜu, ᶜK, ᶜp, ᶜts) = p.precomputed
40+
(; params) = p
41+
thermo_params = CAP.thermodynamics_params(params)
4042

4143
if p.atmos.turbconv_model isa PrognosticEDMFX
4244
(; ᶜuʲs) = p.precomputed
@@ -49,7 +51,13 @@ NVTX.@annotate function horizontal_dynamics_tendency!(Yₜ, Y, p, t)
4951
end
5052
end
5153

52-
ᶜh_tot = @. lazy(TD.total_specific_enthalpy(thermo_params, ᶜts, specific(Y.c.ρe_tot, Y.c.ρ)))
54+
ᶜh_tot = @. lazy(
55+
TD.total_specific_enthalpy(
56+
thermo_params,
57+
ᶜts,
58+
specific(Y.c.ρe_tot, Y.c.ρ),
59+
),
60+
)
5361
@. Yₜ.c.ρe_tot -= wdivₕ(Y.c.ρ * ᶜh_tot * ᶜu)
5462

5563
if p.atmos.turbconv_model isa PrognosticEDMFX
@@ -174,7 +182,7 @@ NVTX.@annotate function explicit_vertical_advection_tendency!(Yₜ, Y, p, t)
174182
(; dt) = p
175183
ᶜJ = Fields.local_geometry_field(Y.c).J
176184
(; ᶜf³, ᶠf¹², ᶜΦ) = p.core
177-
(; ᶜu, ᶠu³, ᶜK) = p.precomputed
185+
(; ᶜu, ᶠu³, ᶜK, ᶜts) = p.precomputed
178186
(; edmfx_upwinding) = n > 0 || advect_tke ? p.atmos.numerics : all_nothing
179187
(; ᶜuʲs, ᶜKʲs, ᶠKᵥʲs) = n > 0 ? p.precomputed : all_nothing
180188
(; energy_upwinding, tracer_upwinding) = p.atmos.numerics
@@ -196,8 +204,8 @@ NVTX.@annotate function explicit_vertical_advection_tendency!(Yₜ, Y, p, t)
196204
else
197205
nothing
198206
end
199-
ᶜtke⁰ = advect_tke ?
200-
(@.lazy(specific_tke(Y.c.sgs⁰, Y.c, turbconv_model))) :
207+
ᶜtke⁰ =
208+
advect_tke ? (@.lazy(specific_tke(Y.c.sgs⁰, Y.c, turbconv_model))) :
201209
nothing
202210
ᶜa_scalar = p.scratch.ᶜtemp_scalar
203211
ᶜω³ = p.scratch.ᶜtemp_CT3
@@ -233,7 +241,13 @@ NVTX.@annotate function explicit_vertical_advection_tendency!(Yₜ, Y, p, t)
233241
# ... and upwinding correction of energy and total water.
234242
# (The central advection of energy and total water is done implicitly.)
235243
if energy_upwinding != Val(:none)
236-
ᶜh_tot = @. lazy(TD.total_specific_enthalpy(thermo_params, ᶜts, specific(Y.c.ρe_tot, Y.c.ρ)))
244+
ᶜh_tot = @. lazy(
245+
TD.total_specific_enthalpy(
246+
thermo_params,
247+
ᶜts,
248+
specific(Y.c.ρe_tot, Y.c.ρ),
249+
),
250+
)
237251
vtt = vertical_transport(ᶜρ, ᶠu³, ᶜh_tot, float(dt), energy_upwinding)
238252
vtt_central = vertical_transport(ᶜρ, ᶠu³, ᶜh_tot, float(dt), Val(:none))
239253
@. Yₜ.c.ρe_tot += vtt - vtt_central

src/prognostic_equations/edmfx_entr_detr.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,8 @@ function edmfx_entr_detr_tendency!(Yₜ, Y, p, t, turbconv_model::PrognosticEDMF
530530
(; ᶜturb_entrʲs, ᶜentrʲs, ᶜdetrʲs) = p.precomputed
531531
(; ᶠu₃⁰) = p.precomputed
532532

533-
ᶜmse⁰ = @.lazy(specific_env_mse(Y.c, p))
533+
ᶜmse⁰ = p.scratch.ᶜtemp_scalar
534+
ᶜmse⁰ .= specific_env_mse(Y.c, p)
534535
if p.atmos.moisture_model isa NonEquilMoistModel &&
535536
p.atmos.precip_model isa Microphysics1Moment
536537
ᶜq_liq⁰ = @.lazy(specific_env_value(:q_liq, Y.c, turbconv_model))

0 commit comments

Comments
 (0)