From eb057e669fe57230f07354c4ebfa3e1a87eacf12 Mon Sep 17 00:00:00 2001 From: Zhaoyi Shen <11598433+szy21@users.noreply.github.com> Date: Tue, 21 Nov 2023 13:30:38 -0800 Subject: [PATCH] change entrainment dt limiter --- src/prognostic_equations/edmfx_entr_detr.jl | 24 +++++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/prognostic_equations/edmfx_entr_detr.jl b/src/prognostic_equations/edmfx_entr_detr.jl index dd1b5aa27e..1a1279e24e 100644 --- a/src/prognostic_equations/edmfx_entr_detr.jl +++ b/src/prognostic_equations/edmfx_entr_detr.jl @@ -80,7 +80,7 @@ function entrainment( abs(ᶜwʲ) / (ᶜz - z_sfc) * ( -4.013288 - 0.000968 * Π₁ + 0.356974 * Π₃ - 0.403124 * Π₄ + 1.503261 * Π₆ ), - 1 / dt, + (1 - ᶜaʲ) / max(ᶜaʲ, eps(FT)) / dt, ), ) @@ -115,9 +115,14 @@ function entrainment( min_area_limiter = min_area_limiter_scale * exp(-min_area_limiter_power * (max(ᶜaʲ, 0) - a_min)) - entr = min( - entr_inv_tau + entr_coeff * abs(ᶜwʲ) / (ᶜz - z_sfc) + min_area_limiter, - 1 / dt, + entr = max( + 0, + min( + entr_inv_tau + + entr_coeff * abs(ᶜwʲ) / (ᶜz - z_sfc) + + min_area_limiter, + (1 - ᶜaʲ) / max(ᶜaʲ, eps(FT)) / dt, + ), ) return entr end @@ -149,9 +154,14 @@ function entrainment( min_area_limiter = min_area_limiter_scale * exp(-min_area_limiter_power * (max(ᶜaʲ, 0) - a_min)) - entr = min( - entr_inv_tau + entr_coeff * abs(ᶜwʲ) / (ᶜz - z_sfc) + min_area_limiter, - 1 / dt, + entr = max( + 0, + min( + entr_inv_tau + + entr_coeff * abs(ᶜwʲ) / (ᶜz - z_sfc) + + min_area_limiter, + (1 - ᶜaʲ) / max(ᶜaʲ, eps(FT)) / dt, + ), ) return entr * FT(2) * hm_limiter(ᶜaʲ) end