Closed iuryt closed 1 year ago
As discussed in https://github.com/CliMA/Oceananigans.jl/discussions/3177#discussioncomment-6448740 I see two solutions: either drop support for v1.8 or prior with a v1.9 compat entry, or add something like
if VERSION < v"1.8"
...
else
...
end
Adding the compat requirement is safer since tests only run on v1.9.
On the other hand, in this case, allowing backwards compatibility might be just a few lines like above.
As it seems like an easy PR, I can do that if needed and if people decide to do the backward compatibility.
Letβs discuss here whatβs better. Then the PR is easy, agreed!
Btw, the problem is not related with bathymetry directly. It's related with the Heptadiagonal Matrix-based free surface solver.
When there is an immersed boundary the default free-surface solver is the Heptadiagonal Matrix-based solver so that's why we get the error above. But an immersed boundary grid is not really required.
test_Oceananigans/ $ julia-1.8 --project
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.8.5 (2023-01-08)
_/ |\__'_|_|_|\__'_| |
|__/ |
(@v1.8) pkg> activate .
Activating new project at `~/Research/test_OC`
(test_Oceananigans) pkg> add Oceananigans
Updating registry at `~/.julia/registries/General.toml`
Resolving package versions...
Updating `~/Research/test_OC/Project.toml`
[9e8cae18] + Oceananigans v0.84.1
Updating `~/Research/test_OC/Manifest.toml`
[621f4979] + AbstractFFTs v1.4.0
[79e6a3ab] + Adapt v3.6.2
[4fba245c] + ArrayInterface v7.4.11
[a9b6321e] + Atomix v0.1.0
[ab4f0b2a] + BFloat16s v0.4.2
[fa961155] + CEnum v0.4.2
[179af706] + CFTime v0.1.2
[052768ef] + CUDA v4.4.0
[1af6417a] + CUDA_Runtime_Discovery v0.2.2
[d360d2e6] + ChainRulesCore v1.16.0
[9e997f8a] + ChangesOfVariables v0.1.8
[1fbeeb36] + CommonDataModel v0.2.4
[34da2185] + Compat v4.7.0
[a8cc5b0e] + Crayons v4.1.1
[7445602f] + CubedSphere v0.2.3
[9a962f9c] + DataAPI v1.15.0
[864edb3b] + DataStructures v0.18.14
[e2d170a0] + DataValueInterfaces v1.0.0
[ffbed154] + DocStringExtensions v0.9.3
[b305315f] + Elliptic v1.0.1
[e2ba6199] + ExprTools v0.1.9
[7a1cc6ca] + FFTW v1.7.1
[5789e2e9] + FileIO v1.16.1
[0c68f7d7] + GPUArrays v8.8.1
[46192b85] + GPUArraysCore v0.1.5
[61eb1bfa] + GPUCompiler v0.21.4
[c27321d9] + Glob v1.3.1
[615f187c] + IfElse v0.1.1
[40713840] + IncompleteLU v0.2.1
[3587e190] + InverseFunctions v0.1.11
[92d709cd] + IrrationalConstants v0.2.2
[42fd0dbc] + IterativeSolvers v0.9.2
[82899510] + IteratorInterfaceExtensions v1.0.0
[033835bb] + JLD2 v0.4.32
[692b3bcd] + JLLWrappers v1.4.1
[0f8b85d8] + JSON3 v1.13.1
[63c18a36] + KernelAbstractions v0.9.7
[929cbde3] + LLVM v6.1.0
[2ab3a3ac] + LogExpFunctions v0.3.24
[da04e1cc] + MPI v0.20.12
[3da0fdf6] + MPIPreferences v0.1.8
[1914dd2f] + MacroTools v0.5.10
[85f8d34a] + NCDatasets v0.12.17
[9e8cae18] + Oceananigans v0.84.1
[6fe1bfb0] + OffsetArrays v1.12.10
[bac558e1] + OrderedCollections v1.6.0
[69de0a69] + Parsers v2.7.1
β
[0e08944d] + PencilArrays v0.18.0
[4a48f351] + PencilFFTs v0.15.0
[eebad327] + PkgVersion v0.3.2
[aea7be01] + PrecompileTools v1.1.2
[21216c6a] + Preferences v1.4.0
[49802e3a] + ProgressBars v1.5.0
[94ee1d12] + Quaternions v0.7.4
[74087812] + Random123 v1.6.1
[e6cf234a] + RandomNumbers v1.5.3
[c1ae055f] + RealDot v0.1.0
[3cdcf5f2] + RecipesBase v1.3.4
[189a3867] + Reexport v1.2.2
[ae029012] + Requires v1.3.0
[6038ab10] + Rotations v1.5.1
[6c6a2e73] + Scratch v1.2.0
[d496a93d] + SeawaterPolynomials v0.3.2
[66db9d55] + SnoopPrecompile v1.0.3
[276daf66] + SpecialFunctions v2.3.0
[aedffcd0] + Static v0.8.7
[0d7ed370] + StaticArrayInterface v1.4.0
[90137ffa] + StaticArrays v1.6.1
[1e83bf80] + StaticArraysCore v1.4.1
[15972242] + StaticPermutations v0.3.0
[5e0ebb24] + Strided v2.0.1
[4db3bf67] + StridedViews v0.1.2
[09ab397b] + StructArrays v0.6.15
[856f2bd8] + StructTypes v1.10.0
[3783bdb8] + TableTraits v1.0.1
[bd369af6] + Tables v1.10.1
[6aa5eb33] + TaylorSeries v0.15.2
[a759f4b9] + TimerOutputs v0.5.23
[3bb67fe8] + TranscodingStreams v0.9.13
[9d95972d] + TupleTools v1.3.0
[013be700] + UnsafeAtomics v0.2.1
[d80eeb9a] + UnsafeAtomicsLLVM v0.1.3
[81def892] + VersionParsing v1.3.0
[6e34b625] + Bzip2_jll v1.0.8+0
[4ee394cb] + CUDA_Driver_jll v0.5.0+1
[76a88914] + CUDA_Runtime_jll v0.6.0+0
[f5851436] + FFTW_jll v3.3.10+0
[0234f1f7] + HDF5_jll v1.14.0+0
[1d5cc7b8] + IntelOpenMP_jll v2023.1.0+0
[dad2f222] + LLVMExtra_jll v0.0.23+0
[1d63c593] + LLVMOpenMP_jll v15.0.4+0
[94ce4f54] + Libiconv_jll v1.16.1+2
[856f044c] + MKL_jll v2023.1.0+0
[7cb0a576] + MPICH_jll v4.1.2+0
[f1f71cc9] + MPItrampoline_jll v5.3.1+0
[9237b28f] + MicrosoftMPI_jll v10.1.3+4
[7243133f] + NetCDF_jll v400.902.208+0
[fe0851c0] + OpenMPI_jll v4.1.5+0
[458c3c95] + OpenSSL_jll v3.0.9+0
[efe28fd5] + OpenSpecFun_jll v0.5.5+0
[02c8fc9c] + XML2_jll v2.10.3+0
[3161d3a3] + Zstd_jll v1.5.5+0
[477f73a3] + libaec_jll v1.0.6+1
[0dad84c5] + ArgTools v1.1.1
[56f22d72] + Artifacts
[2a0f44e3] + Base64
[ade2ca70] + Dates
[8ba89e20] + Distributed
[f43a241f] + Downloads v1.6.0
[7b1f6079] + FileWatching
[b77e0a4c] + InteractiveUtils
[4af54fe1] + LazyArtifacts
[b27032c2] + LibCURL v0.6.3
[76f85450] + LibGit2
[8f399da3] + Libdl
[37e2e46d] + LinearAlgebra
[56ddb016] + Logging
[d6f4376e] + Markdown
[a63ad114] + Mmap
[ca575930] + NetworkOptions v1.2.0
[44cfe95a] + Pkg v1.8.0
[de0858da] + Printf
[3fa0cd96] + REPL
[9a3f8284] + Random
[ea8e919c] + SHA v0.7.0
[9e88b42a] + Serialization
[6462fe0b] + Sockets
[2f01184e] + SparseArrays
[10745b16] + Statistics
[4607b0f0] + SuiteSparse
[fa267f1f] + TOML v1.0.0
[a4e569a6] + Tar v1.10.1
[8dfed614] + Test
[cf7118a7] + UUIDs
[4ec0a83e] + Unicode
[e66e0078] + CompilerSupportLibraries_jll v1.0.1+0
[deac9b47] + LibCURL_jll v7.84.0+0
[29816b5a] + LibSSH2_jll v1.10.2+0
[c8ffd9c3] + MbedTLS_jll v2.28.0+0
[14a3606d] + MozillaCACerts_jll v2022.2.1
[4536629a] + OpenBLAS_jll v0.3.20+0
[05823500] + OpenLibm_jll v0.8.1+0
[83775a58] + Zlib_jll v1.2.12+3
[8e850b90] + libblastrampoline_jll v5.1.1+0
[8e850ede] + nghttp2_jll v1.48.0+0
[3f19e933] + p7zip_jll v17.4.0+0
Info Packages marked with β
have new versions available but compatibility constraints restrict them from upgrading. To see why use `status --outdated -m`
julia> using Oceananigans
julia> grid = RectilinearGrid(size=(5, 4, 3), extent=(1, 2, 3));
julia> model = HydrostaticFreeSurfaceModel(; grid)
HydrostaticFreeSurfaceModel{CPU, RectilinearGrid}(time = 0 seconds, iteration = 0)
βββ grid: 5Γ4Γ3 RectilinearGrid{Float64, Periodic, Periodic, Bounded} on CPU with 3Γ3Γ3 halo
βββ timestepper: QuasiAdamsBashforth2TimeStepper
βββ tracers: (T, S)
βββ closure: Nothing
βββ buoyancy: SeawaterBuoyancy with g=9.80665 and LinearEquationOfState(thermal_expansion=0.000167, haline_contraction=0.00078) with Δ = NegativeZDirection()
βββ free surface: ImplicitFreeSurface with gravitational acceleration 9.80665 m sβ»Β²
β βββ solver: FFTImplicitFreeSurfaceSolver
βββ coriolis: Nothing
julia> model = HydrostaticFreeSurfaceModel(; grid, free_surface = ImplicitFreeSurface(; solver_method=:HeptadiagonalIterativeSolver))
ERROR: MethodError: no method matching fkeep!(::Oceananigans.Solvers.var"#60#61", ::SparseArrays.SparseMatrixCSC{Float64, Int64})
Closest candidates are:
fkeep!(::SparseArrays.AbstractSparseMatrixCSC, ::Any) at ~/julia-1.8/usr/share/julia/stdlib/v1.8/SparseArrays/src/sparsematrix.jl:1491
fkeep!(::SparseArrays.AbstractSparseMatrixCSC, ::Any, ::Bool) at ~/julia-1.8/usr/share/julia/stdlib/v1.8/SparseArrays/src/sparsematrix.jl:1491
fkeep!(::SparseArrays.SparseVector, ::Any) at ~/julia-1.8/usr/share/julia/stdlib/v1.8/SparseArrays/src/sparsevector.jl:2005
Stacktrace:
[1] ensure_diagonal_elements_are_present!
@ ~/.julia/packages/Oceananigans/uvw2D/src/Solvers/matrix_solver_utils.jl:96 [inlined]
[2] matrix_from_coefficients(arch::CPU, grid::RectilinearGrid{Float64, Periodic, Periodic, Bounded, Float64, Float64, Float64, OffsetArrays.OffsetVector{Float64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}}, OffsetArrays.OffsetVector{Float64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}}, OffsetArrays.OffsetVector{Float64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}}, CPU}, coeffs::NTuple{5, Array{Float64, 3}}, reduced_dim::Tuple{Bool, Bool, Bool})
@ Oceananigans.Solvers ~/.julia/packages/Oceananigans/uvw2D/src/Solvers/heptadiagonal_iterative_solver.jl:196
[3] Oceananigans.Solvers.HeptadiagonalIterativeSolver(coeffs::NTuple{5, Array{Float64, 3}}; grid::RectilinearGrid{Float64, Periodic, Periodic, Bounded, Float64, Float64, Float64, OffsetArrays.OffsetVector{Float64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}}, OffsetArrays.OffsetVector{Float64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}}, OffsetArrays.OffsetVector{Float64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}}, CPU}, iterative_solver::Function, maximum_iterations::Int64, tolerance::Float64, reduced_dim::Tuple{Bool, Bool, Bool}, placeholder_timestep::Float64, preconditioner_method::Symbol, preconditioner_settings::Nothing, template::Vector{Float64}, verbose::Bool)
@ Oceananigans.Solvers ~/.julia/packages/Oceananigans/uvw2D/src/Solvers/heptadiagonal_iterative_solver.jl:98
[4] Oceananigans.Models.HydrostaticFreeSurfaceModels.MatrixImplicitFreeSurfaceSolver(grid::RectilinearGrid{Float64, Periodic, Periodic, Bounded, Float64, Float64, Float64, OffsetArrays.OffsetVector{Float64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}}, OffsetArrays.OffsetVector{Float64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}}, OffsetArrays.OffsetVector{Float64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}}, CPU}, settings::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, gravitational_acceleration::Float64)
@ Oceananigans.Models.HydrostaticFreeSurfaceModels ~/.julia/packages/Oceananigans/uvw2D/src/Models/HydrostaticFreeSurfaceModels/matrix_implicit_free_surface_solver.jl:61
[5] build_implicit_step_solver(#unused#::Val{:HeptadiagonalIterativeSolver}, grid::RectilinearGrid{Float64, Periodic, Periodic, Bounded, Float64, Float64, Float64, OffsetArrays.OffsetVector{Float64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}}, OffsetArrays.OffsetVector{Float64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}}, OffsetArrays.OffsetVector{Float64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}}, CPU}, settings::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, gravitational_acceleration::Float64)
@ Oceananigans.Models.HydrostaticFreeSurfaceModels ~/.julia/packages/Oceananigans/uvw2D/src/Models/HydrostaticFreeSurfaceModels/matrix_implicit_free_surface_solver.jl:66
[6] FreeSurface(free_surface::ImplicitFreeSurface{Nothing, Float64, Nothing, Nothing, Symbol, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}, velocities::NamedTuple{(:u, :v, :w), Tuple{Field{Face, Center, Center, Nothing, RectilinearGrid{Float64, Periodic, Periodic, Bounded, Float64, Float64, Float64, OffsetArrays.OffsetVector{Float64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}}, OffsetArrays.OffsetVector{Float64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}}, OffsetArrays.OffsetVector{Float64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}}, CPU}, Tuple{Colon, Colon, Colon}, OffsetArrays.OffsetArray{Float64, 3, Array{Float64, 3}}, Float64, FieldBoundaryConditions{BoundaryCondition{Oceananigans.BoundaryConditions.Periodic, Nothing}, BoundaryCondition{Oceananigans.BoundaryConditions.Periodic, Nothing}, BoundaryCondition{Oceananigans.BoundaryConditions.Periodic, Nothing}, BoundaryCondition{Oceananigans.BoundaryConditions.Periodic, Nothing}, BoundaryCondition{Oceananigans.BoundaryConditions.Flux, Nothing}, BoundaryCondition{Oceananigans.BoundaryConditions.Flux, Nothing}, BoundaryCondition{Oceananigans.BoundaryConditions.Flux, Nothing}}, Nothing, Oceananigans.Fields.FieldBoundaryBuffers{Nothing, Nothing, Nothing, Nothing}}, Field{Center, Face, Center, Nothing, RectilinearGrid{Float64, Periodic, Periodic, Bounded, Float64, Float64, Float64, OffsetArrays.OffsetVector{Float64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}}, OffsetArrays.OffsetVector{Float64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}}, OffsetArrays.OffsetVector{Float64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}}, CPU}, Tuple{Colon, Colon, Colon}, OffsetArrays.OffsetArray{Float64, 3, Array{Float64, 3}}, Float64, FieldBoundaryConditions{BoundaryCondition{Oceananigans.BoundaryConditions.Periodic, Nothing}, BoundaryCondition{Oceananigans.BoundaryConditions.Periodic, Nothing}, BoundaryCondition{Oceananigans.BoundaryConditions.Periodic, Nothing}, BoundaryCondition{Oceananigans.BoundaryConditions.Periodic, Nothing}, BoundaryCondition{Oceananigans.BoundaryConditions.Flux, Nothing}, BoundaryCondition{Oceananigans.BoundaryConditions.Flux, Nothing}, BoundaryCondition{Oceananigans.BoundaryConditions.Flux, Nothing}}, Nothing, Oceananigans.Fields.FieldBoundaryBuffers{Nothing, Nothing, Nothing, Nothing}}, Field{Center, Center, Face, Nothing, RectilinearGrid{Float64, Periodic, Periodic, Bounded, Float64, Float64, Float64, OffsetArrays.OffsetVector{Float64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}}, OffsetArrays.OffsetVector{Float64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}}, OffsetArrays.OffsetVector{Float64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}}, CPU}, Tuple{Colon, Colon, Colon}, OffsetArrays.OffsetArray{Float64, 3, Array{Float64, 3}}, Float64, FieldBoundaryConditions{BoundaryCondition{Oceananigans.BoundaryConditions.Periodic, Nothing}, BoundaryCondition{Oceananigans.BoundaryConditions.Periodic, Nothing}, BoundaryCondition{Oceananigans.BoundaryConditions.Periodic, Nothing}, BoundaryCondition{Oceananigans.BoundaryConditions.Periodic, Nothing}, Nothing, Nothing, BoundaryCondition{Oceananigans.BoundaryConditions.Flux, Nothing}}, Nothing, Oceananigans.Fields.FieldBoundaryBuffers{Nothing, Nothing, Nothing, Nothing}}}}, grid::RectilinearGrid{Float64, Periodic, Periodic, Bounded, Float64, Float64, Float64, OffsetArrays.OffsetVector{Float64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}}, OffsetArrays.OffsetVector{Float64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}}, OffsetArrays.OffsetVector{Float64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}}, CPU})
@ Oceananigans.Models.HydrostaticFreeSurfaceModels ~/.julia/packages/Oceananigans/uvw2D/src/Models/HydrostaticFreeSurfaceModels/implicit_free_surface.jl:95
[7] HydrostaticFreeSurfaceModel(; grid::RectilinearGrid{Float64, Periodic, Periodic, Bounded, Float64, Float64, Float64, OffsetArrays.OffsetVector{Float64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}}, OffsetArrays.OffsetVector{Float64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}}, OffsetArrays.OffsetVector{Float64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}}, CPU}, clock::Clock{Float64}, momentum_advection::Centered{1, Float64, Nothing, Nothing, Nothing, Nothing}, tracer_advection::Centered{1, Float64, Nothing, Nothing, Nothing, Nothing}, buoyancy::SeawaterBuoyancy{Float64, LinearEquationOfState{Float64}, Nothing, Nothing}, coriolis::Nothing, free_surface::ImplicitFreeSurface{Nothing, Float64, Nothing, Nothing, Symbol, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}, forcing::NamedTuple{(), Tuple{}}, closure::Nothing, boundary_conditions::NamedTuple{(), Tuple{}}, tracers::Tuple{Symbol, Symbol}, particles::Nothing, biogeochemistry::Nothing, velocities::Nothing, pressure::Nothing, diffusivity_fields::Nothing, auxiliary_fields::NamedTuple{(), Tuple{}})
@ Oceananigans.Models.HydrostaticFreeSurfaceModels ~/.julia/packages/Oceananigans/uvw2D/src/Models/HydrostaticFreeSurfaceModels/hydrostatic_free_surface_model.jl:175
[8] top-level scope
@ REPL[9]:1
Although it seems an easy fix, I'm leaning more towards to dropping support for v1.8 since we don't test there any more. Even if this bug can be alleviated, who knows whether something else is broken (or even silently broken, without even spitting out an error).
That's ok with me. 1.10 will be out soon too, we are moving into the future.
The title of this issue should be corrected. As @navidcy says, bathymetry has nothing to do with the issue. The bug / problem is in the free surface solver.
@iuryt wanna open a PR?
Yes. I would love to do, but I am not exactly sure on where I should make the changes.
Julia's compat entry at Project.toml + remove the warning mentioned in #3182 whatsoever + update the docs/readme where we mention what version of Julia is needed.
Probably that's it. Start with that and we can work together on the PR?
As discussed in #3177 , there is a version bug with
fkeep
and Julia 1.8.3 (1.9.2 works fine). Trying to useImmersedBoundaryGrid
withHydrostaticFreeSurfaceModel
returns the following error:Minimal reproducible example: