@@ -164,6 +164,30 @@ NVTX.@annotate function horizontal_tracer_advection_tendency!(Yₜ, Y, p, t)
164164 return nothing
165165end
166166
167+ """
168+ ᶜρq_tot_vertical_transport_bc(flow, thermo_params, t, ᶠu³)
169+
170+ Computes the vertical transport of `ρq_tot` at the surface due to prescribed flow.
171+
172+ If the flow is not prescribed, this has no effect.
173+
174+ # Arguments
175+ - `flow`: The prescribed flow model, see [`PrescribedFlow`](@ref).
176+ - If `flow` is `nothing`, this has no effect.
177+ - `thermo_params`: The thermodynamic parameters, needed to compute surface air density.
178+ - `t`: The current time.
179+ - `ᶠu³`: The vertical velocity field.
180+
181+ # Returns
182+ - The vertical transport of `ρq_tot` at the surface due to prescribed flow.
183+ """
184+ ᶜρq_tot_vertical_transport_bc (:: Nothing , _, _, _) = NullBroadcasted ()
185+ function ᶜρq_tot_vertical_transport_bc (flow:: PrescribedFlow , thermo_params, t, ᶠu³)
186+ ρu₃qₜ_sfc_bc = get_ρu₃qₜ_surface (flow, thermo_params, t)
187+ ᶜadvdivᵥ = Operators. DivergenceF2C (; bottom = Operators. SetValue (ρu₃qₜ_sfc_bc))
188+ return @. lazy (- (ᶜadvdivᵥ (zero (ᶠu³))))
189+ end
190+
167191"""
168192 explicit_vertical_advection_tendency!(Yₜ, Y, p, t)
169193
@@ -193,7 +217,7 @@ Modifies `Yₜ.c` (various tracers, `ρe_tot`, `ρq_tot`, `uₕ`), `Yₜ.f.u₃`
193217`Yₜ.f.sgsʲs` (updraft `u₃`), and `Yₜ.c.sgs⁰.ρatke` as applicable.
194218"""
195219NVTX. @annotate function explicit_vertical_advection_tendency! (Yₜ, Y, p, t)
196- (; turbconv_model) = p. atmos
220+ (; turbconv_model, prescribed_flow ) = p. atmos
197221 n = n_prognostic_mass_flux_subdomains (turbconv_model)
198222 advect_tke = use_prognostic_tke (turbconv_model)
199223 point_type = eltype (Fields. coordinate_field (Y. c))
@@ -289,7 +313,11 @@ NVTX.@annotate function explicit_vertical_advection_tendency!(Yₜ, Y, p, t)
289313 ᶜq_tot = @. lazy (specific (Y. c. ρq_tot, Y. c. ρ))
290314 vtt = vertical_transport (ᶜρ, ᶠu³, ᶜq_tot, FT (dt), energy_q_tot_upwinding)
291315 vtt_central = vertical_transport (ᶜρ, ᶠu³, ᶜq_tot, FT (dt), Val (:none ))
292- @. Yₜ. c. ρq_tot += vtt - vtt_central
316+ vtt_bc = ᶜρq_tot_vertical_transport_bc (prescribed_flow, thermo_params, t, ᶠu³)
317+ if prescribed_flow isa PrescribedFlow
318+ vtt_central = NullBroadcasted () # turn off implicit advection
319+ end
320+ @. Yₜ. c. ρq_tot += vtt - vtt_central + vtt_bc
293321 end
294322
295323 if isnothing (ᶠf¹²)
0 commit comments