The error message "New nonzero at (1,9) caused a malloc!" is from PETSc.
PETSc is trying to do you a favor by telling you that you're allocating new
non-zeros in your matrix, which is slow and should be avoided.

PETSc requires the number of nonzeros per row to be specified before the
matrix is assembled so that it can allocate memory efficiently. libMesh
handles this pre-allocation for you automatically, but libMesh assumes a
standard sparsity pattern based on the finite element degrees of freedom in
your system. In your case, you've added some extra "non-standard" non-zeros
into the matrix, which causes the PETSc error.

To get around this you can either:

1) Not allocate the "non-standard" non-zeros in the matrix.

2) Tell PETSc not to report an error when a new non-zero is detected. You
can do this by setting MAT_NEW_NONZERO_ALLOCATION_ERR to PetscFalse by
calling MatSetOption on the PETSc Mat object (which you can obtain from the
libMesh PetscMatrix object).

3) Augment the libMesh sparsity pattern by calling augment_sparsity_pattern
on a System's dof_map. This is illustrated in libMesh example
miscellaneous_ex9, for example.

David




On Mon, Jun 6, 2016 at 10:00 PM, Jayaraman, Vegnesh <[email protected]>
wrote:

> Hello,
>
> I am trying to modify the entries of the system matrix in the main
> function.
>
> As a first test, I did the following,
>
>  elem = *el;
>  dof_map.dof_indices(elem,dof_columns);
>  system.matrix->zero_rows(dof_columns,500.234);
>
> The above code changes the variables in system matrix.
> However, if I did the following,
>
>
> DenseMatrix<Number> Fe;
> Fe.resize(dof_columns.size(),dof_columns.size());
> system.matrix->add_matrix (Fe, dof_columns);
>
> I get the following runtime error.
>
>
> [0]PETSC ERROR: --------------------- Error Message
> ------------------------------------
> [0]PETSC ERROR: Argument out of range!
> [0]PETSC ERROR: New nonzero at (1,9) caused a malloc!
> [0]PETSC ERROR:
> ------------------------------------------------------------------------
> [0]PETSC ERROR: Petsc Release Version 3.3.0, Patch 5, Sat Dec  1 15:10:41
> CST 2012
> [0]PETSC ERROR: See docs/changes/index.html for recent updates.
> [0]PETSC ERROR: See docs/faq.html for hints about trouble shooting.
> [0]PETSC ERROR: See docs/index.html for manual pages.
> [0]PETSC ERROR:
> ------------------------------------------------------------------------
> [0]PETSC ERROR: ./example-opt on a arch-linu named thor by vegnesh Mon
> Jun  6 20:48:10 2016
> [0]PETSC ERROR: Libraries linked from
> /home/vegnesh/codes/petsc/3.3-p5/arch-linux2-c-opt/lib
> [0]PETSC ERROR: Configure run at Mon Feb  8 21:38:17 2016
> [0]PETSC ERROR: Configure options
> --with-cxx=/home/mpanesi/APPLICATIONS/openmpi/openmpi-1.6.3-gcc-4.7/bin/mpicxx
> --with-cc=/home/mpanesi/APPLICATIONS/openmpi/openmpi-1.6.3-gcc-4.7/bin/mpicc
> --with-fc=/home/mpanesi/APPLICATIONS/openmpi/openmpi-1.6.3-gcc-4.7/bin/mpif90
> --with-shared-libraries --with-debugging=0 --download-f-blas-lapack=yes
> --download-hypre=yes --with-openmp=1
> [0]PETSC ERROR:
> ------------------------------------------------------------------------
> [0]PETSC ERROR: MatSetValues_SeqAIJ() line 346 in
> src/mat/impls/aij/seq/aij.c
> [0]PETSC ERROR: MatSetValues() line 1025 in 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.
>
>
> I wanted to know where I am going wrong. Can add_matrix function be used
> only with assembly and not in main for modifying the system matrix?
> Similarly, I am unable to use the zero_rows function in the assemble
> function of the system.
>
>
> Thank you for helping me out
>
>
> Regards
> Vegnesh
>
>
>
>
> ------------------------------------------------------------------------------
> What NetFlow Analyzer can do for you? Monitors network bandwidth and
> traffic
> patterns at an interface-level. Reveals which users, apps, and protocols
> are
> consuming the most bandwidth. Provides multi-vendor support for NetFlow,
> J-Flow, sFlow and other flows. Make informed decisions using capacity
> planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
> _______________________________________________
> Libmesh-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/libmesh-users
>
------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
_______________________________________________
Libmesh-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libmesh-users

Reply via email to