[petsc-users] Turn off "Error on nonconvergence" for KSP solve

Jed Brown jed at jedbrown.org
Fri Nov 9 17:55:45 CST 2018


Justin Chang via petsc-users <petsc-users at mcs.anl.gov> writes:

> Hi all,
>
> When using KSP, is it possible to not thrown in error (i.e., DIVERGED_ITS)
> when -ksp_max_it is reached?

You can use KSPConvergedSkip or KSP_NORM_NONE to exit with
KSP_CONVERGED_ITS.

Note that setting the reason to DIVERGED_ITS is not "throwing an error".
There is -ksp_error_if_not_converged that can be used to actually raise
an error.  If you want to use a real convergence test, but not treat
failing to converge as an error, you should tell the code that calls
KSPSolve to accept KSP_DIVERGED_ITS.  For example, there is
-snes_max_linear_solve_fail.


More information about the petsc-users mailing list