# SNESASPIN
Helper `SNES` type for Additive-Schwarz Preconditioned Inexact Newton 
## Options Database Keys

- ***-npc_snes_ -*** options prefix of the nonlinear subdomain solver (must be of type `NASM`)
- ***-npc_sub_snes_ -*** options prefix of the subdomain nonlinear solves
- ***-npc_sub_ksp_ -*** options prefix of the subdomain Krylov solver
- ***-npc_sub_pc_ -*** options prefix of the subdomain preconditioner



## Notes
This solver transform the given nonlinear problem to a new form and then runs matrix-free Newton-Krylov with no
preconditioner on that transformed problem.

This routine sets up an instance of `SNESNETWONLS` with nonlinear left preconditioning.  It differs from other
similar functionality in `SNES` as it creates a linear shell matrix that corresponds to the product

\sum_{i=0}^{N_b}J_b({X^b_{converged}})^{-1}J(X + \sum_{i=0}^{N_b}(X^b_{converged} - X^b))

which is the ASPIN preconditioned matrix. Similar solvers may be constructed by having matrix-free differencing of
nonlinear solves per linear iteration, but this is far more efficient when subdomain sparse-direct preconditioner
factorizations are reused on each application of J_b^{-1}.

The Krylov method used in this nonlinear solver is run with NO preconditioner, because the preconditioning is done
at the nonlinear level, but the Jacobian for the original function must be provided (or calculated via coloring and
finite differences automatically) in the Pmat location of `SNESSetJacobian()` because the action of the original Jacobian
is needed by the shell matrix used to apply the Jacobian of the nonlinear preconditioned problem (see above).
Note that since the Pmat is not used to construct a preconditioner it could be provided in a matrix-free form.
The code for this implementation is a bit confusing because the Amat of `SNESSetJacobian()` applies the Jacobian of the
nonlinearly preconditioned function Jacobian while the Pmat provides the Jacobian of the original user provided function.
Note that the original `SNES` and nonlinear preconditioner preconditioner (see `SNESGetNPC()`), in this case `SNESNASM`, share
the same Jacobian matrices. `SNESNASM` computes the needed Jacobian in `SNESNASMComputeFinalJacobian_Private()`.




## References

- **** -*** X. C. Cai and D. E. Keyes, "Nonlinearly preconditioned inexact Newton algorithms",  SIAM J. Sci. Comput., 24, 2002.
- **** -*** Peter R. Brune, Matthew G. Knepley, Barry F. Smith, and Xuemin Tu, "Composing Scalable Nonlinear Algebraic Solvers",
SIAM Review, 57(4), 2015



## See Also
 `SNESCreate()`, `SNES`, `SNESSetType()`, `SNESNEWTONLS`, `SNESNASM`, `SNESGetNPC()`, `SNESGetNPCSide()`


## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/impls/nasm/aspin.c.html#SNESASPIN">src/snes/impls/nasm/aspin.c</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/snes/impls/nasm/aspin.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)  
