Skip to content

Commit 6513652

Browse files
committed
ensure rho*a_env = rho for diagnostic edmf
1 parent 2eb7859 commit 6513652

10 files changed

+87
-69
lines changed

src/cache/diagnostic_edmf_precomputed_quantities.jl

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -359,8 +359,8 @@ NVTX.@annotate function set_diagnostic_edmf_precomputed_quantities_do_integral!(
359359
specific(Y.c.ρe_tot, Y.c.ρ),
360360
),
361361
)
362-
ᶜρa⁰ = @. lazy(ρa⁰(Y.c.ρ, ᶜρaʲs, turbconv_model))
363-
ᶜtke⁰ = @. lazy(specific_tke(Y.c.ρ, Y.c.sgs⁰.ρatke, ᶜρa⁰, turbconv_model))
362+
363+
ᶜtke⁰ = @. lazy(specific_tke(Y.c.ρ, Y.c.sgs⁰.ρatke, Y.c.ρ, turbconv_model))
364364

365365
for i in 2:Spaces.nlevels(axes(Y.c))
366366
ρ_level = Fields.field_values(Fields.level(Y.c.ρ, i))
@@ -987,12 +987,10 @@ NVTX.@annotate function set_diagnostic_edmf_precomputed_quantities_env_closures!
987987
ᶜlg = Fields.local_geometry_field(Y.c)
988988

989989
if p.atmos.turbconv_model isa DiagnosticEDMFX
990-
(; ᶜρaʲs, ᶠu³ʲs, ᶜdetrʲs, ᶠu³⁰, ᶜu⁰) = p.precomputed
991-
ᶜρa⁰ = @. lazy(ρa⁰(Y.c.ρ, ᶜρaʲs, turbconv_model))
990+
(; ᶠu³⁰, ᶜu⁰) = p.precomputed
992991
elseif p.atmos.turbconv_model isa EDOnlyEDMFX
993992
ᶠu³⁰ = p.precomputed.ᶠu³
994993
ᶜu⁰ = ᶜu
995-
ᶜρa⁰ = Y.c.ρ
996994
end
997995
@. ᶜu⁰ = C123(Y.c.uₕ) + ᶜinterp(C123(ᶠu³⁰)) # Set here, but used in a different function
998996

