@@ -25,27 +25,31 @@ NVTX.@annotate function set_prognostic_edmf_precomputed_quantities_environment!(
25
25
(; ᶜtke⁰, ᶜρa⁰, ᶠu₃⁰, ᶜu⁰, ᶠu³⁰, ᶜK⁰, ᶜts⁰, ᶜρ⁰, ᶜmse⁰, ᶜq_tot⁰) =
26
26
p. precomputed
27
27
28
- @. ᶜρa⁰ = ρa⁰ (Y. c)
29
- @. ᶜtke⁰ = divide_by_ρa (Y. c. sgs⁰. ρatke, ᶜρa⁰, 0 , Y. c. ρ, turbconv_model)
30
- @. ᶜmse⁰ = divide_by_ρa (
31
- Y. c. ρ * (ᶜh_tot - ᶜK) - ρamse⁺ (Y. c. sgsʲs),
32
- ᶜρa⁰,
33
- Y. c. ρ * (ᶜh_tot - ᶜK),
34
- Y. c. ρ,
35
- turbconv_model,
36
- )
37
- @. ᶜq_tot⁰ = divide_by_ρa (
38
- Y. c. ρq_tot - ρaq_tot⁺ (Y. c. sgsʲs),
39
- ᶜρa⁰,
40
- Y. c. ρq_tot,
41
- Y. c. ρ,
42
- turbconv_model,
43
- )
28
+ @fused_direct begin
29
+ @. ᶜρa⁰ = ρa⁰ (Y. c)
30
+ @. ᶜtke⁰ = divide_by_ρa (Y. c. sgs⁰. ρatke, ᶜρa⁰, 0 , Y. c. ρ, turbconv_model)
31
+ @. ᶜmse⁰ = divide_by_ρa (
32
+ Y. c. ρ * (ᶜh_tot - ᶜK) - ρamse⁺ (Y. c. sgsʲs),
33
+ ᶜρa⁰,
34
+ Y. c. ρ * (ᶜh_tot - ᶜK),
35
+ Y. c. ρ,
36
+ turbconv_model,
37
+ )
38
+ @. ᶜq_tot⁰ = divide_by_ρa (
39
+ Y. c. ρq_tot - ρaq_tot⁺ (Y. c. sgsʲs),
40
+ ᶜρa⁰,
41
+ Y. c. ρq_tot,
42
+ Y. c. ρ,
43
+ turbconv_model,
44
+ )
45
+ end
44
46
set_sgs_ᶠu₃! (u₃⁰, ᶠu₃⁰, Y, turbconv_model)
45
47
set_velocity_quantities! (ᶜu⁰, ᶠu³⁰, ᶜK⁰, ᶠu₃⁰, Y. c. uₕ, ᶠuₕ³)
46
48
# @. ᶜK⁰ += ᶜtke⁰
47
- @. ᶜts⁰ = TD. PhaseEquil_phq (thermo_params, ᶜp, ᶜmse⁰ - ᶜΦ, ᶜq_tot⁰)
48
- @. ᶜρ⁰ = TD. air_density (thermo_params, ᶜts⁰)
49
+ @fused_direct begin
50
+ @. ᶜts⁰ = TD. PhaseEquil_phq (thermo_params, ᶜp, ᶜmse⁰ - ᶜΦ, ᶜq_tot⁰)
51
+ @. ᶜρ⁰ = TD. air_density (thermo_params, ᶜts⁰)
52
+ end
49
53
return nothing
50
54
end
51
55
@@ -90,8 +94,10 @@ NVTX.@annotate function set_prognostic_edmf_precomputed_quantities_draft_and_bc!
90
94
91
95
set_velocity_quantities! (ᶜuʲ, ᶠu³ʲ, ᶜKʲ, ᶠu₃ʲ, Y. c. uₕ, ᶠuₕ³)
92
96
@. ᶠKᵥʲ = (adjoint (CT3 (ᶠu₃ʲ)) * ᶠu₃ʲ) / 2
93
- @. ᶜtsʲ = TD. PhaseEquil_phq (thermo_params, ᶜp, ᶜmseʲ - ᶜΦ, ᶜq_totʲ)
94
- @. ᶜρʲ = TD. air_density (thermo_params, ᶜtsʲ)
97
+ @fused_direct begin
98
+ @. ᶜtsʲ = TD. PhaseEquil_phq (thermo_params, ᶜp, ᶜmseʲ - ᶜΦ, ᶜq_totʲ)
99
+ @. ᶜρʲ = TD. air_density (thermo_params, ᶜtsʲ)
100
+ end
95
101
96
102
# EDMFX boundary condition:
97
103
@@ -324,12 +330,14 @@ NVTX.@annotate function set_prognostic_edmf_precomputed_quantities_closures!(
324
330
ᶜtke_exch,
325
331
)
326
332
327
- @. ᶜmixing_length = ᶜmixing_length_tuple. master
328
333
329
334
turbconv_params = CAP. turbconv_params (params)
330
335
c_m = CAP. tke_ed_coeff (turbconv_params)
331
- @. ᶜK_u = c_m * ᶜmixing_length * sqrt (max (ᶜtke⁰, 0 ))
332
- @. ᶜK_h = ᶜK_u / ᶜprandtl_nvec
336
+ @fused_direct begin
337
+ @. ᶜmixing_length = ᶜmixing_length_tuple. master
338
+ @. ᶜK_u = c_m * ᶜmixing_length * sqrt (max (ᶜtke⁰, 0 ))
339
+ @. ᶜK_h = ᶜK_u / ᶜprandtl_nvec
340
+ end
333
341
334
342
ρatke_flux_values = Fields. field_values (ρatke_flux)
335
343
ρ_int_values = Fields. field_values (Fields. level (ᶜρa⁰, 1 ))
0 commit comments