Skip to main content
`Ctrl`+`K`

# 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`, use `NULL` if not needed

- subdm - The `DM` for the subproblem, use `NULL` if not needed

## Note

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

## See Also

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

## Level

intermediate

## Location

src/dm/interface/dm.c

## Examples

src/snes/tutorials/ex63.c
src/snes/tutorials/ex56.c
src/ts/tutorials/ex77.c
src/ts/tutorials/ex30.c
src/snes/tutorials/ex77.c
src/snes/tutorials/ex11.c

## Implementations

DMCreateSubDM_DA() in src/dm/impls/da/dacreate.c
DMCreateSubDM_Forest() in src/dm/impls/forest/forest.c
DMCreateSubDM_Patch() in src/dm/impls/patch/patch.c
DMCreateSubDM_Plex() in src/dm/impls/plex/plex.c
DMCreateSubDM_Shell() in src/dm/impls/shell/dmshell.c

Index of all DM routines
Table of Contents for all manual pages
Index of all manual pages