Ferrite-FEM / Ferrite-FEM/Ferrite.jl
Interface coupling is broken in sparsity patterns for mixed grids
- Dominant language
- Julia
- Stars
- 453
- Forks
- 115
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 11
Description
kinda related to #1102 and #850 . MWE:
```julia
grid = generate_grid(Hexahedron, (1,1,1))
nodes = grid.nodes
cells = grid.cells
push!(nodes, Node((2.0, -1.0, -1.0)))
push!(nodes, Node((2.0, -1.0, 1.0)))
cells = vcat(cells, Wedge((2,9,4,6,10,8)))
grid_mixed = Grid(cells, nodes)
ip1 = DiscontinuousLagrange{RefHexahedron, 1}()
ip2 = DiscontinuousLagrange{RefPrism, 1}()
dh = DofHandler(grid_mixed)
sdh1 = SubDofHandler(dh, Set([1]))
sdh2 = SubDofHandler(dh, Set([2]))
add!(sdh1, :u, ip1)
add!(sdh2, :u, ip2)
close!(dh)
```
```julia
julia> allocate_matrix(dh)
14×14 SparseArrays.SparseMatrixCSC{Float64, Int64} with 100 stored entries:
0.0 0.0 0.0 0.0 0.0 0.0 ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅
0.0 0.0 0.0 0.0 0.0 0.0 ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅
0.0 0.0 0.0 0.0 0.0 0.0 ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅
0.0 0.0 0.0 0.0 0.0 0.0 ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅
0.0 0.0 0.0 0.0 0.0 0.0 ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅
0.0 0.0 0.0 0.0 0.0 0.0 ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅ ⋅
⋅ ⋅ ⋅ ⋅ ⋅ ⋅ 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
⋅ ⋅ ⋅ ⋅ ⋅ ⋅ 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
⋅ ⋅ ⋅ ⋅ ⋅ ⋅ 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
⋅ ⋅ ⋅ ⋅ ⋅ ⋅ 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
⋅ ⋅ ⋅ ⋅ ⋅ ⋅ 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
⋅ ⋅ ⋅ ⋅ ⋅ ⋅ 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
⋅ ⋅ ⋅ ⋅ ⋅ ⋅ 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
⋅ ⋅ ⋅ ⋅ ⋅ ⋅ 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
julia> allocate_matrix(dh; topology = ExclusiveTopology(grid2), interface_coupling = trues(1,1))
ERROR: BoundsError: attempt to access 6-element Vector{Int64} at index [1:8]
Stacktrace:
[1] throw_boundserror(A::Vector{Int64}, I::Tuple{UnitRange{Int64}})
@ Base ./essentials.jl:14
[2] checkbounds
@ ./abstractarray.jl:699 [inlined]
[3] view(A::Vector{Int64}, I::UnitRange{Int64})
@ Base ./subarray.jl:214
[4] _add_interface_entries!(sp::SparsityPattern, dh::DofHandler{…}, ch::Nothing, topology::ExclusiveTopology, keep_constrained::Bool, interface_coupling::BitMatrix)
@ Ferrite ~/.julia/dev/Ferrite/src/Dofs/sparsity_pattern.jl:621
[5] #add_interface_entries!#431
@ ~/.julia/dev/Ferrite/src/Dofs/sparsity_pattern.jl:311 [inlined]
[6] add_interface_entries!
@ ~/.julia/dev/Ferrite/src/Dofs/sparsity_pattern.jl:301 [inlined]
[7] #add_sparsity_entries!#429
@ ~/.julia/dev/Ferrite/src/Dofs/sparsity_pattern.jl:239 [inlined]
[8] add_sparsity_entries! (repeats 2 times)
@ ~/.julia/dev/Ferrite/src/Dofs/sparsity_pattern.jl:222 [inlined]
[9] allocate_matrix(::Type{…}, ::DofHandler{…}; kwargs::@Kwargs{…})
@ Ferrite ~/.julia/dev/Ferrite/src/Dofs/sparsity_pattern.jl:417
[10] allocate_matrix
@ ~/.julia/dev/Ferrite/src/Dofs/sparsity_pattern.jl:415 [inlined]
[11] #allocate_matrix#434
@ ~/.julia/dev/Ferrite/src/Dofs/sparsity_pattern.jl:431 [inlined]
[12] top-level scope
@ REPL[66]:1
Some type information was truncated. Use `show(err)` to see complete types.
```
I'm thinking of caching which subdmains share interfaces and have a third coupling matrix of size ndofs_here x ndofs_there for that
Contributor guide
Assessment
This issue has not been assessed yet.