CliMA / CliMA/ClimaCore.jl

Different behavior when indexing with ColumnIndex vs Integers

Open
#2,355 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Julia
Stars
117
Forks
19
Avg merge
3d 4h
Merged PRs (30d)
41

Description

## Describe the bug
When calling `column` on a `SpectralElementSpace2D`, we see different behavior when indexing with a `ColumnIndex` or with Integers.

With integers we get the expected behavior - a new `PointSpace`. With `ColumnIndex` however the fallback method is called which does nothing, and the input space is returned unchanged.

## To Reproduce

```julia
import ClimaCore
import ClimaComms
import ClimaUtilities

FT = Float64
xlim = FT.((0, 1))
ylim = FT.((0, 1))
context = ClimaComms.context()

domain_x = ClimaCore.Domains.IntervalDomain(
ClimaCore.Geometry.XPoint(xlim[1]),
ClimaCore.Geometry.XPoint(xlim[2]),
periodic = true,
)
domain_y = ClimaCore.Domains.IntervalDomain(
ClimaCore.Geometry.YPoint(ylim[1]),
ClimaCore.Geometry.YPoint(ylim[2]),
periodic = true,
)
plane = ClimaCore.Domains.RectangleDomain(domain_x, domain_y)
mesh = ClimaCore.Meshes.RectilinearMesh(plane, 1, 1)
grid_topology = ClimaCore.Topologies.Topology2D(context, mesh)
quad = ClimaCore.Spaces.Quadratures.GL{1}()
space_2d = ClimaCore.Spaces.SpectralElementSpace2D(
grid_topology,
quad,
)

# Observe different behaviors when using ColumnIndex vs. Integers
ClimaCore.Spaces.column(space_2d, 1, 1, 1) isa ClimaCore.Spaces.PointSpace # true
ClimaCore.Spaces.column(space_2d, ClimaCore.Grids.ColumnIndex((1, 1), 1)) isa ClimaCore.Spaces.PointSpace # false
ClimaCore.Spaces.column(space_2d, ClimaCore.Grids.ColumnIndex((1, 1), 1)) == space_2d # true
```

Project


ClimaCore v0.14.35

## System details

Any relevant system information:
- ClimaCore v0.14.35
- Julia version 1.11.5
- operating system MacOS Sequoia 15.5

## Related issues / PRs

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.