petsc-3.7.1 2016-05-15
Report Typos and Errors

MatCreateSNESMF

Creates a matrix-free matrix context for use with a SNES solver. This matrix can be used as the Jacobian argument for the routine SNESSetJacobian(). See MatCreateMFFD() for details on how the finite difference computation is done.

Synopsis

#include "petscsnes.h" 
#include "petscdm.h"   
PetscErrorCode  MatCreateSNESMF(SNES snes,Mat *J)
Collective on SNES and Vec Many br

Input Parameters

snes -the SNES context Many br

Output Parameter

J -the matrix-free matrix Many br

Many br

Notes

You can call SNESSetJacobian() with MatMFFDComputeJacobian() if you are using matrix and not a different Many brpreconditioner matrix Many br

If you wish to provide a different function to do differencing on to compute the matrix-free operator than Many brthat provided to SNESSetFunction() then call MatMFFDSetFunction() with your function after this call. Many br

The difference between this routine and MatCreateMFFD() is that this matrix Many brautomatically gets the current base vector from the SNES object and not from an Many brexplicit call to MatMFFDSetBase(). Many br

Warning

If MatMFFDSetBase() is ever called on jac then this routine will NO longer get Many brthe x from the SNES object and MatMFFDSetBase() must from that point on be used to Many brchange the base vector x. Many br

Warning

Using a different function for the differencing will not work if you are using non-linear left preconditioning. Many br

See Also

MatDestroy(), MatMFFDSetFunction(), MatMFFDSetFunctionError(), MatMFFDDSSetUmin()
MatMFFDSetHHistory(), MatMFFDResetHHistory(), MatCreateMFFD(), Many brMatMFFDGetH(), MatMFFDRegister(), MatMFFDComputeJacobian() Many br

Level:advanced
Location:
src/snes/mf/snesmfj.c
Index of all SNES routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/ts/examples/tutorials/ex15.c.html