@@ -10,14 +10,17 @@ NVTX.@annotate function hyperdiffusion_tendency!(Yₜ, Yₜ_lim, Y, p, t)
1010 apply_hyperdiffusion_tendency! (Yₜ, Y, p, t)
1111end
1212
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 )
1315function type_depth_limit (io:: IO , s:: String ; maxtypedepth:: Union{Nothing, Int} )
1416 sz = get (io, :displaysize , displaysize (io)):: Tuple{Int, Int}
1517 return Base. type_depth_limit (s, max (sz[2 ], 120 ); maxdepth = maxtypedepth)
1618end
1719
1820function 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 )
2124 error (" This should be concretized:\n\n\t $T_lim \n\n " )
2225 end
2326 return nothing
@@ -33,13 +36,11 @@ function ᶜremaining_tendency(ᶜY, ᶠY, p, t)
3336 )
3437 debug_tendencies = true
3538 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)
4344 end
4445 return nt
4546end
@@ -50,10 +51,8 @@ function ᶠremaining_tendency(ᶜY, ᶠY, p, t)
5051 )
5152 debug_tendencies = true
5253 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)
5756 end
5857 return nt
5958end
@@ -69,9 +68,6 @@ function ᶜremaining_tendency_ρ(ᶜY, ᶠY, p, t)
6968
7069 if ! (p. atmos. moisture_model isa DryModel)
7170 ᶜ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)
7571 ∑tendencies = lazy .(∑tendencies .- water_adv (ᶜρ, ᶜJ, ᶠJ, ᶜwₜqₜ))
7672 end
7773 return (;ρ= ∑tendencies)
@@ -109,7 +105,7 @@ function compute_ᶜts(ᶜY, ᶠY, p, t)
109105 FT = Spaces. undertype (axes (ᶜY))
110106 grav = FT (CAP. grav (p. params))
111107 ᶜΦ = @. lazy (grav * ᶜz)
112-
108+
113109 ᶜρ = ᶜY. ρ
114110 ᶜuₕ = ᶜY. uₕ
115111 ᶠuₕ³ = compute_ᶠuₕ³ (ᶜuₕ, ᶜρ)
@@ -155,14 +151,12 @@ function ᶜremaining_tendency_ρe_tot(ᶜY, ᶠY, p, t)
155151
156152 if ! (p. atmos. moisture_model isa DryModel)
157153 ᶜ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)
161154 ∑tendencies = lazy .(∑tendencies .- water_adv (ᶜρ, ᶜJ, ᶠJ, ᶜwₕhₜ))
162155 # @show "test 1"
163156 end
164157 if energy_upwinding != Val (:none )
165158 # @show energy_upwinding
159+ # error("Done")
166160 # @show "test 2"
167161 (; dt) = p
168162 ᶠu³ = compute_ᶠu³ (ᶜY, ᶠY)
@@ -175,11 +169,31 @@ function ᶜremaining_tendency_ρe_tot(ᶜY, ᶠY, p, t)
175169 # @. _ᶠu₃_with_bcs = ifelse(iszero(ᶠz), sfc_u₃, ᶠY.u₃)
176170 # ᶠu₃_with_bcs = @. lazy(ifelse(ᶠz==0, sfc_u₃, ᶠY.u₃))
177171 # @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?)
178176
179177 # 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+
183197 ∑tendencies = lazy .(∑tendencies .+ vtt) # problematic
184198 vtt_central = vertical_transport (ᶜρ, ᶠu³, ᶜh_tot, float (dt), Val (:none ))
185199 # need to improve NullBroadcast support for this.
0 commit comments