Skip to main content
`Ctrl`+`K`

# SNESSetConvergenceHistory

Sets the arrays used to hold the convergence history.

## Synopsis

    #include "petscsnes.h"
    #include "petscsnes.h"
    PetscErrorCode SNESSetConvergenceHistory(SNES snes, PetscReal a[], PetscInt its[], PetscInt na, PetscBool reset)

Logically Collective

## Input Parameters

- snes - iterative context obtained from `SNESCreate()`

- a - array to hold history, this array will contain the function norms computed at each step

- its - integer array holds the number of linear iterations for each solve.

- na - size of `a` and `its`

- reset - `PETSC_TRUE` indicates each new nonlinear solve resets the history counter to zero, else it continues storing new values for new nonlinear solves after the old ones

## Notes

If ‘a’ and ‘its’ are `NULL` then space is allocated for the history. If ‘na’ is `PETSC_DECIDE` (or, deprecated, `PETSC_DEFAULT`) then a default array of length 1,000 is allocated.

This routine is useful, e.g., when running a code for purposes of accurate performance monitoring, when no I/O should be done during the section of code that is being timed.

If the arrays run out of space after a number of iterations then the later values are not saved in the history

## See Also

SNES: Nonlinear Solvers, `SNES`, `SNESSolve()`, `SNESGetConvergenceHistory()`

## Level

intermediate

## Location

src/snes/interface/snes.c

## Examples

src/snes/tutorials/ex1f.F90

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