Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nonhydrostatic pressure solver does not accept a horizontally irregular grid. #2940

Closed
m3azevedo opened this issue Feb 22, 2023 · 2 comments · Fixed by #2946
Closed

Nonhydrostatic pressure solver does not accept a horizontally irregular grid. #2940

m3azevedo opened this issue Feb 22, 2023 · 2 comments · Fixed by #2946
Labels
grids 🗺️ question 💭 No such thing as a stupid question

Comments

@m3azevedo
Copy link

m3azevedo commented Feb 22, 2023

Hello,
I noticed a vertically irregular grid can be passed to a nonhydrostatic model and seems to run without a problem, but when the same formulation is applied to the horizontal, a method error is returned by the PressureSolver. The error persists if either the FFTBasedPoissonSolver or the FourierTridiagonalPoissonSolver are called. Is this a known issue?

A MWE follows. Notice the MWE is a reduction of the example given in the grid documentation, which also gives back the same error when passed to a nonhydrostatic model.

using Oceananigans

Lx, Ly, Lz = 1e4, 1e4, 1e3;
Nx, Ny, Nz = 64, 64, 32;
chebychev_spaced_y_faces(j) = - Ly/2 * cos(π * (j - 1) / Ny)

grid = RectilinearGrid(size = (Nx, Ny, Nz),
topology = (Periodic, Bounded, Bounded),
                              x = (0, Lx),
                              y = chebychev_spaced_y_faces,
                              z = (-Lz,0)
                              )

model = NonhydrostaticModel(; grid)

Gives:

ERROR: MethodError: no method matching PressureSolver(::CPU, ::RectilinearGrid{Float64, Periodic, Bounded, Bounded, Float64, OffsetArrays.OffsetVector{Float64, Vector{Float64}}, Float64, OffsetArrays.OffsetVector{Float64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, 
Int64}}, OffsetArrays.OffsetVector{Float64, Vector{Float64}}, OffsetArrays.OffsetVector{Float64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}}, CPU})
Closest candidates are:
  PressureSolver(::Any, ::RectilinearGrid{<:Any, <:Any, <:Any, <:Any, <:Number, <:Number, <:Number}) at C:\Users\.julia\packages\Oceananigans\MDeEL\src\Models\NonhydrostaticModels\NonhydrostaticModels.jl:23
  PressureSolver(::Any, ::RectilinearGrid{<:Any, <:Any, <:Any, <:Any, <:Number, <:Number}) at C:\Users\.julia\packages\Oceananigans\MDeEL\src\Models\NonhydrostaticModels\NonhydrostaticModels.jl:24
  PressureSolver(::Any, ::ImmersedBoundaryGrid) at C:\Users\.julia\packages\Oceananigans\MDeEL\src\Models\NonhydrostaticModels\NonhydrostaticModels.jl:27
Stacktrace:
 [1] NonhydrostaticModel(; grid::RectilinearGrid{Float64, Periodic, Bounded, Bounded, Float64, OffsetArrays.OffsetVector{Float64, Vector{Float64}}, Float64, OffsetArrays.OffsetVector{Float64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}}, OffsetArrays.OffsetVector{Float64, Vector{Float64}}, OffsetArrays.OffsetVector{Float64, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}}, CPU}, clock::Clock{Float64}, advection::Centered{1, Float64, Nothing, Nothing, Nothing, Nothing}, buoyancy::Nothing, coriolis::Nothing, stokes_drift::Nothing, forcing::NamedTuple{(), Tuple{}}, closure::Nothing, boundary_conditions::NamedTuple{(), Tuple{}}, tracers::Tuple{}, timestepper::Symbol, background_fields::NamedTuple{(), Tuple{}}, particles::Nothing, velocities::Nothing, pressures::Nothing, diffusivity_fields::Nothing, pressure_solver::Nothing, immersed_boundary::Nothing, auxiliary_fields::NamedTuple{(), Tuple{}}, calculate_only_active_cells_tendencies::Bool)
   @ Oceananigans.Models.NonhydrostaticModels C:\Users\.julia\packages\Oceananigans\MDeEL\src\Models\NonhydrostaticModels\nonhydrostatic_model.jl:184
 [2] top-level scope
   @ d:\Documentos\Oceananigans\inertial-instability\Minimum_notworking_example.jl:17

All the best.

@glwagner
Copy link
Member

Yes, this is known --- we don't have support for horizontally irregular / curvilinear grids with NonhydrostaticModel.

@navidcy navidcy added question 💭 No such thing as a stupid question grids 🗺️ labels Feb 22, 2023
@navidcy
Copy link
Collaborator

navidcy commented Feb 25, 2023

Let's add an info/warning so that users don't think that this is a bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
grids 🗺️ question 💭 No such thing as a stupid question
Projects
None yet
3 participants