diff --git a/config/model_configs/edmfx_gabls_box.yml b/config/model_configs/edmfx_gabls_box.yml index 6c982cd2524..da655776b08 100644 --- a/config/model_configs/edmfx_gabls_box.yml +++ b/config/model_configs/edmfx_gabls_box.yml @@ -20,9 +20,10 @@ x_elem: 2 y_elem: 2 z_elem: 8 z_stretch: false -dt: "10secs" +dt: "4secs" t_end: "9hours" dt_save_to_disk: "10mins" perturb_initstate: false FLOAT_TYPE: "Float64" -toml: [toml/edmfx_box_gabls.toml] +toml: [toml/edmfx_box.toml] +#toml: [toml/edmfx_box_gabls.toml] diff --git a/src/ClimaAtmos.jl b/src/ClimaAtmos.jl index 05b35455338..10441fd8cb8 100644 --- a/src/ClimaAtmos.jl +++ b/src/ClimaAtmos.jl @@ -42,7 +42,7 @@ include(joinpath("utils", "discrete_hydrostatic_balance.jl")) include(joinpath("prognostic_equations", "pressure_work.jl")) include(joinpath("prognostic_equations", "zero_velocity.jl")) -include(joinpath("prognostic_equations", "filter_sgs_u3_tendency.jl")) +include(joinpath("prognostic_equations", "helper_sgs_tendencies.jl")) include(joinpath("prognostic_equations", "implicit", "wfact.jl")) include(joinpath("prognostic_equations", "implicit", "schur_complement_W.jl")) diff --git a/src/prognostic_equations/filter_sgs_u3_tendency.jl b/src/prognostic_equations/filter_sgs_u3_tendency.jl deleted file mode 100644 index 49923760f4d..00000000000 --- a/src/prognostic_equations/filter_sgs_u3_tendency.jl +++ /dev/null @@ -1,19 +0,0 @@ -### -### tmp sgs u3 filter -### -function filter_sgs_u3_tendency!(Yₜ, Y, p, t, colidx) - # set the sgs momentum tendency to the grid mean momentum tendency - # if updraft area <= 0 - if p.atmos.turbconv_model isa EDMFX - FT = eltype(Y) - n = n_mass_flux_subdomains(p.atmos.turbconv_model) - for j in 1:n - @. Yₜ.f.sgsʲs.:($$j).u₃[colidx] = ifelse( - ᶠinterp(Y.c.sgsʲs.:($$j).ρa[colidx] / p.ᶜρʲs.:($$j)[colidx]) <= FT(0), - Yₜ.f.u₃[colidx], - Yₜ.f.sgsʲs.:($$j).u₃[colidx], - ) - end - end - return nothing -end diff --git a/src/prognostic_equations/helper_sgs_tendencies.jl b/src/prognostic_equations/helper_sgs_tendencies.jl new file mode 100644 index 00000000000..0f5df9cccf5 --- /dev/null +++ b/src/prognostic_equations/helper_sgs_tendencies.jl @@ -0,0 +1,22 @@ +### +### sgs u3 relaxation for a < a_min +### +function relax_sgs_u3_if_small_area!(Yₜ, Y, p, t, colidx) + if p.atmos.turbconv_model isa EDMFX + FT = eltype(Y) + n = n_mass_flux_subdomains(p.atmos.turbconv_model) + a_min = p.atmos.turbconv_model.a_half + dt = p.simulation.dt + for j in 1:n + @. Yₜ.f.sgsʲs.:($$j).u₃[colidx] += ifelse( + draft_area( + ᶠinterp(Y.c.sgsʲs.:($$j).ρa[colidx]), + ᶠinterp(p.ᶜρʲs.:($$j)[colidx]) + ) <= a_min, + (Yₜ.f.u₃[colidx] - Yₜ.f.sgsʲs.:($$j).u₃[colidx]) / dt, + FT(0) * Yₜ.f.sgsʲs.:($$j).u₃[colidx] + ) + end + end + return nothing +end diff --git a/src/prognostic_equations/remaining_tendency.jl b/src/prognostic_equations/remaining_tendency.jl index 0f610587858..580db49346f 100644 --- a/src/prognostic_equations/remaining_tendency.jl +++ b/src/prognostic_equations/remaining_tendency.jl @@ -43,14 +43,13 @@ NVTX.@annotate function additional_tendency!(Yₜ, Y, p, t) # NOTE: All ρa tendencies should be applied before calling this function pressure_work_tendency!(Yₜ, Y, p, t, colidx, p.atmos.turbconv_model) - # NOTE: This will set the sgs momentum tendency to the grid mean momentum tendency - # if the updraft area fraction is equal or smaller than zero. + # NOTE: This adds an additional sgs momentum tendency + # that is a relaxation term to the grid mean momentum + # if updraft area fraction is smaller than a_min # We should not need this, but right now we are diverging slightly # (maybe starting from diverging densities?) - # TODO - A better way to implement this would be to - # make sgs_e_int = gm_e_int when a == 0 and then recompute sgs_e_tot - # based on w and the new sgs_e_int - filter_sgs_u3_tendency!(Yₜ, Y, p, t, colidx) + # and the differences grow even when we increase the entrainment. + relax_sgs_u3_if_small_area!(Yₜ, Y, p, t, colidx) # NOTE: This will zero out all monmentum tendencies in the edmfx advection test # please DO NOT add additional velocity tendencies after this function diff --git a/toml/edmfx_box_gabls.toml b/toml/edmfx_box_gabls.toml index 4f58178f41d..dfe0662e7e3 100644 --- a/toml/edmfx_box_gabls.toml +++ b/toml/edmfx_box_gabls.toml @@ -3,9 +3,21 @@ alias = "C_E" value = 0.044 type = "float" +[entr_coeff] +alias = "entr_coeff" +value = 0.1 +type = "float" +description = "TODO: Remove this. Constant entrainment coefficient used for testing EDMF" + +[detr_coeff] +alias = "detr_coeff" +value = 0.05 +type = "float" +description = "TODO: Remove this. Constant entrainment coefficient used for testing EDMF" + [EDMF_surface_area] alias = "surface_area" -value = 0.1 +value = 1e-1 type = "float" [EDMF_min_area]