# DMCreateSubDM
Returns an IS and DM encapsulating a subproblem defined by the fields passed in. The fields are defined by DMCreateFieldIS(). 
## Synopsis
```
#include "petscdm.h"          
#include "petscdmlabel.h"     
#include "petscds.h"     
PetscErrorCode DMCreateSubDM(DM dm, PetscInt numFields, const PetscInt fields[], IS *is, DM *subdm)
```
Not collective


## Input Parameters

- ***dm        -*** The `DM `object
- ***numFields -*** The number of fields to select
- ***fields    -*** The field numbers of the selected fields



## Output Parameters

- ***is -*** The global indices for all the degrees of freedom in the new sub `DM`
- ***subdm -*** The `DM` for the subproblem



## Note
You need to call `DMPlexSetMigrationSF()` on the original `DM` if you want the Global-To-Natural map to be automatically constructed




## See Also
 `DMCreateFieldIS()`, `DMCreateFieldDecomposition()`, `DMAddField()`, `DMCreateSuperDM()`, `DM`, `IS`, `DMPlexSetMigrationSF()`, `DMDestroy()`, `DMView()`, `DMCreateInterpolation()`, `DMCreateColoring()`, `DMCreateMatrix()`, `DMCreateMassMatrix()`, `DMCreateFieldIS()`

## Level
intermediate

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

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/tutorials/ex56.c.html">src/snes/tutorials/ex56.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/tutorials/ex63.c.html">src/snes/tutorials/ex63.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/tutorials/ex77.c.html">src/snes/tutorials/ex77.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/tutorials/ex77.c.html">src/ts/tutorials/ex77.c.html</A><BR>

## Implementations

<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/impls/da/dacreate.c.html#DMCreateSubDM_DA">DMCreateSubDM_DA in src/dm/impls/da/dacreate.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/impls/forest/forest.c.html#DMCreateSubDM_Forest">DMCreateSubDM_Forest in src/dm/impls/forest/forest.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/impls/patch/patch.c.html#DMCreateSubDM_Patch">DMCreateSubDM_Patch in src/dm/impls/patch/patch.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/impls/plex/plex.c.html#DMCreateSubDM_Plex">DMCreateSubDM_Plex in src/dm/impls/plex/plex.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/impls/shell/dmshell.c.html#DMCreateSubDM_Shell">DMCreateSubDM_Shell in src/dm/impls/shell/dmshell.c</A><BR>


---
[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](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
