Skip to content

Commit

Permalink
Add a threshold for diagnostic edmf updraft velocity
Browse files Browse the repository at this point in the history
  • Loading branch information
szy21 committed Dec 26, 2023
1 parent 573f6fd commit e7856fa
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions src/cache/diagnostic_edmf_precomputed_quantities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,42 @@ function set_diagnostic_edmf_precomputed_quantities_do_integral!(Y, p, t)
ρaʲu³ʲ_dataq_tot / ρaʲu³ʲ_data,
)

# set updraft to grid-mean if vertical velocity is too small
if i > 2
@. ρaʲ_level = ifelse(
(
u³ʲ_data_prev_halflevel * u³ʲ_data_prev_halflevel <
∇Φ³_data_prev_level * (ρʲ_prev_level - ρ_prev_level) / ρʲ_prev_level
),
0,
ρaʲ_level,
)
@. u³ʲ_halflevel = ifelse(
(
u³ʲ_data_prev_halflevel * u³ʲ_data_prev_halflevel <
∇Φ³_data_prev_level * (ρʲ_prev_level - ρ_prev_level) / ρʲ_prev_level
),
u³_halflevel,
u³ʲ_halflevel,
)
@. h_totʲ_level = ifelse(
(
u³ʲ_data_prev_halflevel * u³ʲ_data_prev_halflevel <
∇Φ³_data_prev_level * (ρʲ_prev_level - ρ_prev_level) / ρʲ_prev_level
),
h_tot_level,
h_totʲ_level,
)
@. q_totʲ_level = ifelse(
(
u³ʲ_data_prev_halflevel * u³ʲ_data_prev_halflevel <
∇Φ³_data_prev_level * (ρʲ_prev_level - ρ_prev_level) / ρʲ_prev_level
),
q_tot_level,
q_totʲ_level,
)
end

set_diagnostic_edmfx_draft_quantities_level!(
thermo_params,
Kʲ_level,
Expand Down

0 comments on commit e7856fa

Please sign in to comment.