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

Jed Brown jed at 59A2.org
Wed Aug 4 00:53:40 CDT 2010


On Tue, 03 Aug 2010 23:34:14 -0400, Filippo Spiga <filippo.spiga at disco.unimib.it> wrote:
>   Dear Jed,
>      sorry if I bother you with this private email but I'm not an expert...

No problem, replying to the list because you may not be the only one
with this question.

> Jed Brown wrote:
> > If you use the matrix (rather than some underlying nonlinear function)
> > to evaluate residuals, then this would be expected.
> 
> could you explain me shortly this point?

Usually people use SNES for nonlinear problems (there's nothing wrong
with using it for linear problems, and I often recommend doing so, but
it's usually used for nonlinear problems).  In that case, there will be
some difference, usually around sqrt(epsilon) (roughly 1e-8), between
the analytic Jacobian (computed by you) and the finite differenced
Jacobian.  If you define the residual in terms of the matrix, then the
finite difference Jacobian will agree with the analytic one.


As Barry concluded, your matrix just needs pivoting, build PETSc with
support for one of the third-party direct solvers (e.g. umfpack,
superlu, and/or mumps) and it should work fine with -pc_type lu
-pc_factor_mat_solver_package umfpack.  If you want to use a domain
decomposition method, you will probably need to be careful when defining
the partition, but then you should be able to do direct subdomain solves
as above.  You might also consider a different formulation, or ordering
your unknowns so that the fields with zero on the diagonal come last
(then the diagonal entries fill up during factorization and dynamic
pivoting is no longer needed).

Jed


More information about the petsc-users mailing list