256
256
257
257
# Interpolates the third contravariant component of Y.c.uₕ to cell faces.
258
258
function compute_ᶠuₕ³ (ᶜuₕ, ᶜρ)
259
+ assert_eltype (ᶜuₕ, Geometry. Covariant12Vector)
259
260
ᶜJ = Fields. local_geometry_field (ᶜρ). J
260
261
return @. lazy (ᶠwinterp (ᶜρ * ᶜJ, CT3 (ᶜuₕ)))
261
262
end
@@ -281,10 +282,19 @@ function set_velocity_at_surface!(Y, ᶠuₕ³, turbconv_model)
281
282
end
282
283
283
284
function surface_velocity (ᶠu₃, ᶠuₕ³)
285
+ assert_eltype (ᶠu₃, Geometry. Covariant3Vector)
286
+ assert_eltype (ᶠuₕ³, Geometry. Contravariant3Vector)
284
287
sfc_u₃ = Fields. level (ᶠu₃. components. data.:1 , half)
285
288
sfc_uₕ³ = Fields. level (ᶠuₕ³. components. data.:1 , half)
286
289
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₃
288
298
end
289
299
290
300
"""
313
323
# This is used to set the grid-scale velocity quantities ᶜu, ᶠu³, ᶜK based on
314
324
# ᶠu₃, and it is also used to set the SGS quantities based on ᶠu₃⁰ and ᶠu₃ʲ.
315
325
function 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)
316
329
@. ᶜu = C123 (ᶜuₕ) + ᶜinterp (C123 (ᶠu₃))
317
330
@. ᶠu³ = ᶠuₕ³ + CT3 (ᶠu₃)
318
331
ᶜK .= compute_kinetic (ᶜuₕ, ᶠu₃)
0 commit comments