Lulu Liu <[email protected]> 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);
}
pgpPyWNnVFGPb.pgp
Description: PGP signature
