1 (edited by WXing 13-08-2017 11:06:27)

Topic: petsc solver error: matrix is missing diagonal entry

Hi
When I was using weakly periodic Boundary conditions to be applied on SVE solved with the PETSC linear solver, I came across this problem (matrix is missing diagonal entry). It seems I did not set zero diagonal entries for each row when ILU preconditioning was used? I searched online but I didnot yet find answers for this
How should I solve this issue? Can you give me any hints? Many thanks

Regards

Xing

Re: petsc solver error: matrix is missing diagonal entry

This depends on the choice of solver in PETSc. Weak conditions will introduce a lagrange mult. which leads to indefinite form

K   G
G^T 0

Some direct solvers require the diagonal to be part of the allocated matrix, even if it's zero (they also typically require that top-down reductions ever lead to a zero diagonal on the active line, thus require some effort of the equation numbering).

Some solvers take care of this automatically. You can ensure that the diagonal is present by applying a zero MatShift (also available as a flag http://www.mcs.anl.gov/petsc/petsc-curr … tType.html )

Picking a different external PC solver in PETSc might also suffice.

Re: petsc solver error: matrix is missing diagonal entry

Hi Mikael

Thanks very much. Now, I probably know where to start.

Regards