@@ -360,7 +360,7 @@ NVTX.@annotate function set_prognostic_edmf_precomputed_quantities_explicit_clos
360360
361361 (; params) = p
362362 (; dt) = p
363- (; ᶠgradᵥ_ᶜΦ) = p. core
363+ (; ᶠgradᵥ_ᶜΦ, ᶜgradᵥ_ᶠΦ ) = p. core
364364 thermo_params = CAP. thermodynamics_params (params)
365365 turbconv_params = CAP. turbconv_params (params)
366366
@@ -410,7 +410,7 @@ NVTX.@annotate function set_prognostic_edmf_precomputed_quantities_explicit_clos
410410 draft_area (Y. c. sgsʲs.:($$ j). ρa, ᶜρʲs.:($$ j)),
411411 get_physical_w (ᶜuʲs.:($$ j), ᶜlg),
412412 TD. relative_humidity (thermo_params, ᶜtsʲs.:($$ j)),
413- ᶜphysical_buoyancy (thermo_params, Y. c. ρ, ᶜρʲs.:($$ j)),
413+ vertical_buoyancy_acceleration ( Y. c. ρ, ᶜρʲs.:($$ j), ᶜgradᵥ_ᶠΦ, ᶜlg ),
414414 get_physical_w (ᶜu, ᶜlg),
415415 TD. relative_humidity (thermo_params, ᶜts⁰),
416416 FT (0 ),
@@ -447,7 +447,7 @@ NVTX.@annotate function set_prognostic_edmf_precomputed_quantities_explicit_clos
447447 draft_area (Y. c. sgsʲs.:($$ j). ρa, ᶜρʲs.:($$ j)),
448448 get_physical_w (ᶜuʲs.:($$ j), ᶜlg),
449449 TD. relative_humidity (thermo_params, ᶜtsʲs.:($$ j)),
450- ᶜphysical_buoyancy (thermo_params, Y. c. ρ, ᶜρʲs.:($$ j)),
450+ vertical_buoyancy_acceleration ( Y. c. ρ, ᶜρʲs.:($$ j), ᶜgradᵥ_ᶠΦ, ᶜlg ),
451451 get_physical_w (ᶜu, ᶜlg),
452452 TD. relative_humidity (thermo_params, ᶜts⁰),
453453 FT (0 ),
@@ -471,7 +471,7 @@ NVTX.@annotate function set_prognostic_edmf_precomputed_quantities_explicit_clos
471471 # term is still calculated here as it is used explicitly in the TKE equation.
472472 @. ᶠnh_pressure₃_buoyʲs.:($$ j) = ᶠupdraft_nh_pressure_buoyancy (
473473 params,
474- ᶠbuoyancy (ᶠinterp (Y. c. ρ), ᶠinterp (ᶜρʲs.:($$ j)), ᶠgradᵥ_ᶜΦ),
474+ buoyancy (ᶠinterp (Y. c. ρ), ᶠinterp (ᶜρʲs.:($$ j)), ᶠgradᵥ_ᶜΦ),
475475 )
476476 end
477477
@@ -493,6 +493,7 @@ NVTX.@annotate function set_prognostic_edmf_precomputed_quantities_explicit_clos
493493 ᶜlg,
494494 )
495495
496+ # TODO : Make strain_rate_norm calculation a function in eddy_diffusion_closures
496497 # TODO : Currently the shear production only includes vertical gradients
497498 ᶠu⁰ = p. scratch. ᶠtemp_C123
498499 @. ᶠu⁰ = C123 (ᶠinterp (Y. c. uₕ)) + C123 (ᶠu³⁰)
@@ -532,23 +533,18 @@ NVTX.@annotate function set_prognostic_edmf_precomputed_quantities_explicit_clos
532533
533534 @. ᶜmixing_length = ᶜmixing_length_tuple. master
534535
535- turbconv_params = CAP. turbconv_params (params)
536- c_m = CAP. tke_ed_coeff (turbconv_params)
537- @. ᶜK_u = c_m * ᶜmixing_length * sqrt (max (ᶜtke⁰, 0 ))
538- @. ᶜK_h = ᶜK_u / ᶜprandtl_nvec
536+ @. ᶜK_u = eddy_viscosity (turbconv_params, ᶜtke⁰, ᶜmixing_length)
537+ @. ᶜK_h = eddy_diffusivity (ᶜK_u, ᶜprandtl_nvec)
539538
540539 ρatke_flux_values = Fields. field_values (ρatke_flux)
541- ρ_int_values = Fields. field_values (Fields. level (ᶜρa⁰, 1 ))
542- u_int_values = Fields. field_values (Fields. level (ᶜu, 1 ))
540+ ρa_sfc_values = Fields. field_values (Fields. level (ᶜρa⁰, 1 )) # TODO : replace by surface value
543541 ustar_values = Fields. field_values (ustar)
544- int_local_geometry_values =
545- Fields. field_values (Fields. level (Fields. local_geometry_field (Y. c), 1 ))
546542 sfc_local_geometry_values = Fields. field_values (
547543 Fields. level (Fields. local_geometry_field (Y. f), half),
548544 )
549545 @. ρatke_flux_values = surface_flux_tke (
550546 turbconv_params,
551- ρ_int_values ,
547+ ρa_sfc_values ,
552548 ustar_values,
553549 sfc_local_geometry_values,
554550 )
0 commit comments