TSSetRHSMatrix

Sets the function to compute the matrix A, where U_t = A(t) U. Also sets the location to store A.

Synopsis

int TSSetRHSMatrix(TS ts,Mat A, Mat B,int (*f)(TS,double,Mat*,Mat*,MatStructure*,void*),void *ctx)
Collective on TS

Input Parameters

ts - the TS context obtained from TSCreate()
A - matrix
B - preconditioner matrix (usually same as A)
f - the matrix evaluation routine; use PETSC_NULL (PETSC_NULL_FUNCTION in fortran) if A is not a function of t.
ctx - [optional] user-defined context for private data for the matrix evaluation routine (may be PETSC_NULL)

Calling sequence of func

    func (TS ts,double t,Mat *A,Mat *B,int *flag,void *ctx);

t - current timestep
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 SLESSetOperators())
ctx - [optional] user-defined context for matrix evaluation routine

Notes

See SLESSetOperators() for important information about setting the flagoutput 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 acompletely new new matrix structure (not just different matrix elements) when appropriate, for instance, if the nonzero structure is changingthroughout the global iterations.

Important

The user MUST call either this routine or TSSetRHSFunction().

Keywords

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

See Also

TSSetRHSFunction()

Location: src/ts/interface/ts.c
Time Stepping
Table of Contents