TSMassMatrixFn#

A prototype of a TS mass matrix evaluation function that would be passed to TSSetMassMatrix()

Synopsis#

#include <petscts.h> 
PETSC_EXTERN_TYPEDEF typedef PetscErrorCode TSMassMatrixFn(TS ts, PetscReal t, Vec U, Mat M, PetscCtx ctx);

Calling Sequence#

  • ts - the TS context obtained from TSCreate()

  • t - the time at which the mass matrix is evaluated

  • U - the state vector at which the mass matrix is evaluated

  • M - the mass matrix \(\partial F/\partial \dot U\) to be filled; it is pre-created by the framework with the correct layout

  • ctx - [optional] application context for the mass matrix evaluation routine

Notes#

The routine fills the provided matrix M; it should not create or destroy it. This mirrors TSIJacobianFn. The integrator supplies M pre-created with the correct layout; for TSIRK it is a duplicate of the matrix set with TSSetIJacobian(), so M has the Jacobian’s nonzero pattern. As for TSIJacobianFn, the routine is responsible for zeroing any stale entries and for leaving M fully assembled; TSComputeMassMatrix() does not call MatZeroEntries() or MatAssemblyBegin()/MatAssemblyEnd().

t and U allow a time- or state-dependent mass matrix. For a constant mass matrix they may be ignored; also call TSSetMassMatrixConstant() so the mass matrix is assembled only once.

The routine receives no DM; obtain it with TSGetDM() if needed, for example to assemble on a multigrid level. The integrator sets the current DM before calling, exactly as for TSIFunctionFn and TSIJacobianFn.

See Also#

TS: Scalable ODE and DAE Solvers, TSSetMassMatrix(), DMTSSetMassMatrix(), TSSetMassMatrixConstant(), TSIJacobianFn

Level#

intermediate

Location#

include/petscts.h


Index of all TS routines
Table of Contents for all manual pages
Index of all manual pages