Skip to content

Commit

Permalink
Merge #2164
Browse files Browse the repository at this point in the history
2164: limit mixing length by z - z_sfc r=szy21 a=szy21



Co-authored-by: Zhaoyi Shen <11598433+szy21@users.noreply.github.com>
  • Loading branch information
bors[bot] and szy21 authored Sep 28, 2023
2 parents bac0b76 + a28d86a commit fbd3d12
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/prognostic_equations/edmfx_closures.jl
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,12 @@ function mixing_length(
c_d = TCP.tke_diss_coeff(turbconv_params)
smin_ub = TCP.smin_ub(turbconv_params)
smin_rm = TCP.smin_rm(turbconv_params)
l_max = TCP.l_max(turbconv_params)
c_b = TCP.static_stab_coeff(turbconv_params)
vkc = TCP.von_karman_const(turbconv_params)

# compute the maximum mixing length at height z
l_z = ᶜz - z_sfc

# compute the l_W - the wall constraint mixing length
# which imposes an upper limit on the size of eddies near the surface
# kz scale (surface layer)
Expand Down Expand Up @@ -210,9 +212,9 @@ function mixing_length(
# compute l_N - the effective static stability length scale.
N_eff = sqrt(max(ᶜlinear_buoygrad, 0))
if N_eff > 0.0
l_N = min(sqrt(max(c_b * ᶜtke, 0)) / N_eff, l_max)
l_N = min(sqrt(max(c_b * ᶜtke, 0)) / N_eff, l_z)
else
l_N = l_max
l_N = l_z
end

# compute l_smag - the Smagorinsky length scale.
Expand All @@ -228,9 +230,9 @@ function mixing_length(

# add limiters
l = SA.SVector(
(l_N < eps(FT) || l_N > l_max) ? l_max : l_N,
(l_TKE < eps(FT) || l_TKE > l_max) ? l_max : l_TKE,
(l_W < eps(FT) || l_W > l_max) ? l_max : l_W,
(l_N < eps(FT) || l_N > l_z) ? l_z : l_N,
(l_TKE < eps(FT) || l_TKE > l_z) ? l_z : l_TKE,
(l_W < eps(FT) || l_W > l_z) ? l_z : l_W,
)
# get soft minimum
# TODO: limit it with l_smag
Expand Down

0 comments on commit fbd3d12

Please sign in to comment.