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

Interface coupling is broken in sparsity patterns for mixed grids #1103

Open
AbdAlazezAhmed opened this issue Nov 6, 2024 · 0 comments
Open
Labels

Comments

@AbdAlazezAhmed
Copy link
Collaborator

AbdAlazezAhmed commented Nov 6, 2024

kinda related to #1102 and #850 . MWE:

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> 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant