Skip to content

Commit

Permalink
Fix 2438
Browse files Browse the repository at this point in the history
  • Loading branch information
charleskawczynski committed Dec 18, 2023
1 parent a0ccabd commit 317b4f6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
8 changes: 5 additions & 3 deletions src/cache/cache.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
5 changes: 2 additions & 3 deletions src/solver/type_getters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function get_atmos(config::AtmosConfig, params)
surface_model = get_surface_model(parsed_args),
numerics = get_numerics(parsed_args),
)
@assert !@any_reltype(atmos, (UnionAll,))
@assert !@any_reltype(atmos, (UnionAll, DataType))

@info "AtmosModel: \n$(summary(atmos))"
return atmos
Expand All @@ -97,8 +97,7 @@ function get_numerics(parsed_args)
edmfx_sgsflux_upwinding =
Val(Symbol(parsed_args["edmfx_sgsflux_upwinding"]))

limiter =
parsed_args["apply_limiter"] ? Limiters.QuasiMonotoneLimiter : nothing
limiter = parsed_args["apply_limiter"] ? CA.QuasiMonotoneLimiter() : nothing

# wrap each upwinding mode in a Val for dispatch
numerics = AtmosNumerics(;
Expand Down
2 changes: 2 additions & 0 deletions src/solver/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 317b4f6

Please sign in to comment.