# funny stopping criteria for Krylov solvers

Asked by Nico Schlömer on 2013-03-19

I just got the following output from a Krylov solve in Dolfin

*** Error: Unable to solve linear system using PETSc Krylov solver.
*** Reason: Solution failed to converge in 1000 iterations (PETSc reason DIVERGED_ITS, norm 1.165166e-18).
*** Where: This error was encountered inside PETScKrylovSolver.cpp.

This was with

solve(a2 == L2, p,
solver_parameters={'linear_solver': 'iterative',
'symmetric': False,
'preconditioner': 'ilu',
'krylov_solver': {'relative_tolerance': 1.0e-8,
'absolute_tolerance': 0.0,
'maximum_iterations': 1000,
'monitor_convergence': verbose}
})

I suppose we're dealing with an inconsistency in scaling here.
Can someone point me to where the stopping criteria are set?

## Question information

Language:
English Edit question
Status:
Solved
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Solved by:
Nico Schlömer
Solved:
2013-03-19
Last query:
2013-03-19
2013-03-19
 Gerd Wachsmuth (gerd-wachsmuth) said on 2013-03-19: #1

Your absolute tolerance 0.0 would likely never be reached. Try a large number if you want to ignore the absolute tolerance.

 Nico Schlömer (nschloe) said on 2013-03-19: #2

According to <https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/KSP/KSPDefaultConverged.html#KSPDefaultConverged>, the default stopping criterion is

rnorm < MAX (rtol * rnorm_0, abstol),

meaning that setting abstol to 0.0 will effectively remove it.

 Jan Blechta (blechta) said on 2013-03-19: #3

DIVERGED_ITS means (required more than its to reach convergence). Try increasing maximum_iterations or improve preconditiong.

> Can someone point me to where the stopping criteria are set?
dolfin/la/PETScKrylovSolver.cpp

 Nico Schlömer (nschloe) said on 2013-03-19: #4

The issue is not that I wouldn't get the solver to converge when increasing max_iter, it's that it says it hasn't converged when the residual norm really reached a whooping 1.165166e-18.

 Nico Schlömer (nschloe) said on 2013-03-19: #5

Okay, I think I see now what the issue is:

What the error message spits out is ||r||, the stopping criterion is ||r||/||b||. I'll suggest improving the message in a bug.