This is a PETSc error that you're hitting because you're adding new non-zeros in the matrix. PETSc tries to help you by throwing an error if you do this, because allocating new non-zeros (outside the specified sparsity pattern) can slow down your program a lot.
The easy fix is indicated in the PETSc error message: "Use MatSetOption(A, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE) to turn off this check" To do this, you need to cast your matrix to a PetscMatrix, then do petsc_matrix->mat() to get the PETSc Mat that you can pass to MatSetOption. The more involved fix is to augment your sparsity pattern (e.g. see miscellaneous_ex9). David On Tue, Oct 6, 2015 at 6:13 AM, Вася Бубликов <gream...@gmail.com> wrote: > Dear Sirs, > > I'm trying to make Libmesh work with a simple linear elasticity problem > using linear systems example 4 as an example. I need to force the top > boundary remain flat, i.e. all normal displacements are of the same value > to be computed. > To obtain this, for example to make the displacements for DOFs i1,i2,i3..in > the same as for the DOF j, I add penalty (1e10) to K(in,in) and subtract it > from K(in,j) meaning to add 1e10*(U_in - U_j) = 0 to the in'th equation > in the assembly function. But as soon as in and j are on different finite > elements I get the same error no matter which particular c++ function I use > (system.matrix->add(i,j,value) system.matrix->add_matrix(DenseMatrix) > or system.matrix->add(SparseMatrix) ). I would be very mush obliged if you > helped me. > > Kind regards, > Roman Khudobin > Research Assistant ICHPH RAS > > [0]PETSC ERROR: --------------------- Error Message > -------------------------------------------------------------- > [0]PETSC ERROR: Argument out of range > [0]PETSC ERROR: New nonzero at (17,47) 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.6.1, Jul, 22, 2015 > [0]PETSC ERROR: ./constrain.o on a arch-linux-c-opt named izmailovo by > gream Tue Oct 6 12:55:21 2015 > [0]PETSC ERROR: Configure options --prefix=/opt/petsc/linux-c-opt > --PETSC_ARCH=arch-linux-c-opt --with-shared-libraries=1 --COPTFLAGS=-O3 > --CXXOPTFLAGS=-O3 --with-mumps=1 --with-hdf5=1 --with-scalapack=1 > --with-suitesparse=1 --with-metis=1 --with-parmetis=1 --with-ptscotch=1 > > --with-ptscotch-lib="[libesmumps.so,libptscotch.so,libptscotcherr.so,libscotch.so,libscotcherr.so,libbz2.so]" > --with-ptscotch-include=/usr/include/scotch --with-superlu=1 > --with-superlu-lib=-lsuperlu --with-superlu-include=/usr/include/superlu > --with-ml=1 > [0]PETSC ERROR: #1 MatSetValues_SeqAIJ() line 485 in > /tmp/yaourt-tmp-gream/aur-petsc/src/petsc-3.6.1/src/mat/impls/aij/seq/aij.c > [0]PETSC ERROR: #2 MatSetValues() line 1173 in > /tmp/yaourt-tmp-gream/aur-petsc/src/petsc-3.6.1/src/mat/interface/matrix.c > -------------------------------------------------------------------------- > MPI_ABORT was invoked on rank 0 in communicator MPI_COMM_WORLD > with errorcode 1. > > NOTE: invoking MPI_ABORT causes Open MPI to kill all MPI processes. > You may or may not see output from other processes, depending on > exactly when Open MPI kills them. > -------------------------------------------------------------------------- > > > ------------------------------------------------------------------------------ > > _______________________________________________ > Libmesh-users mailing list > Libmesh-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/libmesh-users > > ------------------------------------------------------------------------------ _______________________________________________ Libmesh-users mailing list Libmesh-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libmesh-users