TSDiscGradSetFormulation — PETSc 3.25.2 documentation

Skip to main content
`Ctrl`+`K`

# TSDiscGradSetFormulation

Set the construction method for S, F, and grad F from the formulation \(u_t = S(u) \nabla F(u)\) for `TSDISCGRAD`

## Synopsis

    #include "petscts.h"
    PetscErrorCode TSDiscGradSetFormulation(TS ts, PetscErrorCode (*Sfunc)(TS ts, PetscReal time, Vec u, Mat S, PetscCtx ctx), PetscErrorCode (*Ffunc)(TS ts, PetscReal time, Vec u, PetscScalar *F, PetscCtx ctx), PetscErrorCode (*Gfunc)(TS ts, PetscReal time, Vec u, Vec G, PetscCtx ctx), PetscCtx ctx)

Not Collective

## Input Parameters

- ts - timestepping context

- Sfunc - constructor for the S matrix from the formulation

- Ffunc - functional F from the formulation

- Gfunc - constructor for the gradient of F from the formulation

- ctx - optional context for the functions

## Calling sequence of `Sfunc`

- ts - the integrator

- time - the current time

- u - the solution

- S - the S-matrix from the formulation

- ctx - the user context

## Calling sequence of `Ffunc`

- ts - the integrator

- time - the current time

- u - the solution

- F - the computed function from the formulation

- ctx - the user context

## Calling sequence of `Gfunc`

- ts - the integrator

- time - the current time

- u - the solution

- G - the gradient of the computed function from the formulation

- ctx - the user context

## See Also

TS: Scalable ODE and DAE Solvers, `TSDISCGRAD`, `TSDiscGradGetFormulation()`

## Level

intermediate

## Location

src/ts/impls/implicit/discgrad/tsdiscgrad.c

## Implementations

TSDiscGradSetFormulation_DiscGrad(TS ts, PetscErrorCode (*Sfunc)(TS, PetscReal, Vec, Mat, void *), PetscErrorCode (*Ffunc)(TS, PetscReal, Vec, PetscScalar *, void *), PetscErrorCode (*Gfunc)() in src/ts/impls/implicit/discgrad/tsdiscgrad.c

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