Skip to main content
`Ctrl`+`K`

# PetscDSSetResidual

Set the pointwise residual function for a given test field

## Synopsis

    #include "petscds.h"
    PetscErrorCode PetscDSSetResidual(PetscDS ds, PetscInt f, PetscPointFn *f0, PetscPointFn *f1)

Not Collective

## Input Parameters

- ds - The `PetscDS`

- f - The test field number

- f0 - integrand for the test function term, see `PetscPointFn`

- f1 - integrand for the test function gradient term, see `PetscPointFn`

## Note

We are using a first order FEM model for the weak form: \( \int_\Omega \phi f_0(u, u_t, \nabla u, x, t) + \nabla\phi \cdot {\vec f}_1(u, u_t, \nabla u, x, t)\)

## See Also

`PetscPointFn`, `PetscDS`, `PetscDSGetResidual()`

## Level

intermediate

## Location

src/dm/dt/interface/dtds.c

## Examples

src/snes/tutorials/ex64.c
src/snes/tutorials/ex12.c
src/snes/tutorials/ex11.c
src/snes/tutorials/ex24.c
src/snes/tutorials/ex26.c
src/snes/tutorials/ex13.c
src/snes/tutorials/ex27.c
src/snes/tutorials/ex34.c
src/snes/tutorials/ex17.c
src/snes/tutorials/ex20.c

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