Skip to main content
`Ctrl`+`K`

# SNESGetNonlinearStepFailures

Gets the number of unsuccessful steps taken by the nonlinear solver in the current or most recent `SNESSolve()` .

## Synopsis

    #include "petscsnes.h"
    #include "petscsnes.h"
    PetscErrorCode SNESGetNonlinearStepFailures(SNES snes, PetscInt *nfails)

Not Collective

## Input Parameter

- snes - `SNES` context

## Output Parameter

- nfails - number of unsuccessful steps attempted

## Notes

A failed step is a step that was generated and taken but did not satisfy the requested step criteria. For example, the `SNESLineSearchApply()` could not generate a sufficient decrease in the function norm (in fact it may have produced an increase).

Taken steps that produce a infinity or NaN in the function evaluation or generate a `SNESSetFunctionDomainError()` will always immediately terminate the `SNESSolve()` regardless of the value of `maxFails`.

`SNESSetMaxNonlinearStepFailures()` determines how many unsuccessful steps are allowed before the `SNESSolve()` terminates

This counter is reset to zero for each successive call to `SNESSolve()`.

## See Also

SNES: Nonlinear Solvers, `SNES`, `SNESGetMaxLinearSolveFailures()`, `SNESGetLinearSolveIterations()`, `SNESSetMaxLinearSolveFailures()`, `SNESGetLinearSolveFailures()`, `SNESSetMaxNonlinearStepFailures()`, `SNESGetMaxNonlinearStepFailures()`

## Level

intermediate

## Location

src/snes/interface/snes.c

Index of all SNES routines
Table of Contents for all manual pages
Index of all manual pages