@@ -10,14 +10,17 @@ NVTX.@annotate function hyperdiffusion_tendency!(Yₜ, Yₜ_lim, Y, p, t)
10
10
apply_hyperdiffusion_tendency! (Yₜ, Y, p, t)
11
11
end
12
12
13
+ print_dlt (x) = type_depth_limit (stdout , string (typeof (x)); maxtypedepth= 3 )
14
+ print_dlt (:: Type{T} ) where {T} = type_depth_limit (stdout , string (T); maxtypedepth= 3 )
13
15
function type_depth_limit (io:: IO , s:: String ; maxtypedepth:: Union{Nothing, Int} )
14
16
sz = get (io, :displaysize , displaysize (io)):: Tuple{Int, Int}
15
17
return Base. type_depth_limit (s, max (sz[2 ], 120 ); maxdepth = maxtypedepth)
16
18
end
17
19
18
20
function assert_concretized (var)
19
- if var isa Base. AbstractBroadcasted
20
- T_lim = type_depth_limit (stdout , string (typeof (var)); maxtypedepth = 3 )
21
+ val = Operators. getidx (axes (var), var, 1 , (1 ,1 ,1 ))
22
+ if val isa Base. AbstractBroadcasted
23
+ T_lim = type_depth_limit (stdout , string (typeof (val)); maxtypedepth = 3 )
21
24
error (" This should be concretized:\n\n\t $T_lim \n\n " )
22
25
end
23
26
return nothing
@@ -33,13 +36,11 @@ function ᶜremaining_tendency(ᶜY, ᶠY, p, t)
33
36
)
34
37
debug_tendencies = true
35
38
if debug_tendencies
36
- val = Operators. getidx (axes (ᶜY), nt, 1 , (1 ,1 ,1 ))
37
- assert_concretized (val)
38
- :ρ in propertynames (ᶜY) && assert_concretized (val. ρ)
39
- :uₕ in propertynames (ᶜY) && assert_concretized (val. uₕ)
40
- :ρe_tot in propertynames (ᶜY) && assert_concretized (val. ρe_tot)
41
- :ρq_tot in propertynames (ᶜY) && assert_concretized (val. ρq_tot)
42
- :sgsʲs in propertynames (ᶜY) && assert_concretized (val. sgsʲs)
39
+ :ρ in propertynames (ᶜY) && assert_concretized (nt. ρ)
40
+ :uₕ in propertynames (ᶜY) && assert_concretized (nt. uₕ)
41
+ :ρe_tot in propertynames (ᶜY) && assert_concretized (nt. ρe_tot)
42
+ :ρq_tot in propertynames (ᶜY) && assert_concretized (nt. ρq_tot)
43
+ :sgsʲs in propertynames (ᶜY) && assert_concretized (nt. sgsʲs)
43
44
end
44
45
return nt
45
46
end
@@ -50,10 +51,8 @@ function ᶠremaining_tendency(ᶜY, ᶠY, p, t)
50
51
)
51
52
debug_tendencies = true
52
53
if debug_tendencies
53
- val = Operators. getidx (axes (ᶠY), nt, 1 , (1 ,1 ,1 ))
54
- assert_concretized (val)
55
- :u₃ in propertynames (ᶠY) && assert_concretized (val. u₃)
56
- :sgsʲs in propertynames (ᶠY) && assert_concretized (val. sgsʲs)
54
+ :u₃ in propertynames (ᶠY) && assert_concretized (nt. u₃)
55
+ :sgsʲs in propertynames (ᶠY) && assert_concretized (nt. sgsʲs)
57
56
end
58
57
return nt
59
58
end
@@ -69,9 +68,6 @@ function ᶜremaining_tendency_ρ(ᶜY, ᶠY, p, t)
69
68
70
69
if ! (p. atmos. moisture_model isa DryModel)
71
70
ᶜwₜqₜ = compute_ᶜwₜqₜ (ᶜY, ᶠY, p, t)
72
- cmc = CAP. microphysics_cloud_params (p. params)
73
- cmp = CAP. microphysics_1m_params (p. params)
74
- thp = CAP. thermodynamics_params (p. params)
75
71
∑tendencies = lazy .(∑tendencies .- water_adv (ᶜρ, ᶜJ, ᶠJ, ᶜwₜqₜ))
76
72
end
77
73
return (;ρ= ∑tendencies)
@@ -109,7 +105,7 @@ function compute_ᶜts(ᶜY, ᶠY, p, t)
109
105
FT = Spaces. undertype (axes (ᶜY))
110
106
grav = FT (CAP. grav (p. params))
111
107
ᶜΦ = @. lazy (grav * ᶜz)
112
-
108
+
113
109
ᶜρ = ᶜY. ρ
114
110
ᶜuₕ = ᶜY. uₕ
115
111
ᶠuₕ³ = compute_ᶠuₕ³ (ᶜuₕ, ᶜρ)
@@ -155,14 +151,12 @@ function ᶜremaining_tendency_ρe_tot(ᶜY, ᶠY, p, t)
155
151
156
152
if ! (p. atmos. moisture_model isa DryModel)
157
153
ᶜwₕhₜ = compute_ᶜwₕhₜ (ᶜY, ᶠY, p, t)
158
- cmc = CAP. microphysics_cloud_params (p. params)
159
- cmp = CAP. microphysics_1m_params (p. params)
160
- thp = CAP. thermodynamics_params (p. params)
161
154
∑tendencies = lazy .(∑tendencies .- water_adv (ᶜρ, ᶜJ, ᶠJ, ᶜwₕhₜ))
162
155
# @show "test 1"
163
156
end
164
157
if energy_upwinding != Val (:none )
165
158
# @show energy_upwinding
159
+ # error("Done")
166
160
# @show "test 2"
167
161
(; dt) = p
168
162
ᶠu³ = compute_ᶠu³ (ᶜY, ᶠY)
@@ -175,11 +169,31 @@ function ᶜremaining_tendency_ρe_tot(ᶜY, ᶠY, p, t)
175
169
# @. _ᶠu₃_with_bcs = ifelse(iszero(ᶠz), sfc_u₃, ᶠY.u₃)
176
170
# ᶠu₃_with_bcs = @. lazy(ifelse(ᶠz==0, sfc_u₃, ᶠY.u₃))
177
171
# @show Base.materialize(ᶠu₃_with_bcs)
172
+ # _ᶠu³ = Base.materialize(ᶠu³)
173
+ _ᶠu³ = ᶠu³ # works!
174
+ # _ᶜh_tot = Base.materialize(ᶜh_tot)
175
+ _ᶜh_tot = ᶜh_tot # results in `Killed: 9` (seg fault?)
178
176
179
177
# return @. lazy(ᶠuₕ³ + CT3(ᶠu₃))
180
- vtt = vertical_transport (ᶜρ, ᶠu³, ᶜh_tot, float (dt), energy_upwinding)
181
- # @show vtt
182
- @show Base. materialize (vtt)
178
+ vtt = vertical_transport (ᶜρ, _ᶠu³, _ᶜh_tot, float (dt), energy_upwinding)
179
+ # # @show vtt
180
+ # ᶠuₕ³ = compute_ᶠuₕ³(ᶜuₕ, ᶜρ)
181
+ # ᶠu₃_with_bcs = compute_ᶠu₃_with_bcs(ᶠY.u₃, ᶠuₕ³)
182
+ # # @show print_dlt(Base.materialize(ᶠuₕ³))
183
+ # # @show print_dlt(Base.materialize(ᶠu₃_with_bcs))
184
+ # # @show print_dlt(Base.materialize(ᶠu³))
185
+ # @show print_dlt(eltype(_ᶠu³))
186
+ # @show print_dlt(eltype(ᶜh_tot))
187
+ # @show print_dlt(eltype(_ᶜh_tot))
188
+ # @show print_dlt(eltype(vtt))
189
+ # val = Operators.getidx(axes(ᶜY), vtt, 1, (1,1,1))
190
+ # if val isa Base.AbstractBroadcasted
191
+ # error("getidx of the input is a broadcasted.")
192
+ # else
193
+ # @show print_dlt(val)
194
+ # end
195
+ # error("Done")
196
+
183
197
∑tendencies = lazy .(∑tendencies .+ vtt) # problematic
184
198
vtt_central = vertical_transport (ᶜρ, ᶠu³, ᶜh_tot, float (dt), Val (:none ))
185
199
# need to improve NullBroadcast support for this.
0 commit comments