TSSetLHSMatrix

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

Synopsis

#include "petscts.h"  
PetscErrorCode PETSCTS_DLLEXPORT TSSetLHSMatrix(TS ts,Mat A,Mat B,PetscErrorCode (*f)(TS,PetscReal,Mat*,Mat*,MatStructure*,void*),void *ctx)
Collective on TS

Input Parameters

ts - the TS context obtained from TSCreate()
A - matrix
B - ignored
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,PetscReal t,Mat *A,Mat *B,PetscInt *flag,void *ctx);

t - current timestep
A - matrix A, where A U_t = F(U)
B - ignored
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 new matrix structure (not just different matrix elements) when appropriate, for instance, if the nonzero structure is changing throughout the global iterations.

Notes

Currently, TSSetLHSMatrix() only supports the TS_BEULER type.

Keywords

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

See Also

TSSetRHSMatrix()

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