Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
szy21 committed Apr 3, 2024
1 parent 1c4e63f commit 662ab38
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
h_elem: 16
z_max: 55000.0
z_elem: 63
dz_bottom: 30.0
dz_top: 3000.0
moist: "equil"
precip_model: "0M"
override_τ_precip: false
rad: "clearsky"
dt_rad: "6hours"
surface_setup: "DefaultMoninObukhov"
turbconv: "prognostic_edmfx"
implicit_diffusion: true
approximate_linear_solve_iters: 2
max_newton_iters_ode: 3
prognostic_tke: true
edmfx_upwinding: "first_order"
edmfx_entr_model: "Generalized"
edmfx_detr_model: "Generalized"
edmfx_nh_pressure: true
edmfx_velocity_relaxation: true
edmfx_sgs_mass_flux: false
edmfx_sgs_diffusive_flux: true
rayleigh_sponge: true
dt_save_state_to_disk: "3hours"
dt: "50secs"
t_end: "2days"
job_id: "longrun_aquaplanet_rhoe_equil_55km_nz63_clearsky_progedmf_0M"
toml: [toml/longrun_aquaplanet_rhoe_equil_55km_nz63_clearsky_progedmf_0M.toml]
diagnostics:
- short_name: [ts, ta, thetaa, ha, pfull, rhoa, ua, va, wa, hur, hus, cl, clw, cli, hussfc, evspsbl]
period: 3hours
- short_name: [arup, waup, taup, thetaaup, haup, husup, hurup, clwup, cliup, waen, taen, thetaaen, haen, husen, huren, clwen, clien, tke]
period: 3hours
- short_name: [entr, detr, lmix, bgrad, strain, edt, evu]
period: 3hours
2 changes: 1 addition & 1 deletion config/model_configs/prognostic_edmfx_bomex_column.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ max_newton_iters_ode: 3
edmfx_upwinding: first_order
edmfx_entr_model: "Generalized"
edmfx_detr_model: "Generalized"
edmfx_sgs_mass_flux: true
edmfx_sgs_mass_flux: false
edmfx_sgs_diffusive_flux: true
edmfx_nh_pressure: true
edmfx_velocity_relaxation: true
Expand Down
14 changes: 14 additions & 0 deletions src/prognostic_equations/edmfx_closures.jl
Original file line number Diff line number Diff line change
Expand Up @@ -305,11 +305,25 @@ function edmfx_velocity_relaxation_tendency!(

n = n_mass_flux_subdomains(turbconv_model)
(; dt) = p
(; ᶜK, ᶜh_tot, ᶜspecific) = p.precomputed
ᶜu₃ʲ = p.scratch.ᶜtemp_C3

if p.atmos.edmfx_velocity_relaxation
for j in 1:n
@. Yₜ.f.sgsʲs.:($$j).u₃[colidx] -=
C3(min(Y.f.sgsʲs.:($$j).u₃[colidx].components.data.:1, 0)) / dt
# @. Yₜ.c.sgsʲs.:($$j).ρa[colidx] -= min(Y.c.sgsʲs.:($$j).ρa[colidx], 0) / dt
# @. ᶜu₃ʲ[colidx] = ᶜinterp(Y.f.sgsʲs.:($$j).u₃[colidx])
# @. Yₜ.c.sgsʲs.:($$j).mse[colidx] -= ifelse(
# ᶜu₃ʲ[colidx].components.data.:1 < 0,
# (Y.c.sgsʲs.:($$j).mse[colidx] - (ᶜh_tot[colidx] - ᶜK[colidx])) / dt,
# 0,
# )
# @. Yₜ.c.sgsʲs.:($$j).q_tot[colidx] -= ifelse(
# ᶜu₃ʲ[colidx].components.data.:1 < 0,
# (Y.c.sgsʲs.:($$j).q_tot[colidx] - ᶜspecific.q_tot[colidx]) / dt,
# 0,
# )
end
end
end
14 changes: 10 additions & 4 deletions src/prognostic_equations/edmfx_tke.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,17 @@ function edmfx_tke_tendency!(

if use_prognostic_tke(turbconv_model)
# shear production
@. Yₜ.c.sgs⁰.ρatke[colidx] +=
2 * ᶜρa⁰[colidx] * ᶜK_u[colidx] * ᶜstrain_rate_norm[colidx]
# buoyancy production
@. Yₜ.c.sgs⁰.ρatke[colidx] -=
# @. Yₜ.c.sgs⁰.ρatke[colidx] +=
# 2 * ᶜρa⁰[colidx] * ᶜK_u[colidx] * ᶜstrain_rate_norm[colidx]
# # buoyancy production
# @. Yₜ.c.sgs⁰.ρatke[colidx] -=
# ᶜρa⁰[colidx] * ᶜK_h[colidx] * ᶜlinear_buoygrad[colidx]
tke_source = p.scratch.ᶜtemp_scalar_2
@. tke_source[colidx] = (
2 * ᶜρa⁰[colidx] * ᶜK_u[colidx] * ᶜstrain_rate_norm[colidx] -
ᶜρa⁰[colidx] * ᶜK_h[colidx] * ᶜlinear_buoygrad[colidx]
)
@. Yₜ.c.sgs⁰.ρatke[colidx] += tke_source[colidx]
# entrainment and detraiment
# using ᶜu⁰ and local geometry results in allocation
for j in 1:n
Expand Down

0 comments on commit 662ab38

Please sign in to comment.