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

move pressure parameters to param_set #130

Merged
merged 1 commit into from
Aug 16, 2021
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
8 changes: 8 additions & 0 deletions integration_tests/utils/parameter_set.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ end
CLIMAParameters.Planet.MSLP(ps::EarthParameterSet) = ps.nt.MSLP
CLIMAParameters.Atmos.Microphysics.τ_cond_evap(ps::EarthParameterSet) = ps.nt.τ_cond_evap
CLIMAParameters.Atmos.EDMF.c_ε(ps::EarthParameterSet) = ps.nt.c_ε
CLIMAParameters.Atmos.EDMF.α_b(ps::EarthParameterSet) = ps.nt.α_b
CLIMAParameters.Atmos.EDMF.α_a(ps::EarthParameterSet) = ps.nt.α_a
CLIMAParameters.Atmos.EDMF.α_d(ps::EarthParameterSet) = ps.nt.α_d
CLIMAParameters.Atmos.EDMF.H_up_min(ps::EarthParameterSet) = ps.nt.H_up_min

#! format: off
function create_parameter_set(namelist)
Expand All @@ -18,6 +22,10 @@ function create_parameter_set(namelist)
MSLP = 100000.0, # or grab from, e.g., namelist[""][...]
τ_cond_evap = TC.parse_namelist(namelist, "microphysics", "τ_cond_evap"; default = 10.0),
c_ε = TC.parse_namelist(namelist, "turbulence", "EDMF_PrognosticTKE", "entrainment_factor"),
α_b = TC.parse_namelist(namelist, "turbulence", "EDMF_PrognosticTKE", "pressure_normalmode_buoy_coeff1"),
α_a = TC.parse_namelist(namelist, "turbulence", "EDMF_PrognosticTKE", "pressure_normalmode_adv_coeff"),
α_d = TC.parse_namelist(namelist, "turbulence", "EDMF_PrognosticTKE", "pressure_normalmode_drag_coeff"),
H_up_min = TC.parse_namelist(namelist, "turbulence", "EDMF_PrognosticTKE", "min_updraft_top"),
)
return EarthParameterSet(nt)
end
Expand Down
10 changes: 4 additions & 6 deletions src/Turbulence_PrognosticTKE.jl
Original file line number Diff line number Diff line change
Expand Up @@ -964,15 +964,11 @@ function compute_updraft_closures(self::EDMF_PrognosticTKE, GMV::GridMeanVariabl
asp_ratio = 1.0
self.nh_pressure_b[i, k], self.nh_pressure_adv[i, k], self.nh_pressure_drag[i, k] =
perturbation_pressure(
param_set,
self.UpdVar.updraft_top[i],
500.0,
a_kfull,
b_kfull,
ref_state.rho0[k],
self.pressure_normalmode_buoy_coeff1,
self.pressure_normalmode_buoy_coeff2,
self.pressure_normalmode_adv_coeff,
self.pressure_normalmode_drag_coeff,
self.UpdVar.W.values[i, k],
∇w_up,
self.EnvVar.W.values[k],
Expand All @@ -991,9 +987,11 @@ end

function compute_pressure_plume_spacing(self::EDMF_PrognosticTKE, GMV::GridMeanVariables, Case::CasesBase)

param_set = parameter_set(self)
H_up_min = CPEDMF.H_up_min(param_set)
@inbounds for i in xrange(self.n_updrafts)
self.pressure_plume_spacing[i] =
max(self.aspect_ratio * self.UpdVar.updraft_top[i], self.min_updraft_top * self.aspect_ratio)
max(self.aspect_ratio * self.UpdVar.updraft_top[i], H_up_min * self.aspect_ratio)
end
return
end
Expand Down
39 changes: 11 additions & 28 deletions src/closures/perturbation_pressure.jl
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
"""
perturbation_pressure(
param_set,
updraft_top,
min_updraft_top,
a_up,
b_up,
ρ0_k,
α₁,
α₂,
β₁,
β₂,
w_up,
∇w_up,
w_en,
Expand All @@ -17,40 +13,27 @@
Returns the value of perturbation pressure gradient
for updraft i following He et al. (JAMES, 2020), given:
- `updraft_top`: the height of the updraft in the previous timestep
- `min_updraft_top`: the minimal height of the updraft to avoid zero devision
- `a_up`: updraft area
- `b_up`: updraft buoyancy
- `ρ0_k`: reference density
- `α₁`: pressure closure free parameter
- `α₂`: pressure closure free parameter
- `β₁`: pressure closure free parameter
- `β₂`: pressure closure free parameter
- `w_up`: updraft vertical velocity
- `∇w_up`: updraft divergence of vertical velocity
- `w_en`: environment vertical velocity
- esp_ratio`: the specific aspect ratio of the updraft
"""
function perturbation_pressure(
updraft_top,
min_updraft_top,
a_up,
b_up,
ρ0_k,
α₁,
α₂,
β₁,
β₂,
w_up,
∇w_up,
w_en,
asp_ratio,
)
function perturbation_pressure(param_set, updraft_top, a_up, b_up, ρ0_k, w_up, ∇w_up, w_en, asp_ratio)

nh_press_buoy = -α₁ / (1 + α₂ * asp_ratio^2) * ρ0_k * a_up * b_up
α_b = CPEDMF.α_b(param_set)
α_a = CPEDMF.α_a(param_set)
α_d = CPEDMF.α_d(param_set)
H_up_min = CPEDMF.H_up_min(param_set)
α₂ = 0.0

nh_pressure_adv = ρ0_k * a_up * β₁ * w_up * ∇w_up
nh_press_buoy = -α_b / (1 + α₂ * asp_ratio^2) * ρ0_k * a_up * b_up

nh_pressure_adv = ρ0_k * a_up * α_a * w_up * ∇w_up
# drag as w_dif and account for downdrafts
nh_pressure_drag = -1.0 * ρ0_k * a_up * β₂ * (w_up - w_en) * abs(w_up - w_en) / max(updraft_top, min_updraft_top)
nh_pressure_drag = -1.0 * ρ0_k * a_up * α_d * (w_up - w_en) * abs(w_up - w_en) / max(updraft_top, H_up_min)

return nh_press_buoy, nh_pressure_adv, nh_pressure_drag
end;
17 changes: 0 additions & 17 deletions src/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,6 @@ mutable struct EDMF_PrognosticTKE{PS, A1, A2}
Ri_bulk_crit::Float64
zi::Float64
n_updrafts::Int
min_updraft_top::Float64
drag_sign::Int
asp_label
extrapolate_buoyancy::Bool
Expand All @@ -747,10 +746,6 @@ mutable struct EDMF_PrognosticTKE{PS, A1, A2}
sorting_power::Float64
turbulent_entrainment_factor::Float64
aspect_ratio::Float64
pressure_normalmode_buoy_coeff1::Float64
pressure_normalmode_buoy_coeff2::Float64
pressure_normalmode_adv_coeff::Float64
pressure_normalmode_drag_coeff::Float64
tke_ed_coeff::Float64
tke_diss_coeff::Float64
static_stab_coeff::Float64
Expand Down Expand Up @@ -858,13 +853,6 @@ mutable struct EDMF_PrognosticTKE{PS, A1, A2}
turbulent_entrainment_factor = namelist["turbulence"]["EDMF_PrognosticTKE"]["turbulent_entrainment_factor"]
# pressure parameters
aspect_ratio = namelist["turbulence"]["EDMF_PrognosticTKE"]["aspect_ratio"]
pressure_normalmode_buoy_coeff1 =
namelist["turbulence"]["EDMF_PrognosticTKE"]["pressure_normalmode_buoy_coeff1"]
pressure_normalmode_buoy_coeff2 =
namelist["turbulence"]["EDMF_PrognosticTKE"]["pressure_normalmode_buoy_coeff2"]
pressure_normalmode_adv_coeff = namelist["turbulence"]["EDMF_PrognosticTKE"]["pressure_normalmode_adv_coeff"]
pressure_normalmode_drag_coeff = namelist["turbulence"]["EDMF_PrognosticTKE"]["pressure_normalmode_drag_coeff"]
min_updraft_top = namelist["turbulence"]["EDMF_PrognosticTKE"]["min_updraft_top"]

# mixing length parameters
tke_ed_coeff = namelist["turbulence"]["EDMF_PrognosticTKE"]["tke_ed_coeff"]
Expand Down Expand Up @@ -967,7 +955,6 @@ mutable struct EDMF_PrognosticTKE{PS, A1, A2}
Ri_bulk_crit,
zi,
n_updrafts,
min_updraft_top,
drag_sign,
asp_label,
extrapolate_buoyancy,
Expand All @@ -982,10 +969,6 @@ mutable struct EDMF_PrognosticTKE{PS, A1, A2}
sorting_power,
turbulent_entrainment_factor,
aspect_ratio,
pressure_normalmode_buoy_coeff1,
pressure_normalmode_buoy_coeff2,
pressure_normalmode_adv_coeff,
pressure_normalmode_drag_coeff,
tke_ed_coeff,
tke_diss_coeff,
static_stab_coeff,
Expand Down