Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

limit mixing length by z - z_sfc #2164

Merged
merged 1 commit into from
Sep 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading