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

Add harmonics limiter for entr/detr, set GABLS config #2125

Merged
merged 1 commit into from
Sep 29, 2023
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
1 change: 0 additions & 1 deletion .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,6 @@ steps:
julia --color=yes --project=examples examples/hybrid/driver.jl
--config_file $CONFIG_PATH/edmfx_gabls_box.yml
artifact_paths: "edmfx_gabls_box/*"
soft_fail: true
agents:
slurm_mem: 20GB

Expand Down
4 changes: 2 additions & 2 deletions config/model_configs/edmfx_gabls_box.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ x_elem: 2
y_elem: 2
z_elem: 8
z_stretch: false
dt: "10secs"
dt: "5secs"
t_end: "9hours"
dt_save_to_disk: "10mins"
perturb_initstate: false
FLOAT_TYPE: "Float64"
toml: [toml/edmfx_box_gabls.toml]
toml: [toml/edmfx_box.toml]
53 changes: 50 additions & 3 deletions src/prognostic_equations/edmfx_entr_detr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
##### EDMF entrainment detrainment
#####

# return a harmonic mean of (a, 1-a)
hm_limiter(a) = 2 * a * (1 - a)

"""
Return entrainment rate [1/s].

Expand Down Expand Up @@ -107,6 +110,28 @@ function entrainment(
return entr
end

function entrainment(
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,
::ConstantCoefficientHarmonicsEntrainment,
) where {FT}
entr_coeff = CAP.entr_coeff(params)
entr = min(entr_coeff * abs(ᶜwʲ) / (ᶜz - z_sfc), 1 / dt)
return entr * FT(2) * hm_limiter(ᶜaʲ)
end

function entrainment(
params,
ᶜz::FT,
Expand Down Expand Up @@ -236,12 +261,34 @@ function detrainment(
return detr
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,
::ConstantCoefficientHarmonicsDetrainment,
) where {FT}
detr_coeff = CAP.detr_coeff(params)
detr = min(detr_coeff * abs(ᶜwʲ), 1 / dt)
return detr * FT(2) * hm_limiter(ᶜaʲ)
end

edmfx_entr_detr_tendency!(Yₜ, Y, p, t, colidx, turbconv_model) = nothing
function edmfx_entr_detr_tendency!(Yₜ, Y, p, t, colidx, turbconv_model::EDMFX)

n = n_mass_flux_subdomains(turbconv_model)
(; ᶜspecificʲs, ᶜh_totʲs, ᶜentrʲs, ᶜdetrʲs) = p
(; ᶜu⁰, ᶜspecific⁰, ᶜh_tot⁰) = p
(; ᶜspecific⁰, ᶜh_tot⁰, ᶠu₃⁰) = p

for j in 1:n

Expand All @@ -262,8 +309,8 @@ function edmfx_entr_detr_tendency!(Yₜ, Y, p, t, colidx, turbconv_model::EDMFX)
)

@. Yₜ.f.sgsʲs.:($$j).u₃[colidx] +=
ᶠinterp(ᶜentrʲs.:($$j)[colidx] * C3(ᶜu⁰[colidx])) -
ᶠinterp(ᶜentrʲs.:($$j)[colidx]) * Y.f.sgsʲs.:($$j).u₃[colidx]
ᶠinterp(ᶜentrʲs.:($$j)[colidx]) *
(ᶠu₃⁰[colidx] - Y.f.sgsʲs.:($$j).u₃[colidx])
end
return nothing
end
4 changes: 4 additions & 0 deletions src/solver/model_getters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,8 @@ function get_entrainment_model(parsed_args)
PiGroupsEntrainment()
elseif entr_model == "ConstantCoefficient"
ConstantCoefficientEntrainment()
elseif entr_model == "ConstantCoefficientHarmonics"
ConstantCoefficientHarmonicsEntrainment()
elseif entr_model == "ConstantTimescale"
ConstantTimescaleEntrainment()
else
Expand All @@ -387,6 +389,8 @@ function get_detrainment_model(parsed_args)
PiGroupsDetrainment()
elseif detr_model == "ConstantCoefficient"
ConstantCoefficientDetrainment()
elseif detr_model == "ConstantCoefficientHarmonics"
ConstantCoefficientHarmonicsDetrainment()
else
error("Invalid entr_model $(entr_model)")
end
Expand Down
2 changes: 2 additions & 0 deletions src/solver/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,15 @@ abstract type AbstractEntrainmentModel end
struct NoEntrainment <: AbstractEntrainmentModel end
struct PiGroupsEntrainment <: AbstractEntrainmentModel end
struct ConstantCoefficientEntrainment <: AbstractEntrainmentModel end
struct ConstantCoefficientHarmonicsEntrainment <: AbstractEntrainmentModel end
struct ConstantTimescaleEntrainment <: AbstractEntrainmentModel end

abstract type AbstractDetrainmentModel end

struct NoDetrainment <: AbstractDetrainmentModel end
struct PiGroupsDetrainment <: AbstractDetrainmentModel end
struct ConstantCoefficientDetrainment <: AbstractDetrainmentModel end
struct ConstantCoefficientHarmonicsDetrainment <: AbstractDetrainmentModel end

abstract type AbstractQuadratureType end
struct LogNormalQuad <: AbstractQuadratureType end
Expand Down
2 changes: 1 addition & 1 deletion toml/edmfx_box.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ type = "float"

[EDMF_min_area]
alias = "min_area"
value = 1.0e-2
value = 1.0e-3
type = "float"
description = "Minimum area fraction per updraft. Parameter not described in the literature."
9 changes: 0 additions & 9 deletions toml/edmfx_box_gabls.toml

This file was deleted.

Loading