Broadcast issue with Data2DX slab data
- Dominant language
- Julia
- Stars
- 117
- Forks
- 19
- Avg merge
- 3d 5h
- Merged PRs (30d)
- 36
Description
While working on the extension of limiters to extruded spaces in #583 , I encountered the following issue on [this line](https://github.com/CliMA/ClimaCore.jl/blob/79d53ec64ee5fd7226dd5175db863af2d119f93d/src/Limiters/limiter.jl#L76).
The issue is reproducible in a MWE.
First I define two fields on my Cartesian extruded space (2D spectral x 1D FD), and corresponding field slab data (via `field_values`):
```
FT = Float64
Nij = 2
n1 = n2 = n3 = 1
horzspace, hv_center_space, hv_face_space = hvspace_3D(FT, Nij = Nij, xelems = n1, yelems = n2, zelems = n3)
# Initialize fields
ρ = ones(hv_center_space)
q = ones(hv_center_space)
ρ_e_slab = Fields.slab(ρ, 1, 1)
q_e_slab = Fields.slab(q, 1, 1)
ρ_e_data = Fields.field_values(ρ_e_slab)
q_e_data = Fields.field_values(q_e_slab)
```
Then I create a working array of the proper size, given the space of one of the two fields (as it's done in the limiter function):
```
julia> slab_space = axes(Fields.slab(ρ, 1))
CenterExtrudedFiniteDifferenceSpace:
SpectralElementSpace2D:
Topology2D on 1×1-element RectilinearMesh of RectangleDomain(
IntervalDomain(XPoint(-6.283185307179586), XPoint(6.283185307179586); periodic=true)
IntervalDomain(YPoint(-6.283185307179586), YPoint(6.283185307179586); periodic=true)
)
ClimaCore.Spaces.Quadratures.GLL{2}()
IntervalTopology on 1-element IntervalMesh of IntervalDomain(ZPoint(0.0), ZPoint(12.566370614359172); boundary_names = (:bottom, :top))
julia> q_data = Fields.field_values(zeros(slab_space))
ClimaCore.DataLayouts.VIJFH{Float64, 2, Array{Float64, 5}}
[0.0, 0.0, 0.0, 0.0]
```
And finally I attempt a simple broadcasted operation between these two that gives the following error:
```
julia> q_data .= q_e_data ./ ρ_e_data
ERROR: MethodError: no method matching copyto!(::ClimaCore.DataLayouts.VIJFH{Float64, 2, Array{Float64, 5}}, ::Base.Broadcast.Broadcasted{ClimaCore.DataLayouts.IJFStyle{2, Array{Float64}}, NTuple{5, Base.OneTo{Int64}}, typeof(/), Tuple{ClimaCore.DataLayouts.IJF{Float64, 2, SubArray{Float64, 3, Array{Float64, 5}, Tuple{Int64, Base.Slice{Base.OneTo{Int64}}, Base.Slice{Base.OneTo{Int64}}, Base.Slice{Base.OneTo{Int64}}, Int64}, true}}, ClimaCore.DataLayouts.IJF{Float64, 2, SubArray{Float64, 3, Array{Float64, 5}, Tuple{Int64, Base.Slice{Base.OneTo{Int64}}, Base.Slice{Base.OneTo{Int64}}, Base.Slice{Base.OneTo{Int64}}, Int64}, true}}}})
Closest candidates are:
copyto!(::Any, ::ArrayLayouts.Lmul) at ~/.julia/packages/ArrayLayouts/tg77x/src/lmul.jl:65
copyto!(::Any, ::ArrayLayouts.Rmul) at ~/.julia/packages/ArrayLayouts/tg77x/src/lmul.jl:67
copyto!(::Any, ::ArrayLayouts.Mul) at ~/.julia/packages/ArrayLayouts/tg77x/src/mul.jl:113
...
Stacktrace:
[1] materialize!
@ ./broadcast.jl:871 [inlined]
[2] materialize!(dest::ClimaCore.DataLayouts.VIJFH{Float64, 2, Array{Float64, 5}}, bc::Base.Broadcast.Broadcasted{ClimaCore.DataLayouts.IJFStyle{2, Array{Float64}}, Nothing, typeof(/), Tuple{ClimaCore.DataLayouts.IJF{Float64, 2, SubArray{Float64, 3, Array{Float64, 5}, Tuple{Int64, Base.Slice{Base.OneTo{Int64}}, Base.Slice{Base.OneTo{Int64}}, Base.Slice{Base.OneTo{Int64}}, Int64}, true}}, ClimaCore.DataLayouts.IJF{Float64, 2, SubArray{Float64, 3, Array{Float64, 5}, Tuple{Int64, Base.Slice{Base.OneTo{Int64}}, Base.Slice{Base.OneTo{Int64}}, Base.Slice{Base.OneTo{Int64}}, Int64}, true}}}})
@ Base.Broadcast ./broadcast.jl:868
[3] top-level scope
@ REPL[21]:1
[4] top-level scope
@ ~/.julia/packages/CUDA/nYggH/src/initialization.jl:52
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.