CliMA / Oceananigans.jl

🌊 Julia software for fast, friendly, flexible, ocean-flavored fluid dynamics on CPUs and GPUs
https://clima.github.io/OceananigansDocumentation/stable
MIT License
989 stars 194 forks source link

Cannot build `HydrostaticFreeSurfaceModel` with different advection schemes for different tracers #3863

Closed glwagner closed 1 week ago

glwagner commented 1 week ago

There's a bug in adapt_advection_order (or the constructor for HydrostaticFreeSurfaceModel, since this code:

using Oceananigans
grid = RectilinearGrid(size=1, x=(0, 1), topology=(Periodic, Flat, Flat))
tracer_advection = (b=nothing, c=WENO())
model = HydrostaticFreeSurfaceModel(; grid, tracer_advection)

fails with

ERROR: LoadError: MethodError: no method matching adapt_advection_order(::@NamedTuple{…}, ::Int64, ::RectilinearGrid{…})

Closest candidates are:
  adapt_advection_order(::Nothing, ::Int64, ::Oceananigans.Grids.AbstractGrid)
   @ Oceananigans ~/Projects/Oceananigans.jl/src/Advection/adapt_advection_order.jl:60
  adapt_advection_order(::UpwindBiased{B}, ::Int64, ::Oceananigans.Grids.AbstractGrid) where B
   @ Oceananigans ~/Projects/Oceananigans.jl/src/Advection/adapt_advection_order.jl:74
  adapt_advection_order(::WENO{B, FT, XT, YT, ZT}, ::Int64, ::Oceananigans.Grids.AbstractGrid) where {B, FT, XT, YT, ZT}
   @ Oceananigans ~/Projects/Oceananigans.jl/src/Advection/adapt_advection_order.jl:92
glwagner commented 1 week ago

@simone-silvestri