AffineConstraints distribute_local_to_global error

43 views
Skip to first unread message

Vinayak Vijay

unread,
May 6, 2024, 3:16:16 PM5/6/24
to deal.II User Group
Hello,

I am trying to assemble a system using the AffineConstraints::distribute_local_to_global(...) function as per the following code snippet:

constraints.distribute_local_to_global(cell_matrix_multiplier01,
local_dof_indices,
dof_indices_multiplier,
system_matrix_network.block(0, 1));

However, i get the following error:

--------------------------------------------------------
An error occurred in line <670> of file </tmp/vinayak/spack-stage/spack-stage-dealii-9.4.0-36iqlesdxyr55pceokjxk6hkwcek4m2d/spack-src/source/lac/sparsity_pattern.cc> in function
    dealii::SparsityPattern::size_type dealii::SparsityPattern::operator()(dealii::SparsityPattern::size_type, dealii::SparsityPattern::size_type) const
The violated condition was:
    ::dealii::deal_II_exceptions::internals::compare_less_than(j, cols)
Additional information:
    Index 6 is not in the half-open range [0,6).

Stacktrace:
-----------
#0  /home/~/Documents/spack_dir_dnd/lib/libdeal_II.g.so.9.4.0: dealii::SparsityPattern::operator()(unsigned int, unsigned int) const
#1  /home/~/Documents/spack_dir_dnd/lib/libdeal_II.g.so.9.4.0: void dealii::SparseMatrix<double>::add<double>(unsigned int, unsigned int, unsigned int const*, double const*, bool, bool)
#2  /home/~/Documents/spack_dir_dnd/lib/libdeal_II.g.so.9.4.0: void dealii::AffineConstraints<double>::distribute_local_to_global<dealii::SparseMatrix<double> >(dealii::FullMatrix<double> const&, std::vector<unsigned int, std::allocator<unsigned int> > const&, dealii::AffineConstraints<double> const&, std::vector<unsigned int, std::allocator<unsigned int> > const&, dealii::SparseMatrix<double>&) const
#3  /home/~/Documents/spack_dir_dnd/lib/libdeal_II.g.so.9.4.0: void dealii::AffineConstraints<double>::distribute_local_to_global<dealii::SparseMatrix<double> >(dealii::FullMatrix<double> const&, std::vector<unsigned int, std::allocator<unsigned int> > const&, std::vector<unsigned int, std::allocator<unsigned int> > const&, dealii::SparseMatrix<double>&) const
#4  ./current: problem::assemble_1dh_constraints4(dealii::AffineConstraints<double> const&)
#5  ./current: problem::assemble_system_network(dealii::AffineConstraints<double> const&)
#6  ./current: solve::run_dealii_nr()
#7  ./current: main
--------------------------------------------------------

Aborted (core dumped)
-------------------------------------------------------------------

local_dof_indices - [0 1 2 3 4 5 6 7 8 9 10 11 ]
dof_indices_multiplier - [0 1 2 3 4 5]
constraints -
    0 6:  1
    1 7:  1
    2 8:  1
    3 9:  1
    4 10:  1
    5 11:  1
    12 18:  1
    13 19:  1
    14 20:  1
    15 21:  1
    16 22:  1
    17 23:  1
    24 30:  1
    25 31:  1
    26 32:  1
    27 33:  1
    28 34:  1
    29 35:  1
    36 42:  1
    37 43:  1
    38 44:  1
    39 45:  1
    40 46:  1
    41 47:  1

I understand that this error is supposed to come up when the entry being accessed isn't there in the sparsity pattern or the sparse matrix.
However, row 6 exists in the sparse matrix (sparse_matrix_network.txt attached herewith).
Can someone please help me with what i am missing here?

Thanks & regards
Vinayak
sparse_matrix_network.txt

Wolfgang Bangerth

unread,
May 6, 2024, 3:42:17 PM5/6/24
to dea...@googlegroups.com
On 5/7/24 00:46, Vinayak Vijay wrote:
>
> I am trying to assemble a system using
> the AffineConstraints::distribute_local_to_global(...) function as per the
> following code snippet:
>
> constraints.distribute_local_to_global(cell_matrix_multiplier01,
> local_dof_indices,
> dof_indices_multiplier,
> system_matrix_network.block(0, 1));
>
> However, i get the following error:
[...]

In the output file you show, it seems like block (0,1) has only columns 0...5,
so accessing column 6 would be an expected error.

Best
W.

--
------------------------------------------------------------------------
Wolfgang Bangerth email: bang...@colostate.edu
www: http://www.math.colostate.edu/~bangerth/


Vinayak Vijay

unread,
May 7, 2024, 2:56:21 PM5/7/24
to deal.II User Group
Thanks, prof. Bangerth.
Reply all
Reply to author
Forward
0 new messages