[petsc-users] Problems with preconditioners, which one?

Jed Brown jed at 59A2.org
Tue Aug 3 10:57:23 CDT 2010


On Tue, 03 Aug 2010 08:27:21 -0400, Filippo Spiga <filippo.spiga at disco.unimib.it> wrote:
>   Dear all,
>      I'm not an expert so probably the answer of my problem is very easy 
> (I hope so!). I have a linear system (a distributed linear system) and I 
> want to solve it using SNES. I know the form of the solution (this is a 
> test case, then we want to apply the same method on another class of 
> problems). I already use part this code that works for another problem.  
> I only changed is the Jacobian and the Jacobian evaluation routine. I 
> tested the Jacobian using the option "-snes_type test" and the 
> differences between mine compared with the one calculated by PETSc is 
> "0" (*).

If you use the matrix (rather than some underlying nonlinear function)
to evaluate residuals, then this would be expected.

> The matrix is very simple but is "singular" (determinant = 1.0519e-55) 

Determinant isn't very meaningful for large matrices, 0.1*eye(55)
(matlab notation) is a very nice matrix with determinant 1e-55.  I
suggest reading your matrix into Matlab/Octave/Scipy [1] and computing
the small eigen/singular values and associated vectors.  If the matrix
really is singular, this will tell you what the null space is, then you
can tell PETSc about the null space (KSPSetNullSpace) and you should be
able to get a good solution.

Jed

[1] You can output the PETSc matrix and vector using -ksp_view_binary,
then read it in using bin/matlab/PetscBinaryRead.m.


More information about the petsc-users mailing list