Skip to content

Commit

Permalink
Merge branch 'main' into sk/add_gpu_sims_to_ci
Browse files Browse the repository at this point in the history
  • Loading branch information
sriharshakandala committed Oct 12, 2023
2 parents 7f5529c + dcfb425 commit 9408d74
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 13 deletions.
6 changes: 3 additions & 3 deletions config/model_configs/edmfx_bomex_box.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ edmfx_entr_model: "ConstantCoefficient"
edmfx_detr_model: "ConstantCoefficient"
edmfx_sgs_mass_flux: true
edmfx_sgs_diffusive_flux: true
edmfx_nh_pressure: false
edmfx_nh_pressure: true
prognostic_tke: false
moist: "equil"
config: "box"
Expand All @@ -24,7 +24,7 @@ y_elem: 2
z_elem: 60
z_stretch: false
perturb_initstate: false
dt: "1secs"
t_end: "10800secs"
dt: "2secs"
t_end: "3hours"
dt_save_to_disk: "10secs"
toml: [toml/edmfx_box.toml]
8 changes: 4 additions & 4 deletions config/model_configs/edmfx_dycoms_rf01_box.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ edmfx_entr_model: "ConstantCoefficient"
edmfx_detr_model: "ConstantCoefficient"
edmfx_sgs_mass_flux: true
edmfx_sgs_diffusive_flux: true
edmfx_nh_pressure: false
edmfx_nh_pressure: true
prognostic_tke: false
moist: equil
config: box
Expand All @@ -23,7 +23,7 @@ x_elem: 2
y_elem: 2
z_elem: 30
z_stretch: false
dt: 1secs
t_end: 2400secs
dt_save_to_disk: 2secs
dt: 2secs
t_end: 4hours
dt_save_to_disk: 10secs
toml: [toml/edmfx_box.toml]
2 changes: 1 addition & 1 deletion config/model_configs/edmfx_gabls_box.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ edmfx_entr_model: "ConstantCoefficient"
edmfx_detr_model: "ConstantCoefficient"
edmfx_sgs_mass_flux: true
edmfx_sgs_diffusive_flux: true
edmfx_nh_pressure: false
edmfx_nh_pressure: true
prognostic_tke: false
moist: "equil"
config: "box"
Expand Down
2 changes: 1 addition & 1 deletion config/model_configs/edmfx_rico_box.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ edmfx_entr_model: "ConstantCoefficient"
edmfx_detr_model: "ConstantCoefficient"
edmfx_sgs_mass_flux: true
edmfx_sgs_diffusive_flux: true
edmfx_nh_pressure: false
edmfx_nh_pressure: true
prognostic_tke: false
moist: "equil"
#precip_model: "0M"
Expand Down
2 changes: 1 addition & 1 deletion config/model_configs/edmfx_trmm_box.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ edmfx_entr_model: "ConstantCoefficient"
edmfx_detr_model: "ConstantCoefficient"
edmfx_sgs_mass_flux: true
edmfx_sgs_diffusive_flux: true
edmfx_nh_pressure: false
edmfx_nh_pressure: true
prognostic_tke: false
moist: equil
apply_limiter: false
Expand Down
2 changes: 1 addition & 1 deletion regression_tests/ref_counter.jl
Original file line number Diff line number Diff line change
@@ -1 +1 @@
132
133
24 changes: 24 additions & 0 deletions src/cache/precomputed_quantities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,29 @@ function set_velocity_at_surface!(Y, ᶠuₕ³, turbconv_model)
return nothing
end

"""
set_velocity_at_top!(Y, turbconv_model)
Modifies `Y.f.u₃` so that `u₃` is 0 at the model top.
"""
function set_velocity_at_top!(Y, turbconv_model)
top_u₃ = Fields.level(
Y.f.u₃.components.data.:1,
Spaces.nlevels(axes(Y.c)) + half,
)
@. top_u₃ = 0
if turbconv_model isa EDMFX
for j in 1:n_mass_flux_subdomains(turbconv_model)
top_u₃ʲ = Fields.level(
Y.f.sgsʲs.:($j).u₃.components.data.:1,
Spaces.nlevels(axes(Y.c)) + half,
)
@. top_u₃ʲ = top_u₃
end
end
return nothing
end

# This is used to set the grid-scale velocity quantities ᶜu, ᶠu³, ᶜK based on
# ᶠu₃, and it is also used to set the SGS quantities based on ᶠu₃⁰ and ᶠu₃ʲ.
function set_velocity_quantities!(ᶜu, ᶠu³, ᶜK, ᶠu₃, ᶜuₕ, ᶠuₕ³)
Expand Down Expand Up @@ -285,6 +308,7 @@ NVTX.@annotate function set_precomputed_quantities!(Y, p, t)
# TODO: We might want to move this to dss! (and rename dss! to something
# like enforce_constraints!).
set_velocity_at_surface!(Y, ᶠuₕ³, turbconv_model)
set_velocity_at_top!(Y, turbconv_model)

set_velocity_quantities!(ᶜu, ᶠu³, ᶜK, Y.f.u₃, Y.c.uₕ, ᶠuₕ³)
if n > 0
Expand Down
4 changes: 2 additions & 2 deletions src/prognostic_equations/edmfx_closures.jl
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ edmfx_nh_pressure_tendency!(Yₜ, Y, p, t, colidx, turbconv_model) = nothing
function edmfx_nh_pressure_tendency!(Yₜ, Y, p, t, colidx, turbconv_model::EDMFX)

n = n_mass_flux_subdomains(turbconv_model)
(; params, ᶜρʲs, ᶜρ_ref, ᶠgradᵥ_ᶜΦ, ᶜuʲs, ᶜu⁰, ᶠu₃⁰) = p
(; params, ᶜρʲs, ᶜρ_ref, ᶜp, ᶜp_ref, ᶠgradᵥ_ᶜΦ, ᶠu₃⁰) = p
FT = eltype(Y)
ᶜz = Fields.coordinate_field(Y.c).z
z_sfc = Fields.level(Fields.coordinate_field(Y.f).z, Fields.half)
Expand Down Expand Up @@ -107,7 +107,7 @@ function edmfx_nh_pressure_tendency!(Yₜ, Y, p, t, colidx, turbconv_model::EDMF
p.atmos.edmfx_nh_pressure,
ᶠlg[colidx],
ᶠbuoyancy(
ᶠinterp(ᶜρ_ref[colidx]),
ᶠinterp(Y.c.ρ[colidx]),
ᶠinterp(ᶜρʲs.:($$j)[colidx]),
ᶠgradᵥ_ᶜΦ[colidx],
),
Expand Down
5 changes: 5 additions & 0 deletions toml/edmfx_box.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,8 @@ alias = "min_area"
value = 1.0e-3
type = "float"
description = "Minimum area fraction per updraft. Parameter not described in the literature."

[entr_coeff]
alias = "entr_coeff"
value = 0.1
type = "float"

0 comments on commit 9408d74

Please sign in to comment.