:orphan:
# DMSetNumFields
Set the number of fields in the `DM`
## Synopsis
```
#include "petscdm.h"
#include "petscdmlabel.h"
#include "petscds.h"
PetscErrorCode DMSetNumFields(DM dm, PetscInt numFields)
```
Logically Collective
## Input Parameters
- ***dm -*** The `DM`
- ***Nf -*** The number of fields
## See Also
[](ch_dmbase), `DM`, `DMGetNumFields()`, `DMSetField()`
## Level
intermediate
## Location
src/dm/interface/dm.c
## Examples
src/dm/impls/plex/tutorials/ex1.c
src/dm/impls/plex/tutorials/ex14.c
src/dm/impls/plex/tutorials/ex1f90.F90
src/dm/impls/plex/tutorials/ex6.c
src/tao/tutorials/ex3.c
src/ts/tutorials/ex11_sa.c
src/ts/tutorials/ex52.c
---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/dm/interface/dm.c)
[Index of all DM routines](index.md)
[Table of Contents for all manual pages](/manualpages/index.md)
[Index of all manual pages](/manualpages/singleindex.md)