DMSetFromOptions — PETSc 3.21.4 documentation

Skip to main content
`Ctrl`+`K`

# DMSetFromOptions

sets parameters in a `DM` from the options database

## Synopsis

    #include "petscdm.h"
    #include "petscdmlabel.h"
    #include "petscds.h"
    PetscErrorCode DMSetFromOptions(DM dm)

Collective

## Input Parameter

- dm - the `DM` object to set options for

## Options Database Keys

- -dm_preallocate_only - Only preallocate the matrix for `DMCreateMatrix()` and `DMCreateMassMatrix()`, but do not fill it with zeros

- -dm_vec_type - type of vector to create inside `DM`

- -dm_mat_type - type of matrix to create inside `DM`

- -dm_is_coloring_type -

- -dm_bind_below - bind (force execution on CPU) for `Vec` and `Mat` objects with local size (number of vector entries or matrix rows) below n; currently only supported for `DMDA`

- -dm_plex_filename - File containing a mesh

- -dm_plex_boundary_filename - File containing a mesh boundary

- -dm_plex_name - Name of the mesh in the file

- -dm_plex_shape - The domain shape, such as `BOX`, `SPHERE`, etc.

- -dm_plex_cell - Cell shape

- -dm_plex_reference_cell_domain - Use a reference cell domain

- -dm_plex_dim - Set the topological dimension

- -dm_plex_simplex - `PETSC_TRUE` for simplex elements, `PETSC_FALSE` for tensor elements

- -dm_plex_interpolate - `PETSC_TRUE` turns on topological interpolation (creating edges and faces)

- -dm_plex_scale - Scale factor for mesh coordinates

- -dm_coord_remap - Map coordinates using a function

- -dm_coord_map - Select a builtin coordinate map

- -dm_coord_map_params <p0,p1,p2,…> - Set coordinate mapping parameters

- -dm_plex_box_faces <m,n,p> - Number of faces along each dimension

- -dm_plex_box_lower <x,y,z> - Specify lower-left-bottom coordinates for the box

- -dm_plex_box_upper <x,y,z> - Specify upper-right-top coordinates for the box

- -dm_plex_box_bd <bx,by,bz> - Specify the `DMBoundaryType` for each direction

- -dm_plex_sphere_radius - The sphere radius

- -dm_plex_ball_radius - Radius of the ball

- -dm_plex_cylinder_bd - Boundary type in the z direction

- -dm_plex_cylinder_num_wedges - Number of wedges around the cylinder

- -dm_plex_reorder - Reorder the mesh using the specified algorithm

- -dm_refine_pre - The number of refinements before distribution

- -dm_refine_uniform_pre - Flag for uniform refinement before distribution

- -dm_refine_volume_limit_pre - The maximum cell volume after refinement before distribution

- -dm_refine - The number of refinements after distribution

- -dm_extrude - Activate extrusion and specify the number of layers to extrude

- -dm_plex_transform_extrude_thickness - The total thickness of extruded layers

- -dm_plex_transform_extrude_use_tensor - Use tensor cells when extruding

- -dm_plex_transform_extrude_symmetric - Extrude layers symmetrically about the surface

- -dm_plex_transform_extrude_normal <n0,…,nd> - Specify the extrusion direction

- -dm_plex_transform_extrude_thicknesses <t0,…,tl> - Specify thickness of each layer

- -dm_plex_create_fv_ghost_cells - Flag to create finite volume ghost cells on the boundary

- -dm_plex_fv_ghost_cells_label - Label name for ghost cells boundary

- -dm_distribute - Flag to redistribute a mesh among processes

- -dm_distribute_overlap - The size of the overlap halo

- -dm_plex_adj_cone - Set adjacency direction

- -dm_plex_adj_closure - Set adjacency size

- -dm_plex_use_ceed - Use LibCEED as the FEM backend

- -dm_plex_check_symmetry - Check that the adjacency information in the mesh is symmetric - `DMPlexCheckSymmetry()`

- -dm_plex_check_skeleton - Check that each cell has the correct number of vertices (only for homogeneous simplex or tensor meshes) - `DMPlexCheckSkeleton()`

- -dm_plex_check_faces - Check that the faces of each cell give a vertex order this is consistent with what we expect from the cell type - `DMPlexCheckFaces()`

- -dm_plex_check_geometry - Check that cells have positive volume - `DMPlexCheckGeometry()`

- -dm_plex_check_pointsf - Check some necessary conditions for `PointSF` - `DMPlexCheckPointSF()`

- -dm_plex_check_interface_cones - Check points on inter-partition interfaces have conforming order of cone points - `DMPlexCheckInterfaceCones()`

- -dm_plex_check_all - Perform all the checks above

## Note

For some `DMType` such as `DMDA` this cannot be called after `DMSetUp()` has been called.

## See Also

DM Basics, `DM`, `DMView()`, `DMCreateGlobalVector()`, `DMCreateInterpolation()`, `DMCreateColoring()`, `DMCreateMatrix()`, `DMPlexCheckSymmetry()`, `DMPlexCheckSkeleton()`, `DMPlexCheckFaces()`, `DMPlexCheckGeometry()`, `DMPlexCheckPointSF()`, `DMPlexCheckInterfaceCones()`, `DMSetOptionsPrefix()`, `DMType`, `DMPLEX`, `DMDA`, `DMSetUp()`

## Level

intermediate

## Location

src/dm/interface/dm.c

## Examples

src/dm/impls/plex/tutorials/ex6.c
src/dm/field/tutorials/ex1.c
src/dm/impls/plex/tutorials/ex11.c
src/dm/impls/plex/tutorials/ex1.c
src/dm/impls/plex/tutorials/ex1f90.F90
src/dm/impls/plex/tutorials/ex14.c
src/dm/impls/plex/tutorials/ex7.c
src/dm/impls/forest/tutorials/ex1.c
src/dm/impls/plex/tutorials/ex10.c
src/dm/impls/plex/tutorials/ex9.c

## Implementations

DMSetFromOptions_DA() in src/dm/impls/da/dacreate.c
DMSetFromOptions_Forest() in src/dm/impls/forest/forest.c
DMSetFromOptions_pforest() in src/dm/impls/forest/p4est/pforest.h
DMSetFromOptions_Moab() in src/dm/impls/moab/dmmoab.cxx
DMSetFromOptions_Network() in src/dm/impls/network/networkcreate.c
DMSetFromOptions_Patch() in src/dm/impls/patch/patchcreate.c
DMSetFromOptions_Plex() in src/dm/impls/plex/plexcreate.c
DMSetFromOptions_Stag() in src/dm/impls/stag/stag.c

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