Actual source code: petscdstypes.h
1: #pragma once
3: #include <petscsystypes.h>
4: #include <petscdmlabeltypes.h>
6: /* MANSEC = DM */
7: /* SUBMANSEC = DT */
9: /*S
10: PetscDS - PETSc object that manages a discrete system, which is a set of discretizations + continuum equations from a `PetscWeakForm`
12: Level: intermediate
14: .seealso: `PetscDSCreate()`, `PetscDSSetType()`, `PetscDSType`, `PetscWeakForm`, `PetscFECreate()`, `PetscFVCreate()`
15: S*/
16: typedef struct _p_PetscDS *PetscDS;
18: /*S
19: PetscWeakForm - PETSc object that manages a sets of pointwise functions defining a system of equations
21: Level: intermediate
23: .seealso: `PetscWeakFormCreate()`, `PetscDS`, `PetscFECreate()`, `PetscFVCreate()`
24: S*/
25: typedef struct _p_PetscWeakForm *PetscWeakForm;
27: /*S
28: PetscFormKey - This key indicates how to use a set of pointwise functions defining part of a system of equations
30: The subdomain on which to integrate is specified by (label, value), the test function field by (field), and the
31: piece of the equation by (part). For example, LHS = 0 and RHS = 1 in IMEX methods. More pieces can be present for
32: operator splitting methods.
34: Level: intermediate
36: Note:
37: This is a struct, not a `PetscObject`
39: .seealso: `DMPlexSNESComputeResidualFEM()`, `DMPlexSNESComputeJacobianFEM()`, `DMPlexSNESComputeBoundaryFEM()`
40: S*/
41: typedef struct {
42: DMLabel label; /* The (label, value) select a subdomain */
43: PetscInt value;
44: PetscInt field; /* Selects the field for the test function */
45: PetscInt part; /* Selects the equation part. For example, LHS = 0 and RHS = 1 in IMEX methods. More pieces can be present for operator splitting methods. */
46: } PetscFormKey;
48: /*E
49: PetscWeakFormKind - The kind of weak form. The specific forms are given in the documentation for the integraton functions.
51: Values:
52: + OBJECTIVE - Objective form
53: . F0, F1 - Residual forms
54: . G0, G1, G2, G3 - Jacobian forms
55: . GP0, GP1, GP2, GP3 - Jacobian forms used to construct the preconditioner
56: . GT0, GT1, GT2, GT3 - Dynamic Jacobian matrix forms
57: . BDF0, BDF1 - Boundary Residual forms
58: . BDG0, BDG1, BDG2, BDG3 - Jacobian forms
59: . BDGP0, BDGP1, BDGP2, BDGP3 - Jacobian forms used to construct the preconditioner
60: . R - Riemann solver
61: - CEED - libCEED QFunction
63: Level: beginner
65: .seealso: `PetscWeakForm`, `PetscFEIntegrateResidual()`, `PetscFEIntegrateJacobian()`, `PetscFEIntegrateBdResidual()`, `PetscFEIntegrateBdJacobian()`,
66: `PetscFVIntegrateRHSFunction()`, `PetscWeakFormSetIndexResidual()`, `PetscWeakFormClearIndex()`
67: E*/
68: typedef enum {
69: PETSC_WF_OBJECTIVE,
70: PETSC_WF_F0,
71: PETSC_WF_F1,
72: PETSC_WF_G0,
73: PETSC_WF_G1,
74: PETSC_WF_G2,
75: PETSC_WF_G3,
76: PETSC_WF_GP0,
77: PETSC_WF_GP1,
78: PETSC_WF_GP2,
79: PETSC_WF_GP3,
80: PETSC_WF_GT0,
81: PETSC_WF_GT1,
82: PETSC_WF_GT2,
83: PETSC_WF_GT3,
84: PETSC_WF_BDF0,
85: PETSC_WF_BDF1,
86: PETSC_WF_BDG0,
87: PETSC_WF_BDG1,
88: PETSC_WF_BDG2,
89: PETSC_WF_BDG3,
90: PETSC_WF_BDGP0,
91: PETSC_WF_BDGP1,
92: PETSC_WF_BDGP2,
93: PETSC_WF_BDGP3,
94: PETSC_WF_R,
95: PETSC_WF_CEED,
96: PETSC_NUM_WF
97: } PetscWeakFormKind;
98: PETSC_EXTERN const char *const PetscWeakFormKinds[];
100: /*S
101: PetscPointFn - A prototype of a pointwise function that can be passed to, for example, `PetscDSSetObjective()`
103: Calling Sequence:
104: + dim - the coordinate dimension
105: . Nf - the number of fields
106: . NfAux - the number of auxiliary fields
107: . uOff - the offset into `u`[] and `u_t`[] for each field
108: . uOff_x - the offset into `u_x`[] for each field
109: . u - each field evaluated at the current point
110: . u_t - the time derivative of each field evaluated at the current point
111: . u_x - the gradient of each field evaluated at the current point
112: . aOff - the offset into `a`[] and `a_t`[] for each auxiliary field
113: . aOff_x - the offset into `a_x`[] for each auxiliary field
114: . a - each auxiliary field evaluated at the current point
115: . a_t - the time derivative of each auxiliary field evaluated at the current point
116: . a_x - the gradient of auxiliary each field evaluated at the current point
117: . t - current time
118: . x - coordinates of the current point
119: . numConstants - number of constant parameters
120: . constants - constant parameters
121: - obj - output values at the current point
123: Level: beginner
125: .seealso: `PetscPointFn`, `PetscDSSetObjective()`, `PetscDSGetObjective()`, `PetscDSGetResidual()`, `PetscDSSetResidual()`,
126: `PetscDSGetRHSResidual()`, `PetscDSSetUpdate()`, `PetscDSGetUpdate()`, `DMPlexSetCoordinateMap()`
127: S*/
128: PETSC_EXTERN_TYPEDEF typedef void PetscPointFn(PetscInt dim, PetscInt Nf, PetscInt NfAux, const PetscInt uOff[], const PetscInt uOff_x[], const PetscScalar u[], const PetscScalar u_t[], const PetscScalar u_x[], const PetscInt aOff[], const PetscInt aOff_x[], const PetscScalar a[], const PetscScalar a_t[], const PetscScalar a_x[], PetscReal t, const PetscReal X[], PetscInt numConstants, const PetscScalar constants[], PetscScalar result[]);
130: /*S
131: PetscPointJacFn - A prototype of a pointwise function that can be passed to, for example, `PetscDSSetJacobian()` for computing Jacobians
133: Calling Sequence:
134: + dim - the coordinate dimension
135: . Nf - the number of fields
136: . NfAux - the number of auxiliary fields
137: . uOff - the offset into `u`[] and `u_t`[] for each field
138: . uOff_x - the offset into `u_x`[] for each field
139: . u - each field evaluated at the current point
140: . u_t - the time derivative of each field evaluated at the current point
141: . u_x - the gradient of each field evaluated at the current point
142: . aOff - the offset into `a`[] and `a_t`[] for each auxiliary field
143: . aOff_x - the offset into a_`x`[] for each auxiliary field
144: . a - each auxiliary field evaluated at the current point
145: . a_t - the time derivative of each auxiliary field evaluated at the current point
146: . a_x - the gradient of auxiliary each field evaluated at the current point
147: . t - current time
148: . u_tShift - the multiplier `a` for $dF/dU_t$
149: . x - coordinates of the current point
150: . numConstants - number of constant parameters
151: . constants - constant parameters
152: - g - output values at the current point
154: Level: beginner
156: .seealso: `PetscPointFn`, `PetscDSSetJacobian()`, `PetscDSGetJacobian()`, `PetscDSSetJacobianPreconditioner()`, `PetscDSGetJacobianPreconditioner()`,
157: `PetscDSSetDynamicJacobian()`, `PetscDSGetDynamicJacobian()`
158: S*/
159: PETSC_EXTERN_TYPEDEF typedef void PetscPointJacFn(PetscInt dim, PetscInt Nf, PetscInt NfAux, const PetscInt uOff[], const PetscInt uOff_x[], const PetscScalar u[], const PetscScalar u_t[], const PetscScalar u_x[], const PetscInt aOff[], const PetscInt aOff_x[], const PetscScalar a[], const PetscScalar a_t[], const PetscScalar a_x[], PetscReal t, PetscReal u_tShift, const PetscReal x[], PetscInt numConstants, const PetscScalar constants[], PetscScalar g[]);
161: /*S
162: PetscBdPointFn - A prototype of a pointwise boundary function that can be passed to, for example, `PetscDSSetBdResidual()`
164: Calling Sequence:
165: + dim - the coordinate dimension
166: . Nf - the number of fields
167: . NfAux - the number of auxiliary fields
168: . uOff - the offset into `u`[] and `u_t`[] for each field
169: . uOff_x - the offset into `u_x`[] for each field
170: . u - each field evaluated at the current point
171: . u_t - the time derivative of each field evaluated at the current point
172: . u_x - the gradient of each field evaluated at the current point
173: . aOff - the offset into `a`[] and `a_t`[] for each auxiliary field
174: . aOff_x - the offset into `a_x`[] for each auxiliary field
175: . a - each auxiliary field evaluated at the current point
176: . a_t - the time derivative of each auxiliary field evaluated at the current point
177: . a_x - the gradient of auxiliary each field evaluated at the current point
178: . t - current time
179: . x - coordinates of the current point
180: . n - unit normal at the current point
181: . numConstants - number of constant parameters
182: . constants - constant parameters
183: - f - output values at the current point
185: Level: beginner
187: .seealso: `PetscPointFn`, `PetscDSSetBdResidual()`, `PetscDSGetBdResidual()`, `PetscDSSetObjective()`, `PetscDSGetObjective()`, `PetscDSGetResidual()`,
188: `PetscDSGetRHSResidual()`, `PetscDSSetUpdate()`, `PetscDSGetUpdate()`, `DMPlexSetCoordinateMap()`,
189: `PetscDSSetResidual()`, `PetscPointJacFn`
190: S*/
191: PETSC_EXTERN_TYPEDEF typedef void PetscBdPointFn(PetscInt dim, PetscInt Nf, PetscInt NfAux, const PetscInt uOff[], const PetscInt uOff_x[], const PetscScalar u[], const PetscScalar u_t[], const PetscScalar u_x[], const PetscInt aOff[], const PetscInt aOff_x[], const PetscScalar a[], const PetscScalar a_t[], const PetscScalar a_x[], PetscReal t, const PetscReal x[], const PetscReal n[], PetscInt numConstants, const PetscScalar constants[], PetscScalar f[]);
193: /*S
194: PetscBdPointJacFn - A prototype of a pointwise boundary function that can be passed to, for example, `PetscDSSetBdJacobian()`
196: Calling Sequence:
197: + dim - the coordinate dimension
198: . Nf - the number of fields
199: . NfAux - the number of auxiliary fields
200: . uOff - the offset into `u`[] and `u_t`[] for each field
201: . uOff_x - the offset into `u_x`[] for each field
202: . u - each field evaluated at the current point
203: . u_t - the time derivative of each field evaluated at the current point
204: . u_x - the gradient of each field evaluated at the current point
205: . aOff - the offset into `a`[] and `a_t`[] for each auxiliary field
206: . aOff_x - the offset into `a_x`[] for each auxiliary field
207: . a - each auxiliary field evaluated at the current point
208: . a_t - the time derivative of each auxiliary field evaluated at the current point
209: . a_x - the gradient of auxiliary each field evaluated at the current point
210: . t - current time
211: . u_tShift - the multiplier `a` for $dF/dU_t$
212: . x - coordinates of the current point
213: . n - normal at the current point
214: . numConstants - number of constant parameters
215: . constants - constant parameters
216: - g - output values at the current point
218: Level: beginner
220: .seealso: `PetscPointFn`, `PetscDSSetBdJacobian()`, `PetscDSGetBdJacobian()`, `PetscDSSetBdJacobianPreconditioner()`, `PetscDSGetBdJacobianPreconditioner()`,
221: `PetscDSSetBdResidual()`, `PetscDSGetBdResidual()`, `PetscDSSetObjective()`, `PetscDSGetObjective()`, `PetscDSGetResidual()`,
222: `PetscDSGetRHSResidual()`, `PetscDSSetUpdate()`, `PetscDSGetUpdate()`, `DMPlexSetCoordinateMap()`,
223: `PetscDSSetResidual()`, `PetscPointJacFn`
224: S*/
225: PETSC_EXTERN_TYPEDEF typedef void PetscBdPointJacFn(PetscInt dim, PetscInt Nf, PetscInt NfAux, const PetscInt uOff[], const PetscInt uOff_x[], const PetscScalar u[], const PetscScalar u_t[], const PetscScalar u_x[], const PetscInt aOff[], const PetscInt aOff_x[], const PetscScalar a[], const PetscScalar a_t[], const PetscScalar a_x[], PetscReal t, PetscReal u_tShift, const PetscReal x[], const PetscReal n[], PetscInt numConstants, const PetscScalar constants[], PetscScalar g0[]);
227: /*S
228: PetscPointExactSolutionFn - A prototype of a pointwise function that computes the exact solution to a PDE. Used with, for example,
229: `PetscDSSetExactSolution()`
231: Calling Sequence:
232: + dim - the coordinate dimension
233: . t - current time
234: . x - coordinates of the current point
235: . Nc - the number of field components
236: . u - the solution field evaluated at the current point
237: - ctx - an application context, set with `PetscDSSetExactSolution()` or `PetscDSSetExactSolutionTimeDerivative()`
239: Level: beginner
241: .seealso: `PetscPointFn`, `PetscDSSetExactSolution()`, `PetscDSGetExactSolution()`, `PetscDSSetExactSolutionTimeDerivative()`, `PetscDSGetExactSolutionTimeDerivative()`
242: S*/
243: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode PetscPointExactSolutionFn(PetscInt dim, PetscReal t, const PetscReal x[], PetscInt Nc, PetscScalar u[], PetscCtx ctx);
245: /*S
246: PetscRiemannFn - A prototype of a pointwise function that can be passed to, for example, `PetscDSSetRiemannSolver()`
248: Calling Sequence:
249: + dim - the coordinate dimension
250: . Nf - The number of fields
251: . x - The coordinates at a point on the interface
252: . n - The normal vector to the interface
253: . uL - The state vector to the left of the interface
254: . uR - The state vector to the right of the interface
255: . numConstants - number of constant parameters
256: . constants - constant parameters
257: . flux - output array of flux through the interface
258: - ctx - optional application context
260: Level: beginner
262: .seealso: `PetscPointFn`, `PetscDSSetRiemannSolver()`, `PetscDSGetRiemannSolver()`
263: S*/
264: PETSC_EXTERN_TYPEDEF typedef void PetscRiemannFn(PetscInt dim, PetscInt Nf, const PetscReal x[], const PetscReal n[], const PetscScalar uL[], const PetscScalar uR[], PetscInt numConstants, const PetscScalar constants[], PetscScalar flux[], PetscCtx ctx);
266: /*S
267: PetscSimplePointFn - A prototype of a simple pointwise function that can be passed to, for example, `DMPlexTransformExtrudeSetNormalFunction()`
269: Calling Sequence:
270: + dim - The coordinate dimension of the original mesh (usually a surface)
271: . time - The current time, or 0.
272: . x - The location of the current normal, in the coordinate space of the original mesh
273: . r - The layer number of this point
274: . u - The user provides the computed normal on output
275: - ctx - An optional application context, this context may be obtained by the calling code with `DMGetApplicationContext()`
277: Level: beginner
279: Developer Note:
280: The handling of `ctx` in the use of such functions may not be ideal since the context is not provided when the function pointer is provided with, for example, `DMSwarmSetCoordinateFunction()`
282: .seealso: `PetscPointFn`, `DMPlexTransformExtrudeSetNormalFunction()`, `DMSwarmSetCoordinateFunction()`
283: S*/
284: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode PetscSimplePointFn(PetscInt dim, PetscReal time, const PetscReal x[], PetscInt r, PetscScalar u[], PetscCtx ctx);
286: PETSC_EXTERN_TYPEDEF typedef PetscSimplePointFn *PetscSimplePointFunc PETSC_DEPRECATED_TYPEDEF(3, 24, 0, "PetscSimplePointFn*", );
287: PETSC_EXTERN_TYPEDEF typedef PetscPointFn *PetscPointFunc PETSC_DEPRECATED_TYPEDEF(3, 24, 0, "PetscPointFn*", );
288: PETSC_EXTERN_TYPEDEF typedef PetscPointJacFn *PetscPointJac PETSC_DEPRECATED_TYPEDEF(3, 24, 0, "PetscPointJacFn*", );
289: PETSC_EXTERN_TYPEDEF typedef PetscBdPointFn *PetscBdPointFunc PETSC_DEPRECATED_TYPEDEF(3, 24, 0, "PetscBdPointFn*", );
290: PETSC_EXTERN_TYPEDEF typedef PetscBdPointJacFn *PetscBdPointJac PETSC_DEPRECATED_TYPEDEF(3, 24, 0, "PetscBdPointJacFn*", );
291: PETSC_EXTERN_TYPEDEF typedef PetscRiemannFn *PetscRiemannFunc PETSC_DEPRECATED_TYPEDEF(3, 24, 0, "PetscRiemannFn*", );
293: /*S
294: PetscPointBoundFn - A prototype of a pointwise function that can be passed to, for example, `PetscDSSetLowerBound()`
296: Calling Sequence:
297: + dim - the coordinate dimension
298: . t - current time
299: . x - coordinates of the current point
300: . Nc - the number of field components
301: . u - the lower bound evaluated at the current point
302: - ctx - an application context, passed in with, for example, `PetscDSSetLowerBound()`
304: Level: beginner
306: .seealso: `PetscPointFn`, `PetscDSSetLowerBound()`, `PetscDSSetUpperBound()`
307: S*/
308: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode PetscPointBoundFn(PetscInt dim, PetscReal t, const PetscReal x[], PetscInt Nc, PetscScalar u[], PetscCtx ctx);