Skip to content

Commit e91a2b9

Browse files
Flatten buoyancy_gradients call
1 parent 76c8be1 commit e91a2b9

File tree

4 files changed

+48
-30
lines changed

4 files changed

+48
-30
lines changed

src/cache/diagnostic_edmf_precomputed_quantities.jl

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -782,16 +782,12 @@ NVTX.@annotate function set_diagnostic_edmf_precomputed_quantities_env_closures!
782782
BuoyGradMean(),
783783
thermo_params,
784784
moisture_model,
785-
EnvBuoyGradVars(
786-
ᶜts,
787-
projected_vector_buoy_grad_vars(
788-
C3,
789-
p.precomputed.ᶜgradᵥ_θ_virt, # ∂θv∂z_unsat
790-
p.precomputed.ᶜgradᵥ_q_tot, # ∂qt∂z_sat
791-
p.precomputed.ᶜgradᵥ_θ_liq_ice, # ∂θl∂z_sat
792-
ᶜlg,
793-
),
794-
),
785+
ᶜts,
786+
C3,
787+
p.precomputed.ᶜgradᵥ_θ_virt, # ∂θv∂z_unsat
788+
p.precomputed.ᶜgradᵥ_q_tot, # ∂qt∂z_sat
789+
p.precomputed.ᶜgradᵥ_θ_liq_ice, # ∂θl∂z_sat
790+
ᶜlg,
795791
)
796792

797793
# TODO: Currently the shear production only includes vertical gradients

src/cache/prognostic_edmf_precomputed_quantities.jl

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -272,16 +272,12 @@ NVTX.@annotate function set_prognostic_edmf_precomputed_quantities_closures!(
272272
BuoyGradMean(),
273273
thermo_params,
274274
moisture_model,
275-
EnvBuoyGradVars(
276-
ᶜts⁰,
277-
projected_vector_buoy_grad_vars(
278-
C3,
279-
ᶜgradᵥ(ᶠinterp(TD.virtual_pottemp(thermo_params, ᶜts⁰))), # ∂θv∂z_unsat
280-
ᶜgradᵥ(ᶠinterp(ᶜq_tot⁰)), # ∂qt∂z_sat
281-
ᶜgradᵥ(ᶠinterp(TD.liquid_ice_pottemp(thermo_params, ᶜts⁰))), # ∂θl∂z_sat
282-
ᶜlg,
283-
),
284-
),
275+
ᶜts⁰,
276+
C3,
277+
ᶜgradᵥ(ᶠinterp(TD.virtual_pottemp(thermo_params, ᶜts⁰))), # ∂θv∂z_unsat
278+
ᶜgradᵥ(ᶠinterp(ᶜq_tot⁰)), # ∂qt∂z_sat
279+
ᶜgradᵥ(ᶠinterp(TD.liquid_ice_pottemp(thermo_params, ᶜts⁰))), # ∂θl∂z_sat
280+
ᶜlg,
285281
)
286282

287283
# TODO: Currently the shear production only includes vertical gradients

src/prognostic_equations/buoyancy_gradients.jl

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,36 @@ The dispatch on EnvBuoyGradVars type is performed at the EnvBuoyGradVars constru
3434
used here are consistent for both mean fields and conditional fields obtained from assumed distributions
3535
over the conserved thermodynamic variables.
3636
"""
37+
function buoyancy_gradients end
38+
39+
function buoyancy_gradients(
40+
ebgc::AbstractEnvBuoyGradClosure,
41+
thermo_params,
42+
moisture_model,
43+
ts,
44+
::Type{C3},
45+
∂θv∂z_unsat,
46+
∂qt∂z_sat,
47+
∂θl∂z_sat,
48+
ᶜlg,
49+
) where {C3}
50+
return buoyancy_gradients(
51+
ebgc,
52+
thermo_params,
53+
moisture_model,
54+
EnvBuoyGradVars(
55+
ts,
56+
projected_vector_buoy_grad_vars(
57+
C3,
58+
∂θv∂z_unsat,
59+
∂qt∂z_sat,
60+
∂θl∂z_sat,
61+
ᶜlg,
62+
),
63+
),
64+
)
65+
end
66+
3767
function buoyancy_gradients(
3868
ebgc::AbstractEnvBuoyGradClosure,
3969
thermo_params,

src/prognostic_equations/gm_sgs_closures.jl

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,12 @@ NVTX.@annotate function compute_gm_mixing_length!(ᶜmixing_length, Y, p)
3636
BuoyGradMean(),
3737
thermo_params,
3838
p.atmos.moisture_model,
39-
EnvBuoyGradVars(
40-
ᶜts,
41-
projected_vector_buoy_grad_vars(
42-
C3,
43-
p.precomputed.ᶜgradᵥ_θ_virt, # ∂θv∂z_unsat
44-
p.precomputed.ᶜgradᵥ_q_tot, # ∂qt∂z_sat
45-
p.precomputed.ᶜgradᵥ_θ_liq_ice, # ∂θl∂z_sat
46-
ᶜlg,
47-
),
48-
),
39+
ᶜts,
40+
C3,
41+
p.precomputed.ᶜgradᵥ_θ_virt, # ∂θv∂z_unsat
42+
p.precomputed.ᶜgradᵥ_q_tot, # ∂qt∂z_sat
43+
p.precomputed.ᶜgradᵥ_θ_liq_ice, # ∂θl∂z_sat
44+
ᶜlg,
4945
)
5046

5147
ᶠu = p.scratch.ᶠtemp_C123

0 commit comments

Comments
 (0)