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

use fixed height scale in nonhydrostatic pressure drag #2838

Merged
merged 1 commit into from
Mar 26, 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
1 change: 0 additions & 1 deletion src/cache/precomputed_quantities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ function precomputed_quantities(Y, atmos)
ᶜK_u = similar(Y.c, FT),
ᶜK_h = similar(Y.c, FT),
ρatke_flux = similar(Fields.level(Y.f, half), C3{FT}),
ᶜupdraft_top = similar(Fields.level(Y.c, 1), FT),
ᶜuʲs = similar(Y.c, NTuple{n, C123{FT}}),
ᶠu³ʲs = similar(Y.f, NTuple{n, CT3{FT}}),
ᶜKʲs = similar(Y.c, NTuple{n, FT}),
Expand Down
40 changes: 5 additions & 35 deletions src/prognostic_equations/edmfx_closures.jl
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,8 @@ function ᶠupdraft_nh_pressure(
ᶠbuoyʲ,
ᶠu3ʲ,
ᶠu3⁰,
updraft_top,
plume_height,
)

if !nh_pressure_flag
return zero(ᶠu3ʲ)
else
Expand All @@ -86,12 +85,11 @@ function ᶠupdraft_nh_pressure(
# Independence of aspect ratio hardcoded: α₂_asp_ratio² = FT(0)

H_up_min = CAP.min_updraft_top(turbconv_params)
plume_scale_height = max(updraft_top, H_up_min)

# We also used to have advection term here: α_a * w_up * div_w_up
return α_b * ᶠbuoyʲ +
α_d * (ᶠu3ʲ - ᶠu3⁰) * CC.Geometry._norm(ᶠu3ʲ - ᶠu3⁰, ᶠlg) /
plume_scale_height
max(plume_height, H_up_min)
end
end

Expand All @@ -108,40 +106,12 @@ function edmfx_nh_pressure_tendency!(
n = n_mass_flux_subdomains(turbconv_model)
(; params) = p
(; ᶠgradᵥ_ᶜΦ) = p.core
(; ᶜρʲs, ᶠnh_pressure₃ʲs, ᶠu₃⁰, ᶜupdraft_top) = p.precomputed
FT = eltype(Y)
ᶜz = Fields.coordinate_field(Y.c).z
z_sfc = Fields.level(Fields.coordinate_field(Y.f).z, Fields.half)
z_sfc_data = Fields.field_values(z_sfc[colidx])
(; ᶜρʲs, ᶠnh_pressure₃ʲs, ᶠu₃⁰) = p.precomputed
ᶠlg = Fields.local_geometry_field(Y.f)

turbconv_params = CAP.turbconv_params(params)
a_min = CAP.min_area(turbconv_params)
scale_height = CAP.R_d(params) * CAP.T_surf_ref(params) / CAP.grav(params)

for j in 1:n

# look for updraft top
ᶜupdraft_top_data = Fields.field_values(ᶜupdraft_top[colidx])
@. ᶜupdraft_top_data = FT(0)
for level in 1:Spaces.nlevels(axes(ᶜz))
ρaʲ_lev = Fields.field_values(
Spaces.level(Y.c.sgsʲs.:($j).ρa[colidx], level),
)
ρʲ_lev =
Fields.field_values(Spaces.level(ᶜρʲs.:($j)[colidx], level))
ᶜz_lev = Fields.field_values(Spaces.level(ᶜz[colidx], level))
@. ᶜupdraft_top_data = ifelse(
draft_area(ρaʲ_lev, ρʲ_lev) > a_min,
ᶜz_lev,
ᶜupdraft_top_data,
)
end
@. ᶜupdraft_top_data = ᶜupdraft_top_data - z_sfc_data

# There's only one updraft_top per column, so it's
# safe to use at cell centers and cell faces, correct?:
ᶠupdraft_top = Fields.Field(ᶜupdraft_top_data, axes(ᶠu₃⁰[colidx]))

@. ᶠnh_pressure₃ʲs.:($$j)[colidx] = ᶠupdraft_nh_pressure(
params,
p.atmos.edmfx_nh_pressure,
Expand All @@ -153,7 +123,7 @@ function edmfx_nh_pressure_tendency!(
),
Y.f.sgsʲs.:($$j).u₃[colidx],
ᶠu₃⁰[colidx],
ᶠupdraft_top,
scale_height,
)

@. Yₜ.f.sgsʲs.:($$j).u₃[colidx] -= ᶠnh_pressure₃ʲs.:($$j)[colidx]
Expand Down
3 changes: 3 additions & 0 deletions toml/prognostic_edmfx_bomex_box.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,6 @@ value = 1

[max_area_limiter_scale]
value = 0

[pressure_normalmode_drag_coeff]
value = 40.0
3 changes: 3 additions & 0 deletions toml/prognostic_edmfx_box.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,6 @@ value = 1

[max_area_limiter_scale]
value = 0

[pressure_normalmode_drag_coeff]
value = 40.0
3 changes: 3 additions & 0 deletions toml/prognostic_edmfx_dycoms_rf01_box.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,6 @@ value = 1

[max_area_limiter_scale]
value = 0.01

[pressure_normalmode_drag_coeff]
value = 40.0
Loading