DMFieldCreateDSWithDG — PETSc 3.25.4 documentation

Skip to main content
`Ctrl`+`K`

# DMFieldCreateDSWithDG

Create a `DMField` of type `DMFIELDDS` for a `PetscDS` field, optionally paired with a matching discontinuous-Galerkin representation on a companion `DM`.

## Synopsis

    #include "petscdmfield.h"
    #include "petscdmfield.h"
    PetscErrorCode DMFieldCreateDSWithDG(DM dm, DM dmDG, PetscInt fieldNum, Vec vec, Vec vecDG, DMField *field)

Collective

## Input Parameters

- dm - the `DM` carrying the primary (continuous) discretization

- dmDG - optional `DM` carrying a matching discontinuous-Galerkin discretization, or `NULL`

- fieldNum - the field number within the `DM`’s `PetscDS`

- vec - local vector holding the coefficients on `dm`

- vecDG - local vector holding the coefficients on `dmDG`, or `NULL` if `dmDG` is `NULL`

## Output Parameter

- field - the newly created `DMField`

## Note

When the `DM` has no discretization set for `fieldNum`, or the field is only marked with a `PetscContainer`, a default Lagrange `PetscFE` is constructed for the topmost stratum.

## See Also

`DMField`, `DMFIELDDS`, `DMFieldCreateDS()`, `DMFieldCreate()`, `PetscDS`, `PetscFE`

## Level

intermediate

## Location

src/dm/field/impls/ds/dmfieldds.c

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