Skip to content

Commit 0df0c62

Browse files
authored
Merge pull request #4029 from CliMA/sa/fix_vanishing_ar_anomalies
Fix updraft values for vanishing ar
2 parents 70c191f + 504688a commit 0df0c62

File tree

3 files changed

+25
-15
lines changed

3 files changed

+25
-15
lines changed

config/model_configs/prognostic_edmfx_rico_column.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ z_elem: 100
2727
z_stretch: false
2828
perturb_initstate: false
2929
dt: "5secs"
30-
t_end: "12hours"
30+
t_end: "24hours"
3131
dt_save_state_to_disk: "60mins"
3232
toml: [toml/prognostic_edmfx_1M.toml]
3333
netcdf_interpolation_num_points: [8, 8, 100]

reproducibility_tests/ref_counter.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
263
1+
264
22

33
# **README**
44
#
@@ -20,6 +20,9 @@
2020

2121

2222
#=
23+
264
24+
- Allow entrainment and detrainment when updraft area fraction is negligible
25+
2326
263
2427
- Make vertical diffusion of updrafts implicit
2528

src/prognostic_equations/edmfx_entr_detr.jl

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,11 @@ function entrainment(
139139
::PiGroupsEntrainment,
140140
)
141141
FT = eltype(thermo_params)
142-
# Entrainment is not well-defined or should be zero if updraft area is negligible.
142+
entr_inv_tau = CAP.entr_inv_tau(turbconv_params)
143+
# Entrainment is not well-defined if updraft area is negligible.
144+
# Fix at entr_inv_tau to ensure some mixing with the environment.
143145
if ᶜaʲ <= eps(FT)
144-
return 0
146+
return entr_inv_tau
145147
end
146148

147149
elev_above_sfc = ᶜz - z_sfc
@@ -168,7 +170,6 @@ function entrainment(
168170
)
169171

170172
entr_param_vec = CAP.entr_param_vec(turbconv_params)
171-
entr_inv_tau = CAP.entr_inv_tau(turbconv_params)
172173
pi_sum =
173174
entr_param_vec[1] * abs(Π₁) +
174175
entr_param_vec[2] * abs(Π₂) +
@@ -212,10 +213,10 @@ function entrainment(
212213
min_area_limiter_power = CAP.min_area_limiter_power(turbconv_params)
213214
a_min = CAP.min_area(turbconv_params)
214215

215-
# Entrainment is not well-defined or should be zero if updraft area is negligible,
216+
# Entrainment is not well-defined if updraft area is negligible,
216217
# as some limiters depend on ᶜaʲ.
217218
if ᶜaʲ <= eps(FT) && min_area_limiter_scale == FT(0) # If no area and no base min_area_limiter
218-
return 0
219+
return entr_inv_tau
219220
end
220221

221222
min_area_limiter =
@@ -386,12 +387,13 @@ function detrainment(
386387
::PiGroupsDetrainment,
387388
)
388389
FT = eltype(thermo_params)
390+
detr_inv_tau = CAP.detr_inv_tau(turbconv_params)
389391

390-
# If ᶜρaʲ (updraft effective density) is zero or negligible,
391-
# detrainment is considered zero. This also protects division by ᶜρaʲ later.
392+
# If ᶜρaʲ (updraft effective density) is zero or negligible, detrainment is
393+
# considered to be fixed at detr_inv_tau. This also protects division by ᶜρaʲ later.
392394
# This condition implies the updraft area (ᶜaʲ) is also likely negligible.
393395
if ᶜρaʲ <= eps(FT)
394-
return 0
396+
return detr_inv_tau
395397
end
396398

397399
elev_above_sfc = ᶜz - z_sfc
@@ -466,9 +468,10 @@ function detrainment(
466468
max_area_limiter_power = CAP.max_area_limiter_power(turbconv_params)
467469
a_max = CAP.max_area(turbconv_params)
468470

469-
# If ᶜρaʲ (updraft effective density) is zero or negligible, detrainment is zero.
470-
if ᶜρaʲ <= eps(FT) # Consistent check
471-
return 0
471+
# If ᶜρaʲ (updraft effective density) is zero or negligible, detrainment is not well defined.
472+
# Fix at detr_inv_tau to ensure some mixing with the environment.
473+
if ᶜρaʲ <= eps(FT)
474+
return detr_inv_tau
472475
end
473476

474477
max_area_limiter =
@@ -508,8 +511,12 @@ function detrainment(
508511
::SmoothAreaDetrainment,
509512
)
510513
FT = eltype(thermo_params)
511-
# If ᶜρaʲ is negligible or vertical velocity divergence term is non-negative, detrainment is zero.
512-
if (ᶜρaʲ <= eps(FT)) || (ᶜw_vert_div >= 0) # Consistent check for ᶜρaʲ
514+
detr_inv_tau = CAP.detr_inv_tau(turbconv_params)
515+
# If ᶜρaʲ is negligible detrainment is fixed at detr_inv_tau.
516+
if (ᶜρaʲ <= eps(FT)) # Consistent check for ᶜρaʲ
517+
detr = detr_inv_tau
518+
# If vertical velocity divergence term is non-negative detrainment is zero.
519+
elseif (ᶜw_vert_div >= 0)
513520
detr = FT(0)
514521
else
515522
detr = ᶜentr - ᶜw_vert_div

0 commit comments

Comments
 (0)