Skip to content

Commit

Permalink
limit mixing length by z - z_sfc
Browse files Browse the repository at this point in the history
  • Loading branch information
szy21 committed Sep 28, 2023
1 parent bac0b76 commit 9396eb8
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,9 +176,11 @@ 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
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 9396eb8

Please sign in to comment.