Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove do_dss from cache #3463

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions src/cache/cache.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ struct AtmosCache{
PREC,
SCRA,
HYPE,
DSS,
PR,
LSAD,
EXTFORCING,
Expand Down Expand Up @@ -70,8 +69,6 @@ struct AtmosCache{
ghost buffers for DSS"""
hyperdiff::HYPE

do_dss::DSS

"""Additional parameters used by the various tendencies"""
precipitation::PR
large_scale_advection::LSAD
Expand Down Expand Up @@ -117,11 +114,8 @@ function build_cache(Y, atmos, params, surface_setup, sim_info, aerosol_names)

(; ᶜf³, ᶠf¹²) = compute_coriolis(ᶜcoord, ᶠcoord, params)

quadrature_style =
Spaces.quadrature_style(Spaces.horizontal_space(axes(Y.c)))
do_dss = quadrature_style isa Quadratures.GLL
ghost_buffer =
!do_dss ? (;) :
!do_dss(axes(Y.c)) ? (;) :
(; c = Spaces.create_dss_buffer(Y.c), f = Spaces.create_dss_buffer(Y.f))

net_energy_flux_toa = [Geometry.WVector(FT(0))]
Expand Down Expand Up @@ -201,7 +195,6 @@ function build_cache(Y, atmos, params, surface_setup, sim_info, aerosol_names)
precomputed,
scratch,
hyperdiff,
do_dss,
precipitation,
large_scale_advection,
external_forcing,
Expand Down
3 changes: 2 additions & 1 deletion src/prognostic_equations/dss.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ using ClimaCore.Utilities: half
import ClimaCore.Fields: ColumnField

NVTX.@annotate function dss!(Y, p, t)
if p.do_dss
if do_dss(axes(Y.c))
Spaces.weighted_dss!(Y.c => p.ghost_buffer.c, Y.f => p.ghost_buffer.f)
end
return nothing
end
3 changes: 1 addition & 2 deletions src/prognostic_equations/hyperdiffusion.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ hyperdiffusion_cache(Y, hyperdiff::Nothing, _) = (;)
function hyperdiffusion_cache(Y, hyperdiff::ClimaHyperdiffusion, turbconv_model)
quadrature_style =
Spaces.quadrature_style(Spaces.horizontal_space(axes(Y.c)))
do_dss = quadrature_style isa Quadratures.GLL
FT = eltype(Y)
n = n_mass_flux_subdomains(turbconv_model)

Expand Down Expand Up @@ -44,7 +43,7 @@ function hyperdiffusion_cache(Y, hyperdiff::ClimaHyperdiffusion, turbconv_model)
(;)
sgs_quantities = (; sgs_quantities..., maybe_ᶜ∇²tke⁰...)
quantities = (; gs_quantities..., sgs_quantities...)
if do_dss
if do_dss(axes(Y.c))
quantities = (;
quantities...,
hyperdiffusion_ghost_buffer = map(
Expand Down
2 changes: 1 addition & 1 deletion src/prognostic_equations/remaining_tendency.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
NVTX.@annotate function hyperdiffusion_tendency!(Yₜ, Yₜ_lim, Y, p, t)
prep_tracer_hyperdiffusion_tendency!(Yₜ_lim, Y, p, t)
prep_hyperdiffusion_tendency!(Yₜ, Y, p, t)
if p.do_dss && !isnothing(p.atmos.hyperdiff)
if do_dss(axes(Y.c)) && !isnothing(p.atmos.hyperdiff)
pairs = dss_hyperdiffusion_tendency_pairs(p)
Spaces.weighted_dss!(pairs...)
end
Expand Down
12 changes: 12 additions & 0 deletions src/utils/utilities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,18 @@ function verify_callbacks(t)
end
end


"""
do_dss(space)

Return whether the underlying horizontal space required DSS or not.
"""
function do_dss(space::Spaces.AbstractSpace)
return Spaces.quadrature_style(Spaces.horizontal_space(space)) isa
Quadratures.GLL
end


using ClimaComms
is_distributed(::ClimaComms.SingletonCommsContext) = false
is_distributed(::ClimaComms.MPICommsContext) = true
Expand Down
1 change: 0 additions & 1 deletion test/coupler_compatibility.jl
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ const T2 = 290
p.precomputed,
p.scratch,
p.hyperdiff,
p.do_dss,
p.precipitation,
p.large_scale_advection,
p.external_forcing,
Expand Down
Loading