Skip to content

Commit

Permalink
Compat fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
charleskawczynski committed Jan 3, 2025
1 parent f0d89dc commit 06fb52c
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 16 deletions.
26 changes: 15 additions & 11 deletions src/prognostic_equations/implicit/implicit_tendency.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
##### Implicit tendencies
#####

import ClimaCore
import ClimaCore: Fields, Geometry

NVTX.@annotate function implicit_tendency!(Yₜ, Y, p, t)
Expand Down Expand Up @@ -73,17 +74,20 @@ vertical_transport!(
::Val{:first_order},
ᶜdivᵥ,
) = @. ᶜρχₜ += -coeff * (ᶜdivᵥ(ᶠwinterp(ᶜJ, ᶜρ) * ᶠupwind1(ᶠu³, ᶜχ)))
vertical_transport!(
coeff,
ᶜρχₜ,
ᶜJ,
ᶜρ,
ᶠu³,
ᶜχ,
dt,
::Val{:vanleer_limiter},
ᶜdivᵥ,
) = @. ᶜρχₜ += -coeff * (ᶜdivᵥ(ᶠwinterp(ᶜJ, ᶜρ) * ᶠlin_vanleer(ᶠu³, ᶜχ, dt)))
@static if pkgversion(ClimaCore) v"0.14.22"
vertical_transport!(
coeff,
ᶜρχₜ,
ᶜJ,
ᶜρ,
ᶠu³,
ᶜχ,
dt,
::Val{:vanleer_limiter},
ᶜdivᵥ,
) = @. ᶜρχₜ +=
-coeff * (ᶜdivᵥ(ᶠwinterp(ᶜJ, ᶜρ) * ᶠlin_vanleer(ᶠu³, ᶜχ, dt)))
end
vertical_transport!(
coeff,
ᶜρχₜ,
Expand Down
14 changes: 14 additions & 0 deletions src/solver/type_getters.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Dates: DateTime, @dateformat_str
import Interpolations
import NCDatasets
import ClimaCore
import ClimaUtilities.OutputPathGenerator
import ClimaCore: InputOutput, Meshes, Spaces, Quadratures
import ClimaAtmos.RRTMGPInterface as RRTMGPI
Expand Down Expand Up @@ -103,6 +104,19 @@ function get_numerics(parsed_args)

energy_upwinding = Val(Symbol(parsed_args["energy_upwinding"]))
tracer_upwinding = Val(Symbol(parsed_args["tracer_upwinding"]))

# Compat
if !(pkgversion(ClimaCore) v"0.14.22") &&
energy_upwinding == Val(:vanleer_limiter)
energy_upwinding = Val(:none)
@warn "energy_upwinding=vanleer_limiter is not supported for ClimaCore $(pkgversion(ClimaCore)), please upgrade. Setting energy_upwinding to :none"
end
if !(pkgversion(ClimaCore) v"0.14.22") &&
tracer_upwinding == Val(:vanleer_limiter)
tracer_upwinding = Val(:none)
@warn "tracer_upwinding=vanleer_limiter is not supported for ClimaCore $(pkgversion(ClimaCore)), please upgrade. Setting tracer_upwinding to :none"
end

edmfx_upwinding = Val(Symbol(parsed_args["edmfx_upwinding"]))
edmfx_sgsflux_upwinding =
Val(Symbol(parsed_args["edmfx_sgsflux_upwinding"]))
Expand Down
13 changes: 8 additions & 5 deletions src/utils/abbreviations.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using ClimaCore: Geometry, Operators, MatrixFields
import ClimaCore

# Alternatively, we could use Vec₁₂₃, Vec³, etc., if that is more readable.
const C1 = Geometry.Covariant1Vector
Expand Down Expand Up @@ -85,11 +86,13 @@ const ᶠfct_zalesak = Operators.FCTZalesak(
bottom = Operators.FirstOrderOneSided(),
top = Operators.FirstOrderOneSided(),
)
const ᶠlin_vanleer = Operators.LinVanLeerC2F(
bottom = Operators.FirstOrderOneSided(),
top = Operators.FirstOrderOneSided(),
constraint = Operators.MonotoneLocalExtrema(), # (Mono5)
)
@static if pkgversion(ClimaCore) v"0.14.22"
const ᶠlin_vanleer = Operators.LinVanLeerC2F(
bottom = Operators.FirstOrderOneSided(),
top = Operators.FirstOrderOneSided(),
constraint = Operators.MonotoneLocalExtrema(), # (Mono5)
)
end

const ᶜinterp_matrix = MatrixFields.operator_matrix(ᶜinterp)
const ᶜleft_bias_matrix = MatrixFields.operator_matrix(ᶜleft_bias)
Expand Down

0 comments on commit 06fb52c

Please sign in to comment.