diff --git a/config/model_configs/edmfx_adv_test_box.yml b/config/model_configs/edmfx_adv_test_box.yml index fc59c7bf96..9a54b0105b 100644 --- a/config/model_configs/edmfx_adv_test_box.yml +++ b/config/model_configs/edmfx_adv_test_box.yml @@ -1,18 +1,21 @@ -dt_save_to_disk: "100secs" +job_id: "edmfx_adv_test_box" initial_condition: "MoistAdiabaticProfileEDMFX" -x_max: 10000.0 -hyperdiff: "true" -z_elem: 45 -dt: "10secs" -t_end: "1000secs" -y_max: 10000.0 -y_elem: 2 +advection_test: true turbconv: "edmfx" -x_elem: 2 -dz_bottom: 30.0 ode_algo: "SSP33ShuOsher" +edmfx_upwinding: "first_order" config: "box" -advection_test: true -kappa_4: 1.0e8 -job_id: "edmfx_adv_test_box" moist: "equil" +hyperdiff: "true" +kappa_4: 1e8 +x_max: 1e4 +y_max: 1e4 +z_max: 3e4 +x_elem: 2 +y_elem: 2 +z_elem: 45 +dz_bottom: 30.0 +dt: "10secs" +t_end: "3600secs" +dt_save_to_disk: "100secs" +toml: [toml/edmfx_box_advection.toml] diff --git a/src/prognostic_equations/advection.jl b/src/prognostic_equations/advection.jl index 9e73101eaa..94d4bbfb49 100644 --- a/src/prognostic_equations/advection.jl +++ b/src/prognostic_equations/advection.jl @@ -89,8 +89,9 @@ NVTX.@annotate function explicit_vertical_advection_tendency!(Yₜ, Y, p, t) (; ᶜh_totʲs) = n > 0 && is_total_energy ? p : all_nothing (; ᶠu³⁰) = advect_tke ? p : all_nothing ᶜρa⁰ = advect_tke ? (n > 0 ? p.ᶜρa⁰ : Y.c.ρ) : nothing + ᶜρ⁰ = advect_tke ? (n > 0 ? p.ᶜρ⁰ : Y.c.ρ) : nothing ᶜtke⁰ = advect_tke ? (n > 0 ? p.ᶜspecific⁰.tke : p.ᶜtke⁰) : nothing - ᶜ1 = p.ᶜtemp_scalar + ᶜa_scalar = p.ᶜtemp_scalar ᶜω³ = p.ᶜtemp_CT3 ᶠω¹² = p.ᶠtemp_CT12 ᶠω¹²ʲs = p.ᶠtemp_CT12ʲs @@ -139,24 +140,28 @@ NVTX.@annotate function explicit_vertical_advection_tendency!(Yₜ, Y, p, t) # TODO: Move this to implicit_vertical_advection_tendency!. for j in 1:n - @. ᶜ1[colidx] = one(Y.c.ρ[colidx]) + @. ᶜa_scalar[colidx] = + draft_area(Y.c.sgsʲs.:($$j).ρa[colidx], ᶜρʲs.:($$j)[colidx]) vertical_transport!( Yₜ.c.sgsʲs.:($j).ρa[colidx], ᶜJ[colidx], - Y.c.sgsʲs.:($j).ρa[colidx], + ᶜρʲs.:($j)[colidx], ᶠu³ʲs.:($j)[colidx], - ᶜ1[colidx], + ᶜa_scalar[colidx], dt, edmfx_upwinding, ) if :ρae_tot in propertynames(Yₜ.c.sgsʲs.:($j)) + @. ᶜa_scalar[colidx] = + ᶜh_totʲs.:($$j)[colidx] * + draft_area(Y.c.sgsʲs.:($$j).ρa[colidx], ᶜρʲs.:($$j)[colidx]) vertical_transport!( Yₜ.c.sgsʲs.:($j).ρae_tot[colidx], ᶜJ[colidx], - Y.c.sgsʲs.:($j).ρa[colidx], + ᶜρʲs.:($j)[colidx], ᶠu³ʲs.:($j)[colidx], - ᶜh_totʲs.:($j)[colidx], + ᶜa_scalar[colidx], dt, edmfx_upwinding, ) @@ -165,12 +170,15 @@ NVTX.@annotate function explicit_vertical_advection_tendency!(Yₜ, Y, p, t) for (ᶜρaχʲₜ, ᶜχʲ, χ_name) in matching_subfields(Yₜ.c.sgsʲs.:($j), ᶜspecificʲs.:($j)) χ_name == :e_tot && continue + @. ᶜa_scalar[colidx] = + ᶜχʲ[colidx] * + draft_area(Y.c.sgsʲs.:($$j).ρa[colidx], ᶜρʲs.:($$j)[colidx]) vertical_transport!( ᶜρaχʲₜ[colidx], ᶜJ[colidx], - Y.c.sgsʲs.:($j).ρa[colidx], + ᶜρʲs.:($j)[colidx], ᶠu³ʲs.:($j)[colidx], - ᶜχʲ[colidx], + ᶜa_scalar[colidx], dt, edmfx_upwinding, ) @@ -179,12 +187,14 @@ NVTX.@annotate function explicit_vertical_advection_tendency!(Yₜ, Y, p, t) # TODO: Move this to implicit_vertical_advection_tendency!. if use_prognostic_tke(turbconv_model) # advect_tke triggers allocations + @. ᶜa_scalar[colidx] = + ᶜtke⁰[colidx] * draft_area(ᶜρa⁰[colidx], ᶜρ⁰[colidx]) vertical_transport!( Yₜ.c.sgs⁰.ρatke[colidx], ᶜJ[colidx], - ᶜρa⁰[colidx], + ᶜρ⁰[colidx], ᶠu³⁰[colidx], - ᶜtke⁰[colidx], + ᶜa_scalar[colidx], dt, edmfx_upwinding, ) diff --git a/toml/edmfx_box.toml b/toml/edmfx_box.toml index 63ce6f56f8..9eb2be9b12 100644 --- a/toml/edmfx_box.toml +++ b/toml/edmfx_box.toml @@ -7,3 +7,9 @@ type = "float" alias = "surface_area" value = 0.1 type = "float" + +[EDMF_min_area] +alias = "min_area" +value = 1.0e-2 +type = "float" +description = "Minimum area fraction per updraft. Parameter not described in the literature." diff --git a/toml/edmfx_box_advection.toml b/toml/edmfx_box_advection.toml new file mode 100644 index 0000000000..d39ecbfaa8 --- /dev/null +++ b/toml/edmfx_box_advection.toml @@ -0,0 +1,10 @@ +[EDMF_surface_area] +alias = "surface_area" +value = 0 +type = "float" + +[EDMF_min_area] +alias = "min_area" +value = 1.0e-2 +type = "float" +description = "Minimum area fraction per updraft. Parameter not described in the literature."