From 0c97cc01f5149c7cad3bffd9bf457d09d8062c3c Mon Sep 17 00:00:00 2001 From: Charles Kawczynski Date: Fri, 15 Dec 2023 11:59:28 -0500 Subject: [PATCH] Fix 2438 --- src/cache/cache.jl | 8 +++++--- src/solver/type_getters.jl | 2 +- src/solver/types.jl | 2 ++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/cache/cache.jl b/src/cache/cache.jl index 4e7cd73b0da..2ab1ae28420 100644 --- a/src/cache/cache.jl +++ b/src/cache/cache.jl @@ -129,9 +129,11 @@ function build_cache(Y, atmos, params, surface_setup, dt, start_date) net_energy_flux_toa = [Geometry.WVector(FT(0))] net_energy_flux_sfc = [Geometry.WVector(FT(0))] - limiter = - isnothing(atmos.numerics.limiter) ? nothing : - atmos.numerics.limiter(similar(Y.c, FT)) + limiter = if isnothing(atmos.numerics.limiter) + nothing + elseif atmos.numerics.limiter isa QuasiMonotoneLimiter + Limiters.QuasiMonotoneLimiter(similar(Y.c, FT)) + end numerics = (; limiter) diff --git a/src/solver/type_getters.jl b/src/solver/type_getters.jl index f4e35e213a2..54c9473eade 100644 --- a/src/solver/type_getters.jl +++ b/src/solver/type_getters.jl @@ -98,7 +98,7 @@ function get_numerics(parsed_args) Val(Symbol(parsed_args["edmfx_sgsflux_upwinding"])) limiter = - parsed_args["apply_limiter"] ? Limiters.QuasiMonotoneLimiter : nothing + parsed_args["apply_limiter"] ? CA.QuasiMonotoneLimiter : nothing # wrap each upwinding mode in a Val for dispatch numerics = AtmosNumerics(; diff --git a/src/solver/types.jl b/src/solver/types.jl index e1b8cc8afc1..314d88c0fa5 100644 --- a/src/solver/types.jl +++ b/src/solver/types.jl @@ -270,6 +270,8 @@ abstract type AbstractTimesteppingMode end struct Explicit <: AbstractTimesteppingMode end struct Implicit <: AbstractTimesteppingMode end +struct QuasiMonotoneLimiter end # For dispatching to use the ClimaCore QuasiMonotoneLimiter. + Base.@kwdef struct AtmosNumerics{ EN_UP, TR_UP,