# [petsc-users] -ksp_rtol problem

Barry Smith bsmith at mcs.anl.gov
Mon Nov 11 12:41:08 CST 2013

```On Nov 11, 2013, at 12:23 PM, Matthew Knepley <knepley at gmail.com> wrote:

> On Mon, Nov 11, 2013 at 12:03 PM, Qiyue Lu <qiyuelu1 at gmail.com> wrote:
> Sorry, I made a mistake in privous email.
> in my output file, the KSP residual norm not the rtol is 1.0e-4 at the 1st iteration. My question is how this residual norm calculated? Is there any initial guess there? thanks
>
> The residual r for some approximate solution x is
>
>   r = b - Ax
>
> The initial residual uses the initial guess, often 0.

Note that for left preconditioning, like the default GMRES in PETSc, the residual norm that is used is the preconditioned residual norm Br = B(b - Ax) which can be scaled differently from the unpreconditioned residual norm. See KPSSetPCSide(). You can run with -ksp_monitor_true_residual to see also the unpreconditioned residual.

Barry

>
>    Matt
>
>
>
> On Mon, Nov 11, 2013 at 11:55 AM, Qiyue Lu <qiyuelu1 at gmail.com> wrote:
> Dear All:
>
> I am working on a linear A*x=b system.
> When I use -ksp_rtol 1.0e-5 option in the command line, I am not very sure how the relative tolerance is defined.
>
> In my understanding:
>
> At the beginning, r= b-A*x_i, so rtol = ||r|| / ||b|| with 2-norm has a value. with the calculation, rtol gets smaller, when the rtol_new / rtol_original < 1.0e-5, the calculation will stop.
>
> Is my understanding correct?
>
> If so, how to decide the rtol at the first iteration? If initial solution values are all zeros, then rtol should be 1.0. In my output file, it's a value related to the matrix and can be at 1.0e-4  scale. Is there any initial guess solution from preconditioner used there?
>
> Could you help to clarify this definition? Thanks
>
>
> Qiyue Lu
>
>
>
>
> --
> 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

```