From 4fc3fd150f39a44da6629815e325657e5ec131a5 Mon Sep 17 00:00:00 2001 From: Anna Jaruga Date: Tue, 19 Sep 2023 21:31:13 -0700 Subject: [PATCH] add the filter for GABLS --- .buildkite/pipeline.yml | 1 - src/ClimaAtmos.jl | 1 + .../filter_sgs_u3_tendency.jl | 19 +++++++++++++++++++ .../remaining_tendency.jl | 9 +++++++++ 4 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 src/prognostic_equations/filter_sgs_u3_tendency.jl diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 0d56a389ccc..95d0abb9ca8 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -648,7 +648,6 @@ steps: julia --color=yes --project=examples examples/hybrid/driver.jl --config_file $CONFIG_PATH/edmfx_gabls_box.yml artifact_paths: "edmfx_gabls_box/*" - soft_fail: true agents: slurm_mem: 20GB diff --git a/src/ClimaAtmos.jl b/src/ClimaAtmos.jl index 07f6847372a..558f7234e70 100644 --- a/src/ClimaAtmos.jl +++ b/src/ClimaAtmos.jl @@ -42,6 +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", "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 new file mode 100644 index 00000000000..49923760f4d --- /dev/null +++ b/src/prognostic_equations/filter_sgs_u3_tendency.jl @@ -0,0 +1,19 @@ +### +### 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/remaining_tendency.jl b/src/prognostic_equations/remaining_tendency.jl index 6c86d9938d4..d269d4ce979 100644 --- a/src/prognostic_equations/remaining_tendency.jl +++ b/src/prognostic_equations/remaining_tendency.jl @@ -44,6 +44,15 @@ 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. + # 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) + # NOTE: This will zero out all monmentum tendencies in the edmfx advection test # please DO NOT add additional velocity tendencies after this function zero_velocity_tendency!(Yₜ, Y, p, t, colidx)