# SNESSetLagPreconditioner
Determines when the preconditioner is rebuilt in the nonlinear solve. 
## Synopsis
```
#include "petscsnes.h"  
PetscErrorCode SNESSetLagPreconditioner(SNES snes, PetscInt lag)
```
Logically Collective on snes


## Input Parameters

- ***snes -*** the `SNES` context
- ***lag -*** 1 means rebuild every time the Jacobian is computed within a single nonlinear solve, 2 means every second time
the Jacobian is built etc. -2 indicates rebuild preconditioner at next chance but then never rebuild after that



## Options Database Keys

- ***-snes_lag_jacobian_persists <true,false> -*** sets the persistence
- ***-snes_lag_jacobian <-*** 2,1,2,...> - sets the lag
- ***-snes_lag_preconditioner_persists <true,false> -*** sets the persistence
- ***-snes_lag_preconditioner <-*** 2,1,2,...> - sets the lag



## Notes
The default is 1
The preconditioner is ALWAYS built in the first iteration of a nonlinear solve unless lag is -1 or `SNESSetLagPreconditionerPersists()` was called

`SNESSetLagPreconditionerPersists()` allows using the same uniform lagging (for example every second linear solve) across multiple nonlinear solves.




## See Also
 `SNESSetTrustRegionTolerance()`, `SNESGetLagPreconditioner()`, `SNESSetLagJacobian()`, `SNESGetLagJacobian()`, `SNESSetLagPreconditionerPersists()`,
`SNESSetLagJacobianPersists()`, `SNES`, `SNESSolve()`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/interface/snes.c.html#SNESSetLagPreconditioner">src/snes/interface/snes.c</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/snes/interface/snes.c)


[Index of all SNES routines](index.md)  
[Table of Contents for all manual pages](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
