[petsc-users] Very small right hand side and KSP_DIVERGED_DTOL

Barry Smith bsmith at mcs.anl.gov
Sat Mar 25 12:31:17 CDT 2017


> On Mar 25, 2017, at 9:11 AM, alexandre this <alexandre.this at gmail.com> wrote:
> 
> This (the code paste that you provided) is exactly what I was thinking about/refering to when I posted my question to this mailing list.
> 
> I changed the tolerance and the solver worked fine but it is definitely a bandage that is going to heal only the symptom. It will also disable the tolerance test in the later iterations while this test is here to prevent divergence of the results, right ?

   The divergence test is very very rarely needed in practice with Krylov methods; it is only there for when preconditioners "go crazy" because they have a bug in them.  Though you are right the fix is "a bandage" you can confidently use it without concerns.

> 
> Is there an option to disable the tolerance test only in the initial check (which I did not find as of yet) ?

   No. 
> 
> Best,
> Alexandre
> 
> 
> 
> 2017-03-25 1:52 GMT+01:00 Barry Smith <bsmith at mcs.anl.gov>:
> 
> > On Mar 24, 2017, at 8:56 AM, alexandre this <alexandre.this at gmail.com> wrote:
> >
> > Dear all,
> >
> > I'm in the configuration where I need to solve a linear system Ax = b where b is very small although not equal to zero.
> >
> > It appears that, in this configuration, the initial residual of the first iteration of the solver is completely out of reach and the KSP_DIVERGED_DTOL is raised.
> >
> > In particular, when using the "-ksp_monitor_true_residual flag", I get the following :
> > 0 KSP preconditioned resid norm 2.907111674781e+00 true resid norm 1.955854211540e+02 ||r(i)||/||b|| 1.765818923254e+09
> 
>    Yeah this is a glitch in the divergence checking. A bad initial guess with a nearly zero right hand side can trigger this. There is special code in KSPConvergedDefault() when the right hand side is identical to zero
> 
>       if (!snorm) {
>         ierr  = PetscInfo(ksp,"Special case, user has provided nonzero initial guess and zero RHS\n");CHKERRQ(ierr);
>         snorm = rnorm;
>       }
> 
> but not for "small" right hand side.
> 
> You can use something like  -ksp_divtol 1.e30 ( or bigger) to turn off the divtol test.
> 
> Do any PETSc users or developers know a more systematic way to handle this issue with small right hand side and bad initial guess?
> 
> 
>   Barry
> 
> 
> 
> >
> > What is the best course of action in this case ?
> >
> > Best,
> > Alexandre



More information about the petsc-users mailing list