xref: /petsc/include/petscdmtypes.h (revision db77db73299823266fc3e7c40818affe792d6eba)
1 #if !defined(PETSCDMTYPES_H)
2 #define PETSCDMTYPES_H
3 
4 /*S
5      DM - Abstract PETSc object that manages an abstract grid object and its interactions with the algebraic solvers
6 
7    Level: intermediate
8 
9    Notes:
10     The DMDACreate() based object and the DMCompositeCreate() based object are examples of DMs
11 
12 .seealso:  DMCompositeCreate(), DMDACreate(), DMSetType(), DMType
13 S*/
14 typedef struct _p_DM* DM;
15 
16 /*E
17   DMBoundaryType - Describes the choice for fill of ghost cells on physical domain boundaries.
18 
19   Level: beginner
20 
21   A boundary may be of type DM_BOUNDARY_NONE (no ghost nodes), DM_BOUNDARY_GHOSTED (ghost vertices/cells
22   exist but aren't filled; you can put values into them and then apply a stencil that uses those ghost locations),
23   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;
24   not yet implemented for 3d), DM_BOUNDARY_PERIODIC (ghost vertices/cells filled by the opposite
25   edge of the domain), or DM_BOUNDARY_TWIST (like periodic, only glued backwards like a Mobius strip).
26 
27   Notes:
28   This is information for the boundary of the __PHYSICAL__ domain. It has nothing to do with boundaries between
29   processes. That width is always determined by the stencil width; see DMDASetStencilWidth().
30 
31   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 .
32 
33   Developer Notes:
34     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
35   as the 0th grid point where the physical boundary serves as the mirror?
36 
37   References:
38   https://scicomp.stackexchange.com/questions/5355/writing-the-poisson-equation-finite-difference-matrix-with-neumann-boundary-cond
39 
40 .seealso: DMDASetBoundaryType(), DMDACreate1d(), DMDACreate2d(), DMDACreate3d(), DMDACreate()
41 E*/
42 typedef enum {DM_BOUNDARY_NONE, DM_BOUNDARY_GHOSTED, DM_BOUNDARY_MIRROR, DM_BOUNDARY_PERIODIC, DM_BOUNDARY_TWIST} DMBoundaryType;
43 /*E
44   DMBoundaryConditionType - indicates what type of boundary condition is to be imposed
45 
46   Note: This flag indicates the type of function which will define the condition:
47 $ DM_BC_ESSENTIAL       - A Dirichlet condition using a function of the coordinates
48 $ DM_BC_ESSENTIAL_FIELD - A Dirichlet condition using a function of the coordinates and auxiliary field data
49 $ DM_BC_ESSENTIAL_BD_FIELD - A Dirichlet condition using a function of the coordinates, facet normal, and auxiliary field data
50 $ DM_BC_NATURAL         - A Neumann condition using a function of the coordinates
51 $ DM_BC_NATURAL_FIELD   - A Neumann condition using a function of the coordinates and auxiliary field data
52 $ DM_BC_NATURAL_RIEMANN - A flux condition which determines the state in ghost cells
53 The user can check whether a boundary condition is essential using (type & DM_BC_ESSENTIAL), and similarly for
54 natural conditions (type & DM_BC_NATURAL)
55 
56   Level: beginner
57 
58 .seealso: DMAddBoundary(), DMGetBoundary()
59 E*/
60 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;
61 
62 /*E
63   DMPointLocationType - Describes the method to handle point location failure
64 
65   Level: beginner
66 
67   If a search using DM_POINTLOCATION_NONE fails, the failure is signaled with a negative cell number. On the
68   other hand, if DM_POINTLOCATION_NEAREST is used, on failure, the (approximate) nearest point in the mesh is
69   used, replacing the given point in the input vector. DM_POINTLOCATION_REMOVE returns values only for points
70   which were located.
71 
72 .seealso: DMLocatePoints()
73 E*/
74 typedef enum {DM_POINTLOCATION_NONE, DM_POINTLOCATION_NEAREST, DM_POINTLOCATION_REMOVE} DMPointLocationType;
75 
76 /*E
77   DMAdaptationStrategy - Describes the strategy used for adaptive solves
78 
79   Level: beginner
80 
81   DM_ADAPTATION_INITIAL will refine a mesh based on an initial guess. DM_ADAPTATION_SEQUENTIAL will refine the
82   mesh based on a sequence of solves, much like grid sequencing. DM_ADAPTATION_MULTILEVEL will use the sequence
83   of constructed meshes in a multilevel solve, much like the Systematic Upscaling of Brandt.
84 
85 .seealso: DMAdaptorSolve()
86 E*/
87 typedef enum {DM_ADAPTATION_INITIAL, DM_ADAPTATION_SEQUENTIAL, DM_ADAPTATION_MULTILEVEL} DMAdaptationStrategy;
88 
89 /*E
90   DMAdaptationCriterion - Describes the test used to decide whether to coarsen or refine parts of the mesh
91 
92   Level: beginner
93 
94   DM_ADAPTATION_REFINE will uniformly refine a mesh, much like grid sequencing. DM_ADAPTATION_LABEL will adapt
95   the mesh based upon a label of the cells filled with DMAdaptFlag markers. DM_ADAPTATION_METRIC will try to
96   mesh the manifold described by the input metric tensor uniformly. PETSc can also construct such a metric based
97   upon an input primal or a gradient field.
98 
99 .seealso: DMAdaptorSolve()
100 E*/
101 typedef enum {DM_ADAPTATION_NONE, DM_ADAPTATION_REFINE, DM_ADAPTATION_LABEL, DM_ADAPTATION_METRIC} DMAdaptationCriterion;
102 
103 /*E
104   DMAdaptFlag - Marker in the label prescribing adaptation
105 
106   Level: beginner
107 
108 .seealso: DMAdaptLabel()
109 E*/
110 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;
111 
112 /*E
113   DMDirection - Indicates a coordinate direction
114 
115   Level: beginner
116 
117 .seealso: DMDAGetRay(), DMDAGetProcessorSubset(), DMPlexShearGeometry()
118 E*/
119 typedef enum {DM_X, DM_Y, DM_Z} DMDirection;
120 
121 /*S
122   PetscPartitioner - PETSc object that manages a graph partitioner
123 
124   Level: intermediate
125 
126 .seealso: PetscPartitionerCreate(), PetscPartitionerSetType(), PetscPartitionerType
127 S*/
128 typedef struct _p_PetscPartitioner *PetscPartitioner;
129 
130 /*E
131   PetscUnit - The seven fundamental SI units
132 
133   Level: beginner
134 
135 .seealso: DMPlexGetScale(), DMPlexSetScale()
136 E*/
137 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;
138 
139 /*S
140     DMField - PETSc object for defining a field on a mesh topology
141 
142     Level: intermediate
143 S*/
144 typedef struct _p_DMField* DMField;
145 
146 #endif
147