[petsc-users] Whether Petsc will deleted zero entries during the solve

Qicang Shen qicangsh at umich.edu
Thu Jun 14 13:17:38 CDT 2018


Hi Guys,

I'm now confronting a problem.

I'm using PETSC to construct a SPARSE Matrix. And I'm sure that the matrix
has been allocated correctly using  *MatMPIAIJSetPreallocation *with the
upper limit of the size.

The code works well when I just solve the system once.

However, after the system been solved. And I want to use the original
non-zero structure, but change the elements inside the matrix. The petsc
will show the error message as:

[14]PETSC ERROR: Argument out of range
[14]PETSC ERROR: New nonzero at (58,56) caused a malloc
Use MatSetOption(A, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE) to turn
off this check

My current the solution is destroy the system and reallocate with the same
size. But I believe there should be more efficient way, i.e. just use the
original structure.

I would like search for help to confirm that whether PETSC will
compress/delete the zero entries during
the MatAssemblyBegin/MatAssemblyEnd/KSPSolve, or other possible places.

And how to avoid deleting zero elements during the process?

Thanks very much.




Qicang SHEN
PhD Candidate
Nuclear Engineering and Radiological Sciences, University of Michigan, Ann
Arbor
Email: qicangsh at umich.edu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20180614/a6f67ccc/attachment.html>


More information about the petsc-users mailing list