TSSetMassMatrix#
Set the function to compute the mass matrix \(M = \partial F/\partial \dot U\) of a DAE.
Synopsis#
#include "petscts.h"
PetscErrorCode TSSetMassMatrix(TS ts, TSMassMatrixFn *func, PetscCtx ctx)
Logically Collective
Input Parameters#
func - the mass matrix evaluation routine, see
TSMassMatrixFnfor the calling sequencectx - application context for the mass matrix evaluation routine (may be
NULL)
Notes#
This is used by implicit integrators that solve DAEs \(F(t, U, \dot U) = 0\) with a possibly singular mass matrix \(M\).
Only TSIRK currently consumes it; other integrators ignore it.
You do not create the matrix \(M\) yourself. The consuming integrator creates it with the correct layout and passes it to
func (a TSMassMatrixFn), which only fills its entries. TSIRK creates \(M\) by duplicating the Jacobian matrix set with
TSSetIJacobian(), so \(M\) shares the Jacobian’s nonzero pattern; fill only the entries the mass matrix needs.
The callback is stored on the TS’s DM and copied to coarser DMs by DMTSCopy(), so it is available at
every level of a geometric multigrid hierarchy. TSIRK currently assembles the mass matrix only on the fine DM.
See Also#
TS: Scalable ODE and DAE Solvers, TS, TSMassMatrixFn, TSGetMassMatrix(), TSComputeMassMatrix(), TSSetIJacobian(), TSIRK
Level#
intermediate
Location#
Examples#
Index of all TS routines
Table of Contents for all manual pages
Index of all manual pages