xref: /petsc/include/petscdmtypes.h (revision dfbbaf821b4c49d07b4ce746493b0d955783fdf9)
1 #if !defined(PETSCDMTYPES_H)
2 #define PETSCDMTYPES_H
3 
4 /* SUBMANSEC = DM */
5 
6 /*S
7      DM - Abstract PETSc object that manages an abstract grid object and its interactions with the algebraic solvers
8 
9    Level: intermediate
10 
11 .seealso: `DMType`, `DMDGetType()`, `DMCompositeCreate()`, `DMDACreate()`, `DMSetType()`, `DMType`, `DMDA`, `DMPLEX`
12 S*/
13 typedef struct _p_DM* DM;
14 
15 /*E
16   DMBoundaryType - Describes the choice for fill of ghost cells on physical domain boundaries.
17 
18   Level: beginner
19 
20   A boundary may be of type `DM_BOUNDARY_NONE` (no ghost nodes), `DM_BOUNDARY_GHOSTED` (ghost vertices/cells
21   exist but aren't filled; you can put values into them and then apply a stencil that uses those ghost locations),
22   `DM_BOUNDARY_MIRROR` (the ghost value is the same as the value 1 grid point in; that is, the 0th grid point in the real mesh acts like a mirror to define the ghost point value;
23   not yet implemented for 3d), `DM_BOUNDARY_PERIODIC` (ghost vertices/cells filled by the opposite
24   edge of the domain), or `DM_BOUNDARY_TWIST` (like periodic, only glued backwards like a Mobius strip).
25 
26   Notes:
27   This is information for the boundary of the __PHYSICAL__ domain. It has nothing to do with boundaries between
28   processes. That width is always determined by the stencil width; see `DMDASetStencilWidth()`.
29 
30   If the physical grid points have values 0 1 2 3 with `DM_BOUNDARY_MIRROR` then the local vector with ghost points has the values 1 0 1 2 3 2 .
31 
32   Developer Notes:
33     Should` DM_BOUNDARY_MIRROR` have the same meaning with DMDA_Q0, that is a staggered grid? In that case should the ghost point have the same value
34   as the 0th grid point where the physical boundary serves as the mirror?
35 
36   References:
37 . * -  https://scicomp.stackexchange.com/questions/5355/writing-the-poisson-equation-finite-difference-matrix-with-neumann-boundary-cond
38 
39 .seealso: `DMDASetBoundaryType()`, `DMDACreate1d()`, `DMDACreate2d()`, `DMDACreate3d()`, `DMDACreate()`
40 E*/
41 typedef enum {DM_BOUNDARY_NONE, DM_BOUNDARY_GHOSTED, DM_BOUNDARY_MIRROR, DM_BOUNDARY_PERIODIC, DM_BOUNDARY_TWIST} DMBoundaryType;
42 /*E
43   DMBoundaryConditionType - indicates what type of boundary condition is to be imposed
44 
45   Note: This flag indicates the type of function which will define the condition:
46 $ DM_BC_ESSENTIAL       - A Dirichlet condition using a function of the coordinates
47 $ DM_BC_ESSENTIAL_FIELD - A Dirichlet condition using a function of the coordinates and auxiliary field data
48 $ DM_BC_ESSENTIAL_BD_FIELD - A Dirichlet condition using a function of the coordinates, facet normal, and auxiliary field data
49 $ DM_BC_NATURAL         - A Neumann condition using a function of the coordinates
50 $ DM_BC_NATURAL_FIELD   - A Neumann condition using a function of the coordinates and auxiliary field data
51 $ DM_BC_NATURAL_RIEMANN - A flux condition which determines the state in ghost cells
52 The user can check whether a boundary condition is essential using (type & DM_BC_ESSENTIAL), and similarly for
53 natural conditions (type & DM_BC_NATURAL)
54 
55   Level: beginner
56 
57 .seealso: `DMAddBoundary()`, `DSAddBoundary()`, `DSGetBoundary()`
58 E*/
59 typedef enum {DM_BC_ESSENTIAL = 1, DM_BC_ESSENTIAL_FIELD = 5, DM_BC_NATURAL = 2, DM_BC_NATURAL_FIELD = 6, DM_BC_ESSENTIAL_BD_FIELD = 9, DM_BC_NATURAL_RIEMANN = 10} DMBoundaryConditionType;
60 
61 /*E
62   DMPointLocationType - Describes the method to handle point location failure
63 
64   Level: beginner
65 
66   If a search using `DM_POINTLOCATION_NONE` fails, the failure is signaled with a negative cell number. On the
67   other hand, if `DM_POINTLOCATION_NEAREST` is used, on failure, the (approximate) nearest point in the mesh is
68   used, replacing the given point in the input vector. `DM_POINTLOCATION_REMOVE` returns values only for points
69   which were located.
70 
71 .seealso: `DMLocatePoints()`
72 E*/
73 typedef enum {DM_POINTLOCATION_NONE, DM_POINTLOCATION_NEAREST, DM_POINTLOCATION_REMOVE} DMPointLocationType;
74 
75 /*E
76   DMAdaptationStrategy - Describes the strategy used for adaptive solves
77 
78   Level: beginner
79 
80   DM_ADAPTATION_INITIAL will refine a mesh based on an initial guess. DM_ADAPTATION_SEQUENTIAL will refine the
81   mesh based on a sequence of solves, much like grid sequencing. DM_ADAPTATION_MULTILEVEL will use the sequence
82   of constructed meshes in a multilevel solve, much like the Systematic Upscaling of Brandt.
83 
84 .seealso: `DMAdaptorSolve()`
85 E*/
86 typedef enum {DM_ADAPTATION_INITIAL, DM_ADAPTATION_SEQUENTIAL, DM_ADAPTATION_MULTILEVEL} DMAdaptationStrategy;
87 
88 /*E
89   DMAdaptationCriterion - Describes the test used to decide whether to coarsen or refine parts of the mesh
90 
91   Level: beginner
92 
93   `DM_ADAPTATION_REFINE` will uniformly refine a mesh, much like grid sequencing. `DM_ADAPTATION_LABEL` will adapt
94   the mesh based upon a label of the cells filled with `DMAdaptFlag` markers. `DM_ADAPTATION_METRIC` will try to
95   mesh the manifold described by the input metric tensor uniformly. PETSc can also construct such a metric based
96   upon an input primal or a gradient field.
97 
98 .seealso: `DMAdaptorSolve()`
99 E*/
100 typedef enum {DM_ADAPTATION_NONE, DM_ADAPTATION_REFINE, DM_ADAPTATION_LABEL, DM_ADAPTATION_METRIC} DMAdaptationCriterion;
101 
102 /*E
103   DMAdaptFlag - Marker in the label prescribing adaptation
104 
105   Level: beginner
106 
107 .seealso: `DMAdaptLabel()`
108 E*/
109 typedef enum {DM_ADAPT_DETERMINE = PETSC_DETERMINE, DM_ADAPT_KEEP = 0, DM_ADAPT_REFINE, DM_ADAPT_COARSEN, DM_ADAPT_COARSEN_LAST, DM_ADAPT_RESERVED_COUNT} DMAdaptFlag;
110 
111 /*E
112   DMDirection - Indicates a coordinate direction
113 
114   Level: beginner
115 
116 .seealso: `DMDAGetRay()`, `DMDAGetProcessorSubset()`, `DMPlexShearGeometry()`
117 E*/
118 typedef enum {DM_X, DM_Y, DM_Z} DMDirection;
119 
120 /*E
121   DMEnclosureType - The type of enclosure relation between one `DM` and another
122 
123   Level: beginner
124 
125   Notes:
126   For example, one `DM` dmA may be the boundary of another dmB, in which case it would be labeled `DM_ENC_SUBMESH`.
127 
128   If the situation is reversed, and dmA has boundary dmB, it would be labeled `DM_ENC_SUPERMESH`.
129 
130   Likewise, if dmA was a subregion of dmB, it would be labeled `DM_ENC_SUBMESH`.
131 
132   If no relation can be determined, `DM_ENC_NONE` is used.
133 
134   If a relation is not yet known, then `DM_ENC_UNKNOWN` is used.
135 
136 .seealso: `DMGetEnclosureRelation()`
137 E*/
138 typedef enum {DM_ENC_EQUALITY, DM_ENC_SUPERMESH, DM_ENC_SUBMESH, DM_ENC_NONE, DM_ENC_UNKNOWN} DMEnclosureType;
139 
140 /*E
141   DMPolytopeType - This describes the polytope represented by each cell.
142 
143   Level: beginner
144 
145   While most operations only need the topology information in the `DMPLEX`, we must sometimes have the
146   user specify a polytope. For instance, when interpolating from a cell-vertex mesh, the type of
147   polytope can be ambiguous. Also, `DMPLEX` allows different symmetries of a prism cell with the same
148   constituent points. Normally these types are autoamtically inferred and the user does not specify
149   them.
150 
151 .seealso: `DMPlexComputeCellTypes()`
152 E*/
153 typedef enum {DM_POLYTOPE_POINT, DM_POLYTOPE_SEGMENT, DM_POLYTOPE_POINT_PRISM_TENSOR, DM_POLYTOPE_TRIANGLE, DM_POLYTOPE_QUADRILATERAL, DM_POLYTOPE_SEG_PRISM_TENSOR, DM_POLYTOPE_TETRAHEDRON, DM_POLYTOPE_HEXAHEDRON, DM_POLYTOPE_TRI_PRISM, DM_POLYTOPE_TRI_PRISM_TENSOR, DM_POLYTOPE_QUAD_PRISM_TENSOR, DM_POLYTOPE_PYRAMID, DM_POLYTOPE_FV_GHOST, DM_POLYTOPE_INTERIOR_GHOST, DM_POLYTOPE_UNKNOWN, DM_NUM_POLYTOPES} DMPolytopeType;
154 PETSC_EXTERN const char *const DMPolytopeTypes[];
155 
156 /*E
157   PetscUnit - The seven fundamental SI units
158 
159   Level: beginner
160 
161 .seealso: `DMPlexGetScale()`, `DMPlexSetScale()`
162 E*/
163 typedef enum {PETSC_UNIT_LENGTH, PETSC_UNIT_MASS, PETSC_UNIT_TIME, PETSC_UNIT_CURRENT, PETSC_UNIT_TEMPERATURE, PETSC_UNIT_AMOUNT, PETSC_UNIT_LUMINOSITY, NUM_PETSC_UNITS} PetscUnit;
164 
165 /*S
166     DMField - PETSc object for defining a field on a mesh topology
167 
168     Level: intermediate
169 S*/
170 typedef struct _p_DMField* DMField;
171 
172 /*S
173     DMUniversalLabel - A label that encodes a set of `DMLabel`s, bijectively
174 
175     Level: developer
176 S*/
177 typedef struct _p_UniversalLabel* DMUniversalLabel;
178 
179 typedef struct _n_DMGeneratorFunctionList *DMGeneratorFunctionList;
180 
181 #endif
182