Skip to content

Commit

Permalink
add the filter for GABLS
Browse files Browse the repository at this point in the history
  • Loading branch information
trontrytel committed Sep 20, 2023
1 parent 4d6fcea commit 4fc3fd1
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
1 change: 0 additions & 1 deletion .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions src/ClimaAtmos.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down
19 changes: 19 additions & 0 deletions src/prognostic_equations/filter_sgs_u3_tendency.jl
Original file line number Diff line number Diff line change
@@ -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
9 changes: 9 additions & 0 deletions src/prognostic_equations/remaining_tendency.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 4fc3fd1

Please sign in to comment.