[petsc-users] Use previous solution when encountering "DIVERGED_LINE_SEARCH"

Barry Smith bsmith at mcs.anl.gov
Wed Nov 30 22:27:48 CST 2016


  Justin,

   Could you provide more details or an example how 

> "DIVERGED_LINE_SEARCH" which essentially "resets" my solution to zero and messes everything up

In the VI RSLS solver the code looks like

    if (lssucceed) {
      if (++snes->numFailures >= snes->maxFailures) {
        PetscBool ismin;
        snes->reason = SNES_DIVERGED_LINE_SEARCH;
        ierr         = SNESVICheckLocalMin_Private(snes,snes->jacobian,F,X,gnorm,&ismin);CHKERRQ(ierr);
        if (ismin) snes->reason = SNES_DIVERGED_LOCAL_MIN;
        break;
      }
   }

  so it essentially just breaks out if the line search failed, I think it should leave whatever the "current" solution is and shouldn't "reset" the solution to zero. That is if it made some progress to the solution and then had a line search failure the "progress" to the solution should still be in the solution vector. 

  Barry

Of course the "current solution" may not be a good solution but the intention is that it contains whatever progress it did make and not zero so if you could provide something that helps us debug why it was zero we could hopefully fix the problem for you.


> On Nov 30, 2016, at 8:27 PM, Justin Chang <jychang48 at gmail.com> wrote:
> 
> Hi all,
> 
> I am running some transient simulations using SNESVINEWTONRSLS. At certain timesteps, I get a "DIVERGED_LINE_SEARCH" which essentially "resets" my solution to zero and messes everything up. I notice that this happens when the SNES Function norm no longer decreases, and if I were to manually terminate the solver right before the final iteration I get the answer I want. 
> 
> Is there a way to "detect" this error and use the solution from the previous non-failing iteration? Setting a fixed maximum iteration doesn't seem reasonble because every time level will require different numbers of iterations to converge.
> 
> Thanks,
> Justin



More information about the petsc-users mailing list