Skip to content

Commit

Permalink
use scale height in nh pressure
Browse files Browse the repository at this point in the history
  • Loading branch information
szy21 committed Mar 26, 2024
1 parent 3650a54 commit 49e8fcc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 33 deletions.
38 changes: 5 additions & 33 deletions src/prognostic_equations/edmfx_closures.jl
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,10 @@ function ᶠupdraft_nh_pressure(
ᶠbuoyʲ,
ᶠu3ʲ,
ᶠu3⁰,
updraft_top,
plume_height,
)

FT = eltype(params)
if !nh_pressure_flag
return zero(ᶠu3ʲ)
else
Expand All @@ -86,12 +87,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 @@ -109,39 +109,11 @@ function edmfx_nh_pressure_tendency!(
(; 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])
ᶠ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 +125,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

0 comments on commit 49e8fcc

Please sign in to comment.