petsc-3.14.5 2021-03-03
Report Typos and Errors

# PetscDSSetUpdate

Set the pointwise update function for a given field

### Synopsis

    #include "petscds.h"
    PetscErrorCode PetscDSSetUpdate(PetscDS prob, PetscInt f,
                                    void (*update)(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[], PetscInt numConstants, const PetscScalar constants[], PetscScalar uNew[]))

Not collective

### Input Parameters

| prob | - The PetscDS
| f | - The field number
| update | - update function

### Note: The calling sequence for the callback update is given by

    update(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[], PetscScalar uNew[])

| 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
| uNew | - new field values at the current point

### See Also

PetscDSGetResidual()

### Level

intermediate

### Location

src/dm/dt/interface/dtds.c
Index of all DT routines
Table of Contents for all manual pages
Index of all manual pages