[petsc-users] Way to remove zero entries from an assembled matrix

Barry Smith bsmith at mcs.anl.gov
Tue Dec 6 11:45:52 CST 2016


> On Dec 6, 2016, at 11:25 AM, Leidy Catherine Ramirez Villalba <leidy-catherine.ramirez-villalba at ec-nantes.fr> wrote:
> 
> Hello PETSc team:
> 
> I'm doing the parallelization of the assembling of a system, previously assembled in a serial way (manual), but  solved using PETSc in parallel.
> Therefore I have the old assembled matrix to compare with the one assembled with PETSc.
> 
> While doing the assembling of the matrix, I avoid the zero entries using the option 'MAT_IGNORE_ZERO_ENTRIES' in MatSetOption, however the final matrix has zero values (or almost) due to the addition of non zero elements.
> Below the example of added values:
> 
> 1664 i 1663 j -165509.423650377 
> 1664 i 1663 j 165509.423650377 
> 1664 i 1663 j -165509.423650377
> 1664 i 1663 j 165509.423650377
> 
> Due to this difference between the two matrices I'm not able to get the solution  for the matrix assembled with petsc.

   Catherine,

      The "extra" zeros should not prevent getting the solution to the system. The computed solution may be a little different but if you use an iterative method with smaller and smaller tolerances the solutions should converge to the same value. With direct solvers the solutions should be very similar.

    Could you please provide more details about not getting the solution for the parallel system? Send output of -ksp_monitor_true_residual for example 

   Barry


> 
> Therefore I wonder if there is a way to remove zero entries from an assembled matrix, or which solver to use so that zeros will not be a problem.
> 
> Thanks in advance, 
> Catherine
> 
> 
> 
> 



More information about the petsc-users mailing list