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: [email protected]
