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 c6d79af
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 8 deletions.
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
13 changes: 12 additions & 1 deletion 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
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

0 comments on commit c6d79af

Please sign in to comment.