Skip to content

Commit 9a932f8

Browse files
committed
use the correct a_m in mixing length
1 parent bdfa8c0 commit 9a932f8

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

src/parameters/Parameters.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ Base.@kwdef struct ClimaAtmosParameters{
120120
α_hyperdiff_tracer::FT
121121
# Vertical diffusion
122122
α_vert_diff_tracer::FT
123-
# Gryanik b_m coefficient
123+
# Gryanik coefficient
124+
coeff_a_m_gryanik::FT
124125
coeff_b_m_gryanik::FT
125126
end
126127

@@ -150,8 +151,9 @@ von_karman_const(ps::ACAP) =
150151

151152
# ------ MOST (Monin–Obukhov) stability-function coefficients ------
152153

153-
# Gryanik b_m
154+
# Gryanik
154155
# needed because surface_fluxes_params defaults to BusingerParams
156+
coefficient_a_m_gryanik(ps::ACAP) = ps.coeff_a_m_gryanik
155157
coefficient_b_m_gryanik(ps::ACAP) = ps.coeff_b_m_gryanik
156158

157159
# Insolation parameters

src/parameters/create_parameters.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ function ClimaAtmosParameters(
4242
SurfaceFluxesParameters(toml_dict, UF.BusingerParams)
4343
SFP = typeof(surface_fluxes_params)
4444

45-
# Fetch Gryanik b_m coefficient (since surface_fluxes_params defaults to BusingerParams)
45+
# Fetch Gryanik coefficients (since surface_fluxes_params defaults to BusingerParams)
46+
coeff_a_m_gryanik_val = UF.GryanikParams(FT).a_m
4647
coeff_b_m_gryanik_val = UF.GryanikParams(FT).b_m
4748

4849
surface_temp_params = SurfaceTemperatureParameters(toml_dict)
@@ -110,6 +111,7 @@ function ClimaAtmosParameters(
110111
surface_temp_params,
111112
vert_diff_params,
112113
external_forcing_params,
114+
coeff_a_m_gryanik = coeff_a_m_gryanik_val,
113115
coeff_b_m_gryanik = coeff_b_m_gryanik_val,
114116
)
115117
end

src/prognostic_equations/eddy_diffusion_closures.jl

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,8 @@ function mixing_length_lopez_gomez_2020(
309309
# MOST stability function coefficients
310310
most_a_m = sf_params.ufp.a_m # Businger a_m
311311
most_b_m = sf_params.ufp.b_m # Businger b_m
312-
most_g_m = CAP.coefficient_b_m_gryanik(params) # Gryanik b_m
312+
gryanik_a_m = CAP.coefficient_a_m_gryanik(params) # Gryanik a_m
313+
gryanik_b_m = CAP.coefficient_b_m_gryanik(params) # Gryanik b_m
313314

314315
# l_z: Geometric distance from the surface
315316
l_z = ᶜz - z_sfc
@@ -359,16 +360,14 @@ function mixing_length_lopez_gomez_2020(
359360
zeta = l_z / obukhov_len_safe_stable # zeta >= 0
360361

361362
# Stable/neutral-regime correction after Gryanik (2020):
362-
# φ_m = 1 + a_m ζ / (1 + g_m ζ)^(2/3),
363+
# φ_m = 1 + a_m ζ / (1 + b_m ζ)^(2/3),
363364
# a nonlinear refinement to the Businger formulation.
364-
phi_m_denom_term = (1 + most_g_m * zeta)
365+
# Optimization: (1+b_m*ζ)^(2/3) -> cbrt((1+b_m*ζ)^2)
365366
# Guard against a negative base in the fractional power
366-
# (theoretically impossible for ζ ≥ 0 and g_m > 0, retained for robustness).
367-
phi_m_denom_cubed_sqrt = cbrt(phi_m_denom_term)
368-
phi_m_denom =
369-
max(phi_m_denom_cubed_sqrt * phi_m_denom_cubed_sqrt, eps_FT) # (val)^(2/3)
367+
# (theoretically impossible for ζ ≥ 0 and b_m > 0, retained for robustness).
368+
phi_m_denom = max(cbrt((1 + gryanik_b_m * zeta)^2), eps_FT)
370369

371-
phi_m = 1 + (most_a_m * zeta) / phi_m_denom
370+
phi_m = 1 + (gryanik_a_m * zeta) / phi_m_denom
372371

373372
# Stable-regime correction factor: 1 / φ_m.
374373
# phi_m should be >= 1 for stable/neutral

0 commit comments

Comments
 (0)