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: Input Parameter:
467: . ts - the `TS` context obtained from `TSCreate()`
469: Output Parameters:
470: + nsol - the number of solutions
471: - Sols - the solution vectors
473: Level: deprecated
475: Notes:
476: Deprecated, use `TSGetEvaluationSolutions()`.
478: Both `nsol` and `Sols` can be `NULL`.
480: 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()`.
481: For example, manipulating the step size, especially with a reduced precision, may cause `TS` to step over certain points in the span.
482: This issue is alleviated in `TSGetEvaluationSolutions()` by returning the solution times that `Sols` were recorded at.
484: .seealso: [](ch_ts), `TS`, `TSGetEvaluationSolutions()`, `TSSetTimeSpan()`, `TSGetEvaluationTimes()`, `TSSetEvaluationTimes()`
485: @*/
486: PETSC_DEPRECATED_FUNCTION(3, 23, 0, "TSGetEvaluationSolutions()", ) static inline PetscErrorCode TSGetTimeSpanSolutions(TS ts, PetscInt *nsol, Vec **Sols)
487: {
488: return TSGetEvaluationSolutions(ts, nsol, NULL, Sols);
489: }
491: PETSC_EXTERN PETSC_DEPRECATED_FUNCTION(3, 8, 0, "TSSetTime()", ) PetscErrorCode TSSetInitialTimeStep(TS, PetscReal, PetscReal);
492: PETSC_EXTERN PETSC_DEPRECATED_FUNCTION(3, 8, 0, "TSSetMax()", ) PetscErrorCode TSSetDuration(TS, PetscInt, PetscReal);
493: PETSC_EXTERN PETSC_DEPRECATED_FUNCTION(3, 8, 0, "TSGetMax()", ) PetscErrorCode TSGetDuration(TS, PetscInt *, PetscReal *);
494: PETSC_EXTERN PETSC_DEPRECATED_FUNCTION(3, 8, 0, "TSGetStepNumber()", ) PetscErrorCode TSGetTimeStepNumber(TS, PetscInt *);
495: PETSC_EXTERN PETSC_DEPRECATED_FUNCTION(3, 8, 0, "TSGetStepNumber()", ) PetscErrorCode TSGetTotalSteps(TS, PetscInt *);
497: PETSC_EXTERN PetscErrorCode TSMonitorDefault(TS, PetscInt, PetscReal, Vec, PetscViewerAndFormat *);
498: PETSC_EXTERN PetscErrorCode TSMonitorWallClockTime(TS, PetscInt, PetscReal, Vec, PetscViewerAndFormat *);
499: PETSC_EXTERN PetscErrorCode TSMonitorWallClockTimeSetUp(TS, PetscViewerAndFormat *);
500: PETSC_EXTERN PetscErrorCode TSMonitorExtreme(TS, PetscInt, PetscReal, Vec, PetscViewerAndFormat *);
502: /*S
503: TSMonitorDrawCtx - Context object for the `TS` graphical monitor routines that draw the solution, phase plot or error using a `PetscDraw`
505: Level: developer
507: .seealso: `TS`, `TSMonitorDrawCtxCreate()`, `TSMonitorDrawCtxDestroy()`, `TSMonitorDrawSolution()`, `TSMonitorDrawSolutionPhase()`, `TSMonitorDrawError()`, `TSMonitorDrawSolutionFunction()`
508: S*/
509: typedef struct _n_TSMonitorDrawCtx *TSMonitorDrawCtx;
510: PETSC_EXTERN PetscErrorCode TSMonitorDrawCtxCreate(MPI_Comm, const char[], const char[], int, int, int, int, PetscInt, TSMonitorDrawCtx *);
511: PETSC_EXTERN PetscErrorCode TSMonitorDrawCtxDestroy(TSMonitorDrawCtx *);
512: PETSC_EXTERN PetscErrorCode TSMonitorDrawSolution(TS, PetscInt, PetscReal, Vec, PetscCtx);
513: PETSC_EXTERN PetscErrorCode TSMonitorDrawSolutionPhase(TS, PetscInt, PetscReal, Vec, PetscCtx);
514: PETSC_EXTERN PetscErrorCode TSMonitorDrawError(TS, PetscInt, PetscReal, Vec, PetscCtx);
515: PETSC_EXTERN PetscErrorCode TSMonitorDrawSolutionFunction(TS, PetscInt, PetscReal, Vec, PetscCtx);
517: PETSC_EXTERN PetscErrorCode TSAdjointMonitorDefault(TS, PetscInt, PetscReal, Vec, PetscInt, Vec[], Vec[], PetscViewerAndFormat *);
518: PETSC_EXTERN PetscErrorCode TSAdjointMonitorDrawSensi(TS, PetscInt, PetscReal, Vec, PetscInt, Vec[], Vec[], PetscCtx);
520: /*S
521: TSMonitorSolutionCtx - Context object for the `TS` `TSMonitorSolution()` monitor that views the solution at each time step using a `PetscViewer`
523: Level: developer
525: .seealso: `TS`, `TSMonitorSet()`, `TSMonitorSolution()`, `TSMonitorSolutionSetup()`
526: S*/
527: typedef struct _n_TSMonitorSolutionCtx *TSMonitorSolutionCtx;
528: PETSC_EXTERN PetscErrorCode TSMonitorSolution(TS, PetscInt, PetscReal, Vec, PetscViewerAndFormat *);
529: PETSC_EXTERN PetscErrorCode TSMonitorSolutionSetup(TS, PetscViewerAndFormat *);
531: /*S
532: TSMonitorVTKCtx - Context object for the `TS` `TSMonitorSolutionVTK()` monitor that dumps the solution to VTK files at each time step
534: Level: developer
536: .seealso: `TS`, `TSMonitorSet()`, `TSMonitorSolutionVTK()`, `TSMonitorSolutionVTKCtxCreate()`, `TSMonitorSolutionVTKDestroy()`
537: S*/
538: typedef struct _n_TSMonitorVTKCtx *TSMonitorVTKCtx;
539: PETSC_EXTERN PetscErrorCode TSMonitorSolutionVTK(TS, PetscInt, PetscReal, Vec, TSMonitorVTKCtx);
540: PETSC_EXTERN PetscErrorCode TSMonitorSolutionVTKDestroy(TSMonitorVTKCtx *);
541: PETSC_EXTERN PetscErrorCode TSMonitorSolutionVTKCtxCreate(const char *, TSMonitorVTKCtx *);
543: PETSC_EXTERN PetscErrorCode TSStep(TS);
544: PETSC_EXTERN PetscErrorCode TSEvaluateWLTE(TS, NormType, PetscInt *, PetscReal *);
545: PETSC_EXTERN PetscErrorCode TSEvaluateStep(TS, PetscInt, Vec, PetscBool *);
546: PETSC_EXTERN PetscErrorCode TSSolve(TS, Vec);
547: PETSC_EXTERN PetscErrorCode TSGetEquationType(TS, TSEquationType *);
548: PETSC_EXTERN PetscErrorCode TSSetEquationType(TS, TSEquationType);
549: PETSC_EXTERN PetscErrorCode TSGetConvergedReason(TS, TSConvergedReason *);
550: PETSC_EXTERN PetscErrorCode TSSetConvergedReason(TS, TSConvergedReason);
551: PETSC_EXTERN PetscErrorCode TSGetSolveTime(TS, PetscReal *);
552: PETSC_EXTERN PetscErrorCode TSGetSNESIterations(TS, PetscInt *);
553: PETSC_EXTERN PetscErrorCode TSGetKSPIterations(TS, PetscInt *);
554: PETSC_EXTERN PetscErrorCode TSGetStepRejections(TS, PetscInt *);
555: PETSC_EXTERN PetscErrorCode TSSetMaxStepRejections(TS, PetscInt);
556: PETSC_EXTERN PetscErrorCode TSGetSNESFailures(TS, PetscInt *);
557: PETSC_EXTERN PetscErrorCode TSSetMaxSNESFailures(TS, PetscInt);
558: PETSC_EXTERN PetscErrorCode TSSetErrorIfStepFails(TS, PetscBool);
559: PETSC_EXTERN PetscErrorCode TSRestartStep(TS);
560: PETSC_EXTERN PetscErrorCode TSRollBack(TS);
561: PETSC_EXTERN PetscErrorCode TSGetStepRollBack(TS, PetscBool *);
563: PETSC_EXTERN PetscErrorCode TSGetStages(TS, PetscInt *, Vec *[]);
565: PETSC_EXTERN PetscErrorCode TSGetTime(TS, PetscReal *);
566: PETSC_EXTERN PetscErrorCode TSSetTime(TS, PetscReal);
567: PETSC_EXTERN PetscErrorCode TSGetPrevTime(TS, PetscReal *);
568: PETSC_EXTERN PetscErrorCode TSGetTimeStep(TS, PetscReal *);
569: PETSC_EXTERN PetscErrorCode TSSetTimeStep(TS, PetscReal);
570: PETSC_EXTERN PetscErrorCode TSGetStepNumber(TS, PetscInt *);
571: PETSC_EXTERN PetscErrorCode TSSetStepNumber(TS, PetscInt);
573: /*S
574: TSRHSFunctionFn - A prototype of a `TS` right-hand-side evaluation function that would be passed to `TSSetRHSFunction()`
576: Calling Sequence:
577: + ts - timestep context
578: . t - current time
579: . u - input vector
580: . F - function vector
581: - ctx - [optional] user-defined function context
583: Level: beginner
585: Note:
586: The deprecated `TSRHSFunction` still works as a replacement for `TSRHSFunctionFn` *.
588: .seealso: [](ch_ts), `TS`, `TSSetRHSFunction()`, `DMTSSetRHSFunction()`, `TSIFunctionFn`,
589: `TSIJacobianFn`, `TSRHSJacobianFn`
590: S*/
591: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode TSRHSFunctionFn(TS ts, PetscReal t, Vec u, Vec F, PetscCtx ctx);
593: PETSC_EXTERN_TYPEDEF typedef TSRHSFunctionFn *TSRHSFunction;
595: /*S
596: TSRHSJacobianFn - A prototype of a `TS` right-hand-side Jacobian evaluation function that would be passed to `TSSetRHSJacobian()`
598: Calling Sequence:
599: + ts - the `TS` context obtained from `TSCreate()`
600: . t - current time
601: . u - input vector
602: . Amat - (approximate) Jacobian matrix
603: . Pmat - matrix from which preconditioner is to be constructed (usually the same as `Amat`)
604: - ctx - [optional] user-defined context for matrix evaluation routine
606: Level: beginner
608: Note:
609: The deprecated `TSRHSJacobian` still works as a replacement for `TSRHSJacobianFn` *.
611: .seealso: [](ch_ts), `TS`, `TSSetRHSJacobian()`, `DMTSSetRHSJacobian()`, `TSRHSFunctionFn`,
612: `TSIFunctionFn`, `TSIJacobianFn`
613: S*/
614: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode TSRHSJacobianFn(TS ts, PetscReal t, Vec u, Mat Amat, Mat Pmat, PetscCtx ctx);
616: PETSC_EXTERN_TYPEDEF typedef TSRHSJacobianFn *TSRHSJacobian;
618: /*S
619: TSRHSJacobianPFn - A prototype of a function that computes the Jacobian of G w.r.t. the parameters P where
620: U_t = G(U,P,t), as well as the location to store the matrix that would be passed to `TSSetRHSJacobianP()`
622: Calling Sequence:
623: + ts - the `TS` context
624: . t - current timestep
625: . U - input vector (current ODE solution)
626: . A - output matrix
627: - ctx - [optional] user-defined function context
629: Level: beginner
631: Note:
632: The deprecated `TSRHSJacobianP` still works as a replacement for `TSRHSJacobianPFn` *.
634: .seealso: [](ch_ts), `TS`, `TSSetRHSJacobianP()`, `TSGetRHSJacobianP()`
635: S*/
636: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode TSRHSJacobianPFn(TS ts, PetscReal t, Vec U, Mat A, PetscCtx ctx);
638: PETSC_EXTERN_TYPEDEF typedef TSRHSJacobianPFn *TSRHSJacobianP;
640: PETSC_EXTERN PetscErrorCode TSSetRHSFunction(TS, Vec, TSRHSFunctionFn *, PetscCtx);
641: PETSC_EXTERN PetscErrorCode TSGetRHSFunction(TS, Vec *, TSRHSFunctionFn **, PetscCtxRt);
642: PETSC_EXTERN PetscErrorCode TSSetRHSJacobian(TS, Mat, Mat, TSRHSJacobianFn *, PetscCtx);
643: PETSC_EXTERN PetscErrorCode TSGetRHSJacobian(TS, Mat *, Mat *, TSRHSJacobianFn **, PetscCtxRt);
644: PETSC_EXTERN PetscErrorCode TSRHSJacobianSetReuse(TS, PetscBool);
646: /*S
647: TSSolutionFn - A prototype of a `TS` solution evaluation function that would be passed to `TSSetSolutionFunction()`
649: Calling Sequence:
650: + ts - timestep context
651: . t - current time
652: . u - output vector
653: - ctx - [optional] user-defined function context
655: Level: advanced
657: Note:
658: The deprecated `TSSolutionFunction` still works as a replacement for `TSSolutionFn` *.
660: .seealso: [](ch_ts), `TS`, `TSSetSolutionFunction()`, `DMTSSetSolutionFunction()`
661: S*/
662: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode TSSolutionFn(TS ts, PetscReal t, Vec u, PetscCtx ctx);
664: PETSC_EXTERN_TYPEDEF typedef TSSolutionFn *TSSolutionFunction;
666: PETSC_EXTERN PetscErrorCode TSSetSolutionFunction(TS, TSSolutionFn *, PetscCtx);
668: /*S
669: TSForcingFn - A prototype of a `TS` forcing function evaluation function that would be passed to `TSSetForcingFunction()`
671: Calling Sequence:
672: + ts - timestep context
673: . t - current time
674: . f - output vector
675: - ctx - [optional] user-defined function context
677: Level: advanced
679: Note:
680: The deprecated `TSForcingFunction` still works as a replacement for `TSForcingFn` *.
682: .seealso: [](ch_ts), `TS`, `TSSetForcingFunction()`, `DMTSSetForcingFunction()`
683: S*/
684: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode TSForcingFn(TS ts, PetscReal t, Vec f, PetscCtx ctx);
686: PETSC_EXTERN_TYPEDEF typedef TSForcingFn *TSForcingFunction;
688: PETSC_EXTERN PetscErrorCode TSSetForcingFunction(TS, TSForcingFn *, PetscCtx);
690: /*S
691: TSIFunctionFn - A prototype of a `TS` implicit function evaluation function that would be passed to `TSSetIFunction()
693: Calling Sequence:
694: + ts - the `TS` context obtained from `TSCreate()`
695: . t - time at step/stage being solved
696: . U - state vector
697: . U_t - time derivative of state vector
698: . F - function vector
699: - ctx - [optional] user-defined context for function
701: Level: beginner
703: Note:
704: The deprecated `TSIFunction` still works as a replacement for `TSIFunctionFn` *.
706: .seealso: [](ch_ts), `TS`, `TSSetIFunction()`, `DMTSSetIFunction()`, `TSIJacobianFn`, `TSRHSFunctionFn`, `TSRHSJacobianFn`
707: S*/
708: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode TSIFunctionFn(TS ts, PetscReal t, Vec U, Vec U_t, Vec F, PetscCtx ctx);
710: PETSC_EXTERN_TYPEDEF typedef TSIFunctionFn *TSIFunction;
712: /*S
713: TSIJacobianFn - A prototype of a `TS` Jacobian evaluation function that would be passed to `TSSetIJacobian()`
715: Calling Sequence:
716: + ts - the `TS` context obtained from `TSCreate()`
717: . t - time at step/stage being solved
718: . U - state vector
719: . U_t - time derivative of state vector
720: . a - shift
721: . Amat - (approximate) Jacobian of F(t,U,W+a*U), equivalent to dF/dU + a*dF/dU_t
722: . Pmat - matrix used for constructing preconditioner, usually the same as `Amat`
723: - ctx - [optional] user-defined context for Jacobian evaluation routine
725: Level: beginner
727: Note:
728: The deprecated `TSIJacobian` still works as a replacement for `TSIJacobianFn` *.
730: .seealso: [](ch_ts), `TSSetIJacobian()`, `DMTSSetIJacobian()`, `TSIFunctionFn`, `TSRHSFunctionFn`, `TSRHSJacobianFn`
731: S*/
732: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode TSIJacobianFn(TS ts, PetscReal t, Vec U, Vec U_t, PetscReal a, Mat Amat, Mat Pmat, PetscCtx ctx);
734: PETSC_EXTERN_TYPEDEF typedef TSIJacobianFn *TSIJacobian;
736: PETSC_EXTERN PetscErrorCode TSSetIFunction(TS, Vec, TSIFunctionFn *, PetscCtx);
737: PETSC_EXTERN PetscErrorCode TSGetIFunction(TS, Vec *, TSIFunctionFn **, PetscCtxRt);
738: PETSC_EXTERN PetscErrorCode TSSetIJacobian(TS, Mat, Mat, TSIJacobianFn *, PetscCtx);
739: PETSC_EXTERN PetscErrorCode TSGetIJacobian(TS, Mat *, Mat *, TSIJacobianFn **, PetscCtxRt);
741: /*S
742: TSI2FunctionFn - A prototype of a `TS` implicit function evaluation function for 2nd order systems that would be passed to `TSSetI2Function()`
744: Calling Sequence:
745: + ts - the `TS` context obtained from `TSCreate()`
746: . t - time at step/stage being solved
747: . U - state vector
748: . U_t - time derivative of state vector
749: . U_tt - second time derivative of state vector
750: . F - function vector
751: - ctx - [optional] user-defined context for matrix evaluation routine (may be `NULL`)
753: Level: advanced
755: Note:
756: The deprecated `TSI2Function` still works as a replacement for `TSI2FunctionFn` *.
758: .seealso: [](ch_ts), `TS`, `TSSetI2Function()`, `DMTSSetI2Function()`, `TSIFunctionFn`
759: S*/
760: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode TSI2FunctionFn(TS ts, PetscReal t, Vec U, Vec U_t, Vec U_tt, Vec F, PetscCtx ctx);
762: PETSC_EXTERN_TYPEDEF typedef TSI2FunctionFn *TSI2Function;
764: /*S
765: TSI2JacobianFn - A prototype of a `TS` implicit Jacobian evaluation function for 2nd order systems that would be passed to `TSSetI2Jacobian()`
767: Calling Sequence:
768: + ts - the `TS` context obtained from `TSCreate()`
769: . t - time at step/stage being solved
770: . U - state vector
771: . U_t - time derivative of state vector
772: . U_tt - second time derivative of state vector
773: . v - shift for U_t
774: . a - shift for U_tt
775: . 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
776: . jac - matrix from which to construct the preconditioner, may be same as `J`
777: - ctx - [optional] user-defined context for matrix evaluation routine
779: Level: advanced
781: Note:
782: The deprecated `TSI2Jacobian` still works as a replacement for `TSI2JacobianFn` *.
784: .seealso: [](ch_ts), `TS`, `TSSetI2Jacobian()`, `DMTSSetI2Jacobian()`, `TSIFunctionFn`, `TSIJacobianFn`, `TSRHSFunctionFn`, `TSRHSJacobianFn`
785: S*/
786: 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);
788: PETSC_EXTERN_TYPEDEF typedef TSI2JacobianFn *TSI2Jacobian;
790: PETSC_EXTERN PetscErrorCode TSSetI2Function(TS, Vec, TSI2FunctionFn *, PetscCtx);
791: PETSC_EXTERN PetscErrorCode TSGetI2Function(TS, Vec *, TSI2FunctionFn **, PetscCtxRt);
792: PETSC_EXTERN PetscErrorCode TSSetI2Jacobian(TS, Mat, Mat, TSI2JacobianFn *, PetscCtx);
793: PETSC_EXTERN PetscErrorCode TSGetI2Jacobian(TS, Mat *, Mat *, TSI2JacobianFn **, PetscCtxRt);
795: PETSC_EXTERN PetscErrorCode TSRHSSplitSetIS(TS, const char[], IS);
796: PETSC_EXTERN PetscErrorCode TSRHSSplitGetIS(TS, const char[], IS *);
797: PETSC_EXTERN PetscErrorCode TSRHSSplitSetRHSFunction(TS, const char[], Vec, TSRHSFunctionFn *, PetscCtx);
798: PETSC_EXTERN PetscErrorCode TSRHSSplitSetIFunction(TS, const char[], Vec, TSIFunctionFn *, PetscCtx);
799: PETSC_EXTERN PetscErrorCode TSRHSSplitSetIJacobian(TS, const char[], Mat, Mat, TSIJacobianFn *, PetscCtx);
800: PETSC_EXTERN PetscErrorCode TSRHSSplitGetSubTS(TS, const char[], TS *);
801: PETSC_EXTERN PetscErrorCode TSRHSSplitGetSubTSs(TS, PetscInt *, TS *[]);
802: PETSC_EXTERN PetscErrorCode TSSetUseSplitRHSFunction(TS, PetscBool);
803: PETSC_EXTERN PetscErrorCode TSGetUseSplitRHSFunction(TS, PetscBool *);
804: PETSC_EXTERN PetscErrorCode TSRHSSplitGetSNES(TS, SNES *);
805: PETSC_EXTERN PetscErrorCode TSRHSSplitSetSNES(TS, SNES);
807: PETSC_EXTERN TSRHSFunctionFn TSComputeRHSFunctionLinear;
808: PETSC_EXTERN TSRHSJacobianFn TSComputeRHSJacobianConstant;
809: PETSC_EXTERN PetscErrorCode TSComputeIFunctionLinear(TS, PetscReal, Vec, Vec, Vec, PetscCtx);
810: PETSC_EXTERN PetscErrorCode TSComputeIJacobianConstant(TS, PetscReal, Vec, Vec, PetscReal, Mat, Mat, PetscCtx);
811: PETSC_EXTERN PetscErrorCode TSComputeSolutionFunction(TS, PetscReal, Vec);
812: PETSC_EXTERN PetscErrorCode TSComputeForcingFunction(TS, PetscReal, Vec);
813: PETSC_EXTERN PetscErrorCode TSComputeIJacobianDefaultColor(TS, PetscReal, Vec, Vec, PetscReal, Mat, Mat, PetscCtx);
814: PETSC_EXTERN PetscErrorCode TSPruneIJacobianColor(TS, Mat, Mat);
816: PETSC_EXTERN PetscErrorCode TSSetPreStep(TS, PetscErrorCode (*)(TS));
817: PETSC_EXTERN PetscErrorCode TSSetPreStage(TS, PetscErrorCode (*)(TS, PetscReal));
818: PETSC_EXTERN PetscErrorCode TSSetPostStage(TS, PetscErrorCode (*)(TS, PetscReal, PetscInt, Vec *));
819: PETSC_EXTERN PetscErrorCode TSSetPostEvaluate(TS, PetscErrorCode (*)(TS));
820: PETSC_EXTERN PetscErrorCode TSSetPostStep(TS, PetscErrorCode (*)(TS));
821: PETSC_EXTERN PetscErrorCode TSSetResize(TS, PetscBool, PetscErrorCode (*)(TS, PetscInt, PetscReal, Vec, PetscBool *, PetscCtx), PetscErrorCode (*)(TS, PetscInt, Vec[], Vec[], PetscCtx), PetscCtx);
822: PETSC_EXTERN PetscErrorCode TSPreStep(TS);
823: PETSC_EXTERN PetscErrorCode TSPreStage(TS, PetscReal);
824: PETSC_EXTERN PetscErrorCode TSPostStage(TS, PetscReal, PetscInt, Vec[]);
825: PETSC_EXTERN PetscErrorCode TSPostEvaluate(TS);
826: PETSC_EXTERN PetscErrorCode TSPostStep(TS);
827: PETSC_EXTERN PetscErrorCode TSResize(TS);
828: PETSC_EXTERN PetscErrorCode TSResizeRetrieveVec(TS, const char *, Vec *);
829: PETSC_EXTERN PetscErrorCode TSResizeRegisterVec(TS, const char *, Vec);
830: PETSC_EXTERN PetscErrorCode TSGetStepResize(TS, PetscBool *);
832: PETSC_EXTERN PetscErrorCode TSInterpolate(TS, PetscReal, Vec);
833: PETSC_EXTERN PetscErrorCode TSSetTolerances(TS, PetscReal, Vec, PetscReal, Vec);
834: PETSC_EXTERN PetscErrorCode TSGetTolerances(TS, PetscReal *, Vec *, PetscReal *, Vec *);
835: PETSC_EXTERN PetscErrorCode TSErrorWeightedNorm(TS, Vec, Vec, NormType, PetscReal *, PetscReal *, PetscReal *);
836: PETSC_EXTERN PetscErrorCode TSErrorWeightedENorm(TS, Vec, Vec, Vec, NormType, PetscReal *, PetscReal *, PetscReal *);
837: PETSC_EXTERN PetscErrorCode TSSetCFLTimeLocal(TS, PetscReal);
838: PETSC_EXTERN PetscErrorCode TSGetCFLTime(TS, PetscReal *);
839: PETSC_EXTERN PetscErrorCode TSSetFunctionDomainError(TS, PetscErrorCode (*)(TS, PetscReal, Vec, PetscBool *));
840: PETSC_EXTERN PetscErrorCode TSFunctionDomainError(TS, PetscReal, Vec, PetscBool *);
842: PETSC_EXTERN PetscErrorCode TSPseudoSetTimeStep(TS, PetscErrorCode (*)(TS, PetscReal *, PetscCtx), PetscCtx);
843: PETSC_EXTERN PetscErrorCode TSPseudoTimeStepDefault(TS, PetscReal *, PetscCtx);
844: PETSC_EXTERN PetscErrorCode TSPseudoSetMaxTimeStep(TS, PetscReal);
845: PETSC_EXTERN PetscErrorCode TSPseudoSetVerifyTimeStep(TS, PetscErrorCode (*)(TS, Vec, PetscCtx, PetscReal *, PetscBool *), PetscCtx);
846: PETSC_EXTERN PetscErrorCode TSPseudoSetTimeStepIncrement(TS, PetscReal);
847: PETSC_EXTERN PetscErrorCode TSPseudoIncrementDtFromInitialDt(TS);
848: PETSC_EXTERN PetscErrorCode TSPseudoComputeFunction(TS, Vec, Vec *, PetscReal *);
850: PETSC_EXTERN PetscErrorCode TSPythonSetType(TS, const char[]);
851: PETSC_EXTERN PetscErrorCode TSPythonGetType(TS, const char *[]);
853: PETSC_EXTERN PetscErrorCode TSComputeRHSFunction(TS, PetscReal, Vec, Vec);
854: PETSC_EXTERN PetscErrorCode TSComputeRHSJacobian(TS, PetscReal, Vec, Mat, Mat);
855: PETSC_EXTERN PetscErrorCode TSComputeIFunction(TS, PetscReal, Vec, Vec, Vec, PetscBool);
856: PETSC_EXTERN PetscErrorCode TSComputeIJacobian(TS, PetscReal, Vec, Vec, PetscReal, Mat, Mat, PetscBool);
857: PETSC_EXTERN PetscErrorCode TSComputeI2Function(TS, PetscReal, Vec, Vec, Vec, Vec);
858: PETSC_EXTERN PetscErrorCode TSComputeI2Jacobian(TS, PetscReal, Vec, Vec, Vec, PetscReal, PetscReal, Mat, Mat);
859: PETSC_EXTERN PetscErrorCode TSComputeLinearStability(TS, PetscReal, PetscReal, PetscReal *, PetscReal *);
861: PETSC_EXTERN PetscErrorCode TSVISetVariableBounds(TS, Vec, Vec);
863: PETSC_EXTERN PetscErrorCode DMTSSetBoundaryLocal(DM, PetscErrorCode (*)(DM, PetscReal, Vec, Vec, PetscCtx), PetscCtx);
864: PETSC_EXTERN PetscErrorCode DMTSSetIFunctionPre(DM, PetscErrorCode (*)(DM, PetscReal, Vec, Vec, PetscCtx), PetscCtx);
865: PETSC_EXTERN PetscErrorCode DMTSSetRHSFunction(DM, TSRHSFunctionFn *, PetscCtx);
866: PETSC_EXTERN PetscErrorCode DMTSGetRHSFunction(DM, TSRHSFunctionFn **, PetscCtxRt);
867: PETSC_EXTERN PetscErrorCode DMTSSetRHSFunctionContextDestroy(DM, PetscCtxDestroyFn *);
868: PETSC_EXTERN PetscErrorCode DMTSSetRHSJacobian(DM, TSRHSJacobianFn *, PetscCtx);
869: PETSC_EXTERN PetscErrorCode DMTSGetRHSJacobian(DM, TSRHSJacobianFn **, PetscCtxRt);
870: PETSC_EXTERN PetscErrorCode DMTSSetRHSJacobianContextDestroy(DM, PetscCtxDestroyFn *);
871: PETSC_EXTERN PetscErrorCode DMTSSetIFunction(DM, TSIFunctionFn *, PetscCtx);
872: PETSC_EXTERN PetscErrorCode DMTSGetIFunction(DM, TSIFunctionFn **, PetscCtxRt);
873: PETSC_EXTERN PetscErrorCode DMTSSetIFunctionContextDestroy(DM, PetscCtxDestroyFn *);
874: PETSC_EXTERN PetscErrorCode DMTSSetIJacobian(DM, TSIJacobianFn *, PetscCtx);
875: PETSC_EXTERN PetscErrorCode DMTSGetIJacobian(DM, TSIJacobianFn **, PetscCtxRt);
876: PETSC_EXTERN PetscErrorCode DMTSSetIJacobianContextDestroy(DM, PetscCtxDestroyFn *);
877: PETSC_EXTERN PetscErrorCode DMTSSetI2Function(DM, TSI2FunctionFn *, PetscCtx);
878: PETSC_EXTERN PetscErrorCode DMTSGetI2Function(DM, TSI2FunctionFn **, PetscCtxRt);
879: PETSC_EXTERN PetscErrorCode DMTSSetI2FunctionContextDestroy(DM, PetscCtxDestroyFn *);
880: PETSC_EXTERN PetscErrorCode DMTSSetI2Jacobian(DM, TSI2JacobianFn *, PetscCtx);
881: PETSC_EXTERN PetscErrorCode DMTSGetI2Jacobian(DM, TSI2JacobianFn **, PetscCtxRt);
882: PETSC_EXTERN PetscErrorCode DMTSSetI2JacobianContextDestroy(DM, PetscCtxDestroyFn *);
884: /*S
885: TSTransientVariableFn - A prototype of a function to transform from state to transient variables that would be passed to `TSSetTransientVariable()`
887: Calling Sequence:
888: + ts - timestep context
889: . p - input vector (primitive form)
890: . c - output vector, transient variables (conservative form)
891: - ctx - [optional] user-defined function context
893: Level: advanced
895: Note:
896: The deprecated `TSTransientVariable` still works as a replacement for `TSTransientVariableFn` *.
898: .seealso: [](ch_ts), `TS`, `TSSetTransientVariable()`, `DMTSSetTransientVariable()`
899: S*/
900: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode TSTransientVariableFn(TS ts, Vec p, Vec c, PetscCtx ctx);
902: PETSC_EXTERN_TYPEDEF typedef TSTransientVariableFn *TSTransientVariable;
904: PETSC_EXTERN PetscErrorCode TSSetTransientVariable(TS, TSTransientVariableFn *, PetscCtx);
905: PETSC_EXTERN PetscErrorCode DMTSSetTransientVariable(DM, TSTransientVariableFn *, PetscCtx);
906: PETSC_EXTERN PetscErrorCode DMTSGetTransientVariable(DM, TSTransientVariableFn **, PetscCtx);
907: PETSC_EXTERN PetscErrorCode TSComputeTransientVariable(TS, Vec, Vec);
908: PETSC_EXTERN PetscErrorCode TSHasTransientVariable(TS, PetscBool *);
910: PETSC_EXTERN PetscErrorCode DMTSSetSolutionFunction(DM, TSSolutionFn *, PetscCtx);
911: PETSC_EXTERN PetscErrorCode DMTSGetSolutionFunction(DM, TSSolutionFn **, PetscCtxRt);
912: PETSC_EXTERN PetscErrorCode DMTSSetForcingFunction(DM, TSForcingFn *, PetscCtx);
913: PETSC_EXTERN PetscErrorCode DMTSGetForcingFunction(DM, TSForcingFn **, PetscCtxRt);
914: PETSC_EXTERN PetscErrorCode DMTSCheckResidual(TS, DM, PetscReal, Vec, Vec, PetscReal, PetscReal *);
915: PETSC_EXTERN PetscErrorCode DMTSCheckJacobian(TS, DM, PetscReal, Vec, Vec, PetscReal, PetscBool *, PetscReal *);
916: PETSC_EXTERN PetscErrorCode DMTSCheckFromOptions(TS, Vec);
918: PETSC_EXTERN PetscErrorCode DMTSGetIFunctionLocal(DM, PetscErrorCode (**)(DM, PetscReal, Vec, Vec, Vec, PetscCtx), PetscCtxRt);
919: PETSC_EXTERN PetscErrorCode DMTSSetIFunctionLocal(DM, PetscErrorCode (*)(DM, PetscReal, Vec, Vec, Vec, PetscCtx), PetscCtx);
920: PETSC_EXTERN PetscErrorCode DMTSGetIJacobianLocal(DM, PetscErrorCode (**)(DM, PetscReal, Vec, Vec, PetscReal, Mat, Mat, PetscCtx), PetscCtxRt);
921: PETSC_EXTERN PetscErrorCode DMTSSetIJacobianLocal(DM, PetscErrorCode (*)(DM, PetscReal, Vec, Vec, PetscReal, Mat, Mat, PetscCtx), PetscCtx);
922: PETSC_EXTERN PetscErrorCode DMTSGetRHSFunctionLocal(DM, PetscErrorCode (**)(DM, PetscReal, Vec, Vec, PetscCtx), PetscCtxRt);
923: PETSC_EXTERN PetscErrorCode DMTSSetRHSFunctionLocal(DM, PetscErrorCode (*)(DM, PetscReal, Vec, Vec, PetscCtx), PetscCtx);
924: PETSC_EXTERN PetscErrorCode DMTSCreateRHSMassMatrix(DM);
925: PETSC_EXTERN PetscErrorCode DMTSCreateRHSMassMatrixLumped(DM);
926: PETSC_EXTERN PetscErrorCode DMTSDestroyRHSMassMatrix(DM);
928: PETSC_EXTERN PetscErrorCode DMTSSetIFunctionSerialize(DM, PetscErrorCode (*)(PetscCtx, PetscViewer), PetscErrorCode (*)(PetscCtx *, PetscViewer));
929: PETSC_EXTERN PetscErrorCode DMTSSetIJacobianSerialize(DM, PetscErrorCode (*)(PetscCtx, PetscViewer), PetscErrorCode (*)(PetscCtx *, PetscViewer));
931: /*S
932: DMDATSRHSFunctionLocalFn - A prototype of a local `TS` right-hand side residual evaluation function for use with `DMDA` that would be passed to `DMDATSSetRHSFunctionLocal()`
934: Calling Sequence:
935: + info - defines the subdomain to evaluate the residual on
936: . t - time at which to evaluate residual
937: . x - array of local state information
938: . f - output array of local residual information
939: - ctx - optional application context
941: Level: beginner
943: Note:
944: The deprecated `DMDATSRHSFunctionLocal` still works as a replacement for `DMDATSRHSFunctionLocalFn` *.
946: .seealso: `DMDA`, `DMDATSSetRHSFunctionLocal()`, `TSRHSFunctionFn`, `DMDATSRHSJacobianLocalFn`, `DMDATSIJacobianLocalFn`, `DMDATSIFunctionLocalFn`
947: S*/
948: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode DMDATSRHSFunctionLocalFn(DMDALocalInfo *info, PetscReal t, void *x, void *f, PetscCtx ctx);
950: PETSC_EXTERN_TYPEDEF typedef DMDATSRHSFunctionLocalFn *DMDATSRHSFunctionLocal;
952: /*S
953: DMDATSRHSJacobianLocalFn - A prototype of a local residual evaluation function for use with `DMDA` that would be passed to `DMDATSSetRHSJacobianLocal()`
955: Calling Sequence:
956: + info - defines the subdomain to evaluate the residual on
957: . t - time at which to evaluate residual
958: . x - array of local state information
959: . J - Jacobian matrix
960: . B - matrix from which to construct the preconditioner; often same as `J`
961: - ctx - optional context
963: Level: beginner
965: Note:
966: The deprecated `DMDATSRHSJacobianLocal` still works as a replacement for `DMDATSRHSJacobianLocalFn` *.
968: .seealso: `DMDA`, `DMDATSSetRHSJacobianLocal()`, `TSRHSJacobianFn`, `DMDATSRHSFunctionLocalFn`, `DMDATSIJacobianLocalFn`, `DMDATSIFunctionLocalFn`
969: S*/
970: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode DMDATSRHSJacobianLocalFn(DMDALocalInfo *info, PetscReal t, void *x, Mat J, Mat B, PetscCtx ctx);
972: PETSC_EXTERN_TYPEDEF typedef DMDATSRHSJacobianLocalFn *DMDATSRHSJacobianLocal;
974: /*S
975: DMDATSIFunctionLocalFn - A prototype of a local residual evaluation function for use with `DMDA` that would be passed to `DMDATSSetIFunctionLocal()`
977: Calling Sequence:
978: + info - defines the subdomain to evaluate the residual on
979: . t - time at which to evaluate residual
980: . x - array of local state information
981: . xdot - array of local time derivative information
982: . imode - output array of local function evaluation information
983: - ctx - optional context
985: Level: beginner
987: Note:
988: The deprecated `DMDATSIFunctionLocal` still works as a replacement for `DMDATSIFunctionLocalFn` *.
990: .seealso: `DMDA`, `DMDATSSetIFunctionLocal()`, `DMDATSIJacobianLocalFn`, `TSIFunctionFn`
991: S*/
992: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode DMDATSIFunctionLocalFn(DMDALocalInfo *info, PetscReal t, void *x, void *xdot, void *imode, PetscCtx ctx);
994: PETSC_EXTERN_TYPEDEF typedef DMDATSIFunctionLocalFn *DMDATSIFunctionLocal;
996: /*S
997: DMDATSIJacobianLocalFn - A prototype of a local residual evaluation function for use with `DMDA` that would be passed to `DMDATSSetIJacobianLocal()`
999: Calling Sequence:
1000: + info - defines the subdomain to evaluate the residual on
1001: . t - time at which to evaluate the jacobian
1002: . x - array of local state information
1003: . xdot - time derivative at this state
1004: . shift - see `TSSetIJacobian()` for the meaning of this parameter
1005: . J - Jacobian matrix
1006: . B - matrix from which to construct the preconditioner; often same as `J`
1007: - ctx - optional context
1009: Level: beginner
1011: Note:
1012: The deprecated `DMDATSIJacobianLocal` still works as a replacement for `DMDATSIJacobianLocalFn` *.
1014: .seealso: `DMDA`, `DMDATSSetIJacobianLocal()`, `TSIJacobianFn`, `DMDATSIFunctionLocalFn`, `DMDATSRHSFunctionLocalFn`, `DMDATSRHSJacobianlocal()`
1015: S*/
1016: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode DMDATSIJacobianLocalFn(DMDALocalInfo *info, PetscReal t, void *x, void *xdot, PetscReal shift, Mat J, Mat B, PetscCtx ctx);
1018: PETSC_EXTERN_TYPEDEF typedef DMDATSIJacobianLocalFn *DMDATSIJacobianLocal;
1020: PETSC_EXTERN PetscErrorCode DMDATSSetRHSFunctionLocal(DM, InsertMode, DMDATSRHSFunctionLocalFn *, void *);
1021: PETSC_EXTERN PetscErrorCode DMDATSSetRHSJacobianLocal(DM, DMDATSRHSJacobianLocalFn *, void *);
1022: PETSC_EXTERN PetscErrorCode DMDATSSetIFunctionLocal(DM, InsertMode, DMDATSIFunctionLocalFn *, void *);
1023: PETSC_EXTERN PetscErrorCode DMDATSSetIJacobianLocal(DM, DMDATSIJacobianLocalFn *, void *);
1025: /*S
1026: TSMonitorLGCtx - Context object for `TS` line-graph monitor routines that plot residuals, iteration counts or solution components at each time step on a `PetscDrawLG`
1028: Level: developer
1030: .seealso: `TS`, `TSMonitorLGCtxCreate()`, `TSMonitorLGCtxDestroy()`, `TSMonitorLGSolution()`, `TSMonitorLGTimeStep()`, `TSMonitorLGError()`
1031: S*/
1032: typedef struct _n_TSMonitorLGCtx *TSMonitorLGCtx;
1034: /*S
1035: TSMonitorDMDARayCtx - Context object for `TSMonitorDMDARay()`
1037: Level: developer
1039: .seealso: `TS`, `TSSetMonitor()`, `TSMonitorDMDARay()`, `TSMonitorDMDARayDestroy()`
1040: S*/
1041: typedef struct {
1042: Vec ray;
1043: VecScatter scatter;
1044: PetscViewer viewer;
1045: TSMonitorLGCtx lgctx;
1046: } TSMonitorDMDARayCtx;
1047: PETSC_EXTERN PetscErrorCode TSMonitorDMDARayDestroy(PetscCtxRt);
1048: PETSC_EXTERN PetscErrorCode TSMonitorDMDARay(TS, PetscInt, PetscReal, Vec, void *);
1049: PETSC_EXTERN PetscErrorCode TSMonitorLGDMDARay(TS, PetscInt, PetscReal, Vec, void *);
1051: /* Dynamic creation and loading functions */
1052: PETSC_EXTERN PetscFunctionList TSList;
1053: PETSC_EXTERN PetscErrorCode TSGetType(TS, TSType *);
1054: PETSC_EXTERN PetscErrorCode TSSetType(TS, TSType);
1055: PETSC_EXTERN PetscErrorCode TSRegister(const char[], PetscErrorCode (*)(TS));
1057: PETSC_EXTERN PetscErrorCode TSGetSNES(TS, SNES *);
1058: PETSC_EXTERN PetscErrorCode TSSetSNES(TS, SNES);
1059: PETSC_EXTERN PetscErrorCode TSGetKSP(TS, KSP *);
1060: PETSC_EXTERN PetscErrorCode TSIsImplicit(TS, PetscBool *);
1062: PETSC_EXTERN PetscErrorCode TSView(TS, PetscViewer);
1063: PETSC_EXTERN PetscErrorCode TSLoad(TS, PetscViewer);
1064: PETSC_EXTERN PetscErrorCode TSViewFromOptions(TS, PetscObject, const char[]);
1065: PETSC_EXTERN PetscErrorCode TSTrajectoryViewFromOptions(TSTrajectory, PetscObject, const char[]);
1067: #define TS_FILE_CLASSID 1211225
1069: PETSC_EXTERN PetscErrorCode TSSetApplicationContext(TS, PetscCtx);
1070: PETSC_EXTERN PetscErrorCode TSGetApplicationContext(TS, PetscCtxRt);
1072: PETSC_EXTERN PetscErrorCode TSMonitorLGCtxCreate(MPI_Comm, const char[], const char[], int, int, int, int, PetscInt, TSMonitorLGCtx *);
1073: PETSC_EXTERN PetscErrorCode TSMonitorLGCtxDestroy(TSMonitorLGCtx *);
1074: PETSC_EXTERN PetscErrorCode TSMonitorLGTimeStep(TS, PetscInt, PetscReal, Vec, void *);
1075: PETSC_EXTERN PetscErrorCode TSMonitorLGSolution(TS, PetscInt, PetscReal, Vec, void *);
1076: PETSC_EXTERN PetscErrorCode TSMonitorLGSetVariableNames(TS, const char *const *);
1077: PETSC_EXTERN PetscErrorCode TSMonitorLGGetVariableNames(TS, const char *const **);
1078: PETSC_EXTERN PetscErrorCode TSMonitorLGCtxSetVariableNames(TSMonitorLGCtx, const char *const *);
1079: PETSC_EXTERN PetscErrorCode TSMonitorLGSetDisplayVariables(TS, const char *const *);
1080: PETSC_EXTERN PetscErrorCode TSMonitorLGCtxSetDisplayVariables(TSMonitorLGCtx, const char *const *);
1081: PETSC_EXTERN PetscErrorCode TSMonitorLGSetTransform(TS, PetscErrorCode (*)(void *, Vec, Vec *), PetscCtxDestroyFn *, void *);
1082: PETSC_EXTERN PetscErrorCode TSMonitorLGCtxSetTransform(TSMonitorLGCtx, PetscErrorCode (*)(void *, Vec, Vec *), PetscCtxDestroyFn *, void *);
1083: PETSC_EXTERN PetscErrorCode TSMonitorLGError(TS, PetscInt, PetscReal, Vec, void *);
1084: PETSC_EXTERN PetscErrorCode TSMonitorLGSNESIterations(TS, PetscInt, PetscReal, Vec, void *);
1085: PETSC_EXTERN PetscErrorCode TSMonitorLGKSPIterations(TS, PetscInt, PetscReal, Vec, void *);
1086: PETSC_EXTERN PetscErrorCode TSMonitorError(TS, PetscInt, PetscReal, Vec, PetscViewerAndFormat *);
1087: PETSC_EXTERN PetscErrorCode TSDMSwarmMonitorMoments(TS, PetscInt, PetscReal, Vec, PetscViewerAndFormat *);
1089: struct _n_TSMonitorLGCtxNetwork {
1090: PetscInt nlg;
1091: PetscDrawLG *lg;
1092: PetscBool semilogy;
1093: PetscInt howoften; /* when > 0 uses step % howoften, when negative only final solution plotted */
1094: };
1095: /*S
1096: TSMonitorLGCtxNetwork - Context object for the `TSMonitorLGCtxNetworkSolution()` line-graph monitor that plots solution components on each subnetwork of a `DMNETWORK`
1098: Level: developer
1100: .seealso: `TS`, `DMNETWORK`, `TSMonitorLGCtxNetworkCreate()`, `TSMonitorLGCtxNetworkDestroy()`, `TSMonitorLGCtxNetworkSolution()`
1101: S*/
1102: typedef struct _n_TSMonitorLGCtxNetwork *TSMonitorLGCtxNetwork;
1103: PETSC_EXTERN PetscErrorCode TSMonitorLGCtxNetworkDestroy(TSMonitorLGCtxNetwork *);
1104: PETSC_EXTERN PetscErrorCode TSMonitorLGCtxNetworkCreate(TS, const char[], const char[], int, int, int, int, PetscInt, TSMonitorLGCtxNetwork *);
1105: PETSC_EXTERN PetscErrorCode TSMonitorLGCtxNetworkSolution(TS, PetscInt, PetscReal, Vec, void *);
1107: /*S
1108: TSMonitorEnvelopeCtx - Context object for the `TSMonitorEnvelope()` monitor that tracks the per-component min/max envelope of the solution over a time integration
1110: Level: developer
1112: .seealso: `TS`, `TSMonitorEnvelopeCtxCreate()`, `TSMonitorEnvelopeCtxDestroy()`, `TSMonitorEnvelope()`, `TSMonitorEnvelopeGetBounds()`
1113: S*/
1114: typedef struct _n_TSMonitorEnvelopeCtx *TSMonitorEnvelopeCtx;
1115: PETSC_EXTERN PetscErrorCode TSMonitorEnvelopeCtxCreate(TS, TSMonitorEnvelopeCtx *);
1116: PETSC_EXTERN PetscErrorCode TSMonitorEnvelope(TS, PetscInt, PetscReal, Vec, void *);
1117: PETSC_EXTERN PetscErrorCode TSMonitorEnvelopeGetBounds(TS, Vec *, Vec *);
1118: PETSC_EXTERN PetscErrorCode TSMonitorEnvelopeCtxDestroy(TSMonitorEnvelopeCtx *);
1120: /*S
1121: TSMonitorSPEigCtx - Context object for the `TSMonitorSPEig()` monitor that displays an estimate of the spectrum of the operator using a `PetscDrawSP` scatter plot
1123: Level: developer
1125: .seealso: `TS`, `TSMonitorSPEigCtxCreate()`, `TSMonitorSPEigCtxDestroy()`, `TSMonitorSPEig()`
1126: S*/
1127: typedef struct _n_TSMonitorSPEigCtx *TSMonitorSPEigCtx;
1128: PETSC_EXTERN PetscErrorCode TSMonitorSPEigCtxCreate(MPI_Comm, const char[], const char[], int, int, int, int, PetscInt, TSMonitorSPEigCtx *);
1129: PETSC_EXTERN PetscErrorCode TSMonitorSPEigCtxDestroy(TSMonitorSPEigCtx *);
1130: PETSC_EXTERN PetscErrorCode TSMonitorSPEig(TS, PetscInt, PetscReal, Vec, void *);
1132: /*S
1133: TSMonitorSPCtx - Context object for the `TSMonitorSPSwarmSolution()` scatter-plot monitor that draws the swarm particle positions at each time step on a `PetscDrawSP`
1135: Level: developer
1137: .seealso: `TS`, `DMSWARM`, `TSMonitorSPCtxCreate()`, `TSMonitorSPCtxDestroy()`, `TSMonitorSPSwarmSolution()`
1138: S*/
1139: typedef struct _n_TSMonitorSPCtx *TSMonitorSPCtx;
1140: PETSC_EXTERN PetscErrorCode TSMonitorSPCtxCreate(MPI_Comm, const char[], const char[], int, int, int, int, PetscInt, PetscInt, PetscBool, PetscBool, TSMonitorSPCtx *);
1141: PETSC_EXTERN PetscErrorCode TSMonitorSPCtxDestroy(TSMonitorSPCtx *);
1142: PETSC_EXTERN PetscErrorCode TSMonitorSPSwarmSolution(TS, PetscInt, PetscReal, Vec, void *);
1144: /*S
1145: TSMonitorHGCtx - Context object for the `TSMonitorHGSwarmSolution()` histogram monitor that displays a histogram of `DMSWARM` particle quantities at each time step
1147: Level: developer
1149: .seealso: `TS`, `DMSWARM`, `TSMonitorHGCtxCreate()`, `TSMonitorHGCtxDestroy()`, `TSMonitorHGSwarmSolution()`
1150: S*/
1151: typedef struct _n_TSMonitorHGCtx *TSMonitorHGCtx;
1152: PETSC_EXTERN PetscErrorCode TSMonitorHGCtxCreate(MPI_Comm, const char[], const char[], int, int, int, int, PetscInt, PetscInt, PetscInt, PetscBool, TSMonitorHGCtx *);
1153: PETSC_EXTERN PetscErrorCode TSMonitorHGSwarmSolution(TS, PetscInt, PetscReal, Vec, void *);
1154: PETSC_EXTERN PetscErrorCode TSMonitorHGCtxDestroy(TSMonitorHGCtx *);
1155: PETSC_EXTERN PetscErrorCode TSMonitorHGSwarmSolution(TS, PetscInt, PetscReal, Vec, void *);
1157: /*M
1158: TSEvent - Abstract object to handle event detection in `TS` time integrator
1160: Level: intermediate
1162: Note:
1163: See `TSSetEventHandler()` for the management of events.
1165: .seealso: [](sec_ts_event), `TS`, `TSSetEventHandler()`, `TSSetPostEventStep()`, `TSSetPostEventSecondStep()`, `TSSetEventTolerances()`, `TSGetNumEvents()`
1166: M*/
1167: typedef struct _n_TSEvent *TSEvent;
1169: PETSC_EXTERN PetscErrorCode TSSetEventHandler(TS, PetscInt, PetscInt[], PetscBool[], PetscErrorCode (*)(TS, PetscReal, Vec, PetscReal[], void *), PetscErrorCode (*)(TS, PetscInt, PetscInt[], PetscReal, Vec, PetscBool, void *), void *);
1170: PETSC_EXTERN PetscErrorCode TSSetPostEventStep(TS, PetscReal);
1171: PETSC_EXTERN PetscErrorCode TSSetPostEventSecondStep(TS, PetscReal);
1172: PETSC_DEPRECATED_FUNCTION(3, 21, 0, "TSSetPostEventSecondStep()", ) static inline PetscErrorCode TSSetPostEventIntervalStep(TS ts, PetscReal dt)
1173: {
1174: return TSSetPostEventSecondStep(ts, dt);
1175: }
1176: PETSC_EXTERN PetscErrorCode TSSetEventTolerances(TS, PetscReal, PetscReal[]);
1177: PETSC_EXTERN PetscErrorCode TSGetNumEvents(TS, PetscInt *);
1179: /*J
1180: TSSSPType - string with the name of a `TSSSP` scheme.
1182: Level: beginner
1184: .seealso: [](ch_ts), `TSSSPSetType()`, `TS`, `TSSSP`
1185: J*/
1186: typedef const char *TSSSPType;
1187: #define TSSSPRKS2 "rks2"
1188: #define TSSSPRKS3 "rks3"
1189: #define TSSSPRK104 "rk104"
1191: PETSC_EXTERN PetscErrorCode TSSSPSetType(TS, TSSSPType);
1192: PETSC_EXTERN PetscErrorCode TSSSPGetType(TS, TSSSPType *);
1193: PETSC_EXTERN PetscErrorCode TSSSPSetNumStages(TS, PetscInt);
1194: PETSC_EXTERN PetscErrorCode TSSSPGetNumStages(TS, PetscInt *);
1195: PETSC_EXTERN PetscErrorCode TSSSPInitializePackage(void);
1196: PETSC_EXTERN PetscErrorCode TSSSPFinalizePackage(void);
1197: PETSC_EXTERN PetscFunctionList TSSSPList;
1199: /*S
1200: TSAdapt - Abstract object that manages time-step adaptivity
1202: Level: beginner
1204: .seealso: [](ch_ts), [](sec_ts_error_control), `TS`, `TSGetAdapt()`, `TSAdaptCreate()`, `TSAdaptType`
1205: S*/
1206: typedef struct _p_TSAdapt *TSAdapt;
1208: /*J
1209: TSAdaptType - String with the name of `TSAdapt` scheme.
1211: Level: beginner
1213: .seealso: [](ch_ts), [](sec_ts_error_control), `TSGetAdapt()`, `TSAdaptSetType()`, `TS`, `TSAdapt`
1214: J*/
1215: typedef const char *TSAdaptType;
1216: #define TSADAPTNONE "none"
1217: #define TSADAPTBASIC "basic"
1218: #define TSADAPTDSP "dsp"
1219: #define TSADAPTCFL "cfl"
1220: #define TSADAPTGLEE "glee"
1221: #define TSADAPTHISTORY "history"
1223: PETSC_EXTERN PetscErrorCode TSGetAdapt(TS, TSAdapt *);
1224: PETSC_EXTERN PetscErrorCode TSAdaptRegister(const char[], PetscErrorCode (*)(TSAdapt));
1225: PETSC_EXTERN PetscErrorCode TSAdaptInitializePackage(void);
1226: PETSC_EXTERN PetscErrorCode TSAdaptFinalizePackage(void);
1227: PETSC_EXTERN PetscErrorCode TSAdaptCreate(MPI_Comm, TSAdapt *);
1228: PETSC_EXTERN PetscErrorCode TSAdaptSetType(TSAdapt, TSAdaptType);
1229: PETSC_EXTERN PetscErrorCode TSAdaptGetType(TSAdapt, TSAdaptType *);
1230: PETSC_EXTERN PetscErrorCode TSAdaptSetOptionsPrefix(TSAdapt, const char[]);
1231: PETSC_EXTERN PetscErrorCode TSAdaptCandidatesClear(TSAdapt);
1232: PETSC_EXTERN PetscErrorCode TSAdaptCandidateAdd(TSAdapt, const char[], PetscInt, PetscInt, PetscReal, PetscReal, PetscBool);
1233: PETSC_EXTERN PetscErrorCode TSAdaptCandidatesGet(TSAdapt, PetscInt *, const PetscInt **, const PetscInt **, const PetscReal **, const PetscReal **);
1234: PETSC_EXTERN PetscErrorCode TSAdaptChoose(TSAdapt, TS, PetscReal, PetscInt *, PetscReal *, PetscBool *);
1235: PETSC_EXTERN PetscErrorCode TSAdaptCheckStage(TSAdapt, TS, PetscReal, Vec, PetscBool *);
1236: PETSC_EXTERN PetscErrorCode TSAdaptView(TSAdapt, PetscViewer);
1237: PETSC_EXTERN PetscErrorCode TSAdaptLoad(TSAdapt, PetscViewer);
1238: PETSC_EXTERN PetscErrorCode TSAdaptSetFromOptions(TSAdapt, PetscOptionItems);
1239: PETSC_EXTERN PetscErrorCode TSAdaptReset(TSAdapt);
1240: PETSC_EXTERN PetscErrorCode TSAdaptDestroy(TSAdapt *);
1241: PETSC_EXTERN PetscErrorCode TSAdaptSetMonitor(TSAdapt, PetscBool);
1242: PETSC_EXTERN PetscErrorCode TSAdaptSetAlwaysAccept(TSAdapt, PetscBool);
1243: PETSC_EXTERN PetscErrorCode TSAdaptSetSafety(TSAdapt, PetscReal, PetscReal);
1244: PETSC_EXTERN PetscErrorCode TSAdaptGetSafety(TSAdapt, PetscReal *, PetscReal *);
1245: PETSC_EXTERN PetscErrorCode TSAdaptSetMaxIgnore(TSAdapt, PetscReal);
1246: PETSC_EXTERN PetscErrorCode TSAdaptGetMaxIgnore(TSAdapt, PetscReal *);
1247: PETSC_EXTERN PetscErrorCode TSAdaptSetClip(TSAdapt, PetscReal, PetscReal);
1248: PETSC_EXTERN PetscErrorCode TSAdaptGetClip(TSAdapt, PetscReal *, PetscReal *);
1249: PETSC_EXTERN PetscErrorCode TSAdaptSetScaleSolveFailed(TSAdapt, PetscReal);
1250: PETSC_EXTERN PetscErrorCode TSAdaptGetScaleSolveFailed(TSAdapt, PetscReal *);
1251: PETSC_EXTERN PetscErrorCode TSAdaptSetStepLimits(TSAdapt, PetscReal, PetscReal);
1252: PETSC_EXTERN PetscErrorCode TSAdaptGetStepLimits(TSAdapt, PetscReal *, PetscReal *);
1253: PETSC_EXTERN PetscErrorCode TSAdaptSetCheckStage(TSAdapt, PetscErrorCode (*)(TSAdapt, TS, PetscReal, Vec, PetscBool *));
1254: PETSC_EXTERN PetscErrorCode TSAdaptHistorySetHistory(TSAdapt, PetscInt, PetscReal[], PetscBool);
1255: PETSC_EXTERN PetscErrorCode TSAdaptHistorySetTrajectory(TSAdapt, TSTrajectory, PetscBool);
1256: PETSC_EXTERN PetscErrorCode TSAdaptHistoryGetStep(TSAdapt, PetscInt, PetscReal *, PetscReal *);
1257: PETSC_EXTERN PetscErrorCode TSAdaptSetTimeStepIncreaseDelay(TSAdapt, PetscInt);
1258: PETSC_EXTERN PetscErrorCode TSAdaptDSPSetFilter(TSAdapt, const char *);
1259: PETSC_EXTERN PetscErrorCode TSAdaptDSPSetPID(TSAdapt, PetscReal, PetscReal, PetscReal);
1261: /*S
1262: TSGLLEAdapt - Abstract object that manages time-step adaptivity for `TSGLLE`
1264: Level: beginner
1266: Developer Note:
1267: This functionality should be replaced by the `TSAdapt`.
1269: .seealso: [](ch_ts), `TS`, `TSGLLE`, `TSGLLEAdaptCreate()`, `TSGLLEAdaptType`
1270: S*/
1271: typedef struct _p_TSGLLEAdapt *TSGLLEAdapt;
1273: /*J
1274: TSGLLEAdaptType - String with the name of `TSGLLEAdapt` scheme
1276: Level: beginner
1278: Developer Note:
1279: This functionality should be replaced by the `TSAdaptType`.
1281: .seealso: [](ch_ts), `TSGLLEAdaptSetType()`, `TS`
1282: J*/
1283: typedef const char *TSGLLEAdaptType;
1284: #define TSGLLEADAPT_NONE "none"
1285: #define TSGLLEADAPT_SIZE "size"
1286: #define TSGLLEADAPT_BOTH "both"
1288: PETSC_EXTERN PetscErrorCode TSGLLEAdaptRegister(const char[], PetscErrorCode (*)(TSGLLEAdapt));
1289: PETSC_EXTERN PetscErrorCode TSGLLEAdaptInitializePackage(void);
1290: PETSC_EXTERN PetscErrorCode TSGLLEAdaptFinalizePackage(void);
1291: PETSC_EXTERN PetscErrorCode TSGLLEAdaptCreate(MPI_Comm, TSGLLEAdapt *);
1292: PETSC_EXTERN PetscErrorCode TSGLLEAdaptSetType(TSGLLEAdapt, TSGLLEAdaptType);
1293: PETSC_EXTERN PetscErrorCode TSGLLEAdaptSetOptionsPrefix(TSGLLEAdapt, const char[]);
1294: PETSC_EXTERN PetscErrorCode TSGLLEAdaptChoose(TSGLLEAdapt, PetscInt, const PetscInt[], const PetscReal[], const PetscReal[], PetscInt, PetscReal, PetscReal, PetscInt *, PetscReal *, PetscBool *);
1295: PETSC_EXTERN PetscErrorCode TSGLLEAdaptView(TSGLLEAdapt, PetscViewer);
1296: PETSC_EXTERN PetscErrorCode TSGLLEAdaptSetFromOptions(TSGLLEAdapt, PetscOptionItems);
1297: PETSC_EXTERN PetscErrorCode TSGLLEAdaptDestroy(TSGLLEAdapt *);
1299: /*J
1300: TSGLLEAcceptType - String with the name of `TSGLLEAccept` scheme
1302: Level: beginner
1304: .seealso: [](ch_ts), `TSGLLESetAcceptType()`, `TS`, `TSGLLEAccept`
1305: J*/
1306: typedef const char *TSGLLEAcceptType;
1307: #define TSGLLEACCEPT_ALWAYS "always"
1309: /*S
1310: TSGLLEAcceptFn - A prototype of a `TS` accept function that would be passed to `TSGLLEAcceptRegister()`
1312: Calling Sequence:
1313: + ts - timestep context
1314: . nt - time to end of solution time
1315: . h - the proposed step-size
1316: . enorm - unknown
1317: - accept - output, if the proposal is accepted
1319: Level: beginner
1321: Note:
1322: The deprecated `TSGLLEAcceptFunction` still works as a replacement for `TSGLLEAcceptFn` *
1324: .seealso: [](ch_ts), `TS`, `TSSetRHSFunction()`, `DMTSSetRHSFunction()`, `TSIFunctionFn`,
1325: `TSIJacobianFn`, `TSRHSJacobianFn`, `TSGLLEAcceptRegister()`
1326: S*/
1327: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode TSGLLEAcceptFn(TS ts, PetscReal nt, PetscReal h, const PetscReal enorm[], PetscBool *accept);
1329: PETSC_EXTERN_TYPEDEF typedef TSGLLEAcceptFn *TSGLLEAcceptFunction;
1331: PETSC_EXTERN PetscErrorCode TSGLLEAcceptRegister(const char[], TSGLLEAcceptFn *);
1333: /*J
1334: TSGLLEType - string with the name of a General Linear `TSGLLE` type
1336: Level: beginner
1338: .seealso: [](ch_ts), `TS`, `TSGLLE`, `TSGLLESetType()`, `TSGLLERegister()`, `TSGLLEAccept`
1339: J*/
1340: typedef const char *TSGLLEType;
1341: #define TSGLLE_IRKS "irks"
1343: PETSC_EXTERN PetscErrorCode TSGLLERegister(const char[], PetscErrorCode (*)(TS));
1344: PETSC_EXTERN PetscErrorCode TSGLLEInitializePackage(void);
1345: PETSC_EXTERN PetscErrorCode TSGLLEFinalizePackage(void);
1346: PETSC_EXTERN PetscErrorCode TSGLLESetType(TS, TSGLLEType);
1347: PETSC_EXTERN PetscErrorCode TSGLLEGetAdapt(TS, TSGLLEAdapt *);
1348: PETSC_EXTERN PetscErrorCode TSGLLESetAcceptType(TS, TSGLLEAcceptType);
1350: /*J
1351: TSEIMEXType - String with the name of an Extrapolated IMEX `TSEIMEX` type
1353: Level: beginner
1355: .seealso: [](ch_ts), `TSEIMEXSetType()`, `TS`, `TSEIMEX`, `TSEIMEXRegister()`
1356: J*/
1357: #define TSEIMEXType char *
1359: PETSC_EXTERN PetscErrorCode TSEIMEXSetMaxRows(TS, PetscInt);
1360: PETSC_EXTERN PetscErrorCode TSEIMEXSetRowCol(TS, PetscInt, PetscInt);
1361: PETSC_EXTERN PetscErrorCode TSEIMEXSetOrdAdapt(TS, PetscBool);
1363: /*J
1364: TSRKType - String with the name of a Runge-Kutta `TSRK` type
1366: Level: beginner
1368: .seealso: [](ch_ts), `TS`, `TSRKSetType()`, `TSRK`, `TSRKRegister()`
1369: J*/
1370: typedef const char *TSRKType;
1371: #define TSRK1FE "1fe"
1372: #define TSRK2A "2a"
1373: #define TSRK2B "2b"
1374: #define TSRK3 "3"
1375: #define TSRK3BS "3bs"
1376: #define TSRK4 "4"
1377: #define TSRK5F "5f"
1378: #define TSRK5DP "5dp"
1379: #define TSRK5BS "5bs"
1380: #define TSRK6VR "6vr"
1381: #define TSRK7VR "7vr"
1382: #define TSRK8VR "8vr"
1384: PETSC_EXTERN PetscErrorCode TSRKGetOrder(TS, PetscInt *);
1385: PETSC_EXTERN PetscErrorCode TSRKGetType(TS, TSRKType *);
1386: PETSC_EXTERN PetscErrorCode TSRKSetType(TS, TSRKType);
1387: PETSC_EXTERN PetscErrorCode TSRKGetTableau(TS, PetscInt *, const PetscReal *[], const PetscReal *[], const PetscReal *[], const PetscReal *[], PetscInt *, const PetscReal *[], PetscBool *);
1388: PETSC_EXTERN PetscErrorCode TSRKSetMultirate(TS, PetscBool);
1389: PETSC_EXTERN PetscErrorCode TSRKGetMultirate(TS, PetscBool *);
1390: PETSC_EXTERN PetscErrorCode TSRKRegister(TSRKType, PetscInt, PetscInt, const PetscReal[], const PetscReal[], const PetscReal[], const PetscReal[], PetscInt, const PetscReal[]);
1391: PETSC_EXTERN PetscErrorCode TSRKInitializePackage(void);
1392: PETSC_EXTERN PetscErrorCode TSRKFinalizePackage(void);
1393: PETSC_EXTERN PetscErrorCode TSRKRegisterDestroy(void);
1395: /*J
1396: TSMPRKType - String with the name of a partitioned Runge-Kutta `TSMPRK` type
1398: Level: beginner
1400: .seealso: [](ch_ts), `TSMPRKSetType()`, `TS`, `TSMPRK`, `TSMPRKRegister()`
1401: J*/
1402: typedef const char *TSMPRKType;
1403: #define TSMPRK2A22 "2a22"
1404: #define TSMPRK2A23 "2a23"
1405: #define TSMPRK2A32 "2a32"
1406: #define TSMPRK2A33 "2a33"
1407: #define TSMPRKP2 "p2"
1408: #define TSMPRKP3 "p3"
1410: PETSC_EXTERN PetscErrorCode TSMPRKGetType(TS, TSMPRKType *);
1411: PETSC_EXTERN PetscErrorCode TSMPRKSetType(TS, TSMPRKType);
1412: 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[]);
1413: PETSC_EXTERN PetscErrorCode TSMPRKInitializePackage(void);
1414: PETSC_EXTERN PetscErrorCode TSMPRKFinalizePackage(void);
1415: PETSC_EXTERN PetscErrorCode TSMPRKRegisterDestroy(void);
1417: /*J
1418: TSIRKType - String with the name of an implicit Runge-Kutta `TSIRK` type
1420: Level: beginner
1422: .seealso: [](ch_ts), `TSIRKSetType()`, `TS`, `TSIRK`, `TSIRKRegister()`
1423: J*/
1424: typedef const char *TSIRKType;
1425: #define TSIRKGAUSS "gauss"
1427: PETSC_EXTERN PetscErrorCode TSIRKGetType(TS, TSIRKType *);
1428: PETSC_EXTERN PetscErrorCode TSIRKSetType(TS, TSIRKType);
1429: PETSC_EXTERN PetscErrorCode TSIRKGetNumStages(TS, PetscInt *);
1430: PETSC_EXTERN PetscErrorCode TSIRKSetNumStages(TS, PetscInt);
1431: PETSC_EXTERN PetscErrorCode TSIRKRegister(const char[], PetscErrorCode (*function)(TS));
1432: PETSC_EXTERN PetscErrorCode TSIRKTableauCreate(TS, PetscInt, const PetscReal *, const PetscReal *, const PetscReal *, const PetscReal *, const PetscScalar *, const PetscScalar *, const PetscScalar *);
1433: PETSC_EXTERN PetscErrorCode TSIRKInitializePackage(void);
1434: PETSC_EXTERN PetscErrorCode TSIRKFinalizePackage(void);
1435: PETSC_EXTERN PetscErrorCode TSIRKRegisterDestroy(void);
1437: /*J
1438: TSGLEEType - String with the name of a General Linear with Error Estimation `TSGLEE` type
1440: Level: beginner
1442: .seealso: [](ch_ts), `TSGLEESetType()`, `TS`, `TSGLEE`, `TSGLEERegister()`
1443: J*/
1444: typedef const char *TSGLEEType;
1445: #define TSGLEEi1 "BE1"
1446: #define TSGLEE23 "23"
1447: #define TSGLEE24 "24"
1448: #define TSGLEE25I "25i"
1449: #define TSGLEE35 "35"
1450: #define TSGLEEEXRK2A "exrk2a"
1451: #define TSGLEERK32G1 "rk32g1"
1452: #define TSGLEERK285EX "rk285ex"
1454: /*J
1455: TSGLEEMode - String with the mode of error estimation for a General Linear with Error Estimation `TSGLEE` type
1457: Level: beginner
1459: .seealso: [](ch_ts), `TSGLEESetMode()`, `TS`, `TSGLEE`, `TSGLEERegister()`
1460: J*/
1461: PETSC_EXTERN PetscErrorCode TSGLEEGetType(TS, TSGLEEType *);
1462: PETSC_EXTERN PetscErrorCode TSGLEESetType(TS, TSGLEEType);
1463: 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[]);
1464: PETSC_EXTERN PetscErrorCode TSGLEERegisterAll(void);
1465: PETSC_EXTERN PetscErrorCode TSGLEEFinalizePackage(void);
1466: PETSC_EXTERN PetscErrorCode TSGLEEInitializePackage(void);
1467: PETSC_EXTERN PetscErrorCode TSGLEERegisterDestroy(void);
1469: /*J
1470: TSARKIMEXType - String with the name of an Additive Runge-Kutta IMEX `TSARKIMEX` type
1472: Options Database Key:
1473: . -ts_arkimex_type (1bee|a2|l2|ars122|2c|2d|2e|prssp2|3|bpr3|ars443|4|5) - set `TSARKIMEX` scheme type, see `TSARKIMEXType`
1475: Level: beginner
1477: .seealso: [](ch_ts), `TSARKIMEXSetType()`, `TS`, `TSARKIMEX`, `TSARKIMEXRegister()`
1478: J*/
1479: typedef const char *TSARKIMEXType;
1480: #define TSARKIMEX1BEE "1bee"
1481: #define TSARKIMEXA2 "a2"
1482: #define TSARKIMEXL2 "l2"
1483: #define TSARKIMEXARS122 "ars122"
1484: #define TSARKIMEX2C "2c"
1485: #define TSARKIMEX2D "2d"
1486: #define TSARKIMEX2E "2e"
1487: #define TSARKIMEXPRSSP2 "prssp2"
1488: #define TSARKIMEX3 "3"
1489: #define TSARKIMEXBPR3 "bpr3"
1490: #define TSARKIMEXARS443 "ars443"
1491: #define TSARKIMEX4 "4"
1492: #define TSARKIMEX5 "5"
1494: PETSC_EXTERN PetscErrorCode TSARKIMEXGetType(TS, TSARKIMEXType *);
1495: PETSC_EXTERN PetscErrorCode TSARKIMEXSetType(TS, TSARKIMEXType);
1496: PETSC_EXTERN PetscErrorCode TSARKIMEXSetFullyImplicit(TS, PetscBool);
1497: PETSC_EXTERN PetscErrorCode TSARKIMEXGetFullyImplicit(TS, PetscBool *);
1498: PETSC_EXTERN PetscErrorCode TSARKIMEXSetFastSlowSplit(TS, PetscBool);
1499: PETSC_EXTERN PetscErrorCode TSARKIMEXGetFastSlowSplit(TS, PetscBool *);
1500: 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[]);
1501: PETSC_EXTERN PetscErrorCode TSARKIMEXInitializePackage(void);
1502: PETSC_EXTERN PetscErrorCode TSARKIMEXFinalizePackage(void);
1503: PETSC_EXTERN PetscErrorCode TSARKIMEXRegisterDestroy(void);
1505: /*J
1506: TSDIRKType - String with the name of a Diagonally Implicit Runge-Kutta `TSDIRK` type
1508: Level: beginner
1510: .seealso: [](ch_ts), `TSDIRKSetType()`, `TS`, `TSDIRK`, `TSDIRKRegister()`
1511: J*/
1512: typedef const char *TSDIRKType;
1513: #define TSDIRKS212 "s212"
1514: #define TSDIRKES122SAL "es122sal"
1515: #define TSDIRKES213SAL "es213sal"
1516: #define TSDIRKES324SAL "es324sal"
1517: #define TSDIRKES325SAL "es325sal"
1518: #define TSDIRK657A "657a"
1519: #define TSDIRKES648SA "es648sa"
1520: #define TSDIRK658A "658a"
1521: #define TSDIRKS659A "s659a"
1522: #define TSDIRK7510SAL "7510sal"
1523: #define TSDIRKES7510SA "es7510sa"
1524: #define TSDIRK759A "759a"
1525: #define TSDIRKS7511SAL "s7511sal"
1526: #define TSDIRK8614A "8614a"
1527: #define TSDIRK8616SAL "8616sal"
1528: #define TSDIRKES8516SAL "es8516sal"
1530: PETSC_EXTERN PetscErrorCode TSDIRKGetType(TS, TSDIRKType *);
1531: PETSC_EXTERN PetscErrorCode TSDIRKSetType(TS, TSDIRKType);
1532: PETSC_EXTERN PetscErrorCode TSDIRKRegister(TSDIRKType, PetscInt, PetscInt, const PetscReal[], const PetscReal[], const PetscReal[], const PetscReal[], PetscInt, const PetscReal[]);
1534: /*J
1535: TSRosWType - String with the name of a Rosenbrock-W `TSROSW` type
1537: Level: beginner
1539: .seealso: [](ch_ts), `TSRosWSetType()`, `TS`, `TSROSW`, `TSRosWRegister()`
1540: J*/
1541: typedef const char *TSRosWType;
1542: #define TSROSW2M "2m"
1543: #define TSROSW2P "2p"
1544: #define TSROSWRA3PW "ra3pw"
1545: #define TSROSWRA34PW2 "ra34pw2"
1546: #define TSROSWR34PRW "r34prw"
1547: #define TSROSWR3PRL2 "r3prl2"
1548: #define TSROSWRODAS3 "rodas3"
1549: #define TSROSWRODASPR "rodaspr"
1550: #define TSROSWRODASPR2 "rodaspr2"
1551: #define TSROSWSANDU3 "sandu3"
1552: #define TSROSWASSP3P3S1C "assp3p3s1c"
1553: #define TSROSWLASSP3P4S2C "lassp3p4s2c"
1554: #define TSROSWLLSSP3P4S2C "llssp3p4s2c"
1555: #define TSROSWARK3 "ark3"
1556: #define TSROSWTHETA1 "theta1"
1557: #define TSROSWTHETA2 "theta2"
1558: #define TSROSWGRK4T "grk4t"
1559: #define TSROSWSHAMP4 "shamp4"
1560: #define TSROSWVELDD4 "veldd4"
1561: #define TSROSW4L "4l"
1563: PETSC_EXTERN PetscErrorCode TSRosWGetType(TS, TSRosWType *);
1564: PETSC_EXTERN PetscErrorCode TSRosWSetType(TS, TSRosWType);
1565: PETSC_EXTERN PetscErrorCode TSRosWSetRecomputeJacobian(TS, PetscBool);
1566: PETSC_EXTERN PetscErrorCode TSRosWRegister(TSRosWType, PetscInt, PetscInt, const PetscReal[], const PetscReal[], const PetscReal[], const PetscReal[], PetscInt, const PetscReal[]);
1567: PETSC_EXTERN PetscErrorCode TSRosWRegisterRos4(TSRosWType, PetscReal, PetscReal, PetscReal, PetscReal, PetscReal);
1568: PETSC_EXTERN PetscErrorCode TSRosWInitializePackage(void);
1569: PETSC_EXTERN PetscErrorCode TSRosWFinalizePackage(void);
1570: PETSC_EXTERN PetscErrorCode TSRosWRegisterDestroy(void);
1572: PETSC_EXTERN PetscErrorCode TSBDFSetOrder(TS, PetscInt);
1573: PETSC_EXTERN PetscErrorCode TSBDFGetOrder(TS, PetscInt *);
1575: /*J
1576: TSBasicSymplecticType - String with the name of a basic symplectic integration `TSBASICSYMPLECTIC` type
1578: Level: beginner
1580: .seealso: [](ch_ts), `TSBasicSymplecticSetType()`, `TS`, `TSBASICSYMPLECTIC`, `TSBasicSymplecticRegister()`
1581: J*/
1582: typedef const char *TSBasicSymplecticType;
1583: #define TSBASICSYMPLECTICSIEULER "1"
1584: #define TSBASICSYMPLECTICVELVERLET "2"
1585: #define TSBASICSYMPLECTIC3 "3"
1586: #define TSBASICSYMPLECTIC4 "4"
1588: PETSC_EXTERN PetscErrorCode TSBasicSymplecticSetType(TS, TSBasicSymplecticType);
1589: PETSC_EXTERN PetscErrorCode TSBasicSymplecticGetType(TS, TSBasicSymplecticType *);
1590: PETSC_EXTERN PetscErrorCode TSBasicSymplecticRegister(TSBasicSymplecticType, PetscInt, PetscInt, PetscReal[], PetscReal[]);
1591: PETSC_EXTERN PetscErrorCode TSBasicSymplecticRegisterAll(void);
1592: PETSC_EXTERN PetscErrorCode TSBasicSymplecticInitializePackage(void);
1593: PETSC_EXTERN PetscErrorCode TSBasicSymplecticFinalizePackage(void);
1594: PETSC_EXTERN PetscErrorCode TSBasicSymplecticRegisterDestroy(void);
1596: /*E
1597: TSDGType - Selects the discrete-gradient flavor used by `TSDISCGRAD` when integrating gradient-system ODEs
1599: Values:
1600: + `TS_DG_GONZALEZ` - Gonzalez's mid-point-style discrete gradient
1601: . `TS_DG_AVERAGE` - average vector field (AVF) discrete gradient
1602: - `TS_DG_NONE` - do not apply a discrete gradient correction; the integrator falls back to a standard mid-point rule
1604: Level: advanced
1606: .seealso: `TS`, `TSDISCGRAD`, `TSDiscGradSetType()`, `TSDiscGradGetType()`, `TSDiscGradSetFormulation()`
1607: E*/
1608: typedef enum {
1609: TS_DG_GONZALEZ,
1610: TS_DG_AVERAGE,
1611: TS_DG_NONE
1612: } TSDGType;
1613: PETSC_EXTERN PetscErrorCode TSDiscGradSetFormulation(TS, PetscErrorCode (*)(TS, PetscReal, Vec, Mat, void *), PetscErrorCode (*)(TS, PetscReal, Vec, PetscScalar *, void *), PetscErrorCode (*)(TS, PetscReal, Vec, Vec, void *), void *);
1614: PETSC_EXTERN PetscErrorCode TSDiscGradGetFormulation(TS, PetscErrorCode (**)(TS, PetscReal, Vec, Mat, void *), PetscErrorCode (**)(TS, PetscReal, Vec, PetscScalar *, void *), PetscErrorCode (**)(TS, PetscReal, Vec, Vec, void *), void *);
1615: PETSC_EXTERN PetscErrorCode TSDiscGradSetImplicitFormulation(TS, PetscErrorCode (*)(TS, PetscReal, Vec, Vec, Vec, void *), PetscErrorCode (*)(TS, PetscReal, Vec, Vec, PetscReal, Mat, Mat, void *));
1616: PETSC_EXTERN PetscErrorCode TSDiscGradSetType(TS, TSDGType);
1617: PETSC_EXTERN PetscErrorCode TSDiscGradGetType(TS, TSDGType *);
1618: PETSC_EXTERN PetscErrorCode TSDiscGradGetX0AndXdot(TS, DM, Vec *, Vec *);
1619: PETSC_EXTERN PetscErrorCode TSDiscGradRestoreX0AndXdot(TS, DM, Vec *, Vec *);
1621: /*
1622: PETSc interface to Sundials
1623: */
1624: #if PetscDefined(HAVE_SUNDIALS2)
1625: /*E
1626: TSSundialsLmmType - Selects which linear multistep method is used by the `TSSUNDIALS` interface to SUNDIALS' CVODE integrator
1628: Values:
1629: + `SUNDIALS_ADAMS` - variable-order Adams methods (non-stiff problems)
1630: - `SUNDIALS_BDF` - variable-order backward differentiation formulas (stiff problems)
1632: Level: intermediate
1634: .seealso: `TS`, `TSSUNDIALS`, `TSSundialsSetType()`, `TSSundialsGramSchmidtType`
1635: E*/
1636: typedef enum {
1637: SUNDIALS_ADAMS = 1,
1638: SUNDIALS_BDF = 2
1639: } TSSundialsLmmType;
1640: PETSC_EXTERN const char *const TSSundialsLmmTypes[];
1641: /*E
1642: TSSundialsGramSchmidtType - Selects the Gram--Schmidt orthogonalization variant used by SUNDIALS' internal GMRES inside `TSSUNDIALS`
1644: Values:
1645: + `SUNDIALS_MODIFIED_GS` - modified Gram--Schmidt (more stable)
1646: - `SUNDIALS_CLASSICAL_GS` - classical Gram--Schmidt (cheaper, less stable)
1648: Level: advanced
1650: .seealso: `TS`, `TSSUNDIALS`, `TSSundialsSetGramSchmidtType()`, `TSSundialsLmmType`
1651: E*/
1652: typedef enum {
1653: SUNDIALS_MODIFIED_GS = 1,
1654: SUNDIALS_CLASSICAL_GS = 2
1655: } TSSundialsGramSchmidtType;
1656: PETSC_EXTERN const char *const TSSundialsGramSchmidtTypes[];
1658: PETSC_EXTERN PetscErrorCode TSSundialsSetType(TS, TSSundialsLmmType);
1659: PETSC_EXTERN PetscErrorCode TSSundialsGetPC(TS, PC *);
1660: PETSC_EXTERN PetscErrorCode TSSundialsSetTolerance(TS, PetscReal, PetscReal);
1661: PETSC_EXTERN PetscErrorCode TSSundialsSetMinTimeStep(TS, PetscReal);
1662: PETSC_EXTERN PetscErrorCode TSSundialsSetMaxTimeStep(TS, PetscReal);
1663: PETSC_EXTERN PetscErrorCode TSSundialsGetIterations(TS, PetscInt *, PetscInt *);
1664: PETSC_EXTERN PetscErrorCode TSSundialsSetGramSchmidtType(TS, TSSundialsGramSchmidtType);
1665: PETSC_EXTERN PetscErrorCode TSSundialsSetLinearTolerance(TS, PetscReal);
1666: PETSC_EXTERN PetscErrorCode TSSundialsMonitorInternalSteps(TS, PetscBool);
1667: PETSC_EXTERN PetscErrorCode TSSundialsSetMaxl(TS, PetscInt);
1668: PETSC_EXTERN PetscErrorCode TSSundialsSetMaxord(TS, PetscInt);
1669: PETSC_EXTERN PetscErrorCode TSSundialsSetUseDense(TS, PetscBool);
1670: #endif
1672: PETSC_EXTERN PetscErrorCode TSThetaSetTheta(TS, PetscReal);
1673: PETSC_EXTERN PetscErrorCode TSThetaGetTheta(TS, PetscReal *);
1674: PETSC_EXTERN PetscErrorCode TSThetaGetEndpoint(TS, PetscBool *);
1675: PETSC_EXTERN PetscErrorCode TSThetaSetEndpoint(TS, PetscBool);
1677: PETSC_EXTERN PetscErrorCode TSAlphaSetRadius(TS, PetscReal);
1678: PETSC_EXTERN PetscErrorCode TSAlphaSetParams(TS, PetscReal, PetscReal, PetscReal);
1679: PETSC_EXTERN PetscErrorCode TSAlphaGetParams(TS, PetscReal *, PetscReal *, PetscReal *);
1681: PETSC_EXTERN PetscErrorCode TSAlpha2SetRadius(TS, PetscReal);
1682: PETSC_EXTERN PetscErrorCode TSAlpha2SetParams(TS, PetscReal, PetscReal, PetscReal, PetscReal);
1683: PETSC_EXTERN PetscErrorCode TSAlpha2GetParams(TS, PetscReal *, PetscReal *, PetscReal *, PetscReal *);
1685: /*S
1686: TSAlpha2PredictorFn - A callback to set the predictor (i.e., the initial guess for the nonlinear solver) in
1687: a second-order generalized-alpha time integrator.
1689: Calling Sequence:
1690: + ts - the `TS` context obtained from `TSCreate()`
1691: . X0 - the previous time step's state vector
1692: . V0 - the previous time step's first derivative of the state vector
1693: . A0 - the previous time step's second derivative of the state vector
1694: . X1 - the vector into which the initial guess for the current time step will be written
1695: - ctx - [optional] user-defined context for the predictor evaluation routine (may be `NULL`)
1697: Level: intermediate
1699: Note:
1700: The deprecated `TSAlpha2Predictor` still works as a replacement for `TSAlpha2PredictorFn` *.
1702: .seealso: [](ch_ts), `TS`, `TSAlpha2SetPredictor()`
1703: S*/
1704: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode TSAlpha2PredictorFn(TS ts, Vec X0, Vec V0, Vec A0, Vec X1, PetscCtx ctx);
1706: PETSC_EXTERN_TYPEDEF typedef TSAlpha2PredictorFn *TSAlpha2Predictor;
1708: PETSC_EXTERN PetscErrorCode TSAlpha2SetPredictor(TS, TSAlpha2PredictorFn *, void *);
1710: PETSC_EXTERN PetscErrorCode TSSetDM(TS, DM);
1711: PETSC_EXTERN PetscErrorCode TSGetDM(TS, DM *);
1713: PETSC_EXTERN PetscErrorCode SNESTSFormFunction(SNES, Vec, Vec, void *);
1714: PETSC_EXTERN PetscErrorCode SNESTSFormJacobian(SNES, Vec, Mat, Mat, void *);
1716: PETSC_EXTERN PetscErrorCode TSRHSJacobianTest(TS, PetscBool *);
1717: PETSC_EXTERN PetscErrorCode TSRHSJacobianTestTranspose(TS, PetscBool *);
1719: PETSC_EXTERN PetscErrorCode TSGetComputeInitialCondition(TS, PetscErrorCode (**)(TS, Vec));
1720: PETSC_EXTERN PetscErrorCode TSSetComputeInitialCondition(TS, PetscErrorCode (*)(TS, Vec));
1721: PETSC_EXTERN PetscErrorCode TSComputeInitialCondition(TS, Vec);
1722: PETSC_EXTERN PetscErrorCode TSGetComputeExactError(TS, PetscErrorCode (**)(TS, Vec, Vec));
1723: PETSC_EXTERN PetscErrorCode TSSetComputeExactError(TS, PetscErrorCode (*)(TS, Vec, Vec));
1724: PETSC_EXTERN PetscErrorCode TSComputeExactError(TS, Vec, Vec);
1725: PETSC_EXTERN PetscErrorCode PetscConvEstUseTS(PetscConvEst, PetscBool);
1727: PETSC_EXTERN PetscErrorCode TSSetMatStructure(TS, MatStructure);