New nonzero at (3,3) caused a malloc when changing area of triangulation

440 views
Skip to first unread message

Loylick

unread,
Apr 1, 2017, 12:05:54 AM4/1/17
to deal.II User Group
Hello!

I was experimenting with Dealii examples and stumbled on some error I can not find a reason for.
I modified the example step-36 by defining an area like a pyramid on top of a truncated pyramid.
I constructed the truncated pyramid from 5 simplexes and top pyramid of 2 simplexes by merging
these 7 triangulations.
At running the program stops with the error:
./step-36.exe
   Number of active cells:       224
   Number of degrees of freedom: 327
[0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------
[0]PETSC ERROR: Argument out of range
[0]PETSC ERROR: New nonzero at (3,3) caused a malloc
Use MatSetOption(A, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE) to turn off this check
[0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for trouble shooting.
[0]PETSC ERROR: Petsc Release Version 3.7.5, Jan, 01, 2017
[0]PETSC ERROR: H:\Dev\install\solid\Release\step-36.exe on a arch-mswin-c-debug named LILA by loylick Sat Apr  1 06:46:54 2017
[0]PETSC ERROR: Configure options --with-cc="win32fe cl" --with-fc=0 --with-mpi=0 --with-debugging=1 --download-f2cblaslapack=1
[0]PETSC ERROR: #1 MatSetValues_SeqAIJ() line 485 in H:\Dev\PETSC-~1.5\src\mat\impls\aij\seq\aij.c
[0]PETSC ERROR: #2 MatSetValues() line 1190 in H:\Dev\PETSC-~1.5\src\mat\INTERF~1\matrix.c


----------------------------------------------------
Exception on processing:

--------------------------------------------------------
An error occurred in line <1403> of file <H:\Dev\sources\dealii\include\deal.II/lac/petsc_matrix_base.h> in function
    add
The violated condition was:
    ierr == 0
Additional information:
deal.II encountered an error while calling a PETSc function.
The description of the error provided by PETSc is "Argument out of range".
The numerical value of the original error code is 63.
--------------------------------------------------------

Please give me a clue about what is going wrong in the program. I put the code into attach.

P.S. the same program with the truncated pyramid area constructed from 5 simplexes (without top pyramid) works fine.

step-36.cc
step-36.prm

Wolfgang Bangerth

unread,
Apr 1, 2017, 5:14:44 PM4/1/17
to dea...@googlegroups.com

> I was experimenting with Dealii examples and stumbled on some error I can not
> find a reason for.
> I modified the example step-36 by defining an area like a pyramid on top of a
> truncated pyramid.
> I constructed the truncated pyramid from 5 simplexes and top pyramid of 2
> simplexes by merging
> these 7 triangulations.
> At running the program stops with the error:
> ./step-36.exe
> Number of active cells: 224
> Number of degrees of freedom: 327
> [0]PETSC ERROR: --------------------- Error Message
> --------------------------------------------------------------
> [0]PETSC ERROR: Argument out of range
> [0]PETSC ERROR: New nonzero at (3,3) caused a malloc

You are writing into a matrix entry that does not exist, i.e., that has not
been allocated in the sparsity pattern. Why this happens is difficult to tell,
but you ought to find out why your program writes into entry (3,3) of the
matrix, and why that entry has not been allocated before.

Best
W.

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

Loylick

unread,
Apr 6, 2017, 6:01:50 AM4/6/17
to deal.II User Group
I've resolved the issue by adding a fragment of code that handles sparsity pattern.
    DoFRenumbering::Cuthill_McKee (dof_handler);
    hanging_node_constraints
.clear();
   
DoFTools::make_hanging_node_constraints(dof_handler,hanging_node_constraints);            
    hanging_node_constraints
.close();

   
DynamicSparsityPattern dsp(dof_handler.n_dofs(), dof_handler.n_dofs());
   
DoFTools::make_sparsity_pattern(dof_handler, dsp);
    hanging_node_constraints
.condense(dsp);
    sparsity_pattern
.copy_from(dsp);

    stiffness_matrix
.reinit(sparsity_pattern);
    mass_matrix
.reinit(sparsity_pattern);

Reply all
Reply to author
Forward
0 new messages