@@ -10,9 +10,81 @@ NVTX.@annotate function hyperdiffusion_tendency!(Yₜ, Yₜ_lim, Y, p, t)
1010 apply_hyperdiffusion_tendency! (Yₜ, Y, p, t)
1111end
1212
13+ prognostic_nt (:: Val{names} , tends... ) where {names} =
14+ NamedTuple {names} (tends)
15+
16+ function ᶜremaining_tendency (ᶜY, ᶠY, p, t)
17+ names = propertynames (ᶜY)
18+ tends = (
19+ ᶜremaining_tendency_ρ (ᶜY, ᶠY, p, t)... ,
20+ ᶜremaining_tendency_uₕ (ᶜY, ᶠY, p, t)... ,
21+ ᶜremaining_tendency_ρe_tot (ᶜY, ᶠY, p, t)... ,
22+ ᶜremaining_tendency_ρq_tot (ᶜY, ᶠY, p, t)... ,
23+ ᶜremaining_tendency_sgsʲs (ᶜY, ᶠY, p, t)... ,
24+ )
25+ return lazy .(prognostic_nt .(Val (names), tends... ))
26+ end
27+ function ᶠremaining_tendency (ᶜY, ᶠY, p, t)
28+ names = propertynames (ᶠY)
29+ tends = (
30+ ᶠremaining_tendency_u₃ (ᶜY, ᶠY, p, t)... ,
31+ ᶠremaining_tendency_sgsʲs (ᶜY, ᶠY, p, t)... ,
32+ )
33+ return lazy .(prognostic_nt .(Val (names), tends... ))
34+ end
35+
36+ function ᶜremaining_tendency_ρ (ᶜY, ᶠY, p, t)
37+ :ρ in propertynames (ᶜY) || return ()
38+ ∑tendencies = zero (eltype (ᶜY. ρ))
39+ return (;ρ= ∑tendencies)
40+ end
41+ function ᶜremaining_tendency_uₕ (ᶜY, ᶠY, p, t)
42+ :uₕ in propertynames (ᶜY) || return ()
43+ ∑tendencies = zero (eltype (ᶜY. uₕ))
44+ return (;uₕ= ∑tendencies)
45+ end
46+ function ᶜremaining_tendency_ρe_tot (ᶜY, ᶠY, p, t)
47+ :ρe_tot in propertynames (ᶜY) || return ()
48+ ∑tendencies = zero (eltype (ᶜY. ρe_tot))
49+ return (;ρe_tot= ∑tendencies)
50+ end
51+ function ᶜremaining_tendency_ρq_tot (ᶜY, ᶠY, p, t)
52+ :ρq_tot in propertynames (ᶜY) || return ()
53+ ∑tendencies = zero (eltype (ᶜY. ρq_tot))
54+ return (;ρq_tot= ∑tendencies)
55+ end
56+ function ᶜremaining_tendency_sgsʲs (ᶜY, ᶠY, p, t)
57+ :sgsʲs in propertynames (ᶜY) || return ()
58+ ∑tendencies = zero (eltype (ᶜY. sgsʲs))
59+ return (;sgsʲs= ∑tendencies)
60+ end
61+ function ᶠremaining_tendency_u₃ (ᶜY, ᶠY, p, t)
62+ :u₃ in propertynames (ᶠY) || return ()
63+ ∑tendencies = zero (eltype (ᶠY. u₃))
64+ return (;u₃= ∑tendencies)
65+ end
66+ function ᶠremaining_tendency_sgsʲs (ᶜY, ᶠY, p, t)
67+ :sgsʲs in propertynames (ᶠY) || return ()
68+ ∑tendencies = zero (eltype (ᶠY. sgsʲs))
69+ return (;sgsʲs= ∑tendencies)
70+ end
71+
72+
1373NVTX. @annotate function remaining_tendency! (Yₜ, Yₜ_lim, Y, p, t)
1474 Yₜ_lim .= zero (eltype (Yₜ_lim))
15- Yₜ .= zero (eltype (Yₜ))
75+ device = ClimaComms. device (axes (Y. c))
76+ p_kernel = (;)
77+ Operators. columnwise! (
78+ device,
79+ ᶜremaining_tendency,
80+ ᶠremaining_tendency,
81+ Yₜ. c,
82+ Yₜ. f,
83+ Y. c,
84+ Y. f,
85+ p_kernel,
86+ t,
87+ )
1688 horizontal_tracer_advection_tendency! (Yₜ_lim, Y, p, t)
1789 fill_with_nans! (p)
1890 horizontal_advection_tendency! (Yₜ, Y, p, t)
0 commit comments