# DMAddField#

Add a field to a `DM`

object. A field is a function space defined by of a set of discretization points (geometric entities) and a discretization object that defines the function space associated with those points.

## Synopsis#

```
#include "petscdm.h"
#include "petscdmlabel.h"
#include "petscds.h"
PetscErrorCode DMAddField(DM dm, DMLabel label, PetscObject disc)
```

Logically Collective

## Input Parameters#

The**dm -**`DM`

The label indicating the support of the field, or**label -**`NULL`

for the entire meshThe discretization object**disc -**

## Notes#

The label already exists or will be added to the `DM`

with `DMSetLabel()`

.

For example, a piecewise continuous pressure field can be defined by coefficients at the cell centers of a mesh and piecewise constant functions
within each cell. Thus a specific function in the space is defined by the combination of a `Vec`

containing the coefficients, a `DM`

defining the
geometry entities, a `DMLabel`

indicating a subset of those geometric entities, and a discretization object, such as a `PetscFE`

.

## See Also#

DM Basics, `DM`

, `DMSetLabel()`

, `DMSetField()`

, `DMGetField()`

, `PetscFE`

## Level#

intermediate

## Location#

## Examples#

src/ts/tutorials/ex11.c

src/dm/impls/plex/tutorials/ex8.c

Index of all DM routines

Table of Contents for all manual pages

Index of all manual pages