[petsc-users] singular matrix solve using MAT_SHIFT_POSITIVE_DEFINITE option
Danny Lathouwers - TNW
D.Lathouwers at tudelft.nl
Wed Apr 30 14:53:46 CDT 2014
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140430/c581dc3b/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: petsc.f90
Type: application/octet-stream
Size: 5507 bytes
Desc: petsc.f90
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140430/c581dc3b/attachment-0004.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: f90_kind.f90
Type: application/octet-stream
Size: 694 bytes
Desc: f90_kind.f90
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140430/c581dc3b/attachment-0005.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.f90
Type: application/octet-stream
Size: 10611 bytes
Desc: main.f90
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140430/c581dc3b/attachment-0006.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Makefile
Type: application/octet-stream
Size: 770 bytes
Desc: Makefile
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140430/c581dc3b/attachment-0007.obj>
More information about the petsc-users
mailing list