256256
257257# Interpolates the third contravariant component of Y.c.uₕ to cell faces.
258258function compute_ᶠuₕ³ (ᶜuₕ, ᶜρ)
259+ assert_eltype (ᶜuₕ, Geometry. Covariant12Vector)
259260 ᶜJ = Fields. local_geometry_field (ᶜρ). J
260261 return @. lazy (ᶠwinterp (ᶜρ * ᶜJ, CT3 (ᶜuₕ)))
261262end
@@ -281,10 +282,19 @@ function set_velocity_at_surface!(Y, ᶠuₕ³, turbconv_model)
281282end
282283
283284function surface_velocity (ᶠu₃, ᶠuₕ³)
285+ assert_eltype (ᶠu₃, Geometry. Covariant3Vector)
286+ assert_eltype (ᶠuₕ³, Geometry. Contravariant3Vector)
284287 sfc_u₃ = Fields. level (ᶠu₃. components. data.:1 , half)
285288 sfc_uₕ³ = Fields. level (ᶠuₕ³. components. data.:1 , half)
286289 sfc_g³³ = g³³_field (sfc_u₃)
287- return @. lazy (- sfc_uₕ³ / sfc_g³³) # u³ = uₕ³ + w³ = uₕ³ + w₃ * g³³
290+ w₃ = @. lazy (- sfc_uₕ³ / sfc_g³³) # u³ = uₕ³ + w³ = uₕ³ + w₃ * g³³
291+
292+ # sfc_u₃ = Fields.level(ᶠu₃, half)
293+ # sfc_uₕ³ = Fields.level(ᶠuₕ³, half)
294+ # w₃ = @. lazy(-sfc_uₕ³ / sfc_u₃) # are metric terms automatically applied here?
295+
296+ assert_eltype (w₃, Geometry. Covariant3Vector)
297+ return w₃
288298end
289299
290300"""
313323# This is used to set the grid-scale velocity quantities ᶜu, ᶠu³, ᶜK based on
314324# ᶠu₃, and it is also used to set the SGS quantities based on ᶠu₃⁰ and ᶠu₃ʲ.
315325function set_velocity_quantities! (ᶜu, ᶠu³, ᶜK, ᶠu₃, ᶜuₕ, ᶠuₕ³)
326+ assert_eltype (ᶠu₃, Geometry. Covariant3Vector)
327+ assert_eltype (ᶠuₕ³, Geometry. Contravariant3Vector)
328+ assert_eltype (ᶠu³, Geometry. Contravariant3Vector)
316329 @. ᶜu = C123 (ᶜuₕ) + ᶜinterp (C123 (ᶠu₃))
317330 @. ᶠu³ = ᶠuₕ³ + CT3 (ᶠu₃)
318331 ᶜK .= compute_kinetic (ᶜuₕ, ᶠu₃)
0 commit comments