Actual source code: petscts.h
1: /*
2: User interface for the timestepping package. This package
3: is for use in solving time-dependent PDEs.
4: */
5: #pragma once
7: #include <petscsnes.h>
8: #include <petscconvest.h>
10: /*I <petscts.h> I*/
12: /* SUBMANSEC = TS */
14: /*S
15: TS - Abstract PETSc object that manages integrating an ODE.
17: Level: beginner
19: .seealso: [](integrator_table), [](ch_ts), `TSCreate()`, `TSSetType()`, `TSType`, `SNES`, `KSP`, `PC`, `TSDestroy()`
20: S*/
21: typedef struct _p_TS *TS;
23: /*J
24: TSType - String with the name of a PETSc `TS` method. These are all the time/ODE integrators that PETSc provides.
26: Level: beginner
28: Note:
29: Use `TSSetType()` or the options database key `-ts_type` to set the ODE integrator method to use with a given `TS` object
31: .seealso: [](integrator_table), [](ch_ts), `TSSetType()`, `TS`, `TSRegister()`
32: J*/
33: typedef const char *TSType;
34: #define TSEULER "euler"
35: #define TSBEULER "beuler"
36: #define TSBASICSYMPLECTIC "basicsymplectic"
37: #define TSPSEUDO "pseudo"
38: #define TSCN "cn"
39: #define TSSUNDIALS "sundials"
40: #define TSRK "rk"
41: #define TSPYTHON "python"
42: #define TSTHETA "theta"
43: #define TSALPHA "alpha"
44: #define TSALPHA2 "alpha2"
45: #define TSGLLE "glle"
46: #define TSGLEE "glee"
47: #define TSSSP "ssp"
48: #define TSARKIMEX "arkimex"
49: #define TSROSW "rosw"
50: #define TSEIMEX "eimex"
51: #define TSMIMEX "mimex"
52: #define TSBDF "bdf"
53: #define TSRADAU5 "radau5"
54: #define TSMPRK "mprk"
55: #define TSDISCGRAD "discgrad"
56: #define TSIRK "irk"
57: #define TSDIRK "dirk"
59: /*E
60: TSProblemType - Determines the type of problem this `TS` object is to be used to solve
62: Values:
63: + `TS_LINEAR` - a linear ODE or DAE
64: - `TS_NONLINEAR` - a nonlinear ODE or DAE
66: Level: beginner
68: .seealso: [](ch_ts), `TS`, `TSCreate()`
69: E*/
70: typedef enum {
71: TS_LINEAR,
72: TS_NONLINEAR
73: } TSProblemType;
75: /*E
76: TSEquationType - type of `TS` problem that is solved
78: Values:
79: + `TS_EQ_UNSPECIFIED` - (default)
80: . `TS_EQ_EXPLICIT` - {ODE and DAE index 1, 2, 3, HI} F(t,U,U_t) := M(t) U_t - G(U,t) = 0
81: - `TS_EQ_IMPLICIT` - {ODE and DAE index 1, 2, 3, HI} F(t,U,U_t) = 0
83: Level: beginner
85: .seealso: [](ch_ts), `TS`, `TSGetEquationType()`, `TSSetEquationType()`
86: E*/
87: typedef enum {
88: TS_EQ_UNSPECIFIED = -1,
89: TS_EQ_EXPLICIT = 0,
90: TS_EQ_ODE_EXPLICIT = 1,
91: TS_EQ_DAE_SEMI_EXPLICIT_INDEX1 = 100,
92: TS_EQ_DAE_SEMI_EXPLICIT_INDEX2 = 200,
93: TS_EQ_DAE_SEMI_EXPLICIT_INDEX3 = 300,
94: TS_EQ_DAE_SEMI_EXPLICIT_INDEXHI = 500,
95: TS_EQ_IMPLICIT = 1000,
96: TS_EQ_ODE_IMPLICIT = 1001,
97: TS_EQ_DAE_IMPLICIT_INDEX1 = 1100,
98: TS_EQ_DAE_IMPLICIT_INDEX2 = 1200,
99: TS_EQ_DAE_IMPLICIT_INDEX3 = 1300,
100: TS_EQ_DAE_IMPLICIT_INDEXHI = 1500
101: } TSEquationType;
103: /*E
104: TSConvergedReason - reason a `TS` method has converged (integrated to the requested time) or not
106: Values:
107: + `TS_CONVERGED_ITERATING` - this only occurs if `TSGetConvergedReason()` is called during the `TSSolve()`
108: . `TS_CONVERGED_TIME` - the final time was reached
109: . `TS_CONVERGED_ITS` - the maximum number of iterations (time-steps) was reached prior to the final time
110: . `TS_CONVERGED_USER` - user requested termination
111: . `TS_CONVERGED_EVENT` - user requested termination on event detection
112: . `TS_CONVERGED_PSEUDO_FATOL` - stops when function norm decreased by a set amount, used only for `TSPSEUDO`
113: . `TS_CONVERGED_PSEUDO_FRTOL` - stops when function norm decreases below a set amount, used only for `TSPSEUDO`
114: . `TS_DIVERGED_NONLINEAR_SOLVE` - too many nonlinear solve failures have occurred
115: . `TS_DIVERGED_STEP_REJECTED` - too many steps were rejected
116: . `TSFORWARD_DIVERGED_LINEAR_SOLVE` - tangent linear solve failed
117: - `TSADJOINT_DIVERGED_LINEAR_SOLVE` - transposed linear solve failed
119: Level: beginner
121: .seealso: [](ch_ts), `TS`, `TSGetConvergedReason()`
122: E*/
123: typedef enum {
124: TS_CONVERGED_ITERATING = 0,
125: TS_CONVERGED_TIME = 1,
126: TS_CONVERGED_ITS = 2,
127: TS_CONVERGED_USER = 3,
128: TS_CONVERGED_EVENT = 4,
129: TS_CONVERGED_PSEUDO_FATOL = 5,
130: TS_CONVERGED_PSEUDO_FRTOL = 6,
131: TS_DIVERGED_NONLINEAR_SOLVE = -1,
132: TS_DIVERGED_STEP_REJECTED = -2,
133: TSFORWARD_DIVERGED_LINEAR_SOLVE = -3,
134: TSADJOINT_DIVERGED_LINEAR_SOLVE = -4
135: } TSConvergedReason;
136: PETSC_EXTERN const char *const *TSConvergedReasons;
138: /*MC
139: TS_CONVERGED_ITERATING - this only occurs if `TSGetConvergedReason()` is called during the `TSSolve()`
141: Level: beginner
143: .seealso: [](ch_ts), `TS`, `TSSolve()`, `TSGetConvergedReason()`, `TSGetAdapt()`
144: M*/
146: /*MC
147: TS_CONVERGED_TIME - the final time was reached
149: Level: beginner
151: .seealso: [](ch_ts), `TS`, `TSSolve()`, `TSGetConvergedReason()`, `TSGetAdapt()`, `TSSetMaxTime()`, `TSGetMaxTime()`, `TSGetSolveTime()`
152: M*/
154: /*MC
155: TS_CONVERGED_ITS - the maximum number of iterations (time-steps) was reached prior to the final time
157: Level: beginner
159: .seealso: [](ch_ts), `TS`, `TSSolve()`, `TSGetConvergedReason()`, `TSGetAdapt()`, `TSSetMaxSteps()`, `TSGetMaxSteps()`
160: M*/
162: /*MC
163: TS_CONVERGED_USER - user requested termination
165: Level: beginner
167: .seealso: [](ch_ts), `TS`, `TSSolve()`, `TSGetConvergedReason()`, `TSSetConvergedReason()`
168: M*/
170: /*MC
171: TS_CONVERGED_EVENT - user requested termination on event detection
173: Level: beginner
175: .seealso: [](ch_ts), `TS`, `TSSolve()`, `TSGetConvergedReason()`, `TSSetConvergedReason()`
176: M*/
178: /*MC
179: TS_CONVERGED_PSEUDO_FRTOL - stops when function norm decreased by a set amount, used only for `TSPSEUDO`
181: Options Database Key:
182: . -ts_pseudo_frtol rtol - use specified rtol
184: Level: beginner
186: .seealso: [](ch_ts), `TS`, `TSSolve()`, `TSGetConvergedReason()`, `TSSetConvergedReason()`, `TS_CONVERGED_PSEUDO_FATOL`
187: M*/
189: /*MC
190: TS_CONVERGED_PSEUDO_FATOL - stops when function norm decreases below a set amount, used only for `TSPSEUDO`
192: Options Database Key:
193: . -ts_pseudo_fatol atol - use specified atol
195: Level: beginner
197: .seealso: [](ch_ts), `TS`, `TSSolve()`, `TSGetConvergedReason()`, `TSSetConvergedReason()`, `TS_CONVERGED_PSEUDO_FRTOL`
198: M*/
200: /*MC
201: TS_DIVERGED_NONLINEAR_SOLVE - too many nonlinear solves failed
203: Level: beginner
205: Note:
206: See `TSSetMaxSNESFailures()` for how to allow more nonlinear solver failures.
208: .seealso: [](ch_ts), `TS`, `TSSolve()`, `TSGetConvergedReason()`, `TSGetAdapt()`, `TSGetSNES()`, `SNESGetConvergedReason()`, `TSSetMaxSNESFailures()`
209: M*/
211: /*MC
212: TS_DIVERGED_STEP_REJECTED - too many steps were rejected
214: Level: beginner
216: Notes:
217: See `TSSetMaxStepRejections()` for how to allow more step rejections.
219: .seealso: [](ch_ts), `TS`, `TSSolve()`, `TSGetConvergedReason()`, `TSGetAdapt()`, `TSSetMaxStepRejections()`
220: M*/
222: /*E
223: TSExactFinalTimeOption - option for handling of final time step
225: Values:
226: + `TS_EXACTFINALTIME_STEPOVER` - Don't do anything if requested final time is exceeded
227: . `TS_EXACTFINALTIME_INTERPOLATE` - Interpolate back to final time
228: - `TS_EXACTFINALTIME_MATCHSTEP` - Adapt final time step to match the final time requested
230: Level: beginner
232: .seealso: [](ch_ts), `TS`, `TSGetConvergedReason()`, `TSSetExactFinalTime()`, `TSGetExactFinalTime()`
233: E*/
234: typedef enum {
235: TS_EXACTFINALTIME_UNSPECIFIED = 0,
236: TS_EXACTFINALTIME_STEPOVER = 1,
237: TS_EXACTFINALTIME_INTERPOLATE = 2,
238: TS_EXACTFINALTIME_MATCHSTEP = 3
239: } TSExactFinalTimeOption;
240: PETSC_EXTERN const char *const TSExactFinalTimeOptions[];
242: /* Logging support */
243: PETSC_EXTERN PetscClassId TS_CLASSID;
244: PETSC_EXTERN PetscClassId DMTS_CLASSID;
245: PETSC_EXTERN PetscClassId TSADAPT_CLASSID;
247: PETSC_EXTERN PetscErrorCode TSInitializePackage(void);
248: PETSC_EXTERN PetscErrorCode TSFinalizePackage(void);
250: PETSC_EXTERN PetscErrorCode TSCreate(MPI_Comm, TS *);
251: PETSC_EXTERN PetscErrorCode TSClone(TS, TS *);
252: PETSC_EXTERN PetscErrorCode TSDestroy(TS *);
254: PETSC_EXTERN PetscErrorCode TSSetProblemType(TS, TSProblemType);
255: PETSC_EXTERN PetscErrorCode TSGetProblemType(TS, TSProblemType *);
256: PETSC_EXTERN PetscErrorCode TSMonitor(TS, PetscInt, PetscReal, Vec);
257: PETSC_EXTERN PetscErrorCode TSMonitorSet(TS, PetscErrorCode (*)(TS, PetscInt, PetscReal, Vec, PetscCtx), PetscCtx, PetscCtxDestroyFn *);
258: PETSC_EXTERN PetscErrorCode TSMonitorSetFromOptions(TS, const char[], const char[], const char[], PetscErrorCode (*)(TS, PetscInt, PetscReal, Vec, PetscViewerAndFormat *), PetscErrorCode (*)(TS, PetscViewerAndFormat *));
259: PETSC_EXTERN PetscErrorCode TSMonitorCancel(TS);
261: PETSC_EXTERN PetscErrorCode TSSetOptionsPrefix(TS, const char[]);
262: PETSC_EXTERN PetscErrorCode TSAppendOptionsPrefix(TS, const char[]);
263: PETSC_EXTERN PetscErrorCode TSGetOptionsPrefix(TS, const char *[]);
264: PETSC_EXTERN PetscErrorCode TSSetFromOptions(TS);
265: PETSC_EXTERN PetscErrorCode TSSetUp(TS);
266: PETSC_EXTERN PetscErrorCode TSReset(TS);
268: PETSC_EXTERN PetscErrorCode TSSetSolution(TS, Vec);
269: PETSC_EXTERN PetscErrorCode TSGetSolution(TS, Vec *);
271: PETSC_EXTERN PetscErrorCode TS2SetSolution(TS, Vec, Vec);
272: PETSC_EXTERN PetscErrorCode TS2GetSolution(TS, Vec *, Vec *);
274: PETSC_EXTERN PetscErrorCode TSGetSolutionComponents(TS, PetscInt *, Vec *);
275: PETSC_EXTERN PetscErrorCode TSGetAuxSolution(TS, Vec *);
276: PETSC_EXTERN PetscErrorCode TSGetTimeError(TS, PetscInt, Vec *);
277: PETSC_EXTERN PetscErrorCode TSSetTimeError(TS, Vec);
279: PETSC_EXTERN PetscErrorCode TSSetRHSJacobianP(TS, Mat, PetscErrorCode (*)(TS, PetscReal, Vec, Mat, PetscCtx), PetscCtx);
280: PETSC_EXTERN PetscErrorCode TSGetRHSJacobianP(TS, Mat *, PetscErrorCode (**)(TS, PetscReal, Vec, Mat, PetscCtx), PetscCtxRt);
281: PETSC_EXTERN PetscErrorCode TSComputeRHSJacobianP(TS, PetscReal, Vec, Mat);
282: PETSC_EXTERN PetscErrorCode TSSetIJacobianP(TS, Mat, PetscErrorCode (*)(TS, PetscReal, Vec, Vec, PetscReal, Mat, PetscCtx), PetscCtx);
283: PETSC_EXTERN PetscErrorCode TSGetIJacobianP(TS, Mat *, PetscErrorCode (**)(TS, PetscReal, Vec, Vec, PetscReal, Mat, PetscCtx), PetscCtxRt);
284: PETSC_EXTERN PetscErrorCode TSComputeIJacobianP(TS, PetscReal, Vec, Vec, PetscReal, Mat, PetscBool);
285: PETSC_EXTERN PETSC_DEPRECATED_FUNCTION(3, 5, 0, "TSGetQuadratureTS() then TSComputeRHSJacobianP()", ) PetscErrorCode TSComputeDRDPFunction(TS, PetscReal, Vec, Vec *);
286: PETSC_EXTERN PETSC_DEPRECATED_FUNCTION(3, 5, 0, "TSGetQuadratureTS() then TSComputeRHSJacobian()", ) PetscErrorCode TSComputeDRDUFunction(TS, PetscReal, Vec, Vec *);
287: PETSC_EXTERN PetscErrorCode TSSetIHessianProduct(TS, Vec *, PetscErrorCode (*)(TS, PetscReal, Vec, Vec *, Vec, Vec *, PetscCtx), Vec *, PetscErrorCode (*)(TS, PetscReal, Vec, Vec *, Vec, Vec *, PetscCtx), Vec *, PetscErrorCode (*)(TS, PetscReal, Vec, Vec *, Vec, Vec *, PetscCtx), Vec *, PetscErrorCode (*)(TS, PetscReal, Vec, Vec *, Vec, Vec *, PetscCtx), PetscCtx);
288: PETSC_EXTERN PetscErrorCode TSComputeIHessianProductFunctionUU(TS, PetscReal, Vec, Vec[], Vec, Vec[]);
289: PETSC_EXTERN PetscErrorCode TSComputeIHessianProductFunctionUP(TS, PetscReal, Vec, Vec[], Vec, Vec[]);
290: PETSC_EXTERN PetscErrorCode TSComputeIHessianProductFunctionPU(TS, PetscReal, Vec, Vec[], Vec, Vec[]);
291: PETSC_EXTERN PetscErrorCode TSComputeIHessianProductFunctionPP(TS, PetscReal, Vec, Vec[], Vec, Vec[]);
292: PETSC_EXTERN PetscErrorCode TSSetRHSHessianProduct(TS, Vec[], PetscErrorCode (*)(TS, PetscReal, Vec, Vec *, Vec, Vec *, PetscCtx), Vec[], PetscErrorCode (*)(TS, PetscReal, Vec, Vec *, Vec, Vec *, PetscCtx), Vec[], PetscErrorCode (*)(TS, PetscReal, Vec, Vec *, Vec, Vec *, PetscCtx), Vec[], PetscErrorCode (*)(TS, PetscReal, Vec, Vec *, Vec, Vec *, PetscCtx), PetscCtx);
293: PETSC_EXTERN PetscErrorCode TSComputeRHSHessianProductFunctionUU(TS, PetscReal, Vec, Vec[], Vec, Vec[]);
294: PETSC_EXTERN PetscErrorCode TSComputeRHSHessianProductFunctionUP(TS, PetscReal, Vec, Vec[], Vec, Vec[]);
295: PETSC_EXTERN PetscErrorCode TSComputeRHSHessianProductFunctionPU(TS, PetscReal, Vec, Vec[], Vec, Vec[]);
296: PETSC_EXTERN PetscErrorCode TSComputeRHSHessianProductFunctionPP(TS, PetscReal, Vec, Vec[], Vec, Vec[]);
297: PETSC_EXTERN PetscErrorCode TSSetCostHessianProducts(TS, PetscInt, Vec[], Vec[], Vec);
298: PETSC_EXTERN PetscErrorCode TSGetCostHessianProducts(TS, PetscInt *, Vec *[], Vec *[], Vec *);
299: PETSC_EXTERN PetscErrorCode TSComputeSNESJacobian(TS, Vec, Mat, Mat);
301: /*S
302: TSTrajectory - Abstract PETSc object that stores the trajectory (solution of ODE/DAE at each time step)
304: Level: advanced
306: .seealso: [](ch_ts), `TS`, `TSSetSaveTrajectory()`, `TSTrajectoryCreate()`, `TSTrajectorySetType()`, `TSTrajectoryDestroy()`, `TSTrajectoryReset()`
307: S*/
308: typedef struct _p_TSTrajectory *TSTrajectory;
310: /*J
311: TSTrajectoryType - String with the name of a PETSc `TS` trajectory storage method
313: Level: intermediate
315: .seealso: [](ch_ts), `TS`, `TSSetSaveTrajectory()`, `TSTrajectoryCreate()`, `TSTrajectoryDestroy()`
316: J*/
317: typedef const char *TSTrajectoryType;
318: #define TSTRAJECTORYBASIC "basic"
319: #define TSTRAJECTORYSINGLEFILE "singlefile"
320: #define TSTRAJECTORYMEMORY "memory"
321: #define TSTRAJECTORYVISUALIZATION "visualization"
323: PETSC_EXTERN PetscFunctionList TSTrajectoryList;
324: PETSC_EXTERN PetscClassId TSTRAJECTORY_CLASSID;
325: PETSC_EXTERN PetscBool TSTrajectoryRegisterAllCalled;
327: PETSC_EXTERN PetscErrorCode TSSetSaveTrajectory(TS);
328: PETSC_EXTERN PetscErrorCode TSResetTrajectory(TS);
329: PETSC_EXTERN PetscErrorCode TSRemoveTrajectory(TS);
331: PETSC_EXTERN PetscErrorCode TSTrajectoryCreate(MPI_Comm, TSTrajectory *);
332: PETSC_EXTERN PetscErrorCode TSTrajectoryReset(TSTrajectory);
333: PETSC_EXTERN PetscErrorCode TSTrajectoryDestroy(TSTrajectory *);
334: PETSC_EXTERN PetscErrorCode TSTrajectoryView(TSTrajectory, PetscViewer);
335: PETSC_EXTERN PetscErrorCode TSTrajectorySetType(TSTrajectory, TS, TSTrajectoryType);
336: PETSC_EXTERN PetscErrorCode TSTrajectoryGetType(TSTrajectory, TS, TSTrajectoryType *);
337: PETSC_EXTERN PetscErrorCode TSTrajectorySet(TSTrajectory, TS, PetscInt, PetscReal, Vec);
338: PETSC_EXTERN PetscErrorCode TSTrajectoryGet(TSTrajectory, TS, PetscInt, PetscReal *);
339: PETSC_EXTERN PetscErrorCode TSTrajectoryGetVecs(TSTrajectory, TS, PetscInt, PetscReal *, Vec, Vec);
340: PETSC_EXTERN PetscErrorCode TSTrajectoryGetUpdatedHistoryVecs(TSTrajectory, TS, PetscReal, Vec *, Vec *);
341: PETSC_EXTERN PetscErrorCode TSTrajectoryGetNumSteps(TSTrajectory, PetscInt *);
342: PETSC_EXTERN PetscErrorCode TSTrajectoryRestoreUpdatedHistoryVecs(TSTrajectory, Vec *, Vec *);
343: PETSC_EXTERN PetscErrorCode TSTrajectorySetFromOptions(TSTrajectory, TS);
344: PETSC_EXTERN PetscErrorCode TSTrajectoryRegister(const char[], PetscErrorCode (*)(TSTrajectory, TS));
345: PETSC_EXTERN PetscErrorCode TSTrajectoryRegisterAll(void);
346: PETSC_EXTERN PetscErrorCode TSTrajectorySetUp(TSTrajectory, TS);
347: PETSC_EXTERN PetscErrorCode TSTrajectorySetUseHistory(TSTrajectory, PetscBool);
348: PETSC_EXTERN PetscErrorCode TSTrajectorySetMonitor(TSTrajectory, PetscBool);
349: PETSC_EXTERN PetscErrorCode TSTrajectorySetVariableNames(TSTrajectory, const char *const *);
350: PETSC_EXTERN PetscErrorCode TSTrajectorySetTransform(TSTrajectory, PetscErrorCode (*)(PetscCtx, Vec, Vec *), PetscCtxDestroyFn *, PetscCtx);
351: PETSC_EXTERN PetscErrorCode TSTrajectorySetSolutionOnly(TSTrajectory, PetscBool);
352: PETSC_EXTERN PetscErrorCode TSTrajectoryGetSolutionOnly(TSTrajectory, PetscBool *);
353: PETSC_EXTERN PetscErrorCode TSTrajectorySetKeepFiles(TSTrajectory, PetscBool);
354: PETSC_EXTERN PetscErrorCode TSTrajectorySetDirname(TSTrajectory, const char[]);
355: PETSC_EXTERN PetscErrorCode TSTrajectorySetFiletemplate(TSTrajectory, const char[]);
356: PETSC_EXTERN PetscErrorCode TSGetTrajectory(TS, TSTrajectory *);
358: /*E
359: TSTrajectoryMemoryType - Selects the in-memory checkpointing scheme used by `TSTRAJECTORYMEMORY` to store the forward states needed for an adjoint or sensitivity computation
361: Values:
362: + `TJ_REVOLVE` - the Revolve binomial checkpointing schedule of Griewank & Walther
363: . `TJ_CAMS` - the CAMS (cache-aware multistage) checkpointing schedule
364: - `TJ_PETSC` - PETSc's own in-memory checkpointing implementation
366: Level: advanced
368: .seealso: `TSTrajectory`, `TSTRAJECTORYMEMORY`, `TSTrajectoryMemorySetType()`, `TSSetSaveTrajectory()`
369: E*/
370: typedef enum {
371: TJ_REVOLVE,
372: TJ_CAMS,
373: TJ_PETSC
374: } TSTrajectoryMemoryType;
375: PETSC_EXTERN const char *const TSTrajectoryMemoryTypes[];
377: PETSC_EXTERN PetscErrorCode TSTrajectoryMemorySetType(TSTrajectory, TSTrajectoryMemoryType);
378: PETSC_EXTERN PetscErrorCode TSTrajectorySetMaxCpsRAM(TSTrajectory, PetscInt);
379: PETSC_EXTERN PetscErrorCode TSTrajectorySetMaxCpsDisk(TSTrajectory, PetscInt);
380: PETSC_EXTERN PetscErrorCode TSTrajectorySetMaxUnitsRAM(TSTrajectory, PetscInt);
381: PETSC_EXTERN PetscErrorCode TSTrajectorySetMaxUnitsDisk(TSTrajectory, PetscInt);
383: PETSC_EXTERN PetscErrorCode TSSetCostGradients(TS, PetscInt, Vec[], Vec[]);
384: PETSC_EXTERN PetscErrorCode TSGetCostGradients(TS, PetscInt *, Vec *[], Vec *[]);
385: PETSC_EXTERN PETSC_DEPRECATED_FUNCTION(3, 12, 0, "TSCreateQuadratureTS() and TSForwardSetSensitivities()", ) PetscErrorCode TSSetCostIntegrand(TS, PetscInt, Vec, PetscErrorCode (*)(TS, PetscReal, Vec, Vec, PetscCtx), PetscErrorCode (*)(TS, PetscReal, Vec, Vec *, PetscCtx), PetscErrorCode (*)(TS, PetscReal, Vec, Vec *, PetscCtx), PetscBool, PetscCtx);
386: PETSC_EXTERN PetscErrorCode TSGetCostIntegral(TS, Vec *);
387: PETSC_EXTERN PetscErrorCode TSComputeCostIntegrand(TS, PetscReal, Vec, Vec);
388: PETSC_EXTERN PetscErrorCode TSCreateQuadratureTS(TS, PetscBool, TS *);
389: PETSC_EXTERN PetscErrorCode TSGetQuadratureTS(TS, PetscBool *, TS *);
391: PETSC_EXTERN PetscErrorCode TSAdjointSetFromOptions(TS, PetscOptionItems);
392: PETSC_EXTERN PetscErrorCode TSAdjointMonitor(TS, PetscInt, PetscReal, Vec, PetscInt, Vec[], Vec[]);
393: PETSC_EXTERN PetscErrorCode TSAdjointMonitorSet(TS, PetscErrorCode (*)(TS, PetscInt, PetscReal, Vec, PetscInt, Vec *, Vec *, PetscCtx), PetscCtx, PetscCtxDestroyFn *);
394: PETSC_EXTERN PetscErrorCode TSAdjointMonitorCancel(TS);
395: PETSC_EXTERN PetscErrorCode TSAdjointMonitorSetFromOptions(TS, const char[], const char[], const char[], PetscErrorCode (*)(TS, PetscInt, PetscReal, Vec, PetscInt, Vec *, Vec *, PetscViewerAndFormat *), PetscErrorCode (*)(TS, PetscViewerAndFormat *));
397: PETSC_EXTERN PETSC_DEPRECATED_FUNCTION(3, 5, 0, "TSSetRHSJacobianP()", ) PetscErrorCode TSAdjointSetRHSJacobian(TS, Mat, PetscErrorCode (*)(TS, PetscReal, Vec, Mat, PetscCtx), PetscCtx);
398: PETSC_EXTERN PETSC_DEPRECATED_FUNCTION(3, 5, 0, "TSComputeRHSJacobianP()", ) PetscErrorCode TSAdjointComputeRHSJacobian(TS, PetscReal, Vec, Mat);
399: PETSC_EXTERN PETSC_DEPRECATED_FUNCTION(3, 5, 0, "TSGetQuadratureTS()", ) PetscErrorCode TSAdjointComputeDRDPFunction(TS, PetscReal, Vec, Vec *);
400: PETSC_EXTERN PETSC_DEPRECATED_FUNCTION(3, 5, 0, "TSGetQuadratureTS()", ) PetscErrorCode TSAdjointComputeDRDYFunction(TS, PetscReal, Vec, Vec *);
401: PETSC_EXTERN PetscErrorCode TSAdjointSolve(TS);
402: PETSC_EXTERN PetscErrorCode TSAdjointSetSteps(TS, PetscInt);
404: PETSC_EXTERN PetscErrorCode TSAdjointStep(TS);
405: PETSC_EXTERN PetscErrorCode TSAdjointSetUp(TS);
406: PETSC_EXTERN PetscErrorCode TSAdjointReset(TS);
407: PETSC_EXTERN PetscErrorCode TSAdjointCostIntegral(TS);
408: PETSC_EXTERN PetscErrorCode TSAdjointSetForward(TS, Mat);
409: PETSC_EXTERN PetscErrorCode TSAdjointResetForward(TS);
411: PETSC_EXTERN PetscErrorCode TSForwardSetSensitivities(TS, PetscInt, Mat);
412: PETSC_EXTERN PetscErrorCode TSForwardGetSensitivities(TS, PetscInt *, Mat *);
413: PETSC_EXTERN PETSC_DEPRECATED_FUNCTION(3, 12, 0, "TSCreateQuadratureTS()", ) PetscErrorCode TSForwardSetIntegralGradients(TS, PetscInt, Vec[]);
414: PETSC_EXTERN PETSC_DEPRECATED_FUNCTION(3, 12, 0, "TSForwardGetSensitivities()", ) PetscErrorCode TSForwardGetIntegralGradients(TS, PetscInt *, Vec *[]);
415: PETSC_EXTERN PetscErrorCode TSForwardSetUp(TS);
416: PETSC_EXTERN PetscErrorCode TSForwardReset(TS);
417: PETSC_EXTERN PetscErrorCode TSForwardCostIntegral(TS);
418: PETSC_EXTERN PetscErrorCode TSForwardStep(TS);
419: PETSC_EXTERN PetscErrorCode TSForwardSetInitialSensitivities(TS, Mat);
420: PETSC_EXTERN PetscErrorCode TSForwardGetStages(TS, PetscInt *, Mat *[]);
422: PETSC_EXTERN PetscErrorCode TSSetMaxSteps(TS, PetscInt);
423: PETSC_EXTERN PetscErrorCode TSGetMaxSteps(TS, PetscInt *);
424: PETSC_EXTERN PetscErrorCode TSSetRunSteps(TS, PetscInt);
425: PETSC_EXTERN PetscErrorCode TSGetRunSteps(TS, PetscInt *);
426: PETSC_EXTERN PetscErrorCode TSSetMaxTime(TS, PetscReal);
427: PETSC_EXTERN PetscErrorCode TSGetMaxTime(TS, PetscReal *);
428: PETSC_EXTERN PetscErrorCode TSSetExactFinalTime(TS, TSExactFinalTimeOption);
429: PETSC_EXTERN PetscErrorCode TSGetExactFinalTime(TS, TSExactFinalTimeOption *);
430: PETSC_EXTERN PetscErrorCode TSSetEvaluationTimes(TS, PetscInt, PetscReal[]);
431: PETSC_EXTERN PetscErrorCode TSGetEvaluationTimes(TS, PetscInt *, const PetscReal *[]);
432: PETSC_EXTERN PetscErrorCode TSGetEvaluationSolutions(TS, PetscInt *, const PetscReal *[], Vec *[]);
433: PETSC_EXTERN PetscErrorCode TSSetTimeSpan(TS, PetscInt, PetscReal[]);
435: /*@
436: TSGetTimeSpan - gets the time span set with `TSSetTimeSpan()`
438: Not Collective
440: Input Parameter:
441: . ts - the time-stepper
443: Output Parameters:
444: + n - number of the time points (>=2)
445: - span_times - array of the time points. The first element and the last element are the initial time and the final time respectively.
447: Level: deprecated
449: Note:
450: Deprecated, use `TSGetEvaluationTimes()`.
452: The values obtained are valid until the `TS` object is destroyed.
454: Both `n` and `span_times` can be `NULL`.
456: .seealso: [](ch_ts), `TS`, `TSGetEvaluationTimes()`, `TSSetTimeSpan()`, `TSSetEvaluationTimes()`, `TSGetEvaluationSolutions()`
457: @*/
458: PETSC_DEPRECATED_FUNCTION(3, 23, 0, "TSGetEvaluationTimes()", ) static inline PetscErrorCode TSGetTimeSpan(TS ts, PetscInt *n, const PetscReal *span_times[])
459: {
460: return TSGetEvaluationTimes(ts, n, span_times);
461: }
463: /*@
464: TSGetTimeSpanSolutions - Get the number of solutions and the solutions at the time points specified by the time span.
466: Not Collective
468: Input Parameter:
469: . ts - the `TS` context obtained from `TSCreate()`
471: Output Parameters:
472: + nsol - the number of solutions
473: - Sols - the solution vectors
475: Level: deprecated
477: Notes:
478: Deprecated, use `TSGetEvaluationSolutions()`.
480: Both `nsol` and `Sols` can be `NULL`.
482: Some time points in the time span may be skipped by `TS` so that `nsol` is less than the number of points specified by `TSSetTimeSpan()`.
483: For example, manipulating the step size, especially with a reduced precision, may cause `TS` to step over certain points in the span.
484: This issue is alleviated in `TSGetEvaluationSolutions()` by returning the solution times that `Sols` were recorded at.
486: .seealso: [](ch_ts), `TS`, `TSGetEvaluationSolutions()`, `TSSetTimeSpan()`, `TSGetEvaluationTimes()`, `TSSetEvaluationTimes()`
487: @*/
488: PETSC_DEPRECATED_FUNCTION(3, 23, 0, "TSGetEvaluationSolutions()", ) static inline PetscErrorCode TSGetTimeSpanSolutions(TS ts, PetscInt *nsol, Vec **Sols)
489: {
490: return TSGetEvaluationSolutions(ts, nsol, NULL, Sols);
491: }
493: PETSC_EXTERN PETSC_DEPRECATED_FUNCTION(3, 8, 0, "TSSetTime()", ) PetscErrorCode TSSetInitialTimeStep(TS, PetscReal, PetscReal);
494: PETSC_EXTERN PETSC_DEPRECATED_FUNCTION(3, 8, 0, "TSSetMax()", ) PetscErrorCode TSSetDuration(TS, PetscInt, PetscReal);
495: PETSC_EXTERN PETSC_DEPRECATED_FUNCTION(3, 8, 0, "TSGetMax()", ) PetscErrorCode TSGetDuration(TS, PetscInt *, PetscReal *);
496: PETSC_EXTERN PETSC_DEPRECATED_FUNCTION(3, 8, 0, "TSGetStepNumber()", ) PetscErrorCode TSGetTimeStepNumber(TS, PetscInt *);
497: PETSC_EXTERN PETSC_DEPRECATED_FUNCTION(3, 8, 0, "TSGetStepNumber()", ) PetscErrorCode TSGetTotalSteps(TS, PetscInt *);
499: PETSC_EXTERN PetscErrorCode TSMonitorDefault(TS, PetscInt, PetscReal, Vec, PetscViewerAndFormat *);
500: PETSC_EXTERN PetscErrorCode TSMonitorWallClockTime(TS, PetscInt, PetscReal, Vec, PetscViewerAndFormat *);
501: PETSC_EXTERN PetscErrorCode TSMonitorWallClockTimeSetUp(TS, PetscViewerAndFormat *);
502: PETSC_EXTERN PetscErrorCode TSMonitorExtreme(TS, PetscInt, PetscReal, Vec, PetscViewerAndFormat *);
504: /*S
505: TSMonitorDrawCtx - Context object for the `TS` graphical monitor routines that draw the solution, phase plot or error using a `PetscDraw`
507: Level: developer
509: .seealso: `TS`, `TSMonitorDrawCtxCreate()`, `TSMonitorDrawCtxDestroy()`, `TSMonitorDrawSolution()`, `TSMonitorDrawSolutionPhase()`, `TSMonitorDrawError()`, `TSMonitorDrawSolutionFunction()`
510: S*/
511: typedef struct _n_TSMonitorDrawCtx *TSMonitorDrawCtx;
512: PETSC_EXTERN PetscErrorCode TSMonitorDrawCtxCreate(MPI_Comm, const char[], const char[], int, int, int, int, PetscInt, TSMonitorDrawCtx *);
513: PETSC_EXTERN PetscErrorCode TSMonitorDrawCtxDestroy(TSMonitorDrawCtx *);
514: PETSC_EXTERN PetscErrorCode TSMonitorDrawSolution(TS, PetscInt, PetscReal, Vec, PetscCtx);
515: PETSC_EXTERN PetscErrorCode TSMonitorDrawSolutionPhase(TS, PetscInt, PetscReal, Vec, PetscCtx);
516: PETSC_EXTERN PetscErrorCode TSMonitorDrawError(TS, PetscInt, PetscReal, Vec, PetscCtx);
517: PETSC_EXTERN PetscErrorCode TSMonitorDrawSolutionFunction(TS, PetscInt, PetscReal, Vec, PetscCtx);
519: PETSC_EXTERN PetscErrorCode TSAdjointMonitorDefault(TS, PetscInt, PetscReal, Vec, PetscInt, Vec[], Vec[], PetscViewerAndFormat *);
520: PETSC_EXTERN PetscErrorCode TSAdjointMonitorDrawSensi(TS, PetscInt, PetscReal, Vec, PetscInt, Vec[], Vec[], PetscCtx);
522: /*S
523: TSMonitorSolutionCtx - Context object for the `TS` `TSMonitorSolution()` monitor that views the solution at each time step using a `PetscViewer`
525: Level: developer
527: .seealso: `TS`, `TSMonitorSet()`, `TSMonitorSolution()`, `TSMonitorSolutionSetup()`
528: S*/
529: typedef struct _n_TSMonitorSolutionCtx *TSMonitorSolutionCtx;
530: PETSC_EXTERN PetscErrorCode TSMonitorSolution(TS, PetscInt, PetscReal, Vec, PetscViewerAndFormat *);
531: PETSC_EXTERN PetscErrorCode TSMonitorSolutionSetup(TS, PetscViewerAndFormat *);
533: /*S
534: TSMonitorVTKCtx - Context object for the `TS` `TSMonitorSolutionVTK()` monitor that dumps the solution to VTK files at each time step
536: Level: developer
538: .seealso: `TS`, `TSMonitorSet()`, `TSMonitorSolutionVTK()`, `TSMonitorSolutionVTKCtxCreate()`, `TSMonitorSolutionVTKDestroy()`
539: S*/
540: typedef struct _n_TSMonitorVTKCtx *TSMonitorVTKCtx;
541: PETSC_EXTERN PetscErrorCode TSMonitorSolutionVTK(TS, PetscInt, PetscReal, Vec, TSMonitorVTKCtx);
542: PETSC_EXTERN PetscErrorCode TSMonitorSolutionVTKDestroy(TSMonitorVTKCtx *);
543: PETSC_EXTERN PetscErrorCode TSMonitorSolutionVTKCtxCreate(const char *, TSMonitorVTKCtx *);
545: PETSC_EXTERN PetscErrorCode TSStep(TS);
546: PETSC_EXTERN PetscErrorCode TSEvaluateWLTE(TS, NormType, PetscInt *, PetscReal *);
547: PETSC_EXTERN PetscErrorCode TSEvaluateStep(TS, PetscInt, Vec, PetscBool *);
548: PETSC_EXTERN PetscErrorCode TSSolve(TS, Vec);
549: PETSC_EXTERN PetscErrorCode TSGetEquationType(TS, TSEquationType *);
550: PETSC_EXTERN PetscErrorCode TSSetEquationType(TS, TSEquationType);
551: PETSC_EXTERN PetscErrorCode TSGetConvergedReason(TS, TSConvergedReason *);
552: PETSC_EXTERN PetscErrorCode TSSetConvergedReason(TS, TSConvergedReason);
553: PETSC_EXTERN PetscErrorCode TSGetSolveTime(TS, PetscReal *);
554: PETSC_EXTERN PetscErrorCode TSGetSNESIterations(TS, PetscInt *);
555: PETSC_EXTERN PetscErrorCode TSGetKSPIterations(TS, PetscInt *);
556: PETSC_EXTERN PetscErrorCode TSGetStepRejections(TS, PetscInt *);
557: PETSC_EXTERN PetscErrorCode TSSetMaxStepRejections(TS, PetscInt);
558: PETSC_EXTERN PetscErrorCode TSGetSNESFailures(TS, PetscInt *);
559: PETSC_EXTERN PetscErrorCode TSSetMaxSNESFailures(TS, PetscInt);
560: PETSC_EXTERN PetscErrorCode TSSetErrorIfStepFails(TS, PetscBool);
561: PETSC_EXTERN PetscErrorCode TSRestartStep(TS);
562: PETSC_EXTERN PetscErrorCode TSRollBack(TS);
563: PETSC_EXTERN PetscErrorCode TSGetStepRollBack(TS, PetscBool *);
565: PETSC_EXTERN PetscErrorCode TSGetStages(TS, PetscInt *, Vec *[]);
567: PETSC_EXTERN PetscErrorCode TSGetTime(TS, PetscReal *);
568: PETSC_EXTERN PetscErrorCode TSSetTime(TS, PetscReal);
569: PETSC_EXTERN PetscErrorCode TSGetPrevTime(TS, PetscReal *);
570: PETSC_EXTERN PetscErrorCode TSGetTimeStep(TS, PetscReal *);
571: PETSC_EXTERN PetscErrorCode TSSetTimeStep(TS, PetscReal);
572: PETSC_EXTERN PetscErrorCode TSGetStepNumber(TS, PetscInt *);
573: PETSC_EXTERN PetscErrorCode TSSetStepNumber(TS, PetscInt);
575: /*S
576: TSRHSFunctionFn - A prototype of a `TS` right-hand-side evaluation function that would be passed to `TSSetRHSFunction()`
578: Calling Sequence:
579: + ts - timestep context
580: . t - current time
581: . u - input vector
582: . F - function vector
583: - ctx - [optional] user-defined function context
585: Level: beginner
587: .seealso: [](ch_ts), `TS`, `TSSetRHSFunction()`, `DMTSSetRHSFunction()`, `TSIFunctionFn`,
588: `TSIJacobianFn`, `TSRHSJacobianFn`
589: S*/
590: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode TSRHSFunctionFn(TS ts, PetscReal t, Vec u, Vec F, PetscCtx ctx);
592: PETSC_EXTERN_TYPEDEF typedef TSRHSFunctionFn *TSRHSFunction PETSC_DEPRECATED_TYPEDEF(3, 26, 0, "TSRHSFunctionFn*", );
594: /*S
595: TSRHSJacobianFn - A prototype of a `TS` right-hand-side Jacobian evaluation function that would be passed to `TSSetRHSJacobian()`
597: Calling Sequence:
598: + ts - the `TS` context obtained from `TSCreate()`
599: . t - current time
600: . u - input vector
601: . Amat - (approximate) Jacobian matrix
602: . Pmat - matrix from which preconditioner is to be constructed (usually the same as `Amat`)
603: - ctx - [optional] user-defined context for matrix evaluation routine
605: Level: beginner
607: .seealso: [](ch_ts), `TS`, `TSSetRHSJacobian()`, `DMTSSetRHSJacobian()`, `TSRHSFunctionFn`,
608: `TSIFunctionFn`, `TSIJacobianFn`
609: S*/
610: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode TSRHSJacobianFn(TS ts, PetscReal t, Vec u, Mat Amat, Mat Pmat, PetscCtx ctx);
612: PETSC_EXTERN_TYPEDEF typedef TSRHSJacobianFn *TSRHSJacobian PETSC_DEPRECATED_TYPEDEF(3, 26, 0, "TSRHSJacobianFn*", );
614: /*S
615: TSRHSJacobianPFn - A prototype of a function that computes the Jacobian of G w.r.t. the parameters P where
616: U_t = G(U,P,t), as well as the location to store the matrix that would be passed to `TSSetRHSJacobianP()`
618: Calling Sequence:
619: + ts - the `TS` context
620: . t - current timestep
621: . U - input vector (current ODE solution)
622: . A - output matrix
623: - ctx - [optional] user-defined function context
625: Level: beginner
627: .seealso: [](ch_ts), `TS`, `TSSetRHSJacobianP()`, `TSGetRHSJacobianP()`
628: S*/
629: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode TSRHSJacobianPFn(TS ts, PetscReal t, Vec U, Mat A, PetscCtx ctx);
631: PETSC_EXTERN_TYPEDEF typedef TSRHSJacobianPFn *TSRHSJacobianP PETSC_DEPRECATED_TYPEDEF(3, 26, 0, "TSRHSJacobianPFn*", );
633: PETSC_EXTERN PetscErrorCode TSSetRHSFunction(TS, Vec, TSRHSFunctionFn *, PetscCtx);
634: PETSC_EXTERN PetscErrorCode TSGetRHSFunction(TS, Vec *, TSRHSFunctionFn **, PetscCtxRt);
635: PETSC_EXTERN PetscErrorCode TSSetRHSJacobian(TS, Mat, Mat, TSRHSJacobianFn *, PetscCtx);
636: PETSC_EXTERN PetscErrorCode TSGetRHSJacobian(TS, Mat *, Mat *, TSRHSJacobianFn **, PetscCtxRt);
637: PETSC_EXTERN PetscErrorCode TSRHSJacobianSetReuse(TS, PetscBool);
639: /*S
640: TSSolutionFn - A prototype of a `TS` solution evaluation function that would be passed to `TSSetSolutionFunction()`
642: Calling Sequence:
643: + ts - timestep context
644: . t - current time
645: . u - output vector
646: - ctx - [optional] user-defined function context
648: Level: advanced
650: .seealso: [](ch_ts), `TS`, `TSSetSolutionFunction()`, `DMTSSetSolutionFunction()`
651: S*/
652: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode TSSolutionFn(TS ts, PetscReal t, Vec u, PetscCtx ctx);
654: PETSC_EXTERN_TYPEDEF typedef TSSolutionFn *TSSolutionFunction PETSC_DEPRECATED_TYPEDEF(3, 26, 0, "TSSolutionFn*", );
656: PETSC_EXTERN PetscErrorCode TSSetSolutionFunction(TS, TSSolutionFn *, PetscCtx);
658: /*S
659: TSForcingFn - A prototype of a `TS` forcing function evaluation function that would be passed to `TSSetForcingFunction()`
661: Calling Sequence:
662: + ts - timestep context
663: . t - current time
664: . f - output vector
665: - ctx - [optional] user-defined function context
667: Level: advanced
669: .seealso: [](ch_ts), `TS`, `TSSetForcingFunction()`, `DMTSSetForcingFunction()`
670: S*/
671: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode TSForcingFn(TS ts, PetscReal t, Vec f, PetscCtx ctx);
673: PETSC_EXTERN_TYPEDEF typedef TSForcingFn *TSForcingFunction PETSC_DEPRECATED_TYPEDEF(3, 26, 0, "TSForcingFn*", );
675: PETSC_EXTERN PetscErrorCode TSSetForcingFunction(TS, TSForcingFn *, PetscCtx);
677: /*S
678: TSIFunctionFn - A prototype of a `TS` implicit function evaluation function that would be passed to `TSSetIFunction()
680: Calling Sequence:
681: + ts - the `TS` context obtained from `TSCreate()`
682: . t - time at step/stage being solved
683: . U - state vector
684: . U_t - time derivative of state vector
685: . F - function vector
686: - ctx - [optional] user-defined context for function
688: Level: beginner
690: .seealso: [](ch_ts), `TS`, `TSSetIFunction()`, `DMTSSetIFunction()`, `TSIJacobianFn`, `TSRHSFunctionFn`, `TSRHSJacobianFn`
691: S*/
692: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode TSIFunctionFn(TS ts, PetscReal t, Vec U, Vec U_t, Vec F, PetscCtx ctx);
694: PETSC_EXTERN_TYPEDEF typedef TSIFunctionFn *TSIFunction PETSC_DEPRECATED_TYPEDEF(3, 26, 0, "TSIFunctionFn*", );
696: /*S
697: TSIJacobianFn - A prototype of a `TS` Jacobian evaluation function that would be passed to `TSSetIJacobian()`
699: Calling Sequence:
700: + ts - the `TS` context obtained from `TSCreate()`
701: . t - time at step/stage being solved
702: . U - state vector
703: . U_t - time derivative of state vector
704: . a - shift
705: . Amat - (approximate) Jacobian of F(t,U,W+a*U), equivalent to dF/dU + a*dF/dU_t
706: . Pmat - matrix used for constructing preconditioner, usually the same as `Amat`
707: - ctx - [optional] user-defined context for Jacobian evaluation routine
709: Level: beginner
711: .seealso: [](ch_ts), `TSSetIJacobian()`, `DMTSSetIJacobian()`, `TSIFunctionFn`, `TSRHSFunctionFn`, `TSRHSJacobianFn`
712: S*/
713: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode TSIJacobianFn(TS ts, PetscReal t, Vec U, Vec U_t, PetscReal a, Mat Amat, Mat Pmat, PetscCtx ctx);
715: PETSC_EXTERN_TYPEDEF typedef TSIJacobianFn *TSIJacobian PETSC_DEPRECATED_TYPEDEF(3, 26, 0, "TSIJacobianFn*", );
717: PETSC_EXTERN PetscErrorCode TSSetIFunction(TS, Vec, TSIFunctionFn *, PetscCtx);
718: PETSC_EXTERN PetscErrorCode TSGetIFunction(TS, Vec *, TSIFunctionFn **, PetscCtxRt);
719: PETSC_EXTERN PetscErrorCode TSSetIJacobian(TS, Mat, Mat, TSIJacobianFn *, PetscCtx);
720: PETSC_EXTERN PetscErrorCode TSGetIJacobian(TS, Mat *, Mat *, TSIJacobianFn **, PetscCtxRt);
722: /*S
723: TSI2FunctionFn - A prototype of a `TS` implicit function evaluation function for 2nd order systems that would be passed to `TSSetI2Function()`
725: Calling Sequence:
726: + ts - the `TS` context obtained from `TSCreate()`
727: . t - time at step/stage being solved
728: . U - state vector
729: . U_t - time derivative of state vector
730: . U_tt - second time derivative of state vector
731: . F - function vector
732: - ctx - [optional] user-defined context for matrix evaluation routine (may be `NULL`)
734: Level: advanced
736: .seealso: [](ch_ts), `TS`, `TSSetI2Function()`, `DMTSSetI2Function()`, `TSIFunctionFn`
737: S*/
738: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode TSI2FunctionFn(TS ts, PetscReal t, Vec U, Vec U_t, Vec U_tt, Vec F, PetscCtx ctx);
740: PETSC_EXTERN_TYPEDEF typedef TSI2FunctionFn *TSI2Function PETSC_DEPRECATED_TYPEDEF(3, 26, 0, "TSI2FunctionFn*", );
742: /*S
743: TSI2JacobianFn - A prototype of a `TS` implicit Jacobian evaluation function for 2nd order systems that would be passed to `TSSetI2Jacobian()`
745: Calling Sequence:
746: + ts - the `TS` context obtained from `TSCreate()`
747: . t - time at step/stage being solved
748: . U - state vector
749: . U_t - time derivative of state vector
750: . U_tt - second time derivative of state vector
751: . v - shift for U_t
752: . a - shift for U_tt
753: . J - Jacobian of G(U) = F(t,U,W+v*U,W'+a*U), equivalent to dF/dU + v*dF/dU_t + a*dF/dU_tt
754: . jac - matrix from which to construct the preconditioner, may be same as `J`
755: - ctx - [optional] user-defined context for matrix evaluation routine
757: Level: advanced
759: .seealso: [](ch_ts), `TS`, `TSSetI2Jacobian()`, `DMTSSetI2Jacobian()`, `TSIFunctionFn`, `TSIJacobianFn`, `TSRHSFunctionFn`, `TSRHSJacobianFn`
760: S*/
761: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode TSI2JacobianFn(TS ts, PetscReal t, Vec U, Vec U_t, Vec U_tt, PetscReal v, PetscReal a, Mat J, Mat Jac, PetscCtx ctx);
763: PETSC_EXTERN_TYPEDEF typedef TSI2JacobianFn *TSI2Jacobian PETSC_DEPRECATED_TYPEDEF(3, 26, 0, "TSI2JacobianFn*", );
765: PETSC_EXTERN PetscErrorCode TSSetI2Function(TS, Vec, TSI2FunctionFn *, PetscCtx);
766: PETSC_EXTERN PetscErrorCode TSGetI2Function(TS, Vec *, TSI2FunctionFn **, PetscCtxRt);
767: PETSC_EXTERN PetscErrorCode TSSetI2Jacobian(TS, Mat, Mat, TSI2JacobianFn *, PetscCtx);
768: PETSC_EXTERN PetscErrorCode TSGetI2Jacobian(TS, Mat *, Mat *, TSI2JacobianFn **, PetscCtxRt);
770: PETSC_EXTERN PetscErrorCode TSRHSSplitSetIS(TS, const char[], IS);
771: PETSC_EXTERN PetscErrorCode TSRHSSplitGetIS(TS, const char[], IS *);
772: PETSC_EXTERN PetscErrorCode TSRHSSplitSetRHSFunction(TS, const char[], Vec, TSRHSFunctionFn *, PetscCtx);
773: PETSC_EXTERN PetscErrorCode TSRHSSplitSetIFunction(TS, const char[], Vec, TSIFunctionFn *, PetscCtx);
774: PETSC_EXTERN PetscErrorCode TSRHSSplitSetIJacobian(TS, const char[], Mat, Mat, TSIJacobianFn *, PetscCtx);
775: PETSC_EXTERN PetscErrorCode TSRHSSplitGetSubTS(TS, const char[], TS *);
776: PETSC_EXTERN PetscErrorCode TSRHSSplitGetSubTSs(TS, PetscInt *, TS *[]);
777: PETSC_EXTERN PetscErrorCode TSSetUseSplitRHSFunction(TS, PetscBool);
778: PETSC_EXTERN PetscErrorCode TSGetUseSplitRHSFunction(TS, PetscBool *);
779: PETSC_EXTERN PetscErrorCode TSRHSSplitGetSNES(TS, SNES *);
780: PETSC_EXTERN PetscErrorCode TSRHSSplitSetSNES(TS, SNES);
782: PETSC_EXTERN TSRHSFunctionFn TSComputeRHSFunctionLinear;
783: PETSC_EXTERN TSRHSJacobianFn TSComputeRHSJacobianConstant;
784: PETSC_EXTERN PetscErrorCode TSComputeIFunctionLinear(TS, PetscReal, Vec, Vec, Vec, PetscCtx);
785: PETSC_EXTERN PetscErrorCode TSComputeIJacobianConstant(TS, PetscReal, Vec, Vec, PetscReal, Mat, Mat, PetscCtx);
786: PETSC_EXTERN PetscErrorCode TSComputeSolutionFunction(TS, PetscReal, Vec);
787: PETSC_EXTERN PetscErrorCode TSComputeForcingFunction(TS, PetscReal, Vec);
788: PETSC_EXTERN PetscErrorCode TSComputeIJacobianDefaultColor(TS, PetscReal, Vec, Vec, PetscReal, Mat, Mat, PetscCtx);
789: PETSC_EXTERN PetscErrorCode TSPruneIJacobianColor(TS, Mat, Mat);
791: PETSC_EXTERN PetscErrorCode TSSetPreStep(TS, PetscErrorCode (*)(TS));
792: PETSC_EXTERN PetscErrorCode TSSetPreStage(TS, PetscErrorCode (*)(TS, PetscReal));
793: PETSC_EXTERN PetscErrorCode TSSetPostStage(TS, PetscErrorCode (*)(TS, PetscReal, PetscInt, Vec *));
794: PETSC_EXTERN PetscErrorCode TSSetPostEvaluate(TS, PetscErrorCode (*)(TS));
795: PETSC_EXTERN PetscErrorCode TSSetPostStep(TS, PetscErrorCode (*)(TS));
796: PETSC_EXTERN PetscErrorCode TSSetResize(TS, PetscBool, PetscErrorCode (*)(TS, PetscInt, PetscReal, Vec, PetscBool *, PetscCtx), PetscErrorCode (*)(TS, PetscInt, Vec[], Vec[], PetscCtx), PetscCtx);
797: PETSC_EXTERN PetscErrorCode TSPreStep(TS);
798: PETSC_EXTERN PetscErrorCode TSPreStage(TS, PetscReal);
799: PETSC_EXTERN PetscErrorCode TSPostStage(TS, PetscReal, PetscInt, Vec[]);
800: PETSC_EXTERN PetscErrorCode TSPostEvaluate(TS);
801: PETSC_EXTERN PetscErrorCode TSPostStep(TS);
802: PETSC_EXTERN PetscErrorCode TSResize(TS);
803: PETSC_EXTERN PetscErrorCode TSResizeRetrieveVec(TS, const char *, Vec *);
804: PETSC_EXTERN PetscErrorCode TSResizeRegisterVec(TS, const char *, Vec);
805: PETSC_EXTERN PetscErrorCode TSGetStepResize(TS, PetscBool *);
807: PETSC_EXTERN PetscErrorCode TSInterpolate(TS, PetscReal, Vec);
808: PETSC_EXTERN PetscErrorCode TSSetTolerances(TS, PetscReal, Vec, PetscReal, Vec);
809: PETSC_EXTERN PetscErrorCode TSGetTolerances(TS, PetscReal *, Vec *, PetscReal *, Vec *);
810: PETSC_EXTERN PetscErrorCode TSErrorWeightedNorm(TS, Vec, Vec, NormType, PetscReal *, PetscReal *, PetscReal *);
811: PETSC_EXTERN PetscErrorCode TSErrorWeightedENorm(TS, Vec, Vec, Vec, NormType, PetscReal *, PetscReal *, PetscReal *);
812: PETSC_EXTERN PetscErrorCode TSSetCFLTimeLocal(TS, PetscReal);
813: PETSC_EXTERN PetscErrorCode TSGetCFLTime(TS, PetscReal *);
814: PETSC_EXTERN PetscErrorCode TSSetFunctionDomainError(TS, PetscErrorCode (*)(TS, PetscReal, Vec, PetscBool *));
815: PETSC_EXTERN PetscErrorCode TSFunctionDomainError(TS, PetscReal, Vec, PetscBool *);
817: PETSC_EXTERN PetscErrorCode TSPseudoSetTimeStep(TS, PetscErrorCode (*)(TS, PetscReal *, PetscCtx), PetscCtx);
818: PETSC_EXTERN PetscErrorCode TSPseudoTimeStepDefault(TS, PetscReal *, PetscCtx);
819: PETSC_EXTERN PetscErrorCode TSPseudoSetMaxTimeStep(TS, PetscReal);
820: PETSC_EXTERN PetscErrorCode TSPseudoSetVerifyTimeStep(TS, PetscErrorCode (*)(TS, Vec, PetscCtx, PetscReal *, PetscBool *), PetscCtx);
821: PETSC_EXTERN PetscErrorCode TSPseudoSetTimeStepIncrement(TS, PetscReal);
822: PETSC_EXTERN PetscErrorCode TSPseudoIncrementDtFromInitialDt(TS);
823: PETSC_EXTERN PetscErrorCode TSPseudoComputeFunction(TS, Vec, Vec *, PetscReal *);
825: PETSC_EXTERN PetscErrorCode TSPythonSetType(TS, const char[]);
826: PETSC_EXTERN PetscErrorCode TSPythonGetType(TS, const char *[]);
828: PETSC_EXTERN PetscErrorCode TSComputeRHSFunction(TS, PetscReal, Vec, Vec);
829: PETSC_EXTERN PetscErrorCode TSComputeRHSJacobian(TS, PetscReal, Vec, Mat, Mat);
830: PETSC_EXTERN PetscErrorCode TSComputeIFunction(TS, PetscReal, Vec, Vec, Vec, PetscBool);
831: PETSC_EXTERN PetscErrorCode TSComputeIJacobian(TS, PetscReal, Vec, Vec, PetscReal, Mat, Mat, PetscBool);
832: PETSC_EXTERN PetscErrorCode TSComputeI2Function(TS, PetscReal, Vec, Vec, Vec, Vec);
833: PETSC_EXTERN PetscErrorCode TSComputeI2Jacobian(TS, PetscReal, Vec, Vec, Vec, PetscReal, PetscReal, Mat, Mat);
834: PETSC_EXTERN PetscErrorCode TSComputeLinearStability(TS, PetscReal, PetscReal, PetscReal *, PetscReal *);
836: PETSC_EXTERN PetscErrorCode TSVISetVariableBounds(TS, Vec, Vec);
838: PETSC_EXTERN PetscErrorCode DMTSSetBoundaryLocal(DM, PetscErrorCode (*)(DM, PetscReal, Vec, Vec, PetscCtx), PetscCtx);
839: PETSC_EXTERN PetscErrorCode DMTSSetIFunctionPre(DM, PetscErrorCode (*)(DM, PetscReal, Vec, Vec, PetscCtx), PetscCtx);
840: PETSC_EXTERN PetscErrorCode DMTSSetRHSFunction(DM, TSRHSFunctionFn *, PetscCtx);
841: PETSC_EXTERN PetscErrorCode DMTSGetRHSFunction(DM, TSRHSFunctionFn **, PetscCtxRt);
842: PETSC_EXTERN PetscErrorCode DMTSSetRHSFunctionContextDestroy(DM, PetscCtxDestroyFn *);
843: PETSC_EXTERN PetscErrorCode DMTSSetRHSJacobian(DM, TSRHSJacobianFn *, PetscCtx);
844: PETSC_EXTERN PetscErrorCode DMTSGetRHSJacobian(DM, TSRHSJacobianFn **, PetscCtxRt);
845: PETSC_EXTERN PetscErrorCode DMTSSetRHSJacobianContextDestroy(DM, PetscCtxDestroyFn *);
846: PETSC_EXTERN PetscErrorCode DMTSSetIFunction(DM, TSIFunctionFn *, PetscCtx);
847: PETSC_EXTERN PetscErrorCode DMTSGetIFunction(DM, TSIFunctionFn **, PetscCtxRt);
848: PETSC_EXTERN PetscErrorCode DMTSSetIFunctionContextDestroy(DM, PetscCtxDestroyFn *);
849: PETSC_EXTERN PetscErrorCode DMTSSetIJacobian(DM, TSIJacobianFn *, PetscCtx);
850: PETSC_EXTERN PetscErrorCode DMTSGetIJacobian(DM, TSIJacobianFn **, PetscCtxRt);
851: PETSC_EXTERN PetscErrorCode DMTSSetIJacobianContextDestroy(DM, PetscCtxDestroyFn *);
852: PETSC_EXTERN PetscErrorCode DMTSSetI2Function(DM, TSI2FunctionFn *, PetscCtx);
853: PETSC_EXTERN PetscErrorCode DMTSGetI2Function(DM, TSI2FunctionFn **, PetscCtxRt);
854: PETSC_EXTERN PetscErrorCode DMTSSetI2FunctionContextDestroy(DM, PetscCtxDestroyFn *);
855: PETSC_EXTERN PetscErrorCode DMTSSetI2Jacobian(DM, TSI2JacobianFn *, PetscCtx);
856: PETSC_EXTERN PetscErrorCode DMTSGetI2Jacobian(DM, TSI2JacobianFn **, PetscCtxRt);
857: PETSC_EXTERN PetscErrorCode DMTSSetI2JacobianContextDestroy(DM, PetscCtxDestroyFn *);
859: /*S
860: TSTransientVariableFn - A prototype of a function to transform from state to transient variables that would be passed to `TSSetTransientVariable()`
862: Calling Sequence:
863: + ts - timestep context
864: . p - input vector (primitive form)
865: . c - output vector, transient variables (conservative form)
866: - ctx - [optional] user-defined function context
868: Level: advanced
870: .seealso: [](ch_ts), `TS`, `TSSetTransientVariable()`, `DMTSSetTransientVariable()`
871: S*/
872: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode TSTransientVariableFn(TS ts, Vec p, Vec c, PetscCtx ctx);
874: PETSC_EXTERN_TYPEDEF typedef TSTransientVariableFn *TSTransientVariable PETSC_DEPRECATED_TYPEDEF(3, 26, 0, "TSTransientVariableFn*", );
876: PETSC_EXTERN PetscErrorCode TSSetTransientVariable(TS, TSTransientVariableFn *, PetscCtx);
877: PETSC_EXTERN PetscErrorCode DMTSSetTransientVariable(DM, TSTransientVariableFn *, PetscCtx);
878: PETSC_EXTERN PetscErrorCode DMTSGetTransientVariable(DM, TSTransientVariableFn **, PetscCtx);
879: PETSC_EXTERN PetscErrorCode TSComputeTransientVariable(TS, Vec, Vec);
880: PETSC_EXTERN PetscErrorCode TSHasTransientVariable(TS, PetscBool *);
882: PETSC_EXTERN PetscErrorCode DMTSSetSolutionFunction(DM, TSSolutionFn *, PetscCtx);
883: PETSC_EXTERN PetscErrorCode DMTSGetSolutionFunction(DM, TSSolutionFn **, PetscCtxRt);
884: PETSC_EXTERN PetscErrorCode DMTSSetForcingFunction(DM, TSForcingFn *, PetscCtx);
885: PETSC_EXTERN PetscErrorCode DMTSGetForcingFunction(DM, TSForcingFn **, PetscCtxRt);
886: PETSC_EXTERN PetscErrorCode DMTSCheckResidual(TS, DM, PetscReal, Vec, Vec, PetscReal, PetscReal *);
887: PETSC_EXTERN PetscErrorCode DMTSCheckJacobian(TS, DM, PetscReal, Vec, Vec, PetscReal, PetscBool *, PetscReal *);
888: PETSC_EXTERN PetscErrorCode DMTSCheckFromOptions(TS, Vec);
890: PETSC_EXTERN PetscErrorCode DMTSGetIFunctionLocal(DM, PetscErrorCode (**)(DM, PetscReal, Vec, Vec, Vec, PetscCtx), PetscCtxRt);
891: PETSC_EXTERN PetscErrorCode DMTSSetIFunctionLocal(DM, PetscErrorCode (*)(DM, PetscReal, Vec, Vec, Vec, PetscCtx), PetscCtx);
892: PETSC_EXTERN PetscErrorCode DMTSGetIJacobianLocal(DM, PetscErrorCode (**)(DM, PetscReal, Vec, Vec, PetscReal, Mat, Mat, PetscCtx), PetscCtxRt);
893: PETSC_EXTERN PetscErrorCode DMTSSetIJacobianLocal(DM, PetscErrorCode (*)(DM, PetscReal, Vec, Vec, PetscReal, Mat, Mat, PetscCtx), PetscCtx);
894: PETSC_EXTERN PetscErrorCode DMTSGetRHSFunctionLocal(DM, PetscErrorCode (**)(DM, PetscReal, Vec, Vec, PetscCtx), PetscCtxRt);
895: PETSC_EXTERN PetscErrorCode DMTSSetRHSFunctionLocal(DM, PetscErrorCode (*)(DM, PetscReal, Vec, Vec, PetscCtx), PetscCtx);
896: PETSC_EXTERN PetscErrorCode DMTSCreateRHSMassMatrix(DM);
897: PETSC_EXTERN PetscErrorCode DMTSCreateRHSMassMatrixLumped(DM);
898: PETSC_EXTERN PetscErrorCode DMTSDestroyRHSMassMatrix(DM);
900: PETSC_EXTERN PetscErrorCode DMTSSetIFunctionSerialize(DM, PetscErrorCode (*)(PetscCtx, PetscViewer), PetscErrorCode (*)(PetscCtx *, PetscViewer));
901: PETSC_EXTERN PetscErrorCode DMTSSetIJacobianSerialize(DM, PetscErrorCode (*)(PetscCtx, PetscViewer), PetscErrorCode (*)(PetscCtx *, PetscViewer));
903: /*S
904: DMDATSRHSFunctionLocalFn - A prototype of a local `TS` right-hand side residual evaluation function for use with `DMDA` that would be passed to `DMDATSSetRHSFunctionLocal()`
906: Calling Sequence:
907: + info - defines the subdomain to evaluate the residual on
908: . t - time at which to evaluate residual
909: . x - array of local state information
910: . f - output array of local residual information
911: - ctx - optional application context
913: Level: beginner
915: .seealso: `DMDA`, `DMDATSSetRHSFunctionLocal()`, `TSRHSFunctionFn`, `DMDATSRHSJacobianLocalFn`, `DMDATSIJacobianLocalFn`, `DMDATSIFunctionLocalFn`
916: S*/
917: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode DMDATSRHSFunctionLocalFn(DMDALocalInfo *info, PetscReal t, void *x, void *f, PetscCtx ctx);
919: PETSC_EXTERN_TYPEDEF typedef DMDATSRHSFunctionLocalFn *DMDATSRHSFunctionLocal PETSC_DEPRECATED_TYPEDEF(3, 26, 0, "DMDATSRHSFunctionLocalFn*", );
921: /*S
922: DMDATSRHSJacobianLocalFn - A prototype of a local residual evaluation function for use with `DMDA` that would be passed to `DMDATSSetRHSJacobianLocal()`
924: Calling Sequence:
925: + info - defines the subdomain to evaluate the residual on
926: . t - time at which to evaluate residual
927: . x - array of local state information
928: . J - Jacobian matrix
929: . B - matrix from which to construct the preconditioner; often same as `J`
930: - ctx - optional context
932: Level: beginner
934: .seealso: `DMDA`, `DMDATSSetRHSJacobianLocal()`, `TSRHSJacobianFn`, `DMDATSRHSFunctionLocalFn`, `DMDATSIJacobianLocalFn`, `DMDATSIFunctionLocalFn`
935: S*/
936: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode DMDATSRHSJacobianLocalFn(DMDALocalInfo *info, PetscReal t, void *x, Mat J, Mat B, PetscCtx ctx);
938: PETSC_EXTERN_TYPEDEF typedef DMDATSRHSJacobianLocalFn *DMDATSRHSJacobianLocal PETSC_DEPRECATED_TYPEDEF(3, 26, 0, "DMDATSRHSJacobianLocalFn*", );
940: /*S
941: DMDATSIFunctionLocalFn - A prototype of a local residual evaluation function for use with `DMDA` that would be passed to `DMDATSSetIFunctionLocal()`
943: Calling Sequence:
944: + info - defines the subdomain to evaluate the residual on
945: . t - time at which to evaluate residual
946: . x - array of local state information
947: . xdot - array of local time derivative information
948: . imode - output array of local function evaluation information
949: - ctx - optional context
951: Level: beginner
953: .seealso: `DMDA`, `DMDATSSetIFunctionLocal()`, `DMDATSIJacobianLocalFn`, `TSIFunctionFn`
954: S*/
955: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode DMDATSIFunctionLocalFn(DMDALocalInfo *info, PetscReal t, void *x, void *xdot, void *imode, PetscCtx ctx);
957: PETSC_EXTERN_TYPEDEF typedef DMDATSIFunctionLocalFn *DMDATSIFunctionLocal PETSC_DEPRECATED_TYPEDEF(3, 26, 0, "DMDATSIFunctionLocalFn*", );
959: /*S
960: DMDATSIJacobianLocalFn - A prototype of a local residual evaluation function for use with `DMDA` that would be passed to `DMDATSSetIJacobianLocal()`
962: Calling Sequence:
963: + info - defines the subdomain to evaluate the residual on
964: . t - time at which to evaluate the jacobian
965: . x - array of local state information
966: . xdot - time derivative at this state
967: . shift - see `TSSetIJacobian()` for the meaning of this parameter
968: . J - Jacobian matrix
969: . B - matrix from which to construct the preconditioner; often same as `J`
970: - ctx - optional context
972: Level: beginner
974: .seealso: `DMDA`, `DMDATSSetIJacobianLocal()`, `TSIJacobianFn`, `DMDATSIFunctionLocalFn`, `DMDATSRHSFunctionLocalFn`, `DMDATSRHSJacobianlocal()`
975: S*/
976: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode DMDATSIJacobianLocalFn(DMDALocalInfo *info, PetscReal t, void *x, void *xdot, PetscReal shift, Mat J, Mat B, PetscCtx ctx);
978: PETSC_EXTERN_TYPEDEF typedef DMDATSIJacobianLocalFn *DMDATSIJacobianLocal PETSC_DEPRECATED_TYPEDEF(3, 26, 0, "DMDATSIJacobianLocalFn*", );
980: PETSC_EXTERN PetscErrorCode DMDATSSetRHSFunctionLocal(DM, InsertMode, DMDATSRHSFunctionLocalFn *, void *);
981: PETSC_EXTERN PetscErrorCode DMDATSSetRHSJacobianLocal(DM, DMDATSRHSJacobianLocalFn *, void *);
982: PETSC_EXTERN PetscErrorCode DMDATSSetIFunctionLocal(DM, InsertMode, DMDATSIFunctionLocalFn *, void *);
983: PETSC_EXTERN PetscErrorCode DMDATSSetIJacobianLocal(DM, DMDATSIJacobianLocalFn *, void *);
985: /*S
986: TSMonitorLGCtx - Context object for `TS` line-graph monitor routines that plot residuals, iteration counts or solution components at each time step on a `PetscDrawLG`
988: Level: developer
990: .seealso: `TS`, `TSMonitorLGCtxCreate()`, `TSMonitorLGCtxDestroy()`, `TSMonitorLGSolution()`, `TSMonitorLGTimeStep()`, `TSMonitorLGError()`
991: S*/
992: typedef struct _n_TSMonitorLGCtx *TSMonitorLGCtx;
994: /*S
995: TSMonitorDMDARayCtx - Context object for `TSMonitorDMDARay()`
997: Level: developer
999: .seealso: `TS`, `TSSetMonitor()`, `TSMonitorDMDARay()`, `TSMonitorDMDARayDestroy()`
1000: S*/
1001: typedef struct {
1002: Vec ray;
1003: VecScatter scatter;
1004: PetscViewer viewer;
1005: TSMonitorLGCtx lgctx;
1006: } TSMonitorDMDARayCtx;
1007: PETSC_EXTERN PetscErrorCode TSMonitorDMDARayDestroy(PetscCtxRt);
1008: PETSC_EXTERN PetscErrorCode TSMonitorDMDARay(TS, PetscInt, PetscReal, Vec, void *);
1009: PETSC_EXTERN PetscErrorCode TSMonitorLGDMDARay(TS, PetscInt, PetscReal, Vec, void *);
1011: /* Dynamic creation and loading functions */
1012: PETSC_EXTERN PetscFunctionList TSList;
1013: PETSC_EXTERN PetscErrorCode TSGetType(TS, TSType *);
1014: PETSC_EXTERN PetscErrorCode TSSetType(TS, TSType);
1015: PETSC_EXTERN PetscErrorCode TSRegister(const char[], PetscErrorCode (*)(TS));
1017: PETSC_EXTERN PetscErrorCode TSGetSNES(TS, SNES *);
1018: PETSC_EXTERN PetscErrorCode TSSetSNES(TS, SNES);
1019: PETSC_EXTERN PetscErrorCode TSGetKSP(TS, KSP *);
1020: PETSC_EXTERN PetscErrorCode TSIsImplicit(TS, PetscBool *);
1022: PETSC_EXTERN PetscErrorCode TSView(TS, PetscViewer);
1023: PETSC_EXTERN PetscErrorCode TSLoad(TS, PetscViewer);
1024: PETSC_EXTERN PetscErrorCode TSViewFromOptions(TS, PetscObject, const char[]);
1025: PETSC_EXTERN PetscErrorCode TSTrajectoryViewFromOptions(TSTrajectory, PetscObject, const char[]);
1027: #define TS_FILE_CLASSID 1211225
1029: PETSC_EXTERN PetscErrorCode TSSetApplicationContext(TS, PetscCtx);
1030: PETSC_EXTERN PetscErrorCode TSGetApplicationContext(TS, PetscCtxRt);
1032: PETSC_EXTERN PetscErrorCode TSMonitorLGCtxCreate(MPI_Comm, const char[], const char[], int, int, int, int, PetscInt, TSMonitorLGCtx *);
1033: PETSC_EXTERN PetscErrorCode TSMonitorLGCtxDestroy(TSMonitorLGCtx *);
1034: PETSC_EXTERN PetscErrorCode TSMonitorLGTimeStep(TS, PetscInt, PetscReal, Vec, void *);
1035: PETSC_EXTERN PetscErrorCode TSMonitorLGSolution(TS, PetscInt, PetscReal, Vec, void *);
1036: PETSC_EXTERN PetscErrorCode TSMonitorLGSetVariableNames(TS, const char *const *);
1037: PETSC_EXTERN PetscErrorCode TSMonitorLGGetVariableNames(TS, const char *const **);
1038: PETSC_EXTERN PetscErrorCode TSMonitorLGCtxSetVariableNames(TSMonitorLGCtx, const char *const *);
1039: PETSC_EXTERN PetscErrorCode TSMonitorLGSetDisplayVariables(TS, const char *const *);
1040: PETSC_EXTERN PetscErrorCode TSMonitorLGCtxSetDisplayVariables(TSMonitorLGCtx, const char *const *);
1041: PETSC_EXTERN PetscErrorCode TSMonitorLGSetTransform(TS, PetscErrorCode (*)(void *, Vec, Vec *), PetscCtxDestroyFn *, void *);
1042: PETSC_EXTERN PetscErrorCode TSMonitorLGCtxSetTransform(TSMonitorLGCtx, PetscErrorCode (*)(void *, Vec, Vec *), PetscCtxDestroyFn *, void *);
1043: PETSC_EXTERN PetscErrorCode TSMonitorLGError(TS, PetscInt, PetscReal, Vec, void *);
1044: PETSC_EXTERN PetscErrorCode TSMonitorLGSNESIterations(TS, PetscInt, PetscReal, Vec, void *);
1045: PETSC_EXTERN PetscErrorCode TSMonitorLGKSPIterations(TS, PetscInt, PetscReal, Vec, void *);
1046: PETSC_EXTERN PetscErrorCode TSMonitorError(TS, PetscInt, PetscReal, Vec, PetscViewerAndFormat *);
1047: PETSC_EXTERN PetscErrorCode TSDMSwarmMonitorMoments(TS, PetscInt, PetscReal, Vec, PetscViewerAndFormat *);
1049: struct _n_TSMonitorLGCtxNetwork {
1050: PetscInt nlg;
1051: PetscDrawLG *lg;
1052: PetscBool semilogy;
1053: PetscInt howoften; /* when > 0 uses step % howoften, when negative only final solution plotted */
1054: };
1055: /*S
1056: TSMonitorLGCtxNetwork - Context object for the `TSMonitorLGCtxNetworkSolution()` line-graph monitor that plots solution components on each subnetwork of a `DMNETWORK`
1058: Level: developer
1060: .seealso: `TS`, `DMNETWORK`, `TSMonitorLGCtxNetworkCreate()`, `TSMonitorLGCtxNetworkDestroy()`, `TSMonitorLGCtxNetworkSolution()`
1061: S*/
1062: typedef struct _n_TSMonitorLGCtxNetwork *TSMonitorLGCtxNetwork;
1063: PETSC_EXTERN PetscErrorCode TSMonitorLGCtxNetworkDestroy(TSMonitorLGCtxNetwork *);
1064: PETSC_EXTERN PetscErrorCode TSMonitorLGCtxNetworkCreate(TS, const char[], const char[], int, int, int, int, PetscInt, TSMonitorLGCtxNetwork *);
1065: PETSC_EXTERN PetscErrorCode TSMonitorLGCtxNetworkSolution(TS, PetscInt, PetscReal, Vec, void *);
1067: /*S
1068: TSMonitorEnvelopeCtx - Context object for the `TSMonitorEnvelope()` monitor that tracks the per-component min/max envelope of the solution over a time integration
1070: Level: developer
1072: .seealso: `TS`, `TSMonitorEnvelopeCtxCreate()`, `TSMonitorEnvelopeCtxDestroy()`, `TSMonitorEnvelope()`, `TSMonitorEnvelopeGetBounds()`
1073: S*/
1074: typedef struct _n_TSMonitorEnvelopeCtx *TSMonitorEnvelopeCtx;
1075: PETSC_EXTERN PetscErrorCode TSMonitorEnvelopeCtxCreate(TS, TSMonitorEnvelopeCtx *);
1076: PETSC_EXTERN PetscErrorCode TSMonitorEnvelope(TS, PetscInt, PetscReal, Vec, void *);
1077: PETSC_EXTERN PetscErrorCode TSMonitorEnvelopeGetBounds(TS, Vec *, Vec *);
1078: PETSC_EXTERN PetscErrorCode TSMonitorEnvelopeCtxDestroy(TSMonitorEnvelopeCtx *);
1080: /*S
1081: TSMonitorSPEigCtx - Context object for the `TSMonitorSPEig()` monitor that displays an estimate of the spectrum of the operator using a `PetscDrawSP` scatter plot
1083: Level: developer
1085: .seealso: `TS`, `TSMonitorSPEigCtxCreate()`, `TSMonitorSPEigCtxDestroy()`, `TSMonitorSPEig()`
1086: S*/
1087: typedef struct _n_TSMonitorSPEigCtx *TSMonitorSPEigCtx;
1088: PETSC_EXTERN PetscErrorCode TSMonitorSPEigCtxCreate(MPI_Comm, const char[], const char[], int, int, int, int, PetscInt, TSMonitorSPEigCtx *);
1089: PETSC_EXTERN PetscErrorCode TSMonitorSPEigCtxDestroy(TSMonitorSPEigCtx *);
1090: PETSC_EXTERN PetscErrorCode TSMonitorSPEig(TS, PetscInt, PetscReal, Vec, void *);
1092: /*S
1093: TSMonitorSPCtx - Context object for the `TSMonitorSPSwarmSolution()` scatter-plot monitor that draws the swarm particle positions at each time step on a `PetscDrawSP`
1095: Level: developer
1097: .seealso: `TS`, `DMSWARM`, `TSMonitorSPCtxCreate()`, `TSMonitorSPCtxDestroy()`, `TSMonitorSPSwarmSolution()`
1098: S*/
1099: typedef struct _n_TSMonitorSPCtx *TSMonitorSPCtx;
1100: PETSC_EXTERN PetscErrorCode TSMonitorSPCtxCreate(MPI_Comm, const char[], const char[], int, int, int, int, PetscInt, PetscInt, PetscBool, PetscBool, TSMonitorSPCtx *);
1101: PETSC_EXTERN PetscErrorCode TSMonitorSPCtxDestroy(TSMonitorSPCtx *);
1102: PETSC_EXTERN PetscErrorCode TSMonitorSPSwarmSolution(TS, PetscInt, PetscReal, Vec, void *);
1104: /*S
1105: TSMonitorHGCtx - Context object for the `TSMonitorHGSwarmSolution()` histogram monitor that displays a histogram of `DMSWARM` particle quantities at each time step
1107: Level: developer
1109: .seealso: `TS`, `DMSWARM`, `TSMonitorHGCtxCreate()`, `TSMonitorHGCtxDestroy()`, `TSMonitorHGSwarmSolution()`
1110: S*/
1111: typedef struct _n_TSMonitorHGCtx *TSMonitorHGCtx;
1112: PETSC_EXTERN PetscErrorCode TSMonitorHGCtxCreate(MPI_Comm, const char[], const char[], int, int, int, int, PetscInt, PetscInt, PetscInt, PetscBool, TSMonitorHGCtx *);
1113: PETSC_EXTERN PetscErrorCode TSMonitorHGSwarmSolution(TS, PetscInt, PetscReal, Vec, void *);
1114: PETSC_EXTERN PetscErrorCode TSMonitorHGCtxDestroy(TSMonitorHGCtx *);
1115: PETSC_EXTERN PetscErrorCode TSMonitorHGSwarmSolution(TS, PetscInt, PetscReal, Vec, void *);
1117: /*M
1118: TSEvent - Abstract object to handle event detection in `TS` time integrator
1120: Level: intermediate
1122: Note:
1123: See `TSSetEventHandler()` for the management of events.
1125: .seealso: [](sec_ts_event), `TS`, `TSSetEventHandler()`, `TSSetPostEventStep()`, `TSSetPostEventSecondStep()`, `TSSetEventTolerances()`, `TSGetNumEvents()`
1126: M*/
1127: typedef struct _n_TSEvent *TSEvent;
1129: PETSC_EXTERN PetscErrorCode TSSetEventHandler(TS, PetscInt, PetscInt[], PetscBool[], PetscErrorCode (*)(TS, PetscReal, Vec, PetscReal[], void *), PetscErrorCode (*)(TS, PetscInt, PetscInt[], PetscReal, Vec, PetscBool, void *), void *);
1130: PETSC_EXTERN PetscErrorCode TSSetPostEventStep(TS, PetscReal);
1131: PETSC_EXTERN PetscErrorCode TSSetPostEventSecondStep(TS, PetscReal);
1132: PETSC_DEPRECATED_FUNCTION(3, 21, 0, "TSSetPostEventSecondStep()", ) static inline PetscErrorCode TSSetPostEventIntervalStep(TS ts, PetscReal dt)
1133: {
1134: return TSSetPostEventSecondStep(ts, dt);
1135: }
1136: PETSC_EXTERN PetscErrorCode TSSetEventTolerances(TS, PetscReal, PetscReal[]);
1137: PETSC_EXTERN PetscErrorCode TSGetNumEvents(TS, PetscInt *);
1139: /*J
1140: TSSSPType - string with the name of a `TSSSP` scheme.
1142: Level: beginner
1144: .seealso: [](ch_ts), `TSSSPSetType()`, `TS`, `TSSSP`
1145: J*/
1146: typedef const char *TSSSPType;
1147: #define TSSSPRKS2 "rks2"
1148: #define TSSSPRKS3 "rks3"
1149: #define TSSSPRK104 "rk104"
1151: PETSC_EXTERN PetscErrorCode TSSSPSetType(TS, TSSSPType);
1152: PETSC_EXTERN PetscErrorCode TSSSPGetType(TS, TSSSPType *);
1153: PETSC_EXTERN PetscErrorCode TSSSPSetNumStages(TS, PetscInt);
1154: PETSC_EXTERN PetscErrorCode TSSSPGetNumStages(TS, PetscInt *);
1155: PETSC_EXTERN PetscErrorCode TSSSPInitializePackage(void);
1156: PETSC_EXTERN PetscErrorCode TSSSPFinalizePackage(void);
1157: PETSC_EXTERN PetscFunctionList TSSSPList;
1159: /*S
1160: TSAdapt - Abstract object that manages time-step adaptivity
1162: Level: beginner
1164: .seealso: [](ch_ts), [](sec_ts_error_control), `TS`, `TSGetAdapt()`, `TSAdaptCreate()`, `TSAdaptType`
1165: S*/
1166: typedef struct _p_TSAdapt *TSAdapt;
1168: /*J
1169: TSAdaptType - String with the name of `TSAdapt` scheme.
1171: Level: beginner
1173: .seealso: [](ch_ts), [](sec_ts_error_control), `TSGetAdapt()`, `TSAdaptSetType()`, `TS`, `TSAdapt`
1174: J*/
1175: typedef const char *TSAdaptType;
1176: #define TSADAPTNONE "none"
1177: #define TSADAPTBASIC "basic"
1178: #define TSADAPTDSP "dsp"
1179: #define TSADAPTCFL "cfl"
1180: #define TSADAPTGLEE "glee"
1181: #define TSADAPTHISTORY "history"
1183: PETSC_EXTERN PetscErrorCode TSGetAdapt(TS, TSAdapt *);
1184: PETSC_EXTERN PetscErrorCode TSAdaptRegister(const char[], PetscErrorCode (*)(TSAdapt));
1185: PETSC_EXTERN PetscErrorCode TSAdaptInitializePackage(void);
1186: PETSC_EXTERN PetscErrorCode TSAdaptFinalizePackage(void);
1187: PETSC_EXTERN PetscErrorCode TSAdaptCreate(MPI_Comm, TSAdapt *);
1188: PETSC_EXTERN PetscErrorCode TSAdaptSetType(TSAdapt, TSAdaptType);
1189: PETSC_EXTERN PetscErrorCode TSAdaptGetType(TSAdapt, TSAdaptType *);
1190: PETSC_EXTERN PetscErrorCode TSAdaptSetOptionsPrefix(TSAdapt, const char[]);
1191: PETSC_EXTERN PetscErrorCode TSAdaptCandidatesClear(TSAdapt);
1192: PETSC_EXTERN PetscErrorCode TSAdaptCandidateAdd(TSAdapt, const char[], PetscInt, PetscInt, PetscReal, PetscReal, PetscBool);
1193: PETSC_EXTERN PetscErrorCode TSAdaptCandidatesGet(TSAdapt, PetscInt *, const PetscInt **, const PetscInt **, const PetscReal **, const PetscReal **);
1194: PETSC_EXTERN PetscErrorCode TSAdaptChoose(TSAdapt, TS, PetscReal, PetscInt *, PetscReal *, PetscBool *);
1195: PETSC_EXTERN PetscErrorCode TSAdaptCheckStage(TSAdapt, TS, PetscReal, Vec, PetscBool *);
1196: PETSC_EXTERN PetscErrorCode TSAdaptView(TSAdapt, PetscViewer);
1197: PETSC_EXTERN PetscErrorCode TSAdaptLoad(TSAdapt, PetscViewer);
1198: PETSC_EXTERN PetscErrorCode TSAdaptSetFromOptions(TSAdapt, PetscOptionItems);
1199: PETSC_EXTERN PetscErrorCode TSAdaptReset(TSAdapt);
1200: PETSC_EXTERN PetscErrorCode TSAdaptDestroy(TSAdapt *);
1201: PETSC_EXTERN PetscErrorCode TSAdaptSetMonitor(TSAdapt, PetscBool);
1202: PETSC_EXTERN PetscErrorCode TSAdaptSetAlwaysAccept(TSAdapt, PetscBool);
1203: PETSC_EXTERN PetscErrorCode TSAdaptSetSafety(TSAdapt, PetscReal, PetscReal);
1204: PETSC_EXTERN PetscErrorCode TSAdaptGetSafety(TSAdapt, PetscReal *, PetscReal *);
1205: PETSC_EXTERN PetscErrorCode TSAdaptSetMaxIgnore(TSAdapt, PetscReal);
1206: PETSC_EXTERN PetscErrorCode TSAdaptGetMaxIgnore(TSAdapt, PetscReal *);
1207: PETSC_EXTERN PetscErrorCode TSAdaptSetClip(TSAdapt, PetscReal, PetscReal);
1208: PETSC_EXTERN PetscErrorCode TSAdaptGetClip(TSAdapt, PetscReal *, PetscReal *);
1209: PETSC_EXTERN PetscErrorCode TSAdaptSetScaleSolveFailed(TSAdapt, PetscReal);
1210: PETSC_EXTERN PetscErrorCode TSAdaptGetScaleSolveFailed(TSAdapt, PetscReal *);
1211: PETSC_EXTERN PetscErrorCode TSAdaptSetStepLimits(TSAdapt, PetscReal, PetscReal);
1212: PETSC_EXTERN PetscErrorCode TSAdaptGetStepLimits(TSAdapt, PetscReal *, PetscReal *);
1213: PETSC_EXTERN PetscErrorCode TSAdaptSetCheckStage(TSAdapt, PetscErrorCode (*)(TSAdapt, TS, PetscReal, Vec, PetscBool *));
1214: PETSC_EXTERN PetscErrorCode TSAdaptHistorySetHistory(TSAdapt, PetscInt, PetscReal[], PetscBool);
1215: PETSC_EXTERN PetscErrorCode TSAdaptHistorySetTrajectory(TSAdapt, TSTrajectory, PetscBool);
1216: PETSC_EXTERN PetscErrorCode TSAdaptHistoryGetStep(TSAdapt, PetscInt, PetscReal *, PetscReal *);
1217: PETSC_EXTERN PetscErrorCode TSAdaptSetTimeStepIncreaseDelay(TSAdapt, PetscInt);
1218: PETSC_EXTERN PetscErrorCode TSAdaptDSPSetFilter(TSAdapt, const char *);
1219: PETSC_EXTERN PetscErrorCode TSAdaptDSPSetPID(TSAdapt, PetscReal, PetscReal, PetscReal);
1221: /*S
1222: TSGLLEAdapt - Abstract object that manages time-step adaptivity for `TSGLLE`
1224: Level: beginner
1226: Developer Note:
1227: This functionality should be replaced by the `TSAdapt`.
1229: .seealso: [](ch_ts), `TS`, `TSGLLE`, `TSGLLEAdaptCreate()`, `TSGLLEAdaptType`
1230: S*/
1231: typedef struct _p_TSGLLEAdapt *TSGLLEAdapt;
1233: /*J
1234: TSGLLEAdaptType - String with the name of `TSGLLEAdapt` scheme
1236: Level: beginner
1238: Developer Note:
1239: This functionality should be replaced by the `TSAdaptType`.
1241: .seealso: [](ch_ts), `TSGLLEAdaptSetType()`, `TS`
1242: J*/
1243: typedef const char *TSGLLEAdaptType;
1244: #define TSGLLEADAPT_NONE "none"
1245: #define TSGLLEADAPT_SIZE "size"
1246: #define TSGLLEADAPT_BOTH "both"
1248: PETSC_EXTERN PetscErrorCode TSGLLEAdaptRegister(const char[], PetscErrorCode (*)(TSGLLEAdapt));
1249: PETSC_EXTERN PetscErrorCode TSGLLEAdaptInitializePackage(void);
1250: PETSC_EXTERN PetscErrorCode TSGLLEAdaptFinalizePackage(void);
1251: PETSC_EXTERN PetscErrorCode TSGLLEAdaptCreate(MPI_Comm, TSGLLEAdapt *);
1252: PETSC_EXTERN PetscErrorCode TSGLLEAdaptSetType(TSGLLEAdapt, TSGLLEAdaptType);
1253: PETSC_EXTERN PetscErrorCode TSGLLEAdaptSetOptionsPrefix(TSGLLEAdapt, const char[]);
1254: PETSC_EXTERN PetscErrorCode TSGLLEAdaptChoose(TSGLLEAdapt, PetscInt, const PetscInt[], const PetscReal[], const PetscReal[], PetscInt, PetscReal, PetscReal, PetscInt *, PetscReal *, PetscBool *);
1255: PETSC_EXTERN PetscErrorCode TSGLLEAdaptView(TSGLLEAdapt, PetscViewer);
1256: PETSC_EXTERN PetscErrorCode TSGLLEAdaptSetFromOptions(TSGLLEAdapt, PetscOptionItems);
1257: PETSC_EXTERN PetscErrorCode TSGLLEAdaptDestroy(TSGLLEAdapt *);
1259: /*J
1260: TSGLLEAcceptType - String with the name of `TSGLLEAccept` scheme
1262: Level: beginner
1264: .seealso: [](ch_ts), `TSGLLESetAcceptType()`, `TS`, `TSGLLEAccept`
1265: J*/
1266: typedef const char *TSGLLEAcceptType;
1267: #define TSGLLEACCEPT_ALWAYS "always"
1269: /*S
1270: TSGLLEAcceptFn - A prototype of a `TS` accept function that would be passed to `TSGLLEAcceptRegister()`
1272: Calling Sequence:
1273: + ts - timestep context
1274: . nt - time to end of solution time
1275: . h - the proposed step-size
1276: . enorm - unknown
1277: - accept - output, if the proposal is accepted
1279: Level: beginner
1281: .seealso: [](ch_ts), `TS`, `TSSetRHSFunction()`, `DMTSSetRHSFunction()`, `TSIFunctionFn`,
1282: `TSIJacobianFn`, `TSRHSJacobianFn`, `TSGLLEAcceptRegister()`
1283: S*/
1284: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode TSGLLEAcceptFn(TS ts, PetscReal nt, PetscReal h, const PetscReal enorm[], PetscBool *accept);
1286: PETSC_EXTERN_TYPEDEF typedef TSGLLEAcceptFn *TSGLLEAcceptFunction PETSC_DEPRECATED_TYPEDEF(3, 26, 0, "TSGLLEAcceptFn*", );
1288: PETSC_EXTERN PetscErrorCode TSGLLEAcceptRegister(const char[], TSGLLEAcceptFn *);
1290: /*J
1291: TSGLLEType - string with the name of a General Linear `TSGLLE` type
1293: Level: beginner
1295: .seealso: [](ch_ts), `TS`, `TSGLLE`, `TSGLLESetType()`, `TSGLLERegister()`, `TSGLLEAccept`
1296: J*/
1297: typedef const char *TSGLLEType;
1298: #define TSGLLE_IRKS "irks"
1300: PETSC_EXTERN PetscErrorCode TSGLLERegister(const char[], PetscErrorCode (*)(TS));
1301: PETSC_EXTERN PetscErrorCode TSGLLEInitializePackage(void);
1302: PETSC_EXTERN PetscErrorCode TSGLLEFinalizePackage(void);
1303: PETSC_EXTERN PetscErrorCode TSGLLESetType(TS, TSGLLEType);
1304: PETSC_EXTERN PetscErrorCode TSGLLEGetAdapt(TS, TSGLLEAdapt *);
1305: PETSC_EXTERN PetscErrorCode TSGLLESetAcceptType(TS, TSGLLEAcceptType);
1307: /*J
1308: TSEIMEXType - String with the name of an Extrapolated IMEX `TSEIMEX` type
1310: Level: beginner
1312: .seealso: [](ch_ts), `TSEIMEXSetType()`, `TS`, `TSEIMEX`, `TSEIMEXRegister()`
1313: J*/
1314: #define TSEIMEXType char *
1316: PETSC_EXTERN PetscErrorCode TSEIMEXSetMaxRows(TS, PetscInt);
1317: PETSC_EXTERN PetscErrorCode TSEIMEXSetRowCol(TS, PetscInt, PetscInt);
1318: PETSC_EXTERN PetscErrorCode TSEIMEXSetOrdAdapt(TS, PetscBool);
1320: /*J
1321: TSRKType - String with the name of a Runge-Kutta `TSRK` type
1323: Level: beginner
1325: .seealso: [](ch_ts), `TS`, `TSRKSetType()`, `TSRK`, `TSRKRegister()`
1326: J*/
1327: typedef const char *TSRKType;
1328: #define TSRK1FE "1fe"
1329: #define TSRK2A "2a"
1330: #define TSRK2B "2b"
1331: #define TSRK3 "3"
1332: #define TSRK3BS "3bs"
1333: #define TSRK4 "4"
1334: #define TSRK5F "5f"
1335: #define TSRK5DP "5dp"
1336: #define TSRK5BS "5bs"
1337: #define TSRK6VR "6vr"
1338: #define TSRK7VR "7vr"
1339: #define TSRK8VR "8vr"
1341: PETSC_EXTERN PetscErrorCode TSRKGetOrder(TS, PetscInt *);
1342: PETSC_EXTERN PetscErrorCode TSRKGetType(TS, TSRKType *);
1343: PETSC_EXTERN PetscErrorCode TSRKSetType(TS, TSRKType);
1344: PETSC_EXTERN PetscErrorCode TSRKGetTableau(TS, PetscInt *, const PetscReal *[], const PetscReal *[], const PetscReal *[], const PetscReal *[], PetscInt *, const PetscReal *[], PetscBool *);
1345: PETSC_EXTERN PetscErrorCode TSRKSetMultirate(TS, PetscBool);
1346: PETSC_EXTERN PetscErrorCode TSRKGetMultirate(TS, PetscBool *);
1347: PETSC_EXTERN PetscErrorCode TSRKRegister(TSRKType, PetscInt, PetscInt, const PetscReal[], const PetscReal[], const PetscReal[], const PetscReal[], PetscInt, const PetscReal[]);
1348: PETSC_EXTERN PetscErrorCode TSRKInitializePackage(void);
1349: PETSC_EXTERN PetscErrorCode TSRKFinalizePackage(void);
1350: PETSC_EXTERN PetscErrorCode TSRKRegisterDestroy(void);
1352: /*J
1353: TSMPRKType - String with the name of a partitioned Runge-Kutta `TSMPRK` type
1355: Level: beginner
1357: .seealso: [](ch_ts), `TSMPRKSetType()`, `TS`, `TSMPRK`, `TSMPRKRegister()`
1358: J*/
1359: typedef const char *TSMPRKType;
1360: #define TSMPRK2A22 "2a22"
1361: #define TSMPRK2A23 "2a23"
1362: #define TSMPRK2A32 "2a32"
1363: #define TSMPRK2A33 "2a33"
1364: #define TSMPRKP2 "p2"
1365: #define TSMPRKP3 "p3"
1367: PETSC_EXTERN PetscErrorCode TSMPRKGetType(TS, TSMPRKType *);
1368: PETSC_EXTERN PetscErrorCode TSMPRKSetType(TS, TSMPRKType);
1369: PETSC_EXTERN PetscErrorCode TSMPRKRegister(TSMPRKType, PetscInt, PetscInt, PetscInt, PetscInt, const PetscReal[], const PetscReal[], const PetscReal[], const PetscInt[], const PetscReal[], const PetscReal[], const PetscReal[], const PetscInt[], const PetscReal[], const PetscReal[], const PetscReal[]);
1370: PETSC_EXTERN PetscErrorCode TSMPRKInitializePackage(void);
1371: PETSC_EXTERN PetscErrorCode TSMPRKFinalizePackage(void);
1372: PETSC_EXTERN PetscErrorCode TSMPRKRegisterDestroy(void);
1374: /*J
1375: TSIRKType - String with the name of an implicit Runge-Kutta `TSIRK` type
1377: Level: beginner
1379: .seealso: [](ch_ts), `TSIRKSetType()`, `TS`, `TSIRK`, `TSIRKRegister()`
1380: J*/
1381: typedef const char *TSIRKType;
1382: #define TSIRKGAUSS "gauss"
1384: PETSC_EXTERN PetscErrorCode TSIRKGetType(TS, TSIRKType *);
1385: PETSC_EXTERN PetscErrorCode TSIRKSetType(TS, TSIRKType);
1386: PETSC_EXTERN PetscErrorCode TSIRKGetNumStages(TS, PetscInt *);
1387: PETSC_EXTERN PetscErrorCode TSIRKSetNumStages(TS, PetscInt);
1388: PETSC_EXTERN PetscErrorCode TSIRKRegister(const char[], PetscErrorCode (*function)(TS));
1389: PETSC_EXTERN PetscErrorCode TSIRKTableauCreate(TS, PetscInt, const PetscReal *, const PetscReal *, const PetscReal *, const PetscReal *, const PetscScalar *, const PetscScalar *, const PetscScalar *);
1390: PETSC_EXTERN PetscErrorCode TSIRKInitializePackage(void);
1391: PETSC_EXTERN PetscErrorCode TSIRKFinalizePackage(void);
1392: PETSC_EXTERN PetscErrorCode TSIRKRegisterDestroy(void);
1394: /*J
1395: TSGLEEType - String with the name of a General Linear with Error Estimation `TSGLEE` type
1397: Level: beginner
1399: .seealso: [](ch_ts), `TSGLEESetType()`, `TS`, `TSGLEE`, `TSGLEERegister()`
1400: J*/
1401: typedef const char *TSGLEEType;
1402: #define TSGLEEi1 "BE1"
1403: #define TSGLEE23 "23"
1404: #define TSGLEE24 "24"
1405: #define TSGLEE25I "25i"
1406: #define TSGLEE35 "35"
1407: #define TSGLEEEXRK2A "exrk2a"
1408: #define TSGLEERK32G1 "rk32g1"
1409: #define TSGLEERK285EX "rk285ex"
1411: /*J
1412: TSGLEEMode - String with the mode of error estimation for a General Linear with Error Estimation `TSGLEE` type
1414: Level: beginner
1416: .seealso: [](ch_ts), `TSGLEESetMode()`, `TS`, `TSGLEE`, `TSGLEERegister()`
1417: J*/
1418: PETSC_EXTERN PetscErrorCode TSGLEEGetType(TS, TSGLEEType *);
1419: PETSC_EXTERN PetscErrorCode TSGLEESetType(TS, TSGLEEType);
1420: PETSC_EXTERN PetscErrorCode TSGLEERegister(TSGLEEType, PetscInt, PetscInt, PetscInt, PetscReal, const PetscReal[], const PetscReal[], const PetscReal[], const PetscReal[], const PetscReal[], const PetscReal[], const PetscReal[], const PetscReal[], const PetscReal[], const PetscReal[], PetscInt, const PetscReal[]);
1421: PETSC_EXTERN PetscErrorCode TSGLEERegisterAll(void);
1422: PETSC_EXTERN PetscErrorCode TSGLEEFinalizePackage(void);
1423: PETSC_EXTERN PetscErrorCode TSGLEEInitializePackage(void);
1424: PETSC_EXTERN PetscErrorCode TSGLEERegisterDestroy(void);
1426: /*J
1427: TSARKIMEXType - String with the name of an Additive Runge-Kutta IMEX `TSARKIMEX` type
1429: Options Database Key:
1430: . -ts_arkimex_type (1bee|a2|l2|ars122|2c|2d|2e|prssp2|3|bpr3|ars443|4|5) - set `TSARKIMEX` scheme type, see `TSARKIMEXType`
1432: Level: beginner
1434: .seealso: [](ch_ts), `TSARKIMEXSetType()`, `TS`, `TSARKIMEX`, `TSARKIMEXRegister()`
1435: J*/
1436: typedef const char *TSARKIMEXType;
1437: #define TSARKIMEX1BEE "1bee"
1438: #define TSARKIMEXA2 "a2"
1439: #define TSARKIMEXL2 "l2"
1440: #define TSARKIMEXARS122 "ars122"
1441: #define TSARKIMEX2C "2c"
1442: #define TSARKIMEX2D "2d"
1443: #define TSARKIMEX2E "2e"
1444: #define TSARKIMEXPRSSP2 "prssp2"
1445: #define TSARKIMEX3 "3"
1446: #define TSARKIMEXBPR3 "bpr3"
1447: #define TSARKIMEXARS443 "ars443"
1448: #define TSARKIMEX4 "4"
1449: #define TSARKIMEX5 "5"
1451: PETSC_EXTERN PetscErrorCode TSARKIMEXGetType(TS, TSARKIMEXType *);
1452: PETSC_EXTERN PetscErrorCode TSARKIMEXSetType(TS, TSARKIMEXType);
1453: PETSC_EXTERN PetscErrorCode TSARKIMEXSetFullyImplicit(TS, PetscBool);
1454: PETSC_EXTERN PetscErrorCode TSARKIMEXGetFullyImplicit(TS, PetscBool *);
1455: PETSC_EXTERN PetscErrorCode TSARKIMEXSetFastSlowSplit(TS, PetscBool);
1456: PETSC_EXTERN PetscErrorCode TSARKIMEXGetFastSlowSplit(TS, PetscBool *);
1457: PETSC_EXTERN PetscErrorCode TSARKIMEXRegister(TSARKIMEXType, PetscInt, PetscInt, const PetscReal[], const PetscReal[], const PetscReal[], const PetscReal[], const PetscReal[], const PetscReal[], const PetscReal[], const PetscReal[], PetscInt, const PetscReal[], const PetscReal[]);
1458: PETSC_EXTERN PetscErrorCode TSARKIMEXInitializePackage(void);
1459: PETSC_EXTERN PetscErrorCode TSARKIMEXFinalizePackage(void);
1460: PETSC_EXTERN PetscErrorCode TSARKIMEXRegisterDestroy(void);
1462: /*J
1463: TSDIRKType - String with the name of a Diagonally Implicit Runge-Kutta `TSDIRK` type
1465: Level: beginner
1467: .seealso: [](ch_ts), `TSDIRKSetType()`, `TS`, `TSDIRK`, `TSDIRKRegister()`
1468: J*/
1469: typedef const char *TSDIRKType;
1470: #define TSDIRKS212 "s212"
1471: #define TSDIRKES122SAL "es122sal"
1472: #define TSDIRKES213SAL "es213sal"
1473: #define TSDIRKES324SAL "es324sal"
1474: #define TSDIRKES325SAL "es325sal"
1475: #define TSDIRK657A "657a"
1476: #define TSDIRKES648SA "es648sa"
1477: #define TSDIRK658A "658a"
1478: #define TSDIRKS659A "s659a"
1479: #define TSDIRK7510SAL "7510sal"
1480: #define TSDIRKES7510SA "es7510sa"
1481: #define TSDIRK759A "759a"
1482: #define TSDIRKS7511SAL "s7511sal"
1483: #define TSDIRK8614A "8614a"
1484: #define TSDIRK8616SAL "8616sal"
1485: #define TSDIRKES8516SAL "es8516sal"
1487: PETSC_EXTERN PetscErrorCode TSDIRKGetType(TS, TSDIRKType *);
1488: PETSC_EXTERN PetscErrorCode TSDIRKSetType(TS, TSDIRKType);
1489: PETSC_EXTERN PetscErrorCode TSDIRKRegister(TSDIRKType, PetscInt, PetscInt, const PetscReal[], const PetscReal[], const PetscReal[], const PetscReal[], PetscInt, const PetscReal[]);
1491: /*J
1492: TSRosWType - String with the name of a Rosenbrock-W `TSROSW` type
1494: Level: beginner
1496: .seealso: [](ch_ts), `TSRosWSetType()`, `TS`, `TSROSW`, `TSRosWRegister()`
1497: J*/
1498: typedef const char *TSRosWType;
1499: #define TSROSW2M "2m"
1500: #define TSROSW2P "2p"
1501: #define TSROSWRA3PW "ra3pw"
1502: #define TSROSWRA34PW2 "ra34pw2"
1503: #define TSROSWR34PRW "r34prw"
1504: #define TSROSWR3PRL2 "r3prl2"
1505: #define TSROSWRODAS3 "rodas3"
1506: #define TSROSWRODASPR "rodaspr"
1507: #define TSROSWRODASPR2 "rodaspr2"
1508: #define TSROSWSANDU3 "sandu3"
1509: #define TSROSWASSP3P3S1C "assp3p3s1c"
1510: #define TSROSWLASSP3P4S2C "lassp3p4s2c"
1511: #define TSROSWLLSSP3P4S2C "llssp3p4s2c"
1512: #define TSROSWARK3 "ark3"
1513: #define TSROSWTHETA1 "theta1"
1514: #define TSROSWTHETA2 "theta2"
1515: #define TSROSWGRK4T "grk4t"
1516: #define TSROSWSHAMP4 "shamp4"
1517: #define TSROSWVELDD4 "veldd4"
1518: #define TSROSW4L "4l"
1520: PETSC_EXTERN PetscErrorCode TSRosWGetType(TS, TSRosWType *);
1521: PETSC_EXTERN PetscErrorCode TSRosWSetType(TS, TSRosWType);
1522: PETSC_EXTERN PetscErrorCode TSRosWSetRecomputeJacobian(TS, PetscBool);
1523: PETSC_EXTERN PetscErrorCode TSRosWRegister(TSRosWType, PetscInt, PetscInt, const PetscReal[], const PetscReal[], const PetscReal[], const PetscReal[], PetscInt, const PetscReal[]);
1524: PETSC_EXTERN PetscErrorCode TSRosWRegisterRos4(TSRosWType, PetscReal, PetscReal, PetscReal, PetscReal, PetscReal);
1525: PETSC_EXTERN PetscErrorCode TSRosWInitializePackage(void);
1526: PETSC_EXTERN PetscErrorCode TSRosWFinalizePackage(void);
1527: PETSC_EXTERN PetscErrorCode TSRosWRegisterDestroy(void);
1529: PETSC_EXTERN PetscErrorCode TSBDFSetOrder(TS, PetscInt);
1530: PETSC_EXTERN PetscErrorCode TSBDFGetOrder(TS, PetscInt *);
1532: /*J
1533: TSBasicSymplecticType - String with the name of a basic symplectic integration `TSBASICSYMPLECTIC` type
1535: Level: beginner
1537: .seealso: [](ch_ts), `TSBasicSymplecticSetType()`, `TS`, `TSBASICSYMPLECTIC`, `TSBasicSymplecticRegister()`
1538: J*/
1539: typedef const char *TSBasicSymplecticType;
1540: #define TSBASICSYMPLECTICSIEULER "1"
1541: #define TSBASICSYMPLECTICVELVERLET "2"
1542: #define TSBASICSYMPLECTIC3 "3"
1543: #define TSBASICSYMPLECTIC4 "4"
1545: PETSC_EXTERN PetscErrorCode TSBasicSymplecticSetType(TS, TSBasicSymplecticType);
1546: PETSC_EXTERN PetscErrorCode TSBasicSymplecticGetType(TS, TSBasicSymplecticType *);
1547: PETSC_EXTERN PetscErrorCode TSBasicSymplecticRegister(TSBasicSymplecticType, PetscInt, PetscInt, PetscReal[], PetscReal[]);
1548: PETSC_EXTERN PetscErrorCode TSBasicSymplecticRegisterAll(void);
1549: PETSC_EXTERN PetscErrorCode TSBasicSymplecticInitializePackage(void);
1550: PETSC_EXTERN PetscErrorCode TSBasicSymplecticFinalizePackage(void);
1551: PETSC_EXTERN PetscErrorCode TSBasicSymplecticRegisterDestroy(void);
1553: /*E
1554: TSDGType - Selects the discrete-gradient flavor used by `TSDISCGRAD` when integrating gradient-system ODEs
1556: Values:
1557: + `TS_DG_GONZALEZ` - Gonzalez's mid-point-style discrete gradient
1558: . `TS_DG_AVERAGE` - average vector field (AVF) discrete gradient
1559: - `TS_DG_NONE` - do not apply a discrete gradient correction; the integrator falls back to a standard mid-point rule
1561: Level: advanced
1563: .seealso: `TS`, `TSDISCGRAD`, `TSDiscGradSetType()`, `TSDiscGradGetType()`, `TSDiscGradSetFormulation()`
1564: E*/
1565: typedef enum {
1566: TS_DG_GONZALEZ,
1567: TS_DG_AVERAGE,
1568: TS_DG_NONE
1569: } TSDGType;
1570: PETSC_EXTERN PetscErrorCode TSDiscGradSetFormulation(TS, PetscErrorCode (*)(TS, PetscReal, Vec, Mat, void *), PetscErrorCode (*)(TS, PetscReal, Vec, PetscScalar *, void *), PetscErrorCode (*)(TS, PetscReal, Vec, Vec, void *), void *);
1571: PETSC_EXTERN PetscErrorCode TSDiscGradGetFormulation(TS, PetscErrorCode (**)(TS, PetscReal, Vec, Mat, void *), PetscErrorCode (**)(TS, PetscReal, Vec, PetscScalar *, void *), PetscErrorCode (**)(TS, PetscReal, Vec, Vec, void *), void *);
1572: PETSC_EXTERN PetscErrorCode TSDiscGradSetImplicitFormulation(TS, PetscErrorCode (*)(TS, PetscReal, Vec, Vec, Vec, void *), PetscErrorCode (*)(TS, PetscReal, Vec, Vec, PetscReal, Mat, Mat, void *));
1573: PETSC_EXTERN PetscErrorCode TSDiscGradSetType(TS, TSDGType);
1574: PETSC_EXTERN PetscErrorCode TSDiscGradGetType(TS, TSDGType *);
1575: PETSC_EXTERN PetscErrorCode TSDiscGradGetX0AndXdot(TS, DM, Vec *, Vec *);
1576: PETSC_EXTERN PetscErrorCode TSDiscGradRestoreX0AndXdot(TS, DM, Vec *, Vec *);
1578: /*
1579: PETSc interface to Sundials
1580: */
1581: #if PetscDefined(HAVE_SUNDIALS2)
1582: /*E
1583: TSSundialsLmmType - Selects which linear multistep method is used by the `TSSUNDIALS` interface to SUNDIALS' CVODE integrator
1585: Values:
1586: + `SUNDIALS_ADAMS` - variable-order Adams methods (non-stiff problems)
1587: - `SUNDIALS_BDF` - variable-order backward differentiation formulas (stiff problems)
1589: Level: intermediate
1591: .seealso: `TS`, `TSSUNDIALS`, `TSSundialsSetType()`, `TSSundialsGramSchmidtType`
1592: E*/
1593: typedef enum {
1594: SUNDIALS_ADAMS = 1,
1595: SUNDIALS_BDF = 2
1596: } TSSundialsLmmType;
1597: PETSC_EXTERN const char *const TSSundialsLmmTypes[];
1598: /*E
1599: TSSundialsGramSchmidtType - Selects the Gram--Schmidt orthogonalization variant used by SUNDIALS' internal GMRES inside `TSSUNDIALS`
1601: Values:
1602: + `SUNDIALS_MODIFIED_GS` - modified Gram--Schmidt (more stable)
1603: - `SUNDIALS_CLASSICAL_GS` - classical Gram--Schmidt (cheaper, less stable)
1605: Level: advanced
1607: .seealso: `TS`, `TSSUNDIALS`, `TSSundialsSetGramSchmidtType()`, `TSSundialsLmmType`
1608: E*/
1609: typedef enum {
1610: SUNDIALS_MODIFIED_GS = 1,
1611: SUNDIALS_CLASSICAL_GS = 2
1612: } TSSundialsGramSchmidtType;
1613: PETSC_EXTERN const char *const TSSundialsGramSchmidtTypes[];
1615: PETSC_EXTERN PetscErrorCode TSSundialsSetType(TS, TSSundialsLmmType);
1616: PETSC_EXTERN PetscErrorCode TSSundialsGetPC(TS, PC *);
1617: PETSC_EXTERN PetscErrorCode TSSundialsSetTolerance(TS, PetscReal, PetscReal);
1618: PETSC_EXTERN PetscErrorCode TSSundialsSetMinTimeStep(TS, PetscReal);
1619: PETSC_EXTERN PetscErrorCode TSSundialsSetMaxTimeStep(TS, PetscReal);
1620: PETSC_EXTERN PetscErrorCode TSSundialsGetIterations(TS, PetscInt *, PetscInt *);
1621: PETSC_EXTERN PetscErrorCode TSSundialsSetGramSchmidtType(TS, TSSundialsGramSchmidtType);
1622: PETSC_EXTERN PetscErrorCode TSSundialsSetLinearTolerance(TS, PetscReal);
1623: PETSC_EXTERN PetscErrorCode TSSundialsMonitorInternalSteps(TS, PetscBool);
1624: PETSC_EXTERN PetscErrorCode TSSundialsSetMaxl(TS, PetscInt);
1625: PETSC_EXTERN PetscErrorCode TSSundialsSetMaxord(TS, PetscInt);
1626: PETSC_EXTERN PetscErrorCode TSSundialsSetUseDense(TS, PetscBool);
1627: #endif
1629: PETSC_EXTERN PetscErrorCode TSThetaSetTheta(TS, PetscReal);
1630: PETSC_EXTERN PetscErrorCode TSThetaGetTheta(TS, PetscReal *);
1631: PETSC_EXTERN PetscErrorCode TSThetaGetEndpoint(TS, PetscBool *);
1632: PETSC_EXTERN PetscErrorCode TSThetaSetEndpoint(TS, PetscBool);
1634: PETSC_EXTERN PetscErrorCode TSAlphaSetRadius(TS, PetscReal);
1635: PETSC_EXTERN PetscErrorCode TSAlphaSetParams(TS, PetscReal, PetscReal, PetscReal);
1636: PETSC_EXTERN PetscErrorCode TSAlphaGetParams(TS, PetscReal *, PetscReal *, PetscReal *);
1638: PETSC_EXTERN PetscErrorCode TSAlpha2SetRadius(TS, PetscReal);
1639: PETSC_EXTERN PetscErrorCode TSAlpha2SetParams(TS, PetscReal, PetscReal, PetscReal, PetscReal);
1640: PETSC_EXTERN PetscErrorCode TSAlpha2GetParams(TS, PetscReal *, PetscReal *, PetscReal *, PetscReal *);
1642: /*S
1643: TSAlpha2PredictorFn - A callback to set the predictor (i.e., the initial guess for the nonlinear solver) in
1644: a second-order generalized-alpha time integrator.
1646: Calling Sequence:
1647: + ts - the `TS` context obtained from `TSCreate()`
1648: . X0 - the previous time step's state vector
1649: . V0 - the previous time step's first derivative of the state vector
1650: . A0 - the previous time step's second derivative of the state vector
1651: . X1 - the vector into which the initial guess for the current time step will be written
1652: - ctx - [optional] user-defined context for the predictor evaluation routine (may be `NULL`)
1654: Level: intermediate
1656: .seealso: [](ch_ts), `TS`, `TSAlpha2SetPredictor()`
1657: S*/
1658: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode TSAlpha2PredictorFn(TS ts, Vec X0, Vec V0, Vec A0, Vec X1, PetscCtx ctx);
1660: PETSC_EXTERN_TYPEDEF typedef TSAlpha2PredictorFn *TSAlpha2Predictor PETSC_DEPRECATED_TYPEDEF(3, 26, 0, "TSAlpha2PredictorFn*", );
1662: PETSC_EXTERN PetscErrorCode TSAlpha2SetPredictor(TS, TSAlpha2PredictorFn *, void *);
1664: PETSC_EXTERN PetscErrorCode TSSetDM(TS, DM);
1665: PETSC_EXTERN PetscErrorCode TSGetDM(TS, DM *);
1667: PETSC_EXTERN PetscErrorCode SNESTSFormFunction(SNES, Vec, Vec, void *);
1668: PETSC_EXTERN PetscErrorCode SNESTSFormJacobian(SNES, Vec, Mat, Mat, void *);
1670: PETSC_EXTERN PetscErrorCode TSRHSJacobianTest(TS, PetscBool *);
1671: PETSC_EXTERN PetscErrorCode TSRHSJacobianTestTranspose(TS, PetscBool *);
1673: PETSC_EXTERN PetscErrorCode TSGetComputeInitialCondition(TS, PetscErrorCode (**)(TS, Vec));
1674: PETSC_EXTERN PetscErrorCode TSSetComputeInitialCondition(TS, PetscErrorCode (*)(TS, Vec));
1675: PETSC_EXTERN PetscErrorCode TSComputeInitialCondition(TS, Vec);
1676: PETSC_EXTERN PetscErrorCode TSGetComputeExactError(TS, PetscErrorCode (**)(TS, Vec, Vec));
1677: PETSC_EXTERN PetscErrorCode TSSetComputeExactError(TS, PetscErrorCode (*)(TS, Vec, Vec));
1678: PETSC_EXTERN PetscErrorCode TSComputeExactError(TS, Vec, Vec);
1679: PETSC_EXTERN PetscErrorCode PetscConvEstUseTS(PetscConvEst, PetscBool);
1681: PETSC_EXTERN PetscErrorCode TSSetMatStructure(TS, MatStructure);