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

Can't interpolate between any old OrthogonalSphericalShellGrid and a LatitudeLongitudeGrid #3745

Open
glwagner opened this issue Aug 28, 2024 · 1 comment
Labels
bug 🐞 Even a perfect program still has bugs

Comments

@glwagner
Copy link
Member

glwagner commented Aug 28, 2024

For example

using Oceananigans
using OrthogonalSphericalShellGrids
using Oceananigans.Fields: interpolate!

trg = TripolarGrid(size = (10, 10, 10), z = (0, 1))
llg = LatitudeLongitudeGrid(size = (10, 10, 10), latitude = (-75, 75), longitude = (0, 360), z = (0, 1))

ctrg = CenterField(trg)
cllg = CenterField(llg)

interpolate!(cllg, ctrg)

fails with

julia> interpolate!(cllg, ctrg)
ERROR: MethodError: no method matching fractional_x_index(::Float64, ::Tuple{…}, ::Oceananigans.Grids.ZRegOrthogonalSphericalShellGrid{…})

Closest candidates are:
  fractional_x_index(::Any, ::Any, ::ImmersedBoundaryGrid)
   @ Oceananigans ~/.julia/packages/Oceananigans/A6YUV/src/ImmersedBoundaries/ImmersedBoundaries.jl:283
  fractional_x_index(::Any, ::Any, ::Oceananigans.Grids.XRegularLLG)
   @ Oceananigans ~/.julia/packages/Oceananigans/A6YUV/src/Fields/interpolate.jl:74
  fractional_x_index(::Any, ::Any, ::LatitudeLongitudeGrid)
   @ Oceananigans ~/.julia/packages/Oceananigans/A6YUV/src/Fields/interpolate.jl:89
  ...

Stacktrace:
  [1] _fractional_indices
    @ ~/.julia/packages/Oceananigans/A6YUV/src/Fields/interpolate.jl:165 [inlined]
  [2] fractional_indices
    @ ~/.julia/packages/Oceananigans/A6YUV/src/Fields/interpolate.jl:154 [inlined]
  [3] interpolate
    @ ~/.julia/packages/Oceananigans/A6YUV/src/Fields/interpolate.jl:240 [inlined]
  [4] macro expansion
    @ ~/.julia/packages/Oceananigans/A6YUV/src/Fields/interpolate.jl:337 [inlined]
  [5] cpu__interpolate!
    @ ~/.julia/packages/KernelAbstractions/3B1v2/src/macros.jl:291 [inlined]
  [6] cpu__interpolate!(__ctx__::KernelAbstractions.CompilerMetadata{…}, to_field::Field{…}, to_grid::LatitudeLongitudeGrid{…}, to_location::Tuple{…}, from_field::Field{…}, from_grid::Oceananigans.Grids.ZRegOrthogonalSphericalShellGrid{…}, from_location::Tuple{…})
    @ Oceananigans.Fields ./none:0
  [7] __thread_run(tid::Int64, len::Int64, rem::Int64, obj::KernelAbstractions.Kernel{…}, ndrange::Nothing, iterspace::KernelAbstractions.NDIteration.NDRange{…}, args::Tuple{…}, dynamic::KernelAbstractions.NDIteration.DynamicCheck)
    @ KernelAbstractions ~/.julia/packages/KernelAbstractions/3B1v2/src/cpu.jl:140
  [8] __run(obj::KernelAbstractions.Kernel{…}, ndrange::Nothing, iterspace::KernelAbstractions.NDIteration.NDRange{…}, args::Tuple{…}, dynamic::KernelAbstractions.NDIteration.DynamicCheck, static_threads::Bool)
    @ KernelAbstractions ~/.julia/packages/KernelAbstractions/3B1v2/src/cpu.jl:107
  [9] (::KernelAbstractions.Kernel{…})(::Field{…}, ::Vararg{…}; ndrange::Nothing, workgroupsize::Nothing)
    @ KernelAbstractions ~/.julia/packages/KernelAbstractions/3B1v2/src/cpu.jl:46
 [10] (::KernelAbstractions.Kernel{…})(::Field{…}, ::Vararg{…})
    @ KernelAbstractions ~/.julia/packages/KernelAbstractions/3B1v2/src/cpu.jl:39
 [11] launch!(::CPU, ::LatitudeLongitudeGrid{…}, ::Tuple{…}, ::typeof(Oceananigans.Fields._interpolate!), ::Field{…}, ::Vararg{…}; include_right_boundaries::Bool, reduced_dimensions::Tuple{}, location::Nothing, active_cells_map::Nothing, kwargs::@Kwargs{})
    @ Oceananigans.Utils ~/.julia/packages/Oceananigans/A6YUV/src/Utils/kernel_launching.jl:168
 [12] launch!
    @ ~/.julia/packages/Oceananigans/A6YUV/src/Utils/kernel_launching.jl:154 [inlined]
 [13] interpolate!(to_field::Field{…}, from_field::Field{…})
    @ Oceananigans.Fields ~/.julia/packages/Oceananigans/A6YUV/src/Fields/interpolate.jl:366
 [14] top-level scope
    @ REPL[8]:1
Some type information was truncated. Use `show(err)` to see complete types.

@simone-silvestri code credit

CliMA/OrthogonalSphericalShellGrids.jl#29

@glwagner glwagner added the bug 🐞 Even a perfect program still has bugs label Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐞 Even a perfect program still has bugs
Projects
None yet
Development

No branches or pull requests

2 participants
@glwagner and others