Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rename ConstantArea to SmoothArea detrainment and change the formula #3444

Merged
merged 1 commit into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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: "SmoothArea"
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
7 changes: 7 additions & 0 deletions src/cache/diagnostic_edmf_precomputed_quantities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,12 @@ NVTX.@annotate function set_diagnostic_edmf_precomputed_quantities_do_integral!(
u³ʲ_data_prev_halflevel *
ρ_prev_level
) / local_geometry_level.J / ρ_level
w_vert_div_level = p.scratch.temp_data_level_3
@. w_vert_div_level =
(
local_geometry_halflevel.J * u³ʲ_data_halflevel -
local_geometry_prev_level.J * u³ʲ_data_prev_halflevel
) / local_geometry_level.J

@. detrʲ_prev_level = detrainment_from_thermo_state(
thermo_params,
Expand All @@ -617,6 +623,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
w_vert_div_level,
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
15 changes: 13 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_level,
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
w_vert_div_level,
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,
::ConstantAreaDetrainment,
ᶜw_vert_div,
ᶜtke⁰,
::SmoothAreaDetrainment,
)
detr = ᶜentr - ᶜvert_div
if (ᶜρaʲ <= 0) || (ᶜw_vert_div >= 0)
detr = 0
else
detr = ᶜentr - ᶜw_vert_div
end
return max(detr, 0)
end

Expand Down
4 changes: 2 additions & 2 deletions src/solver/model_getters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -497,8 +497,8 @@ function get_detrainment_model(parsed_args)
GeneralizedDetrainment()
elseif detr_model == "GeneralizedHarmonics"
GeneralizedHarmonicsDetrainment()
elseif detr_model == "ConstantArea"
ConstantAreaDetrainment()
elseif detr_model == "SmoothArea"
SmoothAreaDetrainment()
else
error("Invalid detr_model $(detr_model)")
end
Expand Down
2 changes: 1 addition & 1 deletion src/solver/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ struct NoDetrainment <: AbstractDetrainmentModel end
struct PiGroupsDetrainment <: AbstractDetrainmentModel end
struct GeneralizedDetrainment <: AbstractDetrainmentModel end
struct GeneralizedHarmonicsDetrainment <: AbstractDetrainmentModel end
struct ConstantAreaDetrainment <: AbstractDetrainmentModel end
struct SmoothAreaDetrainment <: AbstractDetrainmentModel end

abstract type AbstractQuadratureType end
struct LogNormalQuad <: AbstractQuadratureType 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
Loading