The solver doesn't converge

Matthew Knepley knepley at
Wed Apr 8 17:16:38 CDT 2009

On Wed, Apr 8, 2009 at 5:08 PM, Yixun Liu <enjoywm at> wrote:

> Hi,
> I build a finite element system and the related PETSc codes are following,
>  KSPSetOperators(ksp,sparseMechanicalStiffnessMatrix,sparseMechanicalStiffnessMatrix,DIFFERENT_NONZERO_PATTERN);
>  KSPSetTolerances(ksp,0.001,1.e-50,PETSC_DEFAULT, PETSC_DEFAULT);
> I output the solution and find its magnitude is about 1.0e+10. It's
> definitely wrong.  The correct solution should be around 1 or 2. It
> seems the solver cannot converge. How do deal with this issue?

Always start with LU to make sure your system is constructed correctly:

  -ksp_type preonly -pc_type lu


> Thanks.
> Yixun
What most experimenters take for granted before they begin their experiments
is infinitely more interesting than any results to which their experiments
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the petsc-users mailing list