[petsc-dev] Is there something like SNESSetConvergedReason()

Jed Brown jedbrown at mcs.anl.gov
Sat Nov 2 10:35:28 CDT 2013


Lulu Liu <lulu.liu at kaust.edu.sa> writes:

> The sub nonlinear solver subsnes fails due to DIVERGED_LINE_SEARCH,  so I
> want to set snes->reason = SNES_DIVERGED_INNER.
>
> Is there any function to set converged reasons?

Let's look at how this is done for nonlinear preconditioning in
SNESSolve_NEWTONLS:

  /* compute the preconditioned function first in the case of left preconditioning with preconditioned function */
  if (snes->pc && snes->pcside == PC_LEFT && snes->functype == SNES_FUNCTION_PRECONDITIONED) {
    ierr = SNESApplyPC(snes,X,PETSC_NULL,PETSC_NULL,F);CHKERRQ(ierr);
    ierr = SNESGetConvergedReason(snes->pc,&reason);CHKERRQ(ierr);
    if (reason < 0  && reason != SNES_DIVERGED_MAX_IT) {
      snes->reason = SNES_DIVERGED_INNER;
      PetscFunctionReturn(0);
    }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20131102/a25eb5fb/attachment.sig>


More information about the petsc-dev mailing list