petsc-3.3-p7 2013-05-11

TSSetRHSJacobian

Sets the function to compute the Jacobian of F, where U_t = F(U,t), as well as the location to store the matrix.

Synopsis

#include "petscts.h"  
PetscErrorCode  TSSetRHSJacobian(TS ts,Mat A,Mat B,TSRHSJacobian f,void *ctx)
Logically Collective on TS

Input Parameters

ts - the TS context obtained from TSCreate()
A - Jacobian matrix
B - preconditioner matrix (usually same as A)
f - the Jacobian evaluation routine
ctx - [optional] user-defined context for private data for the Jacobian evaluation routine (may be PETSC_NULL)

Calling sequence of func

    func (TS ts,PetscReal t,Vec u,Mat *A,Mat *B,MatStructure *flag,void *ctx);

t - current timestep
u - input vector
A - matrix A, where U_t = A(t)u
B - preconditioner matrix, usually the same as A
flag - flag indicating information about the preconditioner matrix structure (same as flag in KSPSetOperators())
ctx - [optional] user-defined context for matrix evaluation routine

Notes

See KSPSetOperators() for important information about setting the flag output parameter in the routine func(). Be sure to read this information!

The routine func() takes Mat * as the matrix arguments rather than Mat. This allows the matrix evaluation routine to replace A and/or B with a completely new matrix structure (not just different matrix elements) when appropriate, for instance, if the nonzero structure is changing throughout the global iterations.

Keywords

TS, timestep, set, right-hand-side, Jacobian

See Also

SNESDefaultComputeJacobianColor(), TSSetRHSFunction()

Level:beginner
Location:
src/ts/interface/ts.c
Index of all TS routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/ts/examples/tutorials/ex1.c.html
src/ts/examples/tutorials/ex2.c.html
src/ts/examples/tutorials/util2.c.html
src/ts/examples/tutorials/ex3.c.html
src/ts/examples/tutorials/ex4.c.html
src/ts/examples/tutorials/ex5.c.html
src/ts/examples/tutorials/ex6.c.html
src/ts/examples/tutorials/ex13.c.html
src/ts/examples/tutorials/ex21.c.html
src/ts/examples/tutorials/ex1f.F.html
src/ts/examples/tutorials/ex2f.F.html