Description
I encountered a BoundsError when attempting to instantiate an OrderedFESpace on a mesh with periodic boundary conditions.
The issue seems to be caused by the topology modification introduced by isperiodic=(true,) (where boundary vertices are topologically glued together but geometrically distinct). This likely breaks the continuous indexing assumptions made by the ordering algorithm in GridapROMs.DofMaps.OrderedFESpaces.
Minimal Working Example
Here is a self-contained script that reproduces the crash:
using Gridap
using GridapROMs
# 1D domain definition and partitioning
L = 1.0
Ω = (-L, L)
partition = (10,)
# Cartesian model creation with periodicity (the bug trigger)
model = CartesianDiscreteModel(Ω, partition, isperiodic=(true,))
# Reference element definition (1st-order Lagrangian)
reffe = ReferenceFE(lagrangian, Float64, 1)
# OrderedFESpace construction
println("Attempting to construct OrderedFESpace...")
V_ordered = OrderedFESpace(model, reffe)
Error / Stacktrace
Attempting to construct OrderedFESpace...
ERROR: LoadError: BoundsError: attempt to access 10-element LinearIndices{1, Tuple{Base.OneTo{Int64}}} at index [10:11]
Stacktrace:
[1] throw_boundserror(A::LinearIndices{1, Tuple{Base.OneTo{Int64}}}, I::Tuple{UnitRange{Int64}})
@ Base ./essentials.jl:15
[2] checkbounds
@ ./abstractarray.jl:699 [inlined]
[3] view(A::LinearIndices{1, Tuple{Base.OneTo{Int64}}}, I::UnitRange{Int64})
@ Base ./subarray.jl:214
[4] get_dof_to_odof(fe_dof_basis::Gridap.ReferenceFEs.LagrangianDofBasis{VectorValue{1, Float64}, Int64}, cell_dofs_ids::Gridap.Arrays.Table{Int32, Vector{Int32}, Vector{Int32}}, cells::SubArray{CartesianIndex{1}, 1, CartesianIndices{1, Tuple{Base.OneTo{Int64}}}, Tuple{Gridap.Arrays.IdentityVector{Int64}}, false}, onodes::LinearIndices{1, Tuple{Base.OneTo{Int64}}}, orders::Tuple{Int64})
@ GridapROMs.DofMaps ~/.julia/packages/GridapROMs/N03YZ/src/FEM/DofMaps/OrderedFESpaces.jl:195
[5] get_dof_to_odof
@ ~/.julia/packages/GridapROMs/N03YZ/src/FEM/DofMaps/OrderedFESpaces.jl:170 [inlined]
[6] _get_cell_odof_info(model::CartesianDiscreteModel{1, Float64, typeof(identity)}, fe_dof_basis::FillArrays.Fill{Gridap.ReferenceFEs.LagrangianDofBasis{VectorValue{1, Float64}, Int64}, 1, Tuple{Base.OneTo{Int64}}}, cell_dofs_ids::Gridap.Arrays.Table{Int32, Vector{Int32}, Vector{Int32}}, cell_to_parent_cell::Gridap.Arrays.IdentityVector{Int64}, orders::Tuple{Int64})
@ GridapROMs.DofMaps ~/.julia/packages/GridapROMs/N03YZ/src/FEM/DofMaps/OrderedFESpaces.jl:146
[7] get_cell_odof_ids(space::Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.CompressedCellConformity{FillArrays.Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}}})
@ GridapROMs.DofMaps ~/.julia/packages/GridapROMs/N03YZ/src/FEM/DofMaps/OrderedFESpaces.jl:122
[8] OrderedFESpace(f::Gridap.FESpaces.UnconstrainedFESpace{Vector{Float64}, Gridap.FESpaces.CompressedCellConformity{FillArrays.Fill{Int64, 1, Tuple{Base.OneTo{Int64}}}}})
@ GridapROMs.DofMaps ~/.julia/packages/GridapROMs/N03YZ/src/FEM/DofMaps/OrderedFESpaces.jl:31
[9] OrderedFESpace(model::CartesianDiscreteModel{1, Float64, typeof(identity)}, args::Tuple{Lagrangian, Tuple{DataType, Int64}, @Kwargs{}}; kwargs::@Kwargs{})
@ GridapROMs.DofMaps ~/.julia/packages/GridapROMs/N03YZ/src/FEM/DofMaps/OrderedFESpaces.jl:43
[10] OrderedFESpace(model::CartesianDiscreteModel{1, Float64, typeof(identity)}, args::Tuple{Lagrangian, Tuple{DataType, Int64}, @Kwargs{}})
@ GridapROMs.DofMaps ~/.julia/packages/GridapROMs/N03YZ/src/FEM/DofMaps/OrderedFESpaces.jl:42
Expected Behavior
OrderedFESpace should correctly map the degrees of freedom on a periodic topology without throwing bounds errors.
Environment
- Julia version: 1.12.6
- Gridap version: 0.20.8
- GridapROMs version: 0.1.4
Description
I encountered a
BoundsErrorwhen attempting to instantiate anOrderedFESpaceon a mesh with periodic boundary conditions.The issue seems to be caused by the topology modification introduced by
isperiodic=(true,)(where boundary vertices are topologically glued together but geometrically distinct). This likely breaks the continuous indexing assumptions made by the ordering algorithm inGridapROMs.DofMaps.OrderedFESpaces.Minimal Working Example
Here is a self-contained script that reproduces the crash:
Error / Stacktrace
Expected Behavior
OrderedFESpaceshould correctly map the degrees of freedom on a periodic topology without throwing bounds errors.Environment