:orphan:
# SNESSetAlwaysComputesFinalResidual
tells the `SNES` to always compute the residual (nonlinear function value) at the final solution 
## Synopsis
```
#include "petscsnes.h"  
PetscErrorCode SNESSetAlwaysComputesFinalResidual(SNES snes, PetscBool flg)
```
Logically Collective


## Input Parameters

- ***snes -*** the shell `SNES`
- ***flg -*** `PETSC_TRUE` to always compute the residual





## Note
Some solvers (such as smoothers in a `SNESFAS`) do not need the residual computed at the final solution so skip computing it
to save time.


## See Also
 [](ch_snes), `SNES`, `SNESSolve()`, `SNESGetAlwaysComputesFinalResidual()`

## Level
advanced

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/interface/snes.c.html#SNESSetAlwaysComputesFinalResidual">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](/manualpages/index.md)  
[Index of all manual pages](/manualpages/singleindex.md)  