src/cache/prognostic_edmf_precomputed_quantities.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import ClimaCore: Spaces, Fields
88
"""
99
set_prognostic_edmf_precomputed_quantities!(Y, p, ᶠuₕ³, t)
1010
11-
Updates the edmf environment precomputed quantities stored in `p` for edmfx.
11+
Updates the edmf environment precomputed quantities stored in `p` for prognostic edmfx.
1212
"""
1313
NVTX.@annotate function set_prognostic_edmf_precomputed_quantities_environment!(
1414
Y,
@@ -336,7 +336,7 @@ NVTX.@annotate function set_prognostic_edmf_precomputed_quantities_explicit_clos
336336
FT = eltype(params)
337337
n = n_mass_flux_subdomains(turbconv_model)
338338

339-
(; ᶜtke⁰, ᶜu, ᶜp, ᶠu³⁰, ᶜts⁰) = p.precomputed
339+
(; ᶜu, ᶜp, ᶠu³⁰, ᶜts⁰) = p.precomputed
340340
(; ᶜlinear_buoygrad, ᶜstrain_rate_norm, ρatke_flux) = p.precomputed
341341
(;
342342
ᶜuʲs,

src/diagnostics/edmfx_diagnostics.jl

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,14 +1152,11 @@ function compute_tke!(
11521152
)
11531153
if turbconv_model isa PrognosticEDMFX
11541154
sgsʲs = state.c.sgsʲs
1155-
elseif turbconv_model isa DiagnosticEDMFX
1156-
(; ᶜρaʲs) = cache.precomputed
1157-
sgsʲs = ᶜρaʲs
1155+
ᶜρa⁰ = @. lazy(ρa⁰(state.c.ρ, sgsʲs, turbconv_model))
11581156
else
1159-
sgsʲs = nothing
1157+
ᶜρa⁰ = state.c.ρ
11601158
end
11611159

1162-
ᶜρa⁰ = @. lazy(ρa⁰(state.c.ρ, sgsʲs, turbconv_model))
11631160
ᶜtke = @. lazy(
11641161
specific_tke(state.c.ρ, state.c.sgs⁰.ρatke, ᶜρa⁰, turbconv_model),
11651162
)
@@ -1330,9 +1327,15 @@ function compute_edt!(
13301327
turbconv_model::Union{PrognosticEDMFX, DiagnosticEDMFX},
13311328
)
13321329
turbconv_params = CAP.turbconv_params(cache.params)
1333-
(; ᶜlinear_buoygrad, ᶜstrain_rate_norm, ᶜtke⁰) = cache.precomputed
1330+
(; ᶜlinear_buoygrad, ᶜstrain_rate_norm) = cache.precomputed
13341331
(; params) = cache
13351332

1333+
ᶜρa⁰ =
1334+
turbconv_model isa PrognosticEDMFX ?
1335+
(@. lazy(ρa⁰(state.c.ρ, state.c.sgsʲs, turbconv_model))) : state.c.ρ
1336+
ᶜtke⁰ = @. lazy(
1337+
specific_tke(state.c.ρ, state.c.sgs⁰.ρatke, ᶜρa⁰, turbconv_model),
1338+
)
13361339
ᶜmixing_length_field = ᶜmixing_length(state, cache)
13371340
ᶜK_u = @. lazy(eddy_viscosity(turbconv_params, ᶜtke⁰, ᶜmixing_length_field))
13381341
ᶜprandtl_nvec = @. lazy(
@@ -1415,7 +1418,13 @@ function compute_evu!(
14151418
turbconv_model::Union{PrognosticEDMFX, DiagnosticEDMFX},
14161419
)
14171420
turbconv_params = CAP.turbconv_params(cache.params)
1418-
(; ᶜtke⁰) = cache.precomputed
1421+
1422+
ᶜρa⁰ =
1423+
turbconv_model isa PrognosticEDMFX ?
1424+
(@. lazy(ρa⁰(state.c.ρ, state.c.sgsʲs, turbconv_model))) : state.c.ρ
1425+
ᶜtke⁰ = @. lazy(
1426+
specific_tke(state.c.ρ, state.c.sgs⁰.ρatke, ᶜρa⁰, turbconv_model),
1427+
)
14191428
ᶜmixing_length_field = ᶜmixing_length(state, cache)
14201429
ᶜK_u = @. lazy(eddy_viscosity(turbconv_params, ᶜtke⁰, ᶜmixing_length_field))
14211430

src/prognostic_equations/advection.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,10 @@ NVTX.@annotate function explicit_vertical_advection_tendency!(Yₜ, Y, p, t)
196196
) : nothing
197197
ᶜρa⁰ =
198198
advect_tke ?
199-
(n > 0 ? (@. lazy(ρa⁰(Y.c.ρ, Y.c.sgsʲs, turbconv_model))) : Y.c.ρ) :
200-
nothing
199+
(
200+
turbconv_model isa PrognosticEDMFX ?
201+
(@. lazy(ρa⁰(Y.c.ρ, Y.c.sgsʲs, turbconv_model))) : Y.c.ρ
202+
) : nothing
201203
ᶜρ⁰ = if advect_tke
202204
if n > 0
203205
(; ᶜts⁰) = p.precomputed

src/prognostic_equations/eddy_diffusion_closures.jl

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -541,11 +541,16 @@ end
541541
function ᶜmixing_length(Y, p, property::Val{P} = Val{:master}()) where {P}
542542
(; params) = p
543543
(; ustar, obukhov_length) = p.precomputed.sfc_conditions
544-
(; ᶜtke⁰) = p.precomputed
545544
(; ᶜlinear_buoygrad, ᶜstrain_rate_norm) = p.precomputed
546545
ᶜz = Fields.coordinate_field(Y.c).z
547546
z_sfc = Fields.level(Fields.coordinate_field(Y.f).z, Fields.half)
548547
ᶜdz = Fields.Δz_field(axes(Y.c))
548+
549+
turbconv_model = p.atmos.turbconv_model
550+
ᶜρa⁰ =
551+
turbconv_model isa PrognosticEDMFX ?
552+
(@. lazy(ρa⁰(Y.c.ρ, Y.c.sgsʲs, turbconv_model))) : Y.c.ρ
553+
ᶜtke⁰ = @. lazy(specific_tke(Y.c.ρ, Y.c.sgs⁰.ρatke, ᶜρa⁰, turbconv_model))
549554
sfc_tke = Fields.level(ᶜtke⁰, 1)
550555

551556
ᶜprandtl_nvec = p.scratch.ᶜtemp_scalar_5
@@ -677,11 +682,12 @@ function ᶜtke_exchange(Y, p)
677682
(; turbconv_model) = p.atmos
678683
n = n_mass_flux_subdomains(turbconv_model)
679684
ᶜρa⁰ =
680-
p.atmos.turbconv_model isa PrognosticEDMFX ? p.precomputed.ᶜρa⁰ : Y.c.ρ
681-
685+
p.atmos.turbconv_model isa PrognosticEDMFX ?
686+
(@. lazy(ρa⁰(Y.c.ρ, Y.c.sgsʲs, turbconv_model))) : Y.c.ρ
687+
ᶜtke⁰ = @. lazy(specific_tke(Y.c.ρ, Y.c.sgs⁰.ρatke, ᶜρa⁰, turbconv_model))
682688

683689
if p.atmos.turbconv_model isa PrognosticEDMFX
684-
(; ᶜdetrʲs, ᶜtke⁰, ᶠu³⁰, ᶠu³ʲs) = p.precomputed
690+
(; ᶜdetrʲs, ᶠu³⁰, ᶠu³ʲs) = p.precomputed
685691
ᶜtke_exch = p.scratch.ᶜtemp_scalar_2
686692
@. ᶜtke_exch = 0
687693
for j in 1:n
@@ -694,7 +700,7 @@ function ᶜtke_exchange(Y, p)
694700

695701
return ᶜtke_exch
696702
elseif p.atmos.turbconv_model isa DiagnosticEDMFX
697-
(; ᶜdetrʲs, ᶜtke⁰, ᶠu³⁰, ᶠu³ʲs, ᶜρaʲs) = p.precomputed
703+
(; ᶜdetrʲs, ᶠu³⁰, ᶠu³ʲs, ᶜρaʲs) = p.precomputed
698704
ᶜtke_exch = p.scratch.ᶜtemp_scalar_2
699705
@. ᶜtke_exch = 0
700706
for j in 1:n

src/prognostic_equations/edmfx_sgs_flux.jl

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ function edmfx_sgs_mass_flux_tendency!(
318318
# TODO: the following adds the environment flux to the tendency
319319
# Make active and test later
320320
# @. ᶠu³_diff = p.precomputed.ᶠu³⁰ - ᶠu³
321-
# ᶜρa⁰ = @.lazy(ρa⁰(Y.c))
321+
# ρa⁰(Y.c.ρ, Y.c.sgsʲs, turbconv_model)
322322
# ᶜρ⁰ = p.scratch.ᶜtemp_scalar_2
323323
# @. ᶜρ⁰ = TD.air_density(
324324
# CAP.thermodynamics_params(p.params),
@@ -393,7 +393,7 @@ function edmfx_sgs_diffusive_flux_tendency!(
393393
turbconv_params = CAP.turbconv_params(params)
394394
c_d = CAP.tke_diss_coeff(turbconv_params)
395395
(; ᶜu⁰, ᶜK⁰, ᶜlinear_buoygrad, ᶜstrain_rate_norm) = p.precomputed
396-
(; ᶜmixing_length, ᶜK_u, ᶜK_h, ρatke_flux) = p.precomputed
396+
(; ρatke_flux) = p.precomputed
397397
ᶠgradᵥ = Operators.GradientC2F()
398398
ᶜρa⁰ = @. lazy(ρa⁰(Y.c.ρ, Y.c.sgsʲs, turbconv_model))
399399
ᶜtke⁰ = @. lazy(specific_tke(Y.c.ρ, Y.c.sgs⁰.ρatke, ᶜρa⁰, turbconv_model))
@@ -520,13 +520,7 @@ function edmfx_sgs_diffusive_flux_tendency!(
520520
(; ᶜu, ᶜts) = p.precomputed
521521
(; ρatke_flux) = p.precomputed
522522
ᶠgradᵥ = Operators.GradientC2F()
523-
if turbconv_model isa DiagnosticEDMFX
524-
(; ᶜρaʲs) = p.precomputed
525-
ᶜρa⁰ = @. lazy(ρa⁰(Y.c.ρ, ᶜρaʲs, turbconv_model))
526-
elseif turbconv_model isa EDOnlyEDMFX
527-
ᶜρa⁰ = Y.c.ρ
528-
end
529-
ᶜtke⁰ = @. lazy(specific_tke(Y.c.ρ, Y.c.sgs⁰.ρatke, ᶜρa⁰, turbconv_model))
523+
ᶜtke⁰ = @. lazy(specific_tke(Y.c.ρ, Y.c.sgs⁰.ρatke, Y.c.ρ, turbconv_model))
530524

531525
if p.atmos.edmfx_model.sgs_diffusive_flux isa Val{true}
532526

src/prognostic_equations/edmfx_tke.jl

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,10 @@ edmfx_tke_tendency!(Yₜ, Y, p, t, turbconv_model) = nothing
2727

2828
function edmfx_tke_tendency!(Yₜ, Y, p, t, turbconv_model::EDOnlyEDMFX)
2929
(; params) = p
30-
(; ᶜstrain_rate_norm, ᶜlinear_buoygrad, ᶜtke⁰) = p.precomputed
30+
(; ᶜstrain_rate_norm, ᶜlinear_buoygrad) = p.precomputed
3131
turbconv_params = CAP.turbconv_params(p.params)
32-
32+
ᶜρa⁰ = Y.c.ρ # EDOnly
33+
ᶜtke⁰ = @. lazy(specific_tke(Y.c.ρ, Y.c.sgs⁰.ρatke, ᶜρa⁰, turbconv_model))
3334
ᶜmixing_length_field = p.scratch.ᶜtemp_scalar
3435
ᶜmixing_length_field .= ᶜmixing_length(Y, p)
3536
ᶜK_u = @. lazy(eddy_viscosity(turbconv_params, ᶜtke⁰, ᶜmixing_length_field))
@@ -53,8 +54,7 @@ function edmfx_tke_tendency!(
5354
)
5455
n = n_mass_flux_subdomains(turbconv_model)
5556
(; ᶜturb_entrʲs, ᶜentrʲs, ᶜdetrʲs, ᶠu³ʲs) = p.precomputed
56-
(; ᶠu³⁰, ᶠu³, ᶜstrain_rate_norm, ᶜlinear_buoygrad, ᶜK_u, ᶜK_h) =
57-
p.precomputed
57+
(; ᶠu³⁰, ᶠu³, ᶜstrain_rate_norm, ᶜlinear_buoygrad) = p.precomputed
5858
turbconv_params = CAP.turbconv_params(p.params)
5959
FT = eltype(p.params)
6060

@@ -86,6 +86,11 @@ function edmfx_tke_tendency!(
8686

8787
ᶜmixing_length_field = p.scratch.ᶜtemp_scalar_2
8888
ᶜmixing_length_field .= ᶜmixing_length(Y, p)
89+
ᶜρa⁰ =
90+
turbconv_model isa PrognosticEDMFX ?
91+
(@. lazy(ρa⁰(Y.c.ρ, Y.c.sgsʲs, turbconv_model))) : Y.c.ρ
92+
ᶜtke⁰ =
93+
@. lazy(specific_tke(Y.c.ρ, Y.c.sgs⁰.ρatke, ᶜρa⁰, turbconv_model))
8994
ᶜK_u = @. lazy(
9095
eddy_viscosity(turbconv_params, ᶜtke⁰, ᶜmixing_length_field),
9196
)

src/prognostic_equations/hyperdiffusion.jl

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -117,15 +117,9 @@ NVTX.@annotate function prep_hyperdiffusion_tendency!(Yₜ, Y, p, t)
117117
wdivₕ(gradₕ(specific(Y.c.ρe_tot, Y.c.ρ) + ᶜp / Y.c.ρ - ᶜh_ref))
118118

119119
if diffuse_tke
120-
if turbconv_model isa PrognosticEDMFX
121-
sgsʲs = Y.c.sgsʲs
122-
elseif turbconv_model isa DiagnosticEDMFX
123-
(; ᶜρaʲs) = p.precomputed
124-
sgsʲs = ᶜρaʲs
125-
else
126-
sgsʲs = nothing
127-
end
128-
ᶜρa⁰ = @. lazy(ρa⁰(Y.c.ρ, sgsʲs, turbconv_model))
120+
ᶜρa⁰ =
121+
turbconv_model isa PrognosticEDMFX ?
122+
(@. lazy(ρa⁰(Y.c.ρ, Y.c.sgsʲs, turbconv_model))) : Y.c.ρ
129123
ᶜtke⁰ =
130124
@. lazy(specific_tke(Y.c.ρ, Y.c.sgs⁰.ρatke, ᶜρa⁰, turbconv_model))
131125
(; ᶜ∇²tke⁰) = p.hyperdiff

src/prognostic_equations/implicit/manual_sparse_jacobian.jl

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,7 @@ function update_jacobian!(alg::ManualSparseJacobian, cache, Y, p, dtγ, t)
559559
end
560560

561561
if use_derivative(diffusion_flag)
562+
(; turbconv_model) = p.atmos
562563
turbconv_params = CAP.turbconv_params(params)
563564
FT = eltype(params)
564565
(; vertical_diffusion) = p.atmos
@@ -575,7 +576,13 @@ function update_jacobian!(alg::ManualSparseJacobian, cache, Y, p, dtγ, t)
575576
)
576577
ᶜK_u = ᶜK_h
577578
else
578-
(; ᶜtke⁰, ᶜlinear_buoygrad, ᶜstrain_rate_norm) = p.precomputed
579+
(; ᶜlinear_buoygrad, ᶜstrain_rate_norm) = p.precomputed
580+
ᶜρa⁰ =
581+
p.atmos.turbconv_model isa PrognosticEDMFX ?
582+
(@. lazy(ρa⁰(Y.c.ρ, Y.c.sgsʲs, turbconv_model))) : Y.c.ρ
583+
ᶜtke⁰ = @. lazy(
584+
specific_tke(Y.c.ρ, Y.c.sgs⁰.ρatke, ᶜρa⁰, turbconv_model),
585+
)
579586
ᶜmixing_length_field = p.scratch.ᶜtemp_scalar_3
580587
ᶜmixing_length_field .= ᶜmixing_length(Y, p)
581588
ᶜK_u = @. lazy(
@@ -658,11 +665,15 @@ function update_jacobian!(alg::ManualSparseJacobian, cache, Y, p, dtγ, t)
658665
turbconv_model = p.atmos.turbconv_model
659666
ᶜρa⁰ =
660667
p.atmos.turbconv_model isa PrognosticEDMFX ?
661-
(@.lazy(ρa⁰(Y.c))) : Y.c.ρ
662-
ᶜtke⁰ = @. lazy(specific_tke(Y.c.sgs⁰, Y.c, turbconv_model))
668+
(@. lazy(ρa⁰(Y.c.ρ, Y.c.sgsʲs, turbconv_model))) : Y.c.ρ
669+
ᶜtke⁰ = @. lazy(
670+
specific_tke(Y.c.ρ, Y.c.sgs⁰.ρatke, ᶜρa⁰, turbconv_model),
671+
)
663672
ᶜρatke⁰ = Y.c.sgs⁰.ρatke
664673

665-
ᶜmixing_length_field = ᶜmixing_length(Y, p)
674+
# scratch to prevent GPU Kernel parameter memory error
675+
ᶜmixing_length_field = p.scratch.ᶜtemp_scalar_3
676+
ᶜmixing_length_field .= ᶜmixing_length(Y, p)
666677

667678
@inline tke_dissipation_rate_tendency(tke⁰, mixing_length) =
668679
tke⁰ >= 0 ? c_d * sqrt(tke⁰) / mixing_length : 1 / float(dt)

src/utils/variable_manipulations.jl

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -328,8 +328,8 @@ function ᶜspecific_env_value(::Val{χ_name}, Y, p) where {χ_name}
328328
end
329329

330330
ᶜρaχ⁰ = @. lazy(ᶜρχ - ᶜρaχʲs_sum)
331-
# Denominator: ρa⁰ = ρ - Σ ρaʲ
332-
ᶜρa⁰ = @. lazy(ρa⁰(Y.c.ρ, p.precomputed.ᶜρaʲs, turbconv_model))
331+
# Denominator: ρa⁰ = ρ - Σ ρaʲ, assume ᶜρa⁰ = ρ
332+
ᶜρa⁰ = Y.c.ρ
333333
end
334334

335335
return @. lazy(specific(
@@ -342,23 +342,21 @@ function ᶜspecific_env_value(::Val{χ_name}, Y, p) where {χ_name}
342342
end
343343

344344
"""
345-
ρa⁰(Y, p)
345+
ρa⁰(ρ, sgsʲs, turbconv_model)
346346
347347
Computes the environment area-weighted density (`ρa⁰`).
348348
349-
This function uses the `ᶜenv_value` helper, which applies the domain
350-
decomposition principle (`GridMean = Environment + Sum(Drafts)`) to calculate
351-
the environment area-weighted density by subtracting the sum of all draft
352-
subdomain area-weighted densities (`ρaʲ`) from the grid-mean density (`ρ`).
349+
This function calculates the environment area-weighted density by subtracting the sum of all draft subdomain area-weighted densities (`ρaʲ`) from the grid-mean density (`ρ`), following the domain decomposition principle (`GridMean = Environment + Sum(Drafts)`).
353350
354351
Arguments:
355-
- `ρ`: Grid-mean density
352+
- `ρ`: Grid-mean density.
356353
- `sgsʲs`: Iterable of draft subdomain quantities.
357-
PrognosticEDMFX: Y.c.sgsʲs
358-
DiagnosticEDMFX: p.precomputed.ᶜρaʲs
354+
- For `PrognosticEDMFX`: typically `Y.c.sgsʲs`
355+
- For `DiagnosticEDMFX`: typically `p.precomputed.ᶜρaʲs`
356+
- `turbconv_model`: The turbulence convection model (e.g., `PrognosticEDMFX`, `DiagnosticEDMFX`, or others).
359357
360358
Returns:
361-
- The area-weighted density (`ρa⁰`).
359+
- The area-weighted density of the environment (`ρa⁰`).
362360
"""
363361

364362
function ρa⁰(ρ, sgsʲs, turbconv_model)
@@ -375,19 +373,20 @@ end
375373

376374

377375
"""
378-
ᶜspecific_tke(Y, p)
376+
specific_tke(ρ, ρatke, ρa⁰, turbconv_model)
379377
380-
Computes the specific turbulent kinetic energy (`tke`) in the environment (`tke⁰`).
378+
Computes the specific turbulent kinetic energy (TKE) in the environment.
381379
382-
This is a specialized helper that encapsulates the call to the regularized
383-
`specific` function for the TKE variable. It provides `0` as the grid-scale
384-
fallback value (`ρχ_fallback`) in the limit of small environmental area
385-
fraction.
380+
This function returns the specific TKE of the environment by regularizing the
381+
area-weighted TKE density (`ρatke`) with the environment area-weighted density
382+
(`ρa⁰`). In the limit of vanishing environment area fraction, the fallback value
383+
for TKE is zero.
386384
387385
Arguments:
388-
- `ρ`: The grid-mean density `ρ` and the environment SGS state `Y.c.sgs⁰`.
389-
- `ρatke`: The cache, containing precomputed quantities and turbconv_model.
390-
- `ρa⁰`: The environment area-weighted density.
386+
- `ρ`: Grid-mean density.
387+
- `ρatke`: Area-weighted TKE density in the environment.
388+
- `ρa⁰`: Area-weighted density of the environment.
389+
- `turbconv_model`: The turbulence convection model (e.g., `PrognosticEDMFX`, `DiagnosticEDMFX`, or others).
391390
392391
Returns:
393392
- The specific TKE of the environment (`tke⁰`).
@@ -461,8 +460,8 @@ function ᶜspecific_env_mse(Y, p)
461460
@. ᶜρamseʲ_sum += ᶜρaʲ * ᶜmseʲ
462461
end
463462
ρa⁰mse⁰ = @. lazy(ᶜρmse - ᶜρamseʲ_sum)
464-
# Denominator: ρa⁰ = ρ - Σ ρaʲ
465-
ᶜρa⁰ = @. lazy(ρa⁰(Y.c.ρ, ᶜρaʲs, turbconv_model))
463+
# Denominator: ρa⁰ = ρ - Σ ρaʲ, assume ᶜρa⁰ = ρ
464+
ᶜρa⁰ = Y.c.ρ
466465
end
467466

468467
return @. lazy(specific(ρa⁰mse⁰, ᶜρa⁰, ᶜρmse, Y.c.ρ, turbconv_model))

0 commit comments

Comments
 (0)