[petsc-users] confused by the converged reason output

Smith, Barry F. bsmith at mcs.anl.gov
Fri Jul 19 20:42:19 CDT 2019

```  It says right in the -ksp_view

left preconditioning
using PRECONDITIONED norm type for convergence test

The preconditioned residual has decreased by slight more than .001 hence convergence is declared.

For GMRES if you want to use the true residual norm decrease for the convergence test you must use -ksp_pc_side right.

See KSPSetNormType() and KSPSetPCSide()

Barry

The reason you can't use the true residual norm with left preconditioner in GMRES is that the GMRES algorithm tracks the preconditioned norm using a recursion formula that is efficient. To calculate the unpreconditioned norm for GMRES with left preconditioning requires forming x_n (expensive) and computing the residual explicitly r_n = b - A x_n (expensive). While the preconditioned residual norm comes with the algorithm for free.

> On Jul 19, 2019, at 11:21 AM, Michael Wick via petsc-users <petsc-users at mcs.anl.gov> wrote:
>
> Yes, it returns:
>
> Linear m_fieldsplit_0_ solve converged due to CONVERGED_RTOL iterations 3
>
>
>
> On Fri, Jul 19, 2019 at 9:20 AM Matthew Knepley <knepley at gmail.com> wrote:
> On Fri, Jul 19, 2019 at 11:14 AM Michael Wick via petsc-users <petsc-users at mcs.anl.gov> wrote:
> Hi PETSc team:
>
> I am a bit confused by the output of converged reason. I set the relative tolerance to be 10^{-3}. In my run, I get the monitor true residual to be as follows.
>
> Can you run with -ksp_converged_reason?
>
>   Thanks,
>
>      Matt
>
> 0 KSP preconditioned resid norm 5.402205955230e-11 true resid norm 9.999870838355e-01 ||r(i)||/||b|| 1.000000000000e+00
>     1 KSP preconditioned resid norm 2.240069771831e-12 true resid norm 2.329743436488e-01 ||r(i)||/||b|| 2.329773528226e-01
>     2 KSP preconditioned resid norm 3.394412665922e-13 true resid norm 7.296473323081e-02 ||r(i)||/||b|| 7.296567566748e-02
>     3 KSP preconditioned resid norm 4.936386334724e-14 true resid norm 1.313944571812e-02 ||r(i)||/||b|| 1.313961543155e-02
>
> And the converged reason is solve converged due to CONVERGED_RTOL iterations 3. The relative error is quite far from the prescribed tolerance. Is there something I should know about the stopping criteria?
>
> The ks_view output is
> Linear m_fieldsplit_0_ solve converged due to CONVERGED_RTOL iterations 3
> KSP Object:(m_fieldsplit_0_) 24 MPI processes
>   type: gmres
>     GMRES: restart=100, using Classical (unmodified) Gram-Schmidt Orthogonalization with no iterative refinement
>     GMRES: happy breakdown tolerance 1e-30
>   maximum iterations=100, initial guess is zero
>   tolerances:  relative=0.001, absolute=1e-50, divergence=10000
>   left preconditioning
>   using PRECONDITIONED norm type for convergence test
> PC Object:(m_fieldsplit_0_) 24 MPI processes
>   type: hypre
>     HYPRE BoomerAMG preconditioning
>     HYPRE BoomerAMG: Cycle type V
>     HYPRE BoomerAMG: Maximum number of levels 25
>     HYPRE BoomerAMG: Maximum number of iterations PER hypre call 1
>     HYPRE BoomerAMG: Convergence tolerance PER hypre call 0
>     HYPRE BoomerAMG: Threshold for strong coupling 0.25
>     HYPRE BoomerAMG: Interpolation truncation factor 0
>     HYPRE BoomerAMG: Interpolation: max elements per row 0
>     HYPRE BoomerAMG: Number of levels of aggressive coarsening 0
>     HYPRE BoomerAMG: Number of paths for aggressive coarsening 1
>     HYPRE BoomerAMG: Maximum row sums 0.9
>     HYPRE BoomerAMG: Sweeps down         1
>     HYPRE BoomerAMG: Sweeps up           1
>     HYPRE BoomerAMG: Sweeps on coarse    1
>     HYPRE BoomerAMG: Relax down          symmetric-SOR/Jacobi
>     HYPRE BoomerAMG: Relax up            symmetric-SOR/Jacobi
>     HYPRE BoomerAMG: Relax on coarse     Gaussian-elimination
>     HYPRE BoomerAMG: Relax weight  (all)      1
>     HYPRE BoomerAMG: Outer relax weight (all) 1
>     HYPRE BoomerAMG: Using CF-relaxation
>     HYPRE BoomerAMG: Measure type        local
>     HYPRE BoomerAMG: Coarsen type        HMIS
>     HYPRE BoomerAMG: Interpolation type  ext+i
>   linear system matrix = precond matrix:
>   Mat Object:  (m_fieldsplit_0_)   24 MPI processes
>     type: mpiaij
>     rows=115812, cols=115812
>     total: nonzeros=1.34986e+06, allocated nonzeros=1.34986e+06
>     total number of mallocs used during MatSetValues calls =0
>       not using I-node (on process 0) routines
>
>
> Thanks,
>
> Mike
>
>
>
>
> --
> What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.
> -- Norbert Wiener
>
> https://www.cse.buffalo.edu/~knepley/

```