Skip to content

Commit

Permalink
add constant detrainment option
Browse files Browse the repository at this point in the history
  • Loading branch information
szy21 committed Oct 7, 2023
1 parent e12f5a4 commit e1d8983
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion config/default_configs/default_edmf_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ edmfx_entr_model:
help: "EDMFX entrainment closure. [`nothing` (default), `PiGroups`, `ConstantCoefficent`, `ConstantTimescale`]"
value: ~
edmfx_detr_model:
help: "EDMFX detrainment closure. [`nothing` (default), `PiGroups`, `ConstantCoefficent`]"
help: "EDMFX detrainment closure. [`nothing` (default), `PiGroups`, `ConstantCoefficent`, `ConstantTimescale`]"
value: ~
edmfx_upwinding:
help: "EDMFX upwinding mode [`none` (default), `first_order` , `third_order`, `boris_book`, `zalesak`]"
Expand Down
1 change: 1 addition & 0 deletions src/parameters/Parameters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Base.@kwdef struct ClimaAtmosParameters{FT, TP, RP, IP, MPP, SFP, TCP} <: ACAP
planet_radius::FT
astro_unit::FT
entr_tau::FT
detr_tau::FT
entr_coeff::FT
detr_coeff::FT
C_E::FT
Expand Down
22 changes: 22 additions & 0 deletions src/prognostic_equations/edmfx_entr_detr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -314,3 +314,25 @@ function edmfx_entr_detr_tendency!(Yₜ, Y, p, t, colidx, turbconv_model::EDMFX)
end
return nothing
end

function detrainment(
params,
ᶜz::FT,
z_sfc::FT,
ᶜp::FT,
ᶜρ::FT,
buoy_flux_surface::FT,
ᶜaʲ::FT,
ᶜwʲ::FT,
ᶜRHʲ::FT,
ᶜbuoyʲ::FT,
ᶜw⁰::FT,
ᶜRH⁰::FT,
ᶜbuoy⁰::FT,
dt::FT,
::ConstantTimescaleDetrainment,
) where {FT}
detr_tau = CAP.detr_tau(params)
detr = min(1 / detr_tau, 1 / dt)
return detr
end
2 changes: 2 additions & 0 deletions src/solver/model_getters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,8 @@ function get_detrainment_model(parsed_args)
ConstantCoefficientDetrainment()
elseif detr_model == "ConstantCoefficientHarmonics"
ConstantCoefficientHarmonicsDetrainment()
elseif detr_model == "ConstantTimescale"
ConstantTimescaleDetrainment()
else
error("Invalid entr_model $(entr_model)")
end
Expand Down
1 change: 1 addition & 0 deletions src/solver/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ struct NoDetrainment <: AbstractDetrainmentModel end
struct PiGroupsDetrainment <: AbstractDetrainmentModel end
struct ConstantCoefficientDetrainment <: AbstractDetrainmentModel end
struct ConstantCoefficientHarmonicsDetrainment <: AbstractDetrainmentModel end
struct ConstantTimescaleDetrainment <: AbstractDetrainmentModel end

abstract type AbstractQuadratureType end
struct LogNormalQuad <: AbstractQuadratureType end
Expand Down

0 comments on commit e1d8983

Please sign in to comment.