Skip to content

Commit

Permalink
modify constant area detrainment
Browse files Browse the repository at this point in the history
  • Loading branch information
szy21 committed Nov 22, 2024
1 parent 5f3da9f commit 305f977
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 14 deletions.
6 changes: 3 additions & 3 deletions config/model_configs/prognostic_edmfx_bomex_column.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ edmf_coriolis: "Bomex"
ls_adv: "Bomex"
surface_setup: "Bomex"
turbconv: "prognostic_edmfx"
implicit_diffusion: true
implicit_diffusion: false
implicit_sgs_advection: false
approximate_linear_solve_iters: 2
edmfx_upwinding: first_order
edmfx_entr_model: "Generalized"
edmfx_detr_model: "Generalized"
edmfx_detr_model: "ConstantArea"
edmfx_sgs_mass_flux: true
edmfx_sgs_diffusive_flux: true
edmfx_nh_pressure: true
edmfx_filter: true
prognostic_tke: true
prognostic_tke: false
moist: "equil"
cloud_model: "quadrature_sgs"
call_cloud_diagnostics_per_stage: true
Expand Down
11 changes: 5 additions & 6 deletions config/model_configs/prognostic_edmfx_simpleplume_column.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
initial_condition: "SimplePlume"
surface_setup: "SimplePlume"
turbconv: "prognostic_edmfx"
implicit_diffusion: true
implicit_sgs_advection: true
implicit_diffusion: false
implicit_sgs_advection: false
approximate_linear_solve_iters: 2
max_newton_iters_ode: 3
zero_tendency: "grid_scale"
edmfx_upwinding: first_order
edmfx_entr_model: "Generalized"
edmfx_detr_model: "Generalized"
edmfx_detr_model: "ConstantArea"
edmfx_sgs_mass_flux: false
edmfx_sgs_diffusive_flux: false
edmfx_nh_pressure: true
Expand All @@ -19,10 +18,10 @@ cloud_model: "quadrature_sgs"
call_cloud_diagnostics_per_stage: true
config: "column"
z_max: 4e3
z_elem: 80
z_elem: 40
z_stretch: false
perturb_initstate: false
dt: 20secs"
dt: 30secs"
t_end: "12hours"
dt_save_state_to_disk: "10mins"
toml: [toml/prognostic_edmfx_simpleplume.toml]
Expand Down
1 change: 1 addition & 0 deletions src/cache/diagnostic_edmf_precomputed_quantities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,7 @@ NVTX.@annotate function set_diagnostic_edmf_precomputed_quantities_do_integral!(
entrʲ_prev_level,
vert_div_level,
FT(0), # mass flux divergence is not implemented for diagnostic edmf
FT(0), # w divergence is not implemented for diagnostic edmf
tke_prev_level,
p.atmos.edmfx_model.detr_model,
)
Expand Down
3 changes: 3 additions & 0 deletions src/cache/prognostic_edmf_precomputed_quantities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ NVTX.@annotate function set_prognostic_edmf_precomputed_quantities_closures!(

ᶜvert_div = p.scratch.ᶜtemp_scalar
ᶜmassflux_vert_div = p.scratch.ᶜtemp_scalar_2
ᶜw_vert_div = p.scratch.ᶜtemp_scalar_3
for j in 1:n
# entrainment/detrainment
@. ᶜentrʲs.:($$j) = entrainment(
Expand Down Expand Up @@ -252,6 +253,7 @@ NVTX.@annotate function set_prognostic_edmf_precomputed_quantities_closures!(
@. ᶜvert_div = ᶜdivᵥ(ᶠinterp(ᶜρʲs.:($$j)) * ᶠu³ʲs.:($$j)) / ᶜρʲs.:($$j)
@. ᶜmassflux_vert_div =
ᶜdivᵥ(ᶠinterp(Y.c.sgsʲs.:($$j).ρa) * ᶠu³ʲs.:($$j))
@. ᶜw_vert_div = ᶜdivᵥ(ᶠu³ʲs.:($$j))
@. ᶜdetrʲs.:($$j) = detrainment(
thermo_params,
turbconv_params,
Expand All @@ -270,6 +272,7 @@ NVTX.@annotate function set_prognostic_edmf_precomputed_quantities_closures!(
ᶜentrʲs.:($$j),
ᶜvert_div,
ᶜmassflux_vert_div,
ᶜw_vert_div,
ᶜtke⁰,
p.atmos.edmfx_model.detr_model,
)
Expand Down
17 changes: 15 additions & 2 deletions src/prognostic_equations/edmfx_entr_detr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ function detrainment_from_thermo_state(
entrʲ_prev_level,
vert_div_level,
ᶜmassflux_vert_div, # mass flux divergence is not implemented for diagnostic edmf
ᶜw_vert_div, # mass flux divergence is not implemented for diagnostic edmf
tke_prev_level,
edmfx_detr_model,
)
Expand All @@ -164,6 +165,7 @@ function detrainment_from_thermo_state(
entrʲ_prev_level,
vert_div_level,
FT(0), # mass flux divergence is not implemented for diagnostic edmf
FT(0), # w divergence is not implemented for diagnostic edmf
tke_prev_level,
edmfx_detr_model,
)
Expand Down Expand Up @@ -202,6 +204,7 @@ function detrainment(
ᶜentr,
ᶜvert_div,
ᶜmassflux_vert_div,
ᶜw_vert_div,
ᶜtke⁰,
::NoDetrainment,
)
Expand All @@ -226,6 +229,7 @@ function detrainment(
ᶜentr,
ᶜvert_div,
ᶜmassflux_vert_div,
ᶜw_vert_div,
ᶜtke⁰,
::PiGroupsDetrainment,
)
Expand Down Expand Up @@ -278,6 +282,7 @@ function detrainment(
ᶜentr,
ᶜvert_div,
ᶜmassflux_vert_div,
ᶜw_vert_div,
ᶜtke⁰,
::GeneralizedDetrainment,
)
Expand Down Expand Up @@ -329,9 +334,15 @@ function detrainment(
ᶜentr,
ᶜvert_div,
ᶜmassflux_vert_div,
ᶜw_vert_div,
ᶜtke⁰,
::ConstantAreaDetrainment,
)
detr = ᶜentr - ᶜvert_div
if ᶜρaʲ <= 0
detr = 0
else
detr = (ᶜw_vert_div < 0) * (ᶜentr - ᶜw_vert_div)
end
return max(detr, 0)
end

Expand Down Expand Up @@ -374,8 +385,10 @@ limit_entrainment(entr::FT, a, dt) where {FT} = max(
min(entr, FT(0.9) * (1 - a) / max(a, eps(FT)) / dt, FT(0.9) * 1 / dt),
0,
)
# limit_detrainment(detr::FT, a, dt) where {FT} =
# max(min(detr, FT(0.9) * 1 / dt), 0)
limit_detrainment(detr::FT, a, dt) where {FT} =
max(min(detr, FT(0.9) * 1 / dt), 0)
max(detr, 0)

function limit_turb_entrainment(dyn_entr::FT, turb_entr, dt) where {FT}
return max(min((FT(0.9) * 1 / dt) - dyn_entr, turb_entr), 0)
Expand Down
2 changes: 1 addition & 1 deletion src/surface_conditions/surface_setups.jl
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ function (::SimplePlume)(params)
T = FT(310)
p = FT(101500)
q_vap = FT(0.02245)
θ_flux = FT(8)
θ_flux = FT(8e-2)
q_flux = FT(0)
z0 = FT(1e-4)
ustar = FT(0.28)
Expand Down
4 changes: 2 additions & 2 deletions toml/prognostic_edmfx_bomex.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ value = 1.0e-5
value = 0.7

[entr_inv_tau]
value = 0.0001
value = 0.0002

[entr_coeff]
value = 0.3
value = 0

[min_area_limiter_scale]
value = 0
Expand Down

0 comments on commit 305f977

Please sign in to comment.