Dear users, I encountered a strange problem. I have a singular matrix P (Poisson, Neumann boundary conditions, N=4). The rhs b sums to 0. If I hand-fill the matrix with the right entries (non-zeroes only) things work with KSPCG and ICC preconditioning and using the MAT_SHIFT_POSITIVE_DEFINITE option. Convergence in 2 iterations to (a) correct solution. So far for the debugging problem.
My real problem computes P from D * M * D^T. If I do this I get the same matrix (on std out I do not see the difference to all digits). The system P * x = b now does NOT converge. More strange is that is if I remove the zeroes from D then things do work again. Either things are overly sensitive or I am misusing petsc. It does work when using e.g. the AMG preconditioner (again it is a correct but different solution). So system really seems OK. Should I also use the Null space commands as I have seen in some of the examples as well? But, I recall from many years ago when using MICCG (alpha) preconditioning that no such tricks were needed for CG with Poisson-Neumann. I am supposing the MAT_SHIFT_POSITIVE_DEFINITE option does something similar as MICCG. For clarity I have included the code (unfortunately this is the smallest I could get it; it's quite straightforward though). By setting the value of option to 1 in main.f90 the code use P = D * M * D^T otherwise it will use the hand-filled matrix. The code prints the matrix P and solution etc. Anyone any hints on this? What other preconditioners (serial) are suitable for this problem besides ICC/AMG? Thanks very much. Danny Lathouwers
petsc.f90
Description: petsc.f90
f90_kind.f90
Description: f90_kind.f90
main.f90
Description: main.f90
Makefile
Description: Makefile
