:orphan:
# PetscDSSetBdResidual
Get the pointwise boundary residual function for a given test field 
## Synopsis
```
#include "petscds.h" 
PetscErrorCode PetscDSSetBdResidual(PetscDS ds, PetscInt f, void (*f0)(PetscInt dim, PetscInt Nf, PetscInt NfAux, const PetscInt uOff[], const PetscInt uOff_x[], const PetscScalar u[], const PetscScalar u_t[], const PetscScalar u_x[], const PetscInt aOff[], const PetscInt aOff_x[], const PetscScalar a[], const PetscScalar a_t[], const PetscScalar a_x[], PetscReal t, const PetscReal x[], const PetscReal n[], PetscInt numConstants, const PetscScalar constants[], PetscScalar f0[]), void (*f1)(PetscInt dim, PetscInt Nf, PetscInt NfAux, const PetscInt uOff[], const PetscInt uOff_x[], const PetscScalar u[], const PetscScalar u_t[], const PetscScalar u_x[], const PetscInt aOff[], const PetscInt aOff_x[], const PetscScalar a[], const PetscScalar a_t[], const PetscScalar a_x[], PetscReal t, const PetscReal x[], const PetscReal n[], PetscInt numConstants, const PetscScalar constants[], PetscScalar f1[]))
```
Not Collective


## Input Parameters

- ***ds -*** The `PetscDS`
- ***f  -*** The test field number
- ***f0 -*** boundary integrand for the test function term
- ***f1 -*** boundary integrand for the test function gradient term



## Calling sequence of `f0` and `f1`
```none
  void f0(PetscInt dim, PetscInt Nf, PetscInt NfAux,
          const PetscInt uOff[], const PetscInt uOff_x[], const PetscScalar u[], const PetscScalar u_t[], const PetscScalar u_x[],
          const PetscInt aOff[], const PetscInt aOff_x[], const PetscScalar a[], const PetscScalar a_t[], const PetscScalar a_x[],
          PetscReal t, const PetscReal x[], const PetscReal n[], PetscScalar f0[])
```


- ***dim -*** the spatial dimension
- ***Nf -*** the number of fields
- ***uOff -*** the offset into u[] and u_t[] for each field
- ***uOff_x -*** the offset into u_x[] for each field
- ***u -*** each field evaluated at the current point
- ***u_t -*** the time derivative of each field evaluated at the current point
- ***u_x -*** the gradient of each field evaluated at the current point
- ***aOff -*** the offset into a[] and a_t[] for each auxiliary field
- ***aOff_x -*** the offset into a_x[] for each auxiliary field
- ***a -*** each auxiliary field evaluated at the current point
- ***a_t -*** the time derivative of each auxiliary field evaluated at the current point
- ***a_x -*** the gradient of auxiliary each field evaluated at the current point
- ***t -*** current time
- ***x -*** coordinates of the current point
- ***n -*** unit normal at the current point
- ***numConstants -*** number of constant parameters
- ***constants -*** constant parameters
- ***f0 -*** output values at the current point





## Note

## We are using a first order FEM model for the weak form
\int_\Gamma \phi {\vec f}_0(u, u_t, \nabla u, x, t) \cdot \hat n + \nabla\phi \cdot {\overleftrightarrow f}_1(u, u_t, \nabla u, x, t) \cdot \hat n


## See Also
 `PetscDS`, `PetscDSGetBdResidual()`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/dt/interface/dtds.c.html#PetscDSSetBdResidual">src/dm/dt/interface/dtds.c</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/tutorials/ex53.c.html">src/ts/tutorials/ex53.c</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/dm/dt/interface/dtds.c)


[Index of all DT routines](index.md)  
[Table of Contents for all manual pages](/manualpages/index.md)  
[Index of all manual pages](/manualpages/singleindex.md)  
