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;
102: PETSC_EXTERN const char *const *TSEquationTypes;
104: /*E
105: TSConvergedReason - reason a `TS` method has converged (integrated to the requested time) or not
107: Values:
108: + `TS_CONVERGED_ITERATING` - this only occurs if `TSGetConvergedReason()` is called during the `TSSolve()`
109: . `TS_CONVERGED_TIME` - the final time was reached
110: . `TS_CONVERGED_ITS` - the maximum number of iterations (time-steps) was reached prior to the final time
111: . `TS_CONVERGED_USER` - user requested termination
112: . `TS_CONVERGED_EVENT` - user requested termination on event detection
113: . `TS_CONVERGED_PSEUDO_FATOL` - stops when function norm decreased by a set amount, used only for `TSPSEUDO`
114: . `TS_CONVERGED_PSEUDO_FRTOL` - stops when function norm decreases below a set amount, used only for `TSPSEUDO`
115: . `TS_DIVERGED_NONLINEAR_SOLVE` - too many nonlinear solve failures have occurred
116: . `TS_DIVERGED_STEP_REJECTED` - too many steps were rejected
117: . `TSFORWARD_DIVERGED_LINEAR_SOLVE` - tangent linear solve failed
118: - `TSADJOINT_DIVERGED_LINEAR_SOLVE` - transposed linear solve failed
120: Level: beginner
122: .seealso: [](ch_ts), `TS`, `TSGetConvergedReason()`
123: E*/
124: typedef enum {
125: TS_CONVERGED_ITERATING = 0,
126: TS_CONVERGED_TIME = 1,
127: TS_CONVERGED_ITS = 2,
128: TS_CONVERGED_USER = 3,
129: TS_CONVERGED_EVENT = 4,
130: TS_CONVERGED_PSEUDO_FATOL = 5,
131: TS_CONVERGED_PSEUDO_FRTOL = 6,
132: TS_DIVERGED_NONLINEAR_SOLVE = -1,
133: TS_DIVERGED_STEP_REJECTED = -2,
134: TSFORWARD_DIVERGED_LINEAR_SOLVE = -3,
135: TSADJOINT_DIVERGED_LINEAR_SOLVE = -4
136: } TSConvergedReason;
137: PETSC_EXTERN const char *const *TSConvergedReasons;
139: /*MC
140: TS_CONVERGED_ITERATING - this only occurs if `TSGetConvergedReason()` is called during the `TSSolve()`
142: Level: beginner
144: .seealso: [](ch_ts), `TS`, `TSSolve()`, `TSGetConvergedReason()`, `TSGetAdapt()`
145: M*/
147: /*MC
148: TS_CONVERGED_TIME - the final time was reached
150: Level: beginner
152: .seealso: [](ch_ts), `TS`, `TSSolve()`, `TSGetConvergedReason()`, `TSGetAdapt()`, `TSSetMaxTime()`, `TSGetMaxTime()`, `TSGetSolveTime()`
153: M*/
155: /*MC
156: TS_CONVERGED_ITS - the maximum number of iterations (time-steps) was reached prior to the final time
158: Level: beginner
160: .seealso: [](ch_ts), `TS`, `TSSolve()`, `TSGetConvergedReason()`, `TSGetAdapt()`, `TSSetMaxSteps()`, `TSGetMaxSteps()`
161: M*/
163: /*MC
164: TS_CONVERGED_USER - user requested termination
166: Level: beginner
168: .seealso: [](ch_ts), `TS`, `TSSolve()`, `TSGetConvergedReason()`, `TSSetConvergedReason()`
169: M*/
171: /*MC
172: TS_CONVERGED_EVENT - user requested termination on event detection
174: Level: beginner
176: .seealso: [](ch_ts), `TS`, `TSSolve()`, `TSGetConvergedReason()`, `TSSetConvergedReason()`
177: M*/
179: /*MC
180: TS_CONVERGED_PSEUDO_FRTOL - stops when function norm decreased by a set amount, used only for `TSPSEUDO`
182: Options Database Key:
183: . -ts_pseudo_frtol rtol - use specified rtol
185: Level: beginner
187: .seealso: [](ch_ts), `TS`, `TSSolve()`, `TSGetConvergedReason()`, `TSSetConvergedReason()`, `TS_CONVERGED_PSEUDO_FATOL`
188: M*/
190: /*MC
191: TS_CONVERGED_PSEUDO_FATOL - stops when function norm decreases below a set amount, used only for `TSPSEUDO`
193: Options Database Key:
194: . -ts_pseudo_fatol atol - use specified atol
196: Level: beginner
198: .seealso: [](ch_ts), `TS`, `TSSolve()`, `TSGetConvergedReason()`, `TSSetConvergedReason()`, `TS_CONVERGED_PSEUDO_FRTOL`
199: M*/
201: /*MC
202: TS_DIVERGED_NONLINEAR_SOLVE - too many nonlinear solves failed
204: Level: beginner
206: Note:
207: See `TSSetMaxSNESFailures()` for how to allow more nonlinear solver failures.
209: .seealso: [](ch_ts), `TS`, `TSSolve()`, `TSGetConvergedReason()`, `TSGetAdapt()`, `TSGetSNES()`, `SNESGetConvergedReason()`, `TSSetMaxSNESFailures()`
210: M*/
212: /*MC
213: TS_DIVERGED_STEP_REJECTED - too many steps were rejected
215: Level: beginner
217: Notes:
218: See `TSSetMaxStepRejections()` for how to allow more step rejections.
220: .seealso: [](ch_ts), `TS`, `TSSolve()`, `TSGetConvergedReason()`, `TSGetAdapt()`, `TSSetMaxStepRejections()`
221: M*/
223: /*E
224: TSExactFinalTimeOption - option for handling of final time step
226: Values:
227: + `TS_EXACTFINALTIME_STEPOVER` - Don't do anything if requested final time is exceeded
228: . `TS_EXACTFINALTIME_INTERPOLATE` - Interpolate back to final time
229: - `TS_EXACTFINALTIME_MATCHSTEP` - Adapt final time step to match the final time requested
231: Level: beginner
233: .seealso: [](ch_ts), `TS`, `TSGetConvergedReason()`, `TSSetExactFinalTime()`, `TSGetExactFinalTime()`
234: E*/
235: typedef enum {
236: TS_EXACTFINALTIME_UNSPECIFIED = 0,
237: TS_EXACTFINALTIME_STEPOVER = 1,
238: TS_EXACTFINALTIME_INTERPOLATE = 2,
239: TS_EXACTFINALTIME_MATCHSTEP = 3
240: } TSExactFinalTimeOption;
241: PETSC_EXTERN const char *const TSExactFinalTimeOptions[];
243: /* Logging support */
244: PETSC_EXTERN PetscClassId TS_CLASSID;
245: PETSC_EXTERN PetscClassId DMTS_CLASSID;
246: PETSC_EXTERN PetscClassId TSADAPT_CLASSID;
248: PETSC_EXTERN PetscErrorCode TSInitializePackage(void);
249: PETSC_EXTERN PetscErrorCode TSFinalizePackage(void);
251: PETSC_EXTERN PetscErrorCode TSCreate(MPI_Comm, TS *);
252: PETSC_EXTERN PetscErrorCode TSClone(TS, TS *);
253: PETSC_EXTERN PetscErrorCode TSDestroy(TS *);
255: PETSC_EXTERN PetscErrorCode TSSetProblemType(TS, TSProblemType);
256: PETSC_EXTERN PetscErrorCode TSGetProblemType(TS, TSProblemType *);
257: PETSC_EXTERN PetscErrorCode TSMonitor(TS, PetscInt, PetscReal, Vec);
258: PETSC_EXTERN PetscErrorCode TSMonitorSet(TS, PetscErrorCode (*)(TS, PetscInt, PetscReal, Vec, PetscCtx), PetscCtx, PetscCtxDestroyFn *);
259: PETSC_EXTERN PetscErrorCode TSMonitorSetFromOptions(TS, const char[], const char[], const char[], PetscErrorCode (*)(TS, PetscInt, PetscReal, Vec, PetscViewerAndFormat *), PetscErrorCode (*)(TS, PetscViewerAndFormat *));
260: PETSC_EXTERN PetscErrorCode TSMonitorCancel(TS);
262: PETSC_EXTERN PetscErrorCode TSSetOptionsPrefix(TS, const char[]);
263: PETSC_EXTERN PetscErrorCode TSAppendOptionsPrefix(TS, const char[]);
264: PETSC_EXTERN PetscErrorCode TSGetOptionsPrefix(TS, const char *[]);
265: PETSC_EXTERN PetscErrorCode TSSetFromOptions(TS);
266: PETSC_EXTERN PetscErrorCode TSSetUp(TS);
267: PETSC_EXTERN PetscErrorCode TSReset(TS);
269: PETSC_EXTERN PetscErrorCode TSSetSolution(TS, Vec);
270: PETSC_EXTERN PetscErrorCode TSGetSolution(TS, Vec *);
272: PETSC_EXTERN PetscErrorCode TS2SetSolution(TS, Vec, Vec);
273: PETSC_EXTERN PetscErrorCode TS2GetSolution(TS, Vec *, Vec *);
275: PETSC_EXTERN PetscErrorCode TSGetSolutionComponents(TS, PetscInt *, Vec *);
276: PETSC_EXTERN PetscErrorCode TSGetAuxSolution(TS, Vec *);
277: PETSC_EXTERN PetscErrorCode TSGetTimeError(TS, PetscInt, Vec *);
278: PETSC_EXTERN PetscErrorCode TSSetTimeError(TS, Vec);
280: PETSC_EXTERN PetscErrorCode TSSetRHSJacobianP(TS, Mat, PetscErrorCode (*)(TS, PetscReal, Vec, Mat, PetscCtx), PetscCtx);
281: PETSC_EXTERN PetscErrorCode TSGetRHSJacobianP(TS, Mat *, PetscErrorCode (**)(TS, PetscReal, Vec, Mat, PetscCtx), PetscCtxRt);
282: PETSC_EXTERN PetscErrorCode TSComputeRHSJacobianP(TS, PetscReal, Vec, Mat);
283: PETSC_EXTERN PetscErrorCode TSSetIJacobianP(TS, Mat, PetscErrorCode (*)(TS, PetscReal, Vec, Vec, PetscReal, Mat, PetscCtx), PetscCtx);
284: PETSC_EXTERN PetscErrorCode TSGetIJacobianP(TS, Mat *, PetscErrorCode (**)(TS, PetscReal, Vec, Vec, PetscReal, Mat, PetscCtx), PetscCtxRt);
285: PETSC_EXTERN PetscErrorCode TSComputeIJacobianP(TS, PetscReal, Vec, Vec, PetscReal, Mat, PetscBool);
286: PETSC_EXTERN PETSC_DEPRECATED_FUNCTION(3, 5, 0, "TSGetQuadratureTS() then TSComputeRHSJacobianP()", ) PetscErrorCode TSComputeDRDPFunction(TS, PetscReal, Vec, Vec *);
287: PETSC_EXTERN PETSC_DEPRECATED_FUNCTION(3, 5, 0, "TSGetQuadratureTS() then TSComputeRHSJacobian()", ) PetscErrorCode TSComputeDRDUFunction(TS, PetscReal, Vec, Vec *);
288: 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);
289: PETSC_EXTERN PetscErrorCode TSComputeIHessianProductFunctionUU(TS, PetscReal, Vec, Vec[], Vec, Vec[]);
290: PETSC_EXTERN PetscErrorCode TSComputeIHessianProductFunctionUP(TS, PetscReal, Vec, Vec[], Vec, Vec[]);
291: PETSC_EXTERN PetscErrorCode TSComputeIHessianProductFunctionPU(TS, PetscReal, Vec, Vec[], Vec, Vec[]);
292: PETSC_EXTERN PetscErrorCode TSComputeIHessianProductFunctionPP(TS, PetscReal, Vec, Vec[], Vec, Vec[]);
293: 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);
294: PETSC_EXTERN PetscErrorCode TSComputeRHSHessianProductFunctionUU(TS, PetscReal, Vec, Vec[], Vec, Vec[]);
295: PETSC_EXTERN PetscErrorCode TSComputeRHSHessianProductFunctionUP(TS, PetscReal, Vec, Vec[], Vec, Vec[]);
296: PETSC_EXTERN PetscErrorCode TSComputeRHSHessianProductFunctionPU(TS, PetscReal, Vec, Vec[], Vec, Vec[]);
297: PETSC_EXTERN PetscErrorCode TSComputeRHSHessianProductFunctionPP(TS, PetscReal, Vec, Vec[], Vec, Vec[]);
298: PETSC_EXTERN PetscErrorCode TSSetCostHessianProducts(TS, PetscInt, Vec[], Vec[], Vec);
299: PETSC_EXTERN PetscErrorCode TSGetCostHessianProducts(TS, PetscInt *, Vec *[], Vec *[], Vec *);
300: PETSC_EXTERN PetscErrorCode TSComputeSNESJacobian(TS, Vec, Mat, Mat);
302: /*S
303: TSTrajectory - Abstract PETSc object that stores the trajectory (solution of ODE/DAE at each time step)
305: Level: advanced
307: .seealso: [](ch_ts), `TS`, `TSSetSaveTrajectory()`, `TSTrajectoryCreate()`, `TSTrajectorySetType()`, `TSTrajectoryDestroy()`, `TSTrajectoryReset()`
308: S*/
309: typedef struct _p_TSTrajectory *TSTrajectory;
311: /*J
312: TSTrajectoryType - String with the name of a PETSc `TS` trajectory storage method
314: Level: intermediate
316: .seealso: [](ch_ts), `TS`, `TSSetSaveTrajectory()`, `TSTrajectoryCreate()`, `TSTrajectoryDestroy()`
317: J*/
318: typedef const char *TSTrajectoryType;
319: #define TSTRAJECTORYBASIC "basic"
320: #define TSTRAJECTORYSINGLEFILE "singlefile"
321: #define TSTRAJECTORYMEMORY "memory"
322: #define TSTRAJECTORYVISUALIZATION "visualization"
324: PETSC_EXTERN PetscFunctionList TSTrajectoryList;
325: PETSC_EXTERN PetscClassId TSTRAJECTORY_CLASSID;
326: PETSC_EXTERN PetscBool TSTrajectoryRegisterAllCalled;
328: PETSC_EXTERN PetscErrorCode TSSetSaveTrajectory(TS);
329: PETSC_EXTERN PetscErrorCode TSResetTrajectory(TS);
330: PETSC_EXTERN PetscErrorCode TSRemoveTrajectory(TS);
332: PETSC_EXTERN PetscErrorCode TSTrajectoryCreate(MPI_Comm, TSTrajectory *);
333: PETSC_EXTERN PetscErrorCode TSTrajectoryReset(TSTrajectory);
334: PETSC_EXTERN PetscErrorCode TSTrajectoryDestroy(TSTrajectory *);
335: PETSC_EXTERN PetscErrorCode TSTrajectoryView(TSTrajectory, PetscViewer);
336: PETSC_EXTERN PetscErrorCode TSTrajectorySetType(TSTrajectory, TS, TSTrajectoryType);
337: PETSC_EXTERN PetscErrorCode TSTrajectoryGetType(TSTrajectory, TS, TSTrajectoryType *);
338: PETSC_EXTERN PetscErrorCode TSTrajectorySet(TSTrajectory, TS, PetscInt, PetscReal, Vec);
339: PETSC_EXTERN PetscErrorCode TSTrajectoryGet(TSTrajectory, TS, PetscInt, PetscReal *);
340: PETSC_EXTERN PetscErrorCode TSTrajectoryGetVecs(TSTrajectory, TS, PetscInt, PetscReal *, Vec, Vec);
341: PETSC_EXTERN PetscErrorCode TSTrajectoryGetUpdatedHistoryVecs(TSTrajectory, TS, PetscReal, Vec *, Vec *);
342: PETSC_EXTERN PetscErrorCode TSTrajectoryGetNumSteps(TSTrajectory, PetscInt *);
343: PETSC_EXTERN PetscErrorCode TSTrajectoryRestoreUpdatedHistoryVecs(TSTrajectory, Vec *, Vec *);
344: PETSC_EXTERN PetscErrorCode TSTrajectorySetFromOptions(TSTrajectory, TS);
345: PETSC_EXTERN PetscErrorCode TSTrajectoryRegister(const char[], PetscErrorCode (*)(TSTrajectory, TS));
346: PETSC_EXTERN PetscErrorCode TSTrajectoryRegisterAll(void);
347: PETSC_EXTERN PetscErrorCode TSTrajectorySetUp(TSTrajectory, TS);
348: PETSC_EXTERN PetscErrorCode TSTrajectorySetUseHistory(TSTrajectory, PetscBool);
349: PETSC_EXTERN PetscErrorCode TSTrajectorySetMonitor(TSTrajectory, PetscBool);
350: PETSC_EXTERN PetscErrorCode TSTrajectorySetVariableNames(TSTrajectory, const char *const *);
351: PETSC_EXTERN PetscErrorCode TSTrajectorySetTransform(TSTrajectory, PetscErrorCode (*)(PetscCtx, Vec, Vec *), PetscCtxDestroyFn *, PetscCtx);
352: PETSC_EXTERN PetscErrorCode TSTrajectorySetSolutionOnly(TSTrajectory, PetscBool);
353: PETSC_EXTERN PetscErrorCode TSTrajectoryGetSolutionOnly(TSTrajectory, PetscBool *);
354: PETSC_EXTERN PetscErrorCode TSTrajectorySetKeepFiles(TSTrajectory, PetscBool);
355: PETSC_EXTERN PetscErrorCode TSTrajectorySetDirname(TSTrajectory, const char[]);
356: PETSC_EXTERN PetscErrorCode TSTrajectorySetFiletemplate(TSTrajectory, const char[]);
357: PETSC_EXTERN PetscErrorCode TSGetTrajectory(TS, TSTrajectory *);
359: /*E
360: TSTrajectoryMemoryType - Selects the in-memory checkpointing scheme used by `TSTRAJECTORYMEMORY` to store the forward states needed for an adjoint or sensitivity computation
362: Values:
363: + `TJ_REVOLVE` - the Revolve binomial checkpointing schedule of Griewank & Walther
364: . `TJ_CAMS` - the CAMS (cache-aware multistage) checkpointing schedule
365: - `TJ_PETSC` - PETSc's own in-memory checkpointing implementation
367: Level: advanced
369: .seealso: `TSTrajectory`, `TSTRAJECTORYMEMORY`, `TSTrajectoryMemorySetType()`, `TSSetSaveTrajectory()`
370: E*/
371: typedef enum {
372: TJ_REVOLVE,
373: TJ_CAMS,
374: TJ_PETSC
375: } TSTrajectoryMemoryType;
376: PETSC_EXTERN const char *const TSTrajectoryMemoryTypes[];
378: PETSC_EXTERN PetscErrorCode TSTrajectoryMemorySetType(TSTrajectory, TSTrajectoryMemoryType);
379: PETSC_EXTERN PetscErrorCode TSTrajectorySetMaxCpsRAM(TSTrajectory, PetscInt);
380: PETSC_EXTERN PetscErrorCode TSTrajectorySetMaxCpsDisk(TSTrajectory, PetscInt);
381: PETSC_EXTERN PetscErrorCode TSTrajectorySetMaxUnitsRAM(TSTrajectory, PetscInt);
382: PETSC_EXTERN PetscErrorCode TSTrajectorySetMaxUnitsDisk(TSTrajectory, PetscInt);
384: PETSC_EXTERN PetscErrorCode TSSetCostGradients(TS, PetscInt, Vec[], Vec[]);
385: PETSC_EXTERN PetscErrorCode TSGetCostGradients(TS, PetscInt *, Vec *[], Vec *[]);
386: 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);
387: PETSC_EXTERN PetscErrorCode TSGetCostIntegral(TS, Vec *);
388: PETSC_EXTERN PetscErrorCode TSComputeCostIntegrand(TS, PetscReal, Vec, Vec);
389: PETSC_EXTERN PetscErrorCode TSCreateQuadratureTS(TS, PetscBool, TS *);
390: PETSC_EXTERN PetscErrorCode TSGetQuadratureTS(TS, PetscBool *, TS *);
392: PETSC_EXTERN PetscErrorCode TSAdjointSetFromOptions(TS, PetscOptionItems);
393: PETSC_EXTERN PetscErrorCode TSAdjointMonitor(TS, PetscInt, PetscReal, Vec, PetscInt, Vec[], Vec[]);
394: PETSC_EXTERN PetscErrorCode TSAdjointMonitorSet(TS, PetscErrorCode (*)(TS, PetscInt, PetscReal, Vec, PetscInt, Vec *, Vec *, PetscCtx), PetscCtx, PetscCtxDestroyFn *);
395: PETSC_EXTERN PetscErrorCode TSAdjointMonitorCancel(TS);
396: PETSC_EXTERN PetscErrorCode TSAdjointMonitorSetFromOptions(TS, const char[], const char[], const char[], PetscErrorCode (*)(TS, PetscInt, PetscReal, Vec, PetscInt, Vec *, Vec *, PetscViewerAndFormat *), PetscErrorCode (*)(TS, PetscViewerAndFormat *));
398: PETSC_EXTERN PETSC_DEPRECATED_FUNCTION(3, 5, 0, "TSSetRHSJacobianP()", ) PetscErrorCode TSAdjointSetRHSJacobian(TS, Mat, PetscErrorCode (*)(TS, PetscReal, Vec, Mat, PetscCtx), PetscCtx);
399: PETSC_EXTERN PETSC_DEPRECATED_FUNCTION(3, 5, 0, "TSComputeRHSJacobianP()", ) PetscErrorCode TSAdjointComputeRHSJacobian(TS, PetscReal, Vec, Mat);
400: PETSC_EXTERN PETSC_DEPRECATED_FUNCTION(3, 5, 0, "TSGetQuadratureTS()", ) PetscErrorCode TSAdjointComputeDRDPFunction(TS, PetscReal, Vec, Vec *);
401: PETSC_EXTERN PETSC_DEPRECATED_FUNCTION(3, 5, 0, "TSGetQuadratureTS()", ) PetscErrorCode TSAdjointComputeDRDYFunction(TS, PetscReal, Vec, Vec *);
402: PETSC_EXTERN PetscErrorCode TSAdjointSolve(TS);
403: PETSC_EXTERN PetscErrorCode TSAdjointSetSteps(TS, PetscInt);
405: PETSC_EXTERN PetscErrorCode TSAdjointStep(TS);
406: PETSC_EXTERN PetscErrorCode TSAdjointSetUp(TS);
407: PETSC_EXTERN PetscErrorCode TSAdjointReset(TS);
408: PETSC_EXTERN PetscErrorCode TSAdjointCostIntegral(TS);
409: PETSC_EXTERN PetscErrorCode TSAdjointSetForward(TS, Mat);
410: PETSC_EXTERN PetscErrorCode TSAdjointResetForward(TS);
412: PETSC_EXTERN PetscErrorCode TSForwardSetSensitivities(TS, PetscInt, Mat);
413: PETSC_EXTERN PetscErrorCode TSForwardGetSensitivities(TS, PetscInt *, Mat *);
414: PETSC_EXTERN PETSC_DEPRECATED_FUNCTION(3, 12, 0, "TSCreateQuadratureTS()", ) PetscErrorCode TSForwardSetIntegralGradients(TS, PetscInt, Vec[]);
415: PETSC_EXTERN PETSC_DEPRECATED_FUNCTION(3, 12, 0, "TSForwardGetSensitivities()", ) PetscErrorCode TSForwardGetIntegralGradients(TS, PetscInt *, Vec *[]);
416: PETSC_EXTERN PetscErrorCode TSForwardSetUp(TS);
417: PETSC_EXTERN PetscErrorCode TSForwardReset(TS);
418: PETSC_EXTERN PetscErrorCode TSForwardCostIntegral(TS);
419: PETSC_EXTERN PetscErrorCode TSForwardStep(TS);
420: PETSC_EXTERN PetscErrorCode TSForwardSetInitialSensitivities(TS, Mat);
421: PETSC_EXTERN PetscErrorCode TSForwardGetStages(TS, PetscInt *, Mat *[]);
423: PETSC_EXTERN PetscErrorCode TSSetMaxSteps(TS, PetscInt);
424: PETSC_EXTERN PetscErrorCode TSGetMaxSteps(TS, PetscInt *);
425: PETSC_EXTERN PetscErrorCode TSSetRunSteps(TS, PetscInt);
426: PETSC_EXTERN PetscErrorCode TSGetRunSteps(TS, PetscInt *);
427: PETSC_EXTERN PetscErrorCode TSSetMaxTime(TS, PetscReal);
428: PETSC_EXTERN PetscErrorCode TSGetMaxTime(TS, PetscReal *);
429: PETSC_EXTERN PetscErrorCode TSSetExactFinalTime(TS, TSExactFinalTimeOption);
430: PETSC_EXTERN PetscErrorCode TSGetExactFinalTime(TS, TSExactFinalTimeOption *);
431: PETSC_EXTERN PetscErrorCode TSSetEvaluationTimes(TS, PetscInt, PetscReal[]);
432: PETSC_EXTERN PetscErrorCode TSGetEvaluationTimes(TS, PetscInt *, const PetscReal *[]);
433: PETSC_EXTERN PetscErrorCode TSGetEvaluationSolutions(TS, PetscInt *, const PetscReal *[], Vec *[]);
434: PETSC_EXTERN PetscErrorCode TSSetTimeSpan(TS, PetscInt, PetscReal[]);
436: /*@C
437: TSGetTimeSpan - gets the time span set with `TSSetTimeSpan()`
439: Not Collective
441: Input Parameter:
442: . ts - the time-stepper
444: Output Parameters:
445: + n - number of the time points (>=2)
446: - span_times - array of the time points. The first element and the last element are the initial time and the final time respectively.
448: Level: deprecated
450: Note:
451: Deprecated, use `TSGetEvaluationTimes()`.
453: The values obtained are valid until the `TS` object is destroyed.
455: Both `n` and `span_times` can be `NULL`.
457: .seealso: [](ch_ts), `TS`, `TSGetEvaluationTimes()`, `TSSetTimeSpan()`, `TSSetEvaluationTimes()`, `TSGetEvaluationSolutions()`
458: @*/
459: PETSC_DEPRECATED_FUNCTION(3, 23, 0, "TSGetEvaluationTimes()", ) static inline PetscErrorCode TSGetTimeSpan(TS ts, PetscInt *n, const PetscReal *span_times[])
460: {
461: return TSGetEvaluationTimes(ts, n, span_times);
462: }
464: /*@C
465: TSGetTimeSpanSolutions - Get the number of solutions and the solutions at the time points specified by the time span.
467: Input Parameter:
468: . ts - the `TS` context obtained from `TSCreate()`
470: Output Parameters:
471: + nsol - the number of solutions
472: - Sols - the solution vectors
474: Level: deprecated
476: Notes:
477: Deprecated, use `TSGetEvaluationSolutions()`.
479: Both `nsol` and `Sols` can be `NULL`.
481: 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()`.
482: For example, manipulating the step size, especially with a reduced precision, may cause `TS` to step over certain points in the span.
483: This issue is alleviated in `TSGetEvaluationSolutions()` by returning the solution times that `Sols` were recorded at.
485: .seealso: [](ch_ts), `TS`, `TSGetEvaluationSolutions()`, `TSSetTimeSpan()`, `TSGetEvaluationTimes()`, `TSSetEvaluationTimes()`
486: @*/
487: PETSC_DEPRECATED_FUNCTION(3, 23, 0, "TSGetEvaluationSolutions()", ) static inline PetscErrorCode TSGetTimeSpanSolutions(TS ts, PetscInt *nsol, Vec **Sols)
488: {
489: return TSGetEvaluationSolutions(ts, nsol, NULL, Sols);
490: }
492: PETSC_EXTERN PETSC_DEPRECATED_FUNCTION(3, 8, 0, "TSSetTime()", ) PetscErrorCode TSSetInitialTimeStep(TS, PetscReal, PetscReal);
493: PETSC_EXTERN PETSC_DEPRECATED_FUNCTION(3, 8, 0, "TSSetMax()", ) PetscErrorCode TSSetDuration(TS, PetscInt, PetscReal);
494: PETSC_EXTERN PETSC_DEPRECATED_FUNCTION(3, 8, 0, "TSGetMax()", ) PetscErrorCode TSGetDuration(TS, PetscInt *, PetscReal *);
495: PETSC_EXTERN PETSC_DEPRECATED_FUNCTION(3, 8, 0, "TSGetStepNumber()", ) PetscErrorCode TSGetTimeStepNumber(TS, PetscInt *);
496: PETSC_EXTERN PETSC_DEPRECATED_FUNCTION(3, 8, 0, "TSGetStepNumber()", ) PetscErrorCode TSGetTotalSteps(TS, PetscInt *);
498: PETSC_EXTERN PetscErrorCode TSMonitorDefault(TS, PetscInt, PetscReal, Vec, PetscViewerAndFormat *);
499: PETSC_EXTERN PetscErrorCode TSMonitorWallClockTime(TS, PetscInt, PetscReal, Vec, PetscViewerAndFormat *);
500: PETSC_EXTERN PetscErrorCode TSMonitorWallClockTimeSetUp(TS, PetscViewerAndFormat *);
501: PETSC_EXTERN PetscErrorCode TSMonitorExtreme(TS, PetscInt, PetscReal, Vec, PetscViewerAndFormat *);
503: /*S
504: TSMonitorDrawCtx - Context object for the `TS` graphical monitor routines that draw the solution, phase plot or error using a `PetscDraw`
506: Level: developer
508: .seealso: `TS`, `TSMonitorDrawCtxCreate()`, `TSMonitorDrawCtxDestroy()`, `TSMonitorDrawSolution()`, `TSMonitorDrawSolutionPhase()`, `TSMonitorDrawError()`, `TSMonitorDrawSolutionFunction()`
509: S*/
510: typedef struct _n_TSMonitorDrawCtx *TSMonitorDrawCtx;
511: PETSC_EXTERN PetscErrorCode TSMonitorDrawCtxCreate(MPI_Comm, const char[], const char[], int, int, int, int, PetscInt, TSMonitorDrawCtx *);
512: PETSC_EXTERN PetscErrorCode TSMonitorDrawCtxDestroy(TSMonitorDrawCtx *);
513: PETSC_EXTERN PetscErrorCode TSMonitorDrawSolution(TS, PetscInt, PetscReal, Vec, PetscCtx);
514: PETSC_EXTERN PetscErrorCode TSMonitorDrawSolutionPhase(TS, PetscInt, PetscReal, Vec, PetscCtx);
515: PETSC_EXTERN PetscErrorCode TSMonitorDrawError(TS, PetscInt, PetscReal, Vec, PetscCtx);
516: PETSC_EXTERN PetscErrorCode TSMonitorDrawSolutionFunction(TS, PetscInt, PetscReal, Vec, PetscCtx);
518: PETSC_EXTERN PetscErrorCode TSAdjointMonitorDefault(TS, PetscInt, PetscReal, Vec, PetscInt, Vec[], Vec[], PetscViewerAndFormat *);
519: PETSC_EXTERN PetscErrorCode TSAdjointMonitorDrawSensi(TS, PetscInt, PetscReal, Vec, PetscInt, Vec[], Vec[], PetscCtx);
521: /*S
522: TSMonitorSolutionCtx - Context object for the `TS` `TSMonitorSolution()` monitor that views the solution at each time step using a `PetscViewer`
524: Level: developer
526: .seealso: `TS`, `TSMonitorSet()`, `TSMonitorSolution()`, `TSMonitorSolutionSetup()`
527: S*/
528: typedef struct _n_TSMonitorSolutionCtx *TSMonitorSolutionCtx;
529: PETSC_EXTERN PetscErrorCode TSMonitorSolution(TS, PetscInt, PetscReal, Vec, PetscViewerAndFormat *);
530: PETSC_EXTERN PetscErrorCode TSMonitorSolutionSetup(TS, PetscViewerAndFormat *);
532: /*S
533: TSMonitorVTKCtx - Context object for the `TS` `TSMonitorSolutionVTK()` monitor that dumps the solution to VTK files at each time step
535: Level: developer
537: .seealso: `TS`, `TSMonitorSet()`, `TSMonitorSolutionVTK()`, `TSMonitorSolutionVTKCtxCreate()`, `TSMonitorSolutionVTKDestroy()`
538: S*/
539: typedef struct _n_TSMonitorVTKCtx *TSMonitorVTKCtx;
540: PETSC_EXTERN PetscErrorCode TSMonitorSolutionVTK(TS, PetscInt, PetscReal, Vec, TSMonitorVTKCtx);
541: PETSC_EXTERN PetscErrorCode TSMonitorSolutionVTKDestroy(TSMonitorVTKCtx *);
542: PETSC_EXTERN PetscErrorCode TSMonitorSolutionVTKCtxCreate(const char *, TSMonitorVTKCtx *);
544: PETSC_EXTERN PetscErrorCode TSStep(TS);
545: PETSC_EXTERN PetscErrorCode TSEvaluateWLTE(TS, NormType, PetscInt *, PetscReal *);
546: PETSC_EXTERN PetscErrorCode TSEvaluateStep(TS, PetscInt, Vec, PetscBool *);
547: PETSC_EXTERN PetscErrorCode TSSolve(TS, Vec);
548: PETSC_EXTERN PetscErrorCode TSGetEquationType(TS, TSEquationType *);
549: PETSC_EXTERN PetscErrorCode TSSetEquationType(TS, TSEquationType);
550: PETSC_EXTERN PetscErrorCode TSGetConvergedReason(TS, TSConvergedReason *);
551: PETSC_EXTERN PetscErrorCode TSSetConvergedReason(TS, TSConvergedReason);
552: PETSC_EXTERN PetscErrorCode TSGetSolveTime(TS, PetscReal *);
553: PETSC_EXTERN PetscErrorCode TSGetSNESIterations(TS, PetscInt *);
554: PETSC_EXTERN PetscErrorCode TSGetKSPIterations(TS, PetscInt *);
555: PETSC_EXTERN PetscErrorCode TSGetStepRejections(TS, PetscInt *);
556: PETSC_EXTERN PetscErrorCode TSSetMaxStepRejections(TS, PetscInt);
557: PETSC_EXTERN PetscErrorCode TSGetSNESFailures(TS, PetscInt *);
558: PETSC_EXTERN PetscErrorCode TSSetMaxSNESFailures(TS, PetscInt);
559: PETSC_EXTERN PetscErrorCode TSSetErrorIfStepFails(TS, PetscBool);
560: PETSC_EXTERN PetscErrorCode TSRestartStep(TS);
561: PETSC_EXTERN PetscErrorCode TSRollBack(TS);
562: PETSC_EXTERN PetscErrorCode TSGetStepRollBack(TS, PetscBool *);
564: PETSC_EXTERN PetscErrorCode TSGetStages(TS, PetscInt *, Vec *[]);
566: PETSC_EXTERN PetscErrorCode TSGetTime(TS, PetscReal *);
567: PETSC_EXTERN PetscErrorCode TSSetTime(TS, PetscReal);
568: PETSC_EXTERN PetscErrorCode TSGetPrevTime(TS, PetscReal *);
569: PETSC_EXTERN PetscErrorCode TSGetTimeStep(TS, PetscReal *);
570: PETSC_EXTERN PetscErrorCode TSSetTimeStep(TS, PetscReal);
571: PETSC_EXTERN PetscErrorCode TSGetStepNumber(TS, PetscInt *);
572: PETSC_EXTERN PetscErrorCode TSSetStepNumber(TS, PetscInt);
574: /*S
575: TSRHSFunctionFn - A prototype of a `TS` right-hand-side evaluation function that would be passed to `TSSetRHSFunction()`
577: Calling Sequence:
578: + ts - timestep context
579: . t - current time
580: . u - input vector
581: . F - function vector
582: - ctx - [optional] user-defined function context
584: Level: beginner
586: Note:
587: The deprecated `TSRHSFunction` still works as a replacement for `TSRHSFunctionFn` *.
589: .seealso: [](ch_ts), `TS`, `TSSetRHSFunction()`, `DMTSSetRHSFunction()`, `TSIFunctionFn`,
590: `TSIJacobianFn`, `TSRHSJacobianFn`
591: S*/
592: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode TSRHSFunctionFn(TS ts, PetscReal t, Vec u, Vec F, PetscCtx ctx);
594: PETSC_EXTERN_TYPEDEF typedef TSRHSFunctionFn *TSRHSFunction;
596: /*S
597: TSRHSJacobianFn - A prototype of a `TS` right-hand-side Jacobian evaluation function that would be passed to `TSSetRHSJacobian()`
599: Calling Sequence:
600: + ts - the `TS` context obtained from `TSCreate()`
601: . t - current time
602: . u - input vector
603: . Amat - (approximate) Jacobian matrix
604: . Pmat - matrix from which preconditioner is to be constructed (usually the same as `Amat`)
605: - ctx - [optional] user-defined context for matrix evaluation routine
607: Level: beginner
609: Note:
610: The deprecated `TSRHSJacobian` still works as a replacement for `TSRHSJacobianFn` *.
612: .seealso: [](ch_ts), `TS`, `TSSetRHSJacobian()`, `DMTSSetRHSJacobian()`, `TSRHSFunctionFn`,
613: `TSIFunctionFn`, `TSIJacobianFn`
614: S*/
615: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode TSRHSJacobianFn(TS ts, PetscReal t, Vec u, Mat Amat, Mat Pmat, PetscCtx ctx);
617: PETSC_EXTERN_TYPEDEF typedef TSRHSJacobianFn *TSRHSJacobian;
619: /*S
620: TSRHSJacobianPFn - A prototype of a function that computes the Jacobian of G w.r.t. the parameters P where
621: U_t = G(U,P,t), as well as the location to store the matrix that would be passed to `TSSetRHSJacobianP()`
623: Calling Sequence:
624: + ts - the `TS` context
625: . t - current timestep
626: . U - input vector (current ODE solution)
627: . A - output matrix
628: - ctx - [optional] user-defined function context
630: Level: beginner
632: Note:
633: The deprecated `TSRHSJacobianP` still works as a replacement for `TSRHSJacobianPFn` *.
635: .seealso: [](ch_ts), `TS`, `TSSetRHSJacobianP()`, `TSGetRHSJacobianP()`
636: S*/
637: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode TSRHSJacobianPFn(TS ts, PetscReal t, Vec U, Mat A, PetscCtx ctx);
639: PETSC_EXTERN_TYPEDEF typedef TSRHSJacobianPFn *TSRHSJacobianP;
641: PETSC_EXTERN PetscErrorCode TSSetRHSFunction(TS, Vec, TSRHSFunctionFn *, PetscCtx);
642: PETSC_EXTERN PetscErrorCode TSGetRHSFunction(TS, Vec *, TSRHSFunctionFn **, PetscCtxRt);
643: PETSC_EXTERN PetscErrorCode TSSetRHSJacobian(TS, Mat, Mat, TSRHSJacobianFn *, PetscCtx);
644: PETSC_EXTERN PetscErrorCode TSGetRHSJacobian(TS, Mat *, Mat *, TSRHSJacobianFn **, PetscCtxRt);
645: PETSC_EXTERN PetscErrorCode TSRHSJacobianSetReuse(TS, PetscBool);
647: /*S
648: TSSolutionFn - A prototype of a `TS` solution evaluation function that would be passed to `TSSetSolutionFunction()`
650: Calling Sequence:
651: + ts - timestep context
652: . t - current time
653: . u - output vector
654: - ctx - [optional] user-defined function context
656: Level: advanced
658: Note:
659: The deprecated `TSSolutionFunction` still works as a replacement for `TSSolutionFn` *.
661: .seealso: [](ch_ts), `TS`, `TSSetSolutionFunction()`, `DMTSSetSolutionFunction()`
662: S*/
663: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode TSSolutionFn(TS ts, PetscReal t, Vec u, PetscCtx ctx);
665: PETSC_EXTERN_TYPEDEF typedef TSSolutionFn *TSSolutionFunction;
667: PETSC_EXTERN PetscErrorCode TSSetSolutionFunction(TS, TSSolutionFn *, PetscCtx);
669: /*S
670: TSForcingFn - A prototype of a `TS` forcing function evaluation function that would be passed to `TSSetForcingFunction()`
672: Calling Sequence:
673: + ts - timestep context
674: . t - current time
675: . f - output vector
676: - ctx - [optional] user-defined function context
678: Level: advanced
680: Note:
681: The deprecated `TSForcingFunction` still works as a replacement for `TSForcingFn` *.
683: .seealso: [](ch_ts), `TS`, `TSSetForcingFunction()`, `DMTSSetForcingFunction()`
684: S*/
685: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode TSForcingFn(TS ts, PetscReal t, Vec f, PetscCtx ctx);
687: PETSC_EXTERN_TYPEDEF typedef TSForcingFn *TSForcingFunction;
689: PETSC_EXTERN PetscErrorCode TSSetForcingFunction(TS, TSForcingFn *, PetscCtx);
691: /*S
692: TSIFunctionFn - A prototype of a `TS` implicit function evaluation function that would be passed to `TSSetIFunction()
694: Calling Sequence:
695: + ts - the `TS` context obtained from `TSCreate()`
696: . t - time at step/stage being solved
697: . U - state vector
698: . U_t - time derivative of state vector
699: . F - function vector
700: - ctx - [optional] user-defined context for function
702: Level: beginner
704: Note:
705: The deprecated `TSIFunction` still works as a replacement for `TSIFunctionFn` *.
707: .seealso: [](ch_ts), `TS`, `TSSetIFunction()`, `DMTSSetIFunction()`, `TSIJacobianFn`, `TSRHSFunctionFn`, `TSRHSJacobianFn`
708: S*/
709: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode TSIFunctionFn(TS ts, PetscReal t, Vec U, Vec U_t, Vec F, PetscCtx ctx);
711: PETSC_EXTERN_TYPEDEF typedef TSIFunctionFn *TSIFunction;
713: /*S
714: TSIJacobianFn - A prototype of a `TS` Jacobian evaluation function that would be passed to `TSSetIJacobian()`
716: Calling Sequence:
717: + ts - the `TS` context obtained from `TSCreate()`
718: . t - time at step/stage being solved
719: . U - state vector
720: . U_t - time derivative of state vector
721: . a - shift
722: . Amat - (approximate) Jacobian of F(t,U,W+a*U), equivalent to dF/dU + a*dF/dU_t
723: . Pmat - matrix used for constructing preconditioner, usually the same as `Amat`
724: - ctx - [optional] user-defined context for Jacobian evaluation routine
726: Level: beginner
728: Note:
729: The deprecated `TSIJacobian` still works as a replacement for `TSIJacobianFn` *.
731: .seealso: [](ch_ts), `TSSetIJacobian()`, `DMTSSetIJacobian()`, `TSIFunctionFn`, `TSRHSFunctionFn`, `TSRHSJacobianFn`
732: S*/
733: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode TSIJacobianFn(TS ts, PetscReal t, Vec U, Vec U_t, PetscReal a, Mat Amat, Mat Pmat, PetscCtx ctx);
735: PETSC_EXTERN_TYPEDEF typedef TSIJacobianFn *TSIJacobian;
737: PETSC_EXTERN PetscErrorCode TSSetIFunction(TS, Vec, TSIFunctionFn *, PetscCtx);
738: PETSC_EXTERN PetscErrorCode TSGetIFunction(TS, Vec *, TSIFunctionFn **, PetscCtxRt);
739: PETSC_EXTERN PetscErrorCode TSSetIJacobian(TS, Mat, Mat, TSIJacobianFn *, PetscCtx);
740: PETSC_EXTERN PetscErrorCode TSGetIJacobian(TS, Mat *, Mat *, TSIJacobianFn **, PetscCtxRt);
742: /*S
743: TSI2FunctionFn - A prototype of a `TS` implicit function evaluation function for 2nd order systems that would be passed to `TSSetI2Function()`
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: . F - function vector
752: - ctx - [optional] user-defined context for matrix evaluation routine (may be `NULL`)
754: Level: advanced
756: Note:
757: The deprecated `TSI2Function` still works as a replacement for `TSI2FunctionFn` *.
759: .seealso: [](ch_ts), `TS`, `TSSetI2Function()`, `DMTSSetI2Function()`, `TSIFunctionFn`
760: S*/
761: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode TSI2FunctionFn(TS ts, PetscReal t, Vec U, Vec U_t, Vec U_tt, Vec F, PetscCtx ctx);
763: PETSC_EXTERN_TYPEDEF typedef TSI2FunctionFn *TSI2Function;
765: /*S
766: TSI2JacobianFn - A prototype of a `TS` implicit Jacobian evaluation function for 2nd order systems that would be passed to `TSSetI2Jacobian()`
768: Calling Sequence:
769: + ts - the `TS` context obtained from `TSCreate()`
770: . t - time at step/stage being solved
771: . U - state vector
772: . U_t - time derivative of state vector
773: . U_tt - second time derivative of state vector
774: . v - shift for U_t
775: . a - shift for U_tt
776: . 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
777: . jac - matrix from which to construct the preconditioner, may be same as `J`
778: - ctx - [optional] user-defined context for matrix evaluation routine
780: Level: advanced
782: Note:
783: The deprecated `TSI2Jacobian` still works as a replacement for `TSI2JacobianFn` *.
785: .seealso: [](ch_ts), `TS`, `TSSetI2Jacobian()`, `DMTSSetI2Jacobian()`, `TSIFunctionFn`, `TSIJacobianFn`, `TSRHSFunctionFn`, `TSRHSJacobianFn`
786: S*/
787: 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);
789: PETSC_EXTERN_TYPEDEF typedef TSI2JacobianFn *TSI2Jacobian;
791: PETSC_EXTERN PetscErrorCode TSSetI2Function(TS, Vec, TSI2FunctionFn *, PetscCtx);
792: PETSC_EXTERN PetscErrorCode TSGetI2Function(TS, Vec *, TSI2FunctionFn **, PetscCtxRt);
793: PETSC_EXTERN PetscErrorCode TSSetI2Jacobian(TS, Mat, Mat, TSI2JacobianFn *, PetscCtx);
794: PETSC_EXTERN PetscErrorCode TSGetI2Jacobian(TS, Mat *, Mat *, TSI2JacobianFn **, PetscCtxRt);
796: PETSC_EXTERN PetscErrorCode TSRHSSplitSetIS(TS, const char[], IS);
797: PETSC_EXTERN PetscErrorCode TSRHSSplitGetIS(TS, const char[], IS *);
798: PETSC_EXTERN PetscErrorCode TSRHSSplitSetRHSFunction(TS, const char[], Vec, TSRHSFunctionFn *, PetscCtx);
799: PETSC_EXTERN PetscErrorCode TSRHSSplitSetIFunction(TS, const char[], Vec, TSIFunctionFn *, PetscCtx);
800: PETSC_EXTERN PetscErrorCode TSRHSSplitSetIJacobian(TS, const char[], Mat, Mat, TSIJacobianFn *, PetscCtx);
801: PETSC_EXTERN PetscErrorCode TSRHSSplitGetSubTS(TS, const char[], TS *);
802: PETSC_EXTERN PetscErrorCode TSRHSSplitGetSubTSs(TS, PetscInt *, TS *[]);
803: PETSC_EXTERN PetscErrorCode TSSetUseSplitRHSFunction(TS, PetscBool);
804: PETSC_EXTERN PetscErrorCode TSGetUseSplitRHSFunction(TS, PetscBool *);
805: PETSC_EXTERN PetscErrorCode TSRHSSplitGetSNES(TS, SNES *);
806: PETSC_EXTERN PetscErrorCode TSRHSSplitSetSNES(TS, SNES);
808: PETSC_EXTERN TSRHSFunctionFn TSComputeRHSFunctionLinear;
809: PETSC_EXTERN TSRHSJacobianFn TSComputeRHSJacobianConstant;
810: PETSC_EXTERN PetscErrorCode TSComputeIFunctionLinear(TS, PetscReal, Vec, Vec, Vec, PetscCtx);
811: PETSC_EXTERN PetscErrorCode TSComputeIJacobianConstant(TS, PetscReal, Vec, Vec, PetscReal, Mat, Mat, PetscCtx);
812: PETSC_EXTERN PetscErrorCode TSComputeSolutionFunction(TS, PetscReal, Vec);
813: PETSC_EXTERN PetscErrorCode TSComputeForcingFunction(TS, PetscReal, Vec);
814: PETSC_EXTERN PetscErrorCode TSComputeIJacobianDefaultColor(TS, PetscReal, Vec, Vec, PetscReal, Mat, Mat, PetscCtx);
815: PETSC_EXTERN PetscErrorCode TSPruneIJacobianColor(TS, Mat, Mat);
817: PETSC_EXTERN PetscErrorCode TSSetPreStep(TS, PetscErrorCode (*)(TS));
818: PETSC_EXTERN PetscErrorCode TSSetPreStage(TS, PetscErrorCode (*)(TS, PetscReal));
819: PETSC_EXTERN PetscErrorCode TSSetPostStage(TS, PetscErrorCode (*)(TS, PetscReal, PetscInt, Vec *));
820: PETSC_EXTERN PetscErrorCode TSSetPostEvaluate(TS, PetscErrorCode (*)(TS));
821: PETSC_EXTERN PetscErrorCode TSSetPostStep(TS, PetscErrorCode (*)(TS));
822: PETSC_EXTERN PetscErrorCode TSSetResize(TS, PetscBool, PetscErrorCode (*)(TS, PetscInt, PetscReal, Vec, PetscBool *, PetscCtx), PetscErrorCode (*)(TS, PetscInt, Vec[], Vec[], PetscCtx), PetscCtx);
823: PETSC_EXTERN PetscErrorCode TSPreStep(TS);
824: PETSC_EXTERN PetscErrorCode TSPreStage(TS, PetscReal);
825: PETSC_EXTERN PetscErrorCode TSPostStage(TS, PetscReal, PetscInt, Vec[]);
826: PETSC_EXTERN PetscErrorCode TSPostEvaluate(TS);
827: PETSC_EXTERN PetscErrorCode TSPostStep(TS);
828: PETSC_EXTERN PetscErrorCode TSResize(TS);
829: PETSC_EXTERN PetscErrorCode TSResizeRetrieveVec(TS, const char *, Vec *);
830: PETSC_EXTERN PetscErrorCode TSResizeRegisterVec(TS, const char *, Vec);
831: PETSC_EXTERN PetscErrorCode TSGetStepResize(TS, PetscBool *);
833: PETSC_EXTERN PetscErrorCode TSInterpolate(TS, PetscReal, Vec);
834: PETSC_EXTERN PetscErrorCode TSSetTolerances(TS, PetscReal, Vec, PetscReal, Vec);
835: PETSC_EXTERN PetscErrorCode TSGetTolerances(TS, PetscReal *, Vec *, PetscReal *, Vec *);
836: PETSC_EXTERN PetscErrorCode TSErrorWeightedNorm(TS, Vec, Vec, NormType, PetscReal *, PetscReal *, PetscReal *);
837: PETSC_EXTERN PetscErrorCode TSErrorWeightedENorm(TS, Vec, Vec, Vec, NormType, PetscReal *, PetscReal *, PetscReal *);
838: PETSC_EXTERN PetscErrorCode TSSetCFLTimeLocal(TS, PetscReal);
839: PETSC_EXTERN PetscErrorCode TSGetCFLTime(TS, PetscReal *);
840: PETSC_EXTERN PetscErrorCode TSSetFunctionDomainError(TS, PetscErrorCode (*)(TS, PetscReal, Vec, PetscBool *));
841: PETSC_EXTERN PetscErrorCode TSFunctionDomainError(TS, PetscReal, Vec, PetscBool *);
843: PETSC_EXTERN PetscErrorCode TSPseudoSetTimeStep(TS, PetscErrorCode (*)(TS, PetscReal *, PetscCtx), PetscCtx);
844: PETSC_EXTERN PetscErrorCode TSPseudoTimeStepDefault(TS, PetscReal *, PetscCtx);
845: PETSC_EXTERN PetscErrorCode TSPseudoSetMaxTimeStep(TS, PetscReal);
846: PETSC_EXTERN PetscErrorCode TSPseudoSetVerifyTimeStep(TS, PetscErrorCode (*)(TS, Vec, PetscCtx, PetscReal *, PetscBool *), PetscCtx);
847: PETSC_EXTERN PetscErrorCode TSPseudoSetTimeStepIncrement(TS, PetscReal);
848: PETSC_EXTERN PetscErrorCode TSPseudoIncrementDtFromInitialDt(TS);
849: PETSC_EXTERN PetscErrorCode TSPseudoComputeFunction(TS, Vec, Vec *, PetscReal *);
851: PETSC_EXTERN PetscErrorCode TSPythonSetType(TS, const char[]);
852: PETSC_EXTERN PetscErrorCode TSPythonGetType(TS, const char *[]);
854: PETSC_EXTERN PetscErrorCode TSComputeRHSFunction(TS, PetscReal, Vec, Vec);
855: PETSC_EXTERN PetscErrorCode TSComputeRHSJacobian(TS, PetscReal, Vec, Mat, Mat);
856: PETSC_EXTERN PetscErrorCode TSComputeIFunction(TS, PetscReal, Vec, Vec, Vec, PetscBool);
857: PETSC_EXTERN PetscErrorCode TSComputeIJacobian(TS, PetscReal, Vec, Vec, PetscReal, Mat, Mat, PetscBool);
858: PETSC_EXTERN PetscErrorCode TSComputeI2Function(TS, PetscReal, Vec, Vec, Vec, Vec);
859: PETSC_EXTERN PetscErrorCode TSComputeI2Jacobian(TS, PetscReal, Vec, Vec, Vec, PetscReal, PetscReal, Mat, Mat);
860: PETSC_EXTERN PetscErrorCode TSComputeLinearStability(TS, PetscReal, PetscReal, PetscReal *, PetscReal *);
862: PETSC_EXTERN PetscErrorCode TSVISetVariableBounds(TS, Vec, Vec);
864: PETSC_EXTERN PetscErrorCode DMTSSetBoundaryLocal(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 user 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 *);
1061: PETSC_EXTERN PetscErrorCode TSView(TS, PetscViewer);
1062: PETSC_EXTERN PetscErrorCode TSLoad(TS, PetscViewer);
1063: PETSC_EXTERN PetscErrorCode TSViewFromOptions(TS, PetscObject, const char[]);
1064: PETSC_EXTERN PetscErrorCode TSTrajectoryViewFromOptions(TSTrajectory, PetscObject, const char[]);
1066: #define TS_FILE_CLASSID 1211225
1068: PETSC_EXTERN PetscErrorCode TSSetApplicationContext(TS, PetscCtx);
1069: PETSC_EXTERN PetscErrorCode TSGetApplicationContext(TS, PetscCtxRt);
1071: PETSC_EXTERN PetscErrorCode TSMonitorLGCtxCreate(MPI_Comm, const char[], const char[], int, int, int, int, PetscInt, TSMonitorLGCtx *);
1072: PETSC_EXTERN PetscErrorCode TSMonitorLGCtxDestroy(TSMonitorLGCtx *);
1073: PETSC_EXTERN PetscErrorCode TSMonitorLGTimeStep(TS, PetscInt, PetscReal, Vec, void *);
1074: PETSC_EXTERN PetscErrorCode TSMonitorLGSolution(TS, PetscInt, PetscReal, Vec, void *);
1075: PETSC_EXTERN PetscErrorCode TSMonitorLGSetVariableNames(TS, const char *const *);
1076: PETSC_EXTERN PetscErrorCode TSMonitorLGGetVariableNames(TS, const char *const **);
1077: PETSC_EXTERN PetscErrorCode TSMonitorLGCtxSetVariableNames(TSMonitorLGCtx, const char *const *);
1078: PETSC_EXTERN PetscErrorCode TSMonitorLGSetDisplayVariables(TS, const char *const *);
1079: PETSC_EXTERN PetscErrorCode TSMonitorLGCtxSetDisplayVariables(TSMonitorLGCtx, const char *const *);
1080: PETSC_EXTERN PetscErrorCode TSMonitorLGSetTransform(TS, PetscErrorCode (*)(void *, Vec, Vec *), PetscCtxDestroyFn *, void *);
1081: PETSC_EXTERN PetscErrorCode TSMonitorLGCtxSetTransform(TSMonitorLGCtx, PetscErrorCode (*)(void *, Vec, Vec *), PetscCtxDestroyFn *, void *);
1082: PETSC_EXTERN PetscErrorCode TSMonitorLGError(TS, PetscInt, PetscReal, Vec, void *);
1083: PETSC_EXTERN PetscErrorCode TSMonitorLGSNESIterations(TS, PetscInt, PetscReal, Vec, void *);
1084: PETSC_EXTERN PetscErrorCode TSMonitorLGKSPIterations(TS, PetscInt, PetscReal, Vec, void *);
1085: PETSC_EXTERN PetscErrorCode TSMonitorError(TS, PetscInt, PetscReal, Vec, PetscViewerAndFormat *);
1086: PETSC_EXTERN PetscErrorCode TSDMSwarmMonitorMoments(TS, PetscInt, PetscReal, Vec, PetscViewerAndFormat *);
1088: struct _n_TSMonitorLGCtxNetwork {
1089: PetscInt nlg;
1090: PetscDrawLG *lg;
1091: PetscBool semilogy;
1092: PetscInt howoften; /* when > 0 uses step % howoften, when negative only final solution plotted */
1093: };
1094: /*S
1095: TSMonitorLGCtxNetwork - Context object for the `TSMonitorLGCtxNetworkSolution()` line-graph monitor that plots solution components on each subnetwork of a `DMNETWORK`
1097: Level: developer
1099: .seealso: `TS`, `DMNETWORK`, `TSMonitorLGCtxNetworkCreate()`, `TSMonitorLGCtxNetworkDestroy()`, `TSMonitorLGCtxNetworkSolution()`
1100: S*/
1101: typedef struct _n_TSMonitorLGCtxNetwork *TSMonitorLGCtxNetwork;
1102: PETSC_EXTERN PetscErrorCode TSMonitorLGCtxNetworkDestroy(TSMonitorLGCtxNetwork *);
1103: PETSC_EXTERN PetscErrorCode TSMonitorLGCtxNetworkCreate(TS, const char[], const char[], int, int, int, int, PetscInt, TSMonitorLGCtxNetwork *);
1104: PETSC_EXTERN PetscErrorCode TSMonitorLGCtxNetworkSolution(TS, PetscInt, PetscReal, Vec, void *);
1106: /*S
1107: TSMonitorEnvelopeCtx - Context object for the `TSMonitorEnvelope()` monitor that tracks the per-component min/max envelope of the solution over a time integration
1109: Level: developer
1111: .seealso: `TS`, `TSMonitorEnvelopeCtxCreate()`, `TSMonitorEnvelopeCtxDestroy()`, `TSMonitorEnvelope()`, `TSMonitorEnvelopeGetBounds()`
1112: S*/
1113: typedef struct _n_TSMonitorEnvelopeCtx *TSMonitorEnvelopeCtx;
1114: PETSC_EXTERN PetscErrorCode TSMonitorEnvelopeCtxCreate(TS, TSMonitorEnvelopeCtx *);
1115: PETSC_EXTERN PetscErrorCode TSMonitorEnvelope(TS, PetscInt, PetscReal, Vec, void *);
1116: PETSC_EXTERN PetscErrorCode TSMonitorEnvelopeGetBounds(TS, Vec *, Vec *);
1117: PETSC_EXTERN PetscErrorCode TSMonitorEnvelopeCtxDestroy(TSMonitorEnvelopeCtx *);
1119: /*S
1120: TSMonitorSPEigCtx - Context object for the `TSMonitorSPEig()` monitor that displays an estimate of the spectrum of the operator using a `PetscDrawSP` scatter plot
1122: Level: developer
1124: .seealso: `TS`, `TSMonitorSPEigCtxCreate()`, `TSMonitorSPEigCtxDestroy()`, `TSMonitorSPEig()`
1125: S*/
1126: typedef struct _n_TSMonitorSPEigCtx *TSMonitorSPEigCtx;
1127: PETSC_EXTERN PetscErrorCode TSMonitorSPEigCtxCreate(MPI_Comm, const char[], const char[], int, int, int, int, PetscInt, TSMonitorSPEigCtx *);
1128: PETSC_EXTERN PetscErrorCode TSMonitorSPEigCtxDestroy(TSMonitorSPEigCtx *);
1129: PETSC_EXTERN PetscErrorCode TSMonitorSPEig(TS, PetscInt, PetscReal, Vec, void *);
1131: /*S
1132: TSMonitorSPCtx - Context object for the `TSMonitorSPSwarmSolution()` scatter-plot monitor that draws the swarm particle positions at each time step on a `PetscDrawSP`
1134: Level: developer
1136: .seealso: `TS`, `DMSWARM`, `TSMonitorSPCtxCreate()`, `TSMonitorSPCtxDestroy()`, `TSMonitorSPSwarmSolution()`
1137: S*/
1138: typedef struct _n_TSMonitorSPCtx *TSMonitorSPCtx;
1139: PETSC_EXTERN PetscErrorCode TSMonitorSPCtxCreate(MPI_Comm, const char[], const char[], int, int, int, int, PetscInt, PetscInt, PetscBool, PetscBool, TSMonitorSPCtx *);
1140: PETSC_EXTERN PetscErrorCode TSMonitorSPCtxDestroy(TSMonitorSPCtx *);
1141: PETSC_EXTERN PetscErrorCode TSMonitorSPSwarmSolution(TS, PetscInt, PetscReal, Vec, void *);
1143: /*S
1144: TSMonitorHGCtx - Context object for the `TSMonitorHGSwarmSolution()` histogram monitor that displays a histogram of `DMSWARM` particle quantities at each time step
1146: Level: developer
1148: .seealso: `TS`, `DMSWARM`, `TSMonitorHGCtxCreate()`, `TSMonitorHGCtxDestroy()`, `TSMonitorHGSwarmSolution()`
1149: S*/
1150: typedef struct _n_TSMonitorHGCtx *TSMonitorHGCtx;
1151: PETSC_EXTERN PetscErrorCode TSMonitorHGCtxCreate(MPI_Comm, const char[], const char[], int, int, int, int, PetscInt, PetscInt, PetscInt, PetscBool, TSMonitorHGCtx *);
1152: PETSC_EXTERN PetscErrorCode TSMonitorHGSwarmSolution(TS, PetscInt, PetscReal, Vec, void *);
1153: PETSC_EXTERN PetscErrorCode TSMonitorHGCtxDestroy(TSMonitorHGCtx *);
1154: PETSC_EXTERN PetscErrorCode TSMonitorHGSwarmSolution(TS, PetscInt, PetscReal, Vec, void *);
1156: /*M
1157: TSEvent - Abstract object to handle event detection in `TS` time integrator
1159: Level: intermediate
1161: Note:
1162: See `TSSetEventHandler()` for the management of events.
1164: .seealso: [](sec_ts_event), `TS`, `TSSetEventHandler()`, `TSSetPostEventStep()`, `TSSetPostEventSecondStep()`, `TSSetEventTolerances()`, `TSGetNumEvents()`
1165: M*/
1166: typedef struct _n_TSEvent *TSEvent;
1168: PETSC_EXTERN PetscErrorCode TSSetEventHandler(TS, PetscInt, PetscInt[], PetscBool[], PetscErrorCode (*)(TS, PetscReal, Vec, PetscReal[], void *), PetscErrorCode (*)(TS, PetscInt, PetscInt[], PetscReal, Vec, PetscBool, void *), void *);
1169: PETSC_EXTERN PetscErrorCode TSSetPostEventStep(TS, PetscReal);
1170: PETSC_EXTERN PetscErrorCode TSSetPostEventSecondStep(TS, PetscReal);
1171: PETSC_DEPRECATED_FUNCTION(3, 21, 0, "TSSetPostEventSecondStep()", ) static inline PetscErrorCode TSSetPostEventIntervalStep(TS ts, PetscReal dt)
1172: {
1173: return TSSetPostEventSecondStep(ts, dt);
1174: }
1175: PETSC_EXTERN PetscErrorCode TSSetEventTolerances(TS, PetscReal, PetscReal[]);
1176: PETSC_EXTERN PetscErrorCode TSGetNumEvents(TS, PetscInt *);
1178: /*J
1179: TSSSPType - string with the name of a `TSSSP` scheme.
1181: Level: beginner
1183: .seealso: [](ch_ts), `TSSSPSetType()`, `TS`, `TSSSP`
1184: J*/
1185: typedef const char *TSSSPType;
1186: #define TSSSPRKS2 "rks2"
1187: #define TSSSPRKS3 "rks3"
1188: #define TSSSPRK104 "rk104"
1190: PETSC_EXTERN PetscErrorCode TSSSPSetType(TS, TSSSPType);
1191: PETSC_EXTERN PetscErrorCode TSSSPGetType(TS, TSSSPType *);
1192: PETSC_EXTERN PetscErrorCode TSSSPSetNumStages(TS, PetscInt);
1193: PETSC_EXTERN PetscErrorCode TSSSPGetNumStages(TS, PetscInt *);
1194: PETSC_EXTERN PetscErrorCode TSSSPInitializePackage(void);
1195: PETSC_EXTERN PetscErrorCode TSSSPFinalizePackage(void);
1196: PETSC_EXTERN PetscFunctionList TSSSPList;
1198: /*S
1199: TSAdapt - Abstract object that manages time-step adaptivity
1201: Level: beginner
1203: .seealso: [](ch_ts), [](sec_ts_error_control), `TS`, `TSGetAdapt()`, `TSAdaptCreate()`, `TSAdaptType`
1204: S*/
1205: typedef struct _p_TSAdapt *TSAdapt;
1207: /*J
1208: TSAdaptType - String with the name of `TSAdapt` scheme.
1210: Level: beginner
1212: .seealso: [](ch_ts), [](sec_ts_error_control), `TSGetAdapt()`, `TSAdaptSetType()`, `TS`, `TSAdapt`
1213: J*/
1214: typedef const char *TSAdaptType;
1215: #define TSADAPTNONE "none"
1216: #define TSADAPTBASIC "basic"
1217: #define TSADAPTDSP "dsp"
1218: #define TSADAPTCFL "cfl"
1219: #define TSADAPTGLEE "glee"
1220: #define TSADAPTHISTORY "history"
1222: PETSC_EXTERN PetscErrorCode TSGetAdapt(TS, TSAdapt *);
1223: PETSC_EXTERN PetscErrorCode TSAdaptRegister(const char[], PetscErrorCode (*)(TSAdapt));
1224: PETSC_EXTERN PetscErrorCode TSAdaptInitializePackage(void);
1225: PETSC_EXTERN PetscErrorCode TSAdaptFinalizePackage(void);
1226: PETSC_EXTERN PetscErrorCode TSAdaptCreate(MPI_Comm, TSAdapt *);
1227: PETSC_EXTERN PetscErrorCode TSAdaptSetType(TSAdapt, TSAdaptType);
1228: PETSC_EXTERN PetscErrorCode TSAdaptGetType(TSAdapt, TSAdaptType *);
1229: PETSC_EXTERN PetscErrorCode TSAdaptSetOptionsPrefix(TSAdapt, const char[]);
1230: PETSC_EXTERN PetscErrorCode TSAdaptCandidatesClear(TSAdapt);
1231: PETSC_EXTERN PetscErrorCode TSAdaptCandidateAdd(TSAdapt, const char[], PetscInt, PetscInt, PetscReal, PetscReal, PetscBool);
1232: PETSC_EXTERN PetscErrorCode TSAdaptCandidatesGet(TSAdapt, PetscInt *, const PetscInt **, const PetscInt **, const PetscReal **, const PetscReal **);
1233: PETSC_EXTERN PetscErrorCode TSAdaptChoose(TSAdapt, TS, PetscReal, PetscInt *, PetscReal *, PetscBool *);
1234: PETSC_EXTERN PetscErrorCode TSAdaptCheckStage(TSAdapt, TS, PetscReal, Vec, PetscBool *);
1235: PETSC_EXTERN PetscErrorCode TSAdaptView(TSAdapt, PetscViewer);
1236: PETSC_EXTERN PetscErrorCode TSAdaptLoad(TSAdapt, PetscViewer);
1237: PETSC_EXTERN PetscErrorCode TSAdaptSetFromOptions(TSAdapt, PetscOptionItems);
1238: PETSC_EXTERN PetscErrorCode TSAdaptReset(TSAdapt);
1239: PETSC_EXTERN PetscErrorCode TSAdaptDestroy(TSAdapt *);
1240: PETSC_EXTERN PetscErrorCode TSAdaptSetMonitor(TSAdapt, PetscBool);
1241: PETSC_EXTERN PetscErrorCode TSAdaptSetAlwaysAccept(TSAdapt, PetscBool);
1242: PETSC_EXTERN PetscErrorCode TSAdaptSetSafety(TSAdapt, PetscReal, PetscReal);
1243: PETSC_EXTERN PetscErrorCode TSAdaptGetSafety(TSAdapt, PetscReal *, PetscReal *);
1244: PETSC_EXTERN PetscErrorCode TSAdaptSetMaxIgnore(TSAdapt, PetscReal);
1245: PETSC_EXTERN PetscErrorCode TSAdaptGetMaxIgnore(TSAdapt, PetscReal *);
1246: PETSC_EXTERN PetscErrorCode TSAdaptSetClip(TSAdapt, PetscReal, PetscReal);
1247: PETSC_EXTERN PetscErrorCode TSAdaptGetClip(TSAdapt, PetscReal *, PetscReal *);
1248: PETSC_EXTERN PetscErrorCode TSAdaptSetScaleSolveFailed(TSAdapt, PetscReal);
1249: PETSC_EXTERN PetscErrorCode TSAdaptGetScaleSolveFailed(TSAdapt, PetscReal *);
1250: PETSC_EXTERN PetscErrorCode TSAdaptSetStepLimits(TSAdapt, PetscReal, PetscReal);
1251: PETSC_EXTERN PetscErrorCode TSAdaptGetStepLimits(TSAdapt, PetscReal *, PetscReal *);
1252: PETSC_EXTERN PetscErrorCode TSAdaptSetCheckStage(TSAdapt, PetscErrorCode (*)(TSAdapt, TS, PetscReal, Vec, PetscBool *));
1253: PETSC_EXTERN PetscErrorCode TSAdaptHistorySetHistory(TSAdapt, PetscInt, PetscReal[], PetscBool);
1254: PETSC_EXTERN PetscErrorCode TSAdaptHistorySetTrajectory(TSAdapt, TSTrajectory, PetscBool);
1255: PETSC_EXTERN PetscErrorCode TSAdaptHistoryGetStep(TSAdapt, PetscInt, PetscReal *, PetscReal *);
1256: PETSC_EXTERN PetscErrorCode TSAdaptSetTimeStepIncreaseDelay(TSAdapt, PetscInt);
1257: PETSC_EXTERN PetscErrorCode TSAdaptDSPSetFilter(TSAdapt, const char *);
1258: PETSC_EXTERN PetscErrorCode TSAdaptDSPSetPID(TSAdapt, PetscReal, PetscReal, PetscReal);
1260: /*S
1261: TSGLLEAdapt - Abstract object that manages time-step adaptivity for `TSGLLE`
1263: Level: beginner
1265: Developer Note:
1266: This functionality should be replaced by the `TSAdapt`.
1268: .seealso: [](ch_ts), `TS`, `TSGLLE`, `TSGLLEAdaptCreate()`, `TSGLLEAdaptType`
1269: S*/
1270: typedef struct _p_TSGLLEAdapt *TSGLLEAdapt;
1272: /*J
1273: TSGLLEAdaptType - String with the name of `TSGLLEAdapt` scheme
1275: Level: beginner
1277: Developer Note:
1278: This functionality should be replaced by the `TSAdaptType`.
1280: .seealso: [](ch_ts), `TSGLLEAdaptSetType()`, `TS`
1281: J*/
1282: typedef const char *TSGLLEAdaptType;
1283: #define TSGLLEADAPT_NONE "none"
1284: #define TSGLLEADAPT_SIZE "size"
1285: #define TSGLLEADAPT_BOTH "both"
1287: PETSC_EXTERN PetscErrorCode TSGLLEAdaptRegister(const char[], PetscErrorCode (*)(TSGLLEAdapt));
1288: PETSC_EXTERN PetscErrorCode TSGLLEAdaptInitializePackage(void);
1289: PETSC_EXTERN PetscErrorCode TSGLLEAdaptFinalizePackage(void);
1290: PETSC_EXTERN PetscErrorCode TSGLLEAdaptCreate(MPI_Comm, TSGLLEAdapt *);
1291: PETSC_EXTERN PetscErrorCode TSGLLEAdaptSetType(TSGLLEAdapt, TSGLLEAdaptType);
1292: PETSC_EXTERN PetscErrorCode TSGLLEAdaptSetOptionsPrefix(TSGLLEAdapt, const char[]);
1293: PETSC_EXTERN PetscErrorCode TSGLLEAdaptChoose(TSGLLEAdapt, PetscInt, const PetscInt[], const PetscReal[], const PetscReal[], PetscInt, PetscReal, PetscReal, PetscInt *, PetscReal *, PetscBool *);
1294: PETSC_EXTERN PetscErrorCode TSGLLEAdaptView(TSGLLEAdapt, PetscViewer);
1295: PETSC_EXTERN PetscErrorCode TSGLLEAdaptSetFromOptions(TSGLLEAdapt, PetscOptionItems);
1296: PETSC_EXTERN PetscErrorCode TSGLLEAdaptDestroy(TSGLLEAdapt *);
1298: /*J
1299: TSGLLEAcceptType - String with the name of `TSGLLEAccept` scheme
1301: Level: beginner
1303: .seealso: [](ch_ts), `TSGLLESetAcceptType()`, `TS`, `TSGLLEAccept`
1304: J*/
1305: typedef const char *TSGLLEAcceptType;
1306: #define TSGLLEACCEPT_ALWAYS "always"
1308: /*S
1309: TSGLLEAcceptFn - A prototype of a `TS` accept function that would be passed to `TSGLLEAcceptRegister()`
1311: Calling Sequence:
1312: + ts - timestep context
1313: . nt - time to end of solution time
1314: . h - the proposed step-size
1315: . enorm - unknown
1316: - accept - output, if the proposal is accepted
1318: Level: beginner
1320: Note:
1321: The deprecated `TSGLLEAcceptFunction` still works as a replacement for `TSGLLEAcceptFn` *
1323: .seealso: [](ch_ts), `TS`, `TSSetRHSFunction()`, `DMTSSetRHSFunction()`, `TSIFunctionFn`,
1324: `TSIJacobianFn`, `TSRHSJacobianFn`, `TSGLLEAcceptRegister()`
1325: S*/
1326: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode TSGLLEAcceptFn(TS ts, PetscReal nt, PetscReal h, const PetscReal enorm[], PetscBool *accept);
1328: PETSC_EXTERN_TYPEDEF typedef TSGLLEAcceptFn *TSGLLEAcceptFunction;
1330: PETSC_EXTERN PetscErrorCode TSGLLEAcceptRegister(const char[], TSGLLEAcceptFn *);
1332: /*J
1333: TSGLLEType - string with the name of a General Linear `TSGLLE` type
1335: Level: beginner
1337: .seealso: [](ch_ts), `TS`, `TSGLLE`, `TSGLLESetType()`, `TSGLLERegister()`, `TSGLLEAccept`
1338: J*/
1339: typedef const char *TSGLLEType;
1340: #define TSGLLE_IRKS "irks"
1342: PETSC_EXTERN PetscErrorCode TSGLLERegister(const char[], PetscErrorCode (*)(TS));
1343: PETSC_EXTERN PetscErrorCode TSGLLEInitializePackage(void);
1344: PETSC_EXTERN PetscErrorCode TSGLLEFinalizePackage(void);
1345: PETSC_EXTERN PetscErrorCode TSGLLESetType(TS, TSGLLEType);
1346: PETSC_EXTERN PetscErrorCode TSGLLEGetAdapt(TS, TSGLLEAdapt *);
1347: PETSC_EXTERN PetscErrorCode TSGLLESetAcceptType(TS, TSGLLEAcceptType);
1349: /*J
1350: TSEIMEXType - String with the name of an Extrapolated IMEX `TSEIMEX` type
1352: Level: beginner
1354: .seealso: [](ch_ts), `TSEIMEXSetType()`, `TS`, `TSEIMEX`, `TSEIMEXRegister()`
1355: J*/
1356: #define TSEIMEXType char *
1358: PETSC_EXTERN PetscErrorCode TSEIMEXSetMaxRows(TS, PetscInt);
1359: PETSC_EXTERN PetscErrorCode TSEIMEXSetRowCol(TS, PetscInt, PetscInt);
1360: PETSC_EXTERN PetscErrorCode TSEIMEXSetOrdAdapt(TS, PetscBool);
1362: /*J
1363: TSRKType - String with the name of a Runge-Kutta `TSRK` type
1365: Level: beginner
1367: .seealso: [](ch_ts), `TS`, `TSRKSetType()`, `TSRK`, `TSRKRegister()`
1368: J*/
1369: typedef const char *TSRKType;
1370: #define TSRK1FE "1fe"
1371: #define TSRK2A "2a"
1372: #define TSRK2B "2b"
1373: #define TSRK3 "3"
1374: #define TSRK3BS "3bs"
1375: #define TSRK4 "4"
1376: #define TSRK5F "5f"
1377: #define TSRK5DP "5dp"
1378: #define TSRK5BS "5bs"
1379: #define TSRK6VR "6vr"
1380: #define TSRK7VR "7vr"
1381: #define TSRK8VR "8vr"
1383: PETSC_EXTERN PetscErrorCode TSRKGetOrder(TS, PetscInt *);
1384: PETSC_EXTERN PetscErrorCode TSRKGetType(TS, TSRKType *);
1385: PETSC_EXTERN PetscErrorCode TSRKSetType(TS, TSRKType);
1386: PETSC_EXTERN PetscErrorCode TSRKGetTableau(TS, PetscInt *, const PetscReal *[], const PetscReal *[], const PetscReal *[], const PetscReal *[], PetscInt *, const PetscReal *[], PetscBool *);
1387: PETSC_EXTERN PetscErrorCode TSRKSetMultirate(TS, PetscBool);
1388: PETSC_EXTERN PetscErrorCode TSRKGetMultirate(TS, PetscBool *);
1389: PETSC_EXTERN PetscErrorCode TSRKRegister(TSRKType, PetscInt, PetscInt, const PetscReal[], const PetscReal[], const PetscReal[], const PetscReal[], PetscInt, const PetscReal[]);
1390: PETSC_EXTERN PetscErrorCode TSRKInitializePackage(void);
1391: PETSC_EXTERN PetscErrorCode TSRKFinalizePackage(void);
1392: PETSC_EXTERN PetscErrorCode TSRKRegisterDestroy(void);
1394: /*J
1395: TSMPRKType - String with the name of a partitioned Runge-Kutta `TSMPRK` type
1397: Level: beginner
1399: .seealso: [](ch_ts), `TSMPRKSetType()`, `TS`, `TSMPRK`, `TSMPRKRegister()`
1400: J*/
1401: typedef const char *TSMPRKType;
1402: #define TSMPRK2A22 "2a22"
1403: #define TSMPRK2A23 "2a23"
1404: #define TSMPRK2A32 "2a32"
1405: #define TSMPRK2A33 "2a33"
1406: #define TSMPRKP2 "p2"
1407: #define TSMPRKP3 "p3"
1409: PETSC_EXTERN PetscErrorCode TSMPRKGetType(TS, TSMPRKType *);
1410: PETSC_EXTERN PetscErrorCode TSMPRKSetType(TS, TSMPRKType);
1411: 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[]);
1412: PETSC_EXTERN PetscErrorCode TSMPRKInitializePackage(void);
1413: PETSC_EXTERN PetscErrorCode TSMPRKFinalizePackage(void);
1414: PETSC_EXTERN PetscErrorCode TSMPRKRegisterDestroy(void);
1416: /*J
1417: TSIRKType - String with the name of an implicit Runge-Kutta `TSIRK` type
1419: Level: beginner
1421: .seealso: [](ch_ts), `TSIRKSetType()`, `TS`, `TSIRK`, `TSIRKRegister()`
1422: J*/
1423: typedef const char *TSIRKType;
1424: #define TSIRKGAUSS "gauss"
1426: PETSC_EXTERN PetscErrorCode TSIRKGetType(TS, TSIRKType *);
1427: PETSC_EXTERN PetscErrorCode TSIRKSetType(TS, TSIRKType);
1428: PETSC_EXTERN PetscErrorCode TSIRKGetNumStages(TS, PetscInt *);
1429: PETSC_EXTERN PetscErrorCode TSIRKSetNumStages(TS, PetscInt);
1430: PETSC_EXTERN PetscErrorCode TSIRKRegister(const char[], PetscErrorCode (*function)(TS));
1431: PETSC_EXTERN PetscErrorCode TSIRKTableauCreate(TS, PetscInt, const PetscReal *, const PetscReal *, const PetscReal *, const PetscReal *, const PetscScalar *, const PetscScalar *, const PetscScalar *);
1432: PETSC_EXTERN PetscErrorCode TSIRKInitializePackage(void);
1433: PETSC_EXTERN PetscErrorCode TSIRKFinalizePackage(void);
1434: PETSC_EXTERN PetscErrorCode TSIRKRegisterDestroy(void);
1436: /*J
1437: TSGLEEType - String with the name of a General Linear with Error Estimation `TSGLEE` type
1439: Level: beginner
1441: .seealso: [](ch_ts), `TSGLEESetType()`, `TS`, `TSGLEE`, `TSGLEERegister()`
1442: J*/
1443: typedef const char *TSGLEEType;
1444: #define TSGLEEi1 "BE1"
1445: #define TSGLEE23 "23"
1446: #define TSGLEE24 "24"
1447: #define TSGLEE25I "25i"
1448: #define TSGLEE35 "35"
1449: #define TSGLEEEXRK2A "exrk2a"
1450: #define TSGLEERK32G1 "rk32g1"
1451: #define TSGLEERK285EX "rk285ex"
1453: /*J
1454: TSGLEEMode - String with the mode of error estimation for a General Linear with Error Estimation `TSGLEE` type
1456: Level: beginner
1458: .seealso: [](ch_ts), `TSGLEESetMode()`, `TS`, `TSGLEE`, `TSGLEERegister()`
1459: J*/
1460: PETSC_EXTERN PetscErrorCode TSGLEEGetType(TS, TSGLEEType *);
1461: PETSC_EXTERN PetscErrorCode TSGLEESetType(TS, TSGLEEType);
1462: 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[]);
1463: PETSC_EXTERN PetscErrorCode TSGLEERegisterAll(void);
1464: PETSC_EXTERN PetscErrorCode TSGLEEFinalizePackage(void);
1465: PETSC_EXTERN PetscErrorCode TSGLEEInitializePackage(void);
1466: PETSC_EXTERN PetscErrorCode TSGLEERegisterDestroy(void);
1468: /*J
1469: TSARKIMEXType - String with the name of an Additive Runge-Kutta IMEX `TSARKIMEX` type
1471: Options Database Key:
1472: . -ts_arkimex_type (1bee|a2|l2|ars122|2c|2d|2e|prssp2|3|bpr3|ars443|4|5) - set `TSARKIMEX` scheme type, see `TSARKIMEXType`
1474: Level: beginner
1476: .seealso: [](ch_ts), `TSARKIMEXSetType()`, `TS`, `TSARKIMEX`, `TSARKIMEXRegister()`
1477: J*/
1478: typedef const char *TSARKIMEXType;
1479: #define TSARKIMEX1BEE "1bee"
1480: #define TSARKIMEXA2 "a2"
1481: #define TSARKIMEXL2 "l2"
1482: #define TSARKIMEXARS122 "ars122"
1483: #define TSARKIMEX2C "2c"
1484: #define TSARKIMEX2D "2d"
1485: #define TSARKIMEX2E "2e"
1486: #define TSARKIMEXPRSSP2 "prssp2"
1487: #define TSARKIMEX3 "3"
1488: #define TSARKIMEXBPR3 "bpr3"
1489: #define TSARKIMEXARS443 "ars443"
1490: #define TSARKIMEX4 "4"
1491: #define TSARKIMEX5 "5"
1493: PETSC_EXTERN PetscErrorCode TSARKIMEXGetType(TS, TSARKIMEXType *);
1494: PETSC_EXTERN PetscErrorCode TSARKIMEXSetType(TS, TSARKIMEXType);
1495: PETSC_EXTERN PetscErrorCode TSARKIMEXSetFullyImplicit(TS, PetscBool);
1496: PETSC_EXTERN PetscErrorCode TSARKIMEXGetFullyImplicit(TS, PetscBool *);
1497: PETSC_EXTERN PetscErrorCode TSARKIMEXSetFastSlowSplit(TS, PetscBool);
1498: PETSC_EXTERN PetscErrorCode TSARKIMEXGetFastSlowSplit(TS, PetscBool *);
1499: 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[]);
1500: PETSC_EXTERN PetscErrorCode TSARKIMEXInitializePackage(void);
1501: PETSC_EXTERN PetscErrorCode TSARKIMEXFinalizePackage(void);
1502: PETSC_EXTERN PetscErrorCode TSARKIMEXRegisterDestroy(void);
1504: /*J
1505: TSDIRKType - String with the name of a Diagonally Implicit Runge-Kutta `TSDIRK` type
1507: Level: beginner
1509: .seealso: [](ch_ts), `TSDIRKSetType()`, `TS`, `TSDIRK`, `TSDIRKRegister()`
1510: J*/
1511: typedef const char *TSDIRKType;
1512: #define TSDIRKS212 "s212"
1513: #define TSDIRKES122SAL "es122sal"
1514: #define TSDIRKES213SAL "es213sal"
1515: #define TSDIRKES324SAL "es324sal"
1516: #define TSDIRKES325SAL "es325sal"
1517: #define TSDIRK657A "657a"
1518: #define TSDIRKES648SA "es648sa"
1519: #define TSDIRK658A "658a"
1520: #define TSDIRKS659A "s659a"
1521: #define TSDIRK7510SAL "7510sal"
1522: #define TSDIRKES7510SA "es7510sa"
1523: #define TSDIRK759A "759a"
1524: #define TSDIRKS7511SAL "s7511sal"
1525: #define TSDIRK8614A "8614a"
1526: #define TSDIRK8616SAL "8616sal"
1527: #define TSDIRKES8516SAL "es8516sal"
1529: PETSC_EXTERN PetscErrorCode TSDIRKGetType(TS, TSDIRKType *);
1530: PETSC_EXTERN PetscErrorCode TSDIRKSetType(TS, TSDIRKType);
1531: PETSC_EXTERN PetscErrorCode TSDIRKRegister(TSDIRKType, PetscInt, PetscInt, const PetscReal[], const PetscReal[], const PetscReal[], const PetscReal[], PetscInt, const PetscReal[]);
1533: /*J
1534: TSRosWType - String with the name of a Rosenbrock-W `TSROSW` type
1536: Level: beginner
1538: .seealso: [](ch_ts), `TSRosWSetType()`, `TS`, `TSROSW`, `TSRosWRegister()`
1539: J*/
1540: typedef const char *TSRosWType;
1541: #define TSROSW2M "2m"
1542: #define TSROSW2P "2p"
1543: #define TSROSWRA3PW "ra3pw"
1544: #define TSROSWRA34PW2 "ra34pw2"
1545: #define TSROSWR34PRW "r34prw"
1546: #define TSROSWR3PRL2 "r3prl2"
1547: #define TSROSWRODAS3 "rodas3"
1548: #define TSROSWRODASPR "rodaspr"
1549: #define TSROSWRODASPR2 "rodaspr2"
1550: #define TSROSWSANDU3 "sandu3"
1551: #define TSROSWASSP3P3S1C "assp3p3s1c"
1552: #define TSROSWLASSP3P4S2C "lassp3p4s2c"
1553: #define TSROSWLLSSP3P4S2C "llssp3p4s2c"
1554: #define TSROSWARK3 "ark3"
1555: #define TSROSWTHETA1 "theta1"
1556: #define TSROSWTHETA2 "theta2"
1557: #define TSROSWGRK4T "grk4t"
1558: #define TSROSWSHAMP4 "shamp4"
1559: #define TSROSWVELDD4 "veldd4"
1560: #define TSROSW4L "4l"
1562: PETSC_EXTERN PetscErrorCode TSRosWGetType(TS, TSRosWType *);
1563: PETSC_EXTERN PetscErrorCode TSRosWSetType(TS, TSRosWType);
1564: PETSC_EXTERN PetscErrorCode TSRosWSetRecomputeJacobian(TS, PetscBool);
1565: PETSC_EXTERN PetscErrorCode TSRosWRegister(TSRosWType, PetscInt, PetscInt, const PetscReal[], const PetscReal[], const PetscReal[], const PetscReal[], PetscInt, const PetscReal[]);
1566: PETSC_EXTERN PetscErrorCode TSRosWRegisterRos4(TSRosWType, PetscReal, PetscReal, PetscReal, PetscReal, PetscReal);
1567: PETSC_EXTERN PetscErrorCode TSRosWInitializePackage(void);
1568: PETSC_EXTERN PetscErrorCode TSRosWFinalizePackage(void);
1569: PETSC_EXTERN PetscErrorCode TSRosWRegisterDestroy(void);
1571: PETSC_EXTERN PetscErrorCode TSBDFSetOrder(TS, PetscInt);
1572: PETSC_EXTERN PetscErrorCode TSBDFGetOrder(TS, PetscInt *);
1574: /*J
1575: TSBasicSymplecticType - String with the name of a basic symplectic integration `TSBASICSYMPLECTIC` type
1577: Level: beginner
1579: .seealso: [](ch_ts), `TSBasicSymplecticSetType()`, `TS`, `TSBASICSYMPLECTIC`, `TSBasicSymplecticRegister()`
1580: J*/
1581: typedef const char *TSBasicSymplecticType;
1582: #define TSBASICSYMPLECTICSIEULER "1"
1583: #define TSBASICSYMPLECTICVELVERLET "2"
1584: #define TSBASICSYMPLECTIC3 "3"
1585: #define TSBASICSYMPLECTIC4 "4"
1587: PETSC_EXTERN PetscErrorCode TSBasicSymplecticSetType(TS, TSBasicSymplecticType);
1588: PETSC_EXTERN PetscErrorCode TSBasicSymplecticGetType(TS, TSBasicSymplecticType *);
1589: PETSC_EXTERN PetscErrorCode TSBasicSymplecticRegister(TSBasicSymplecticType, PetscInt, PetscInt, PetscReal[], PetscReal[]);
1590: PETSC_EXTERN PetscErrorCode TSBasicSymplecticRegisterAll(void);
1591: PETSC_EXTERN PetscErrorCode TSBasicSymplecticInitializePackage(void);
1592: PETSC_EXTERN PetscErrorCode TSBasicSymplecticFinalizePackage(void);
1593: PETSC_EXTERN PetscErrorCode TSBasicSymplecticRegisterDestroy(void);
1595: /*E
1596: TSDGType - Selects the discrete-gradient flavor used by `TSDISCGRAD` when integrating gradient-system ODEs
1598: Values:
1599: + `TS_DG_GONZALEZ` - Gonzalez's mid-point-style discrete gradient
1600: . `TS_DG_AVERAGE` - average vector field (AVF) discrete gradient
1601: - `TS_DG_NONE` - do not apply a discrete gradient correction; the integrator falls back to a standard mid-point rule
1603: Level: advanced
1605: .seealso: `TS`, `TSDISCGRAD`, `TSDiscGradSetType()`, `TSDiscGradGetType()`, `TSDiscGradSetFormulation()`
1606: E*/
1607: typedef enum {
1608: TS_DG_GONZALEZ,
1609: TS_DG_AVERAGE,
1610: TS_DG_NONE
1611: } TSDGType;
1612: PETSC_EXTERN PetscErrorCode TSDiscGradSetFormulation(TS, PetscErrorCode (*)(TS, PetscReal, Vec, Mat, void *), PetscErrorCode (*)(TS, PetscReal, Vec, PetscScalar *, void *), PetscErrorCode (*)(TS, PetscReal, Vec, Vec, void *), void *);
1613: PETSC_EXTERN PetscErrorCode TSDiscGradGetFormulation(TS, PetscErrorCode (**)(TS, PetscReal, Vec, Mat, void *), PetscErrorCode (**)(TS, PetscReal, Vec, PetscScalar *, void *), PetscErrorCode (**)(TS, PetscReal, Vec, Vec, void *), void *);
1614: PETSC_EXTERN PetscErrorCode TSDiscGradSetType(TS, TSDGType);
1615: PETSC_EXTERN PetscErrorCode TSDiscGradGetType(TS, TSDGType *);
1617: /*
1618: PETSc interface to Sundials
1619: */
1620: #ifdef PETSC_HAVE_SUNDIALS2
1621: /*E
1622: TSSundialsLmmType - Selects which linear multistep method is used by the `TSSUNDIALS` interface to SUNDIALS' CVODE integrator
1624: Values:
1625: + `SUNDIALS_ADAMS` - variable-order Adams methods (non-stiff problems)
1626: - `SUNDIALS_BDF` - variable-order backward differentiation formulas (stiff problems)
1628: Level: intermediate
1630: .seealso: `TS`, `TSSUNDIALS`, `TSSundialsSetType()`, `TSSundialsGramSchmidtType`
1631: E*/
1632: typedef enum {
1633: SUNDIALS_ADAMS = 1,
1634: SUNDIALS_BDF = 2
1635: } TSSundialsLmmType;
1636: PETSC_EXTERN const char *const TSSundialsLmmTypes[];
1637: /*E
1638: TSSundialsGramSchmidtType - Selects the Gram--Schmidt orthogonalization variant used by SUNDIALS' internal GMRES inside `TSSUNDIALS`
1640: Values:
1641: + `SUNDIALS_MODIFIED_GS` - modified Gram--Schmidt (more stable)
1642: - `SUNDIALS_CLASSICAL_GS` - classical Gram--Schmidt (cheaper, less stable)
1644: Level: advanced
1646: .seealso: `TS`, `TSSUNDIALS`, `TSSundialsSetGramSchmidtType()`, `TSSundialsLmmType`
1647: E*/
1648: typedef enum {
1649: SUNDIALS_MODIFIED_GS = 1,
1650: SUNDIALS_CLASSICAL_GS = 2
1651: } TSSundialsGramSchmidtType;
1652: PETSC_EXTERN const char *const TSSundialsGramSchmidtTypes[];
1654: PETSC_EXTERN PetscErrorCode TSSundialsSetType(TS, TSSundialsLmmType);
1655: PETSC_EXTERN PetscErrorCode TSSundialsGetPC(TS, PC *);
1656: PETSC_EXTERN PetscErrorCode TSSundialsSetTolerance(TS, PetscReal, PetscReal);
1657: PETSC_EXTERN PetscErrorCode TSSundialsSetMinTimeStep(TS, PetscReal);
1658: PETSC_EXTERN PetscErrorCode TSSundialsSetMaxTimeStep(TS, PetscReal);
1659: PETSC_EXTERN PetscErrorCode TSSundialsGetIterations(TS, PetscInt *, PetscInt *);
1660: PETSC_EXTERN PetscErrorCode TSSundialsSetGramSchmidtType(TS, TSSundialsGramSchmidtType);
1661: PETSC_EXTERN PetscErrorCode TSSundialsSetGMRESRestart(TS, PetscInt);
1662: PETSC_EXTERN PetscErrorCode TSSundialsSetLinearTolerance(TS, PetscReal);
1663: PETSC_EXTERN PetscErrorCode TSSundialsMonitorInternalSteps(TS, PetscBool);
1664: PETSC_EXTERN PetscErrorCode TSSundialsSetMaxl(TS, PetscInt);
1665: PETSC_EXTERN PetscErrorCode TSSundialsSetMaxord(TS, PetscInt);
1666: PETSC_EXTERN PetscErrorCode TSSundialsSetUseDense(TS, PetscBool);
1667: #endif
1669: PETSC_EXTERN PetscErrorCode TSThetaSetTheta(TS, PetscReal);
1670: PETSC_EXTERN PetscErrorCode TSThetaGetTheta(TS, PetscReal *);
1671: PETSC_EXTERN PetscErrorCode TSThetaGetEndpoint(TS, PetscBool *);
1672: PETSC_EXTERN PetscErrorCode TSThetaSetEndpoint(TS, PetscBool);
1674: PETSC_EXTERN PetscErrorCode TSAlphaSetRadius(TS, PetscReal);
1675: PETSC_EXTERN PetscErrorCode TSAlphaSetParams(TS, PetscReal, PetscReal, PetscReal);
1676: PETSC_EXTERN PetscErrorCode TSAlphaGetParams(TS, PetscReal *, PetscReal *, PetscReal *);
1678: PETSC_EXTERN PetscErrorCode TSAlpha2SetRadius(TS, PetscReal);
1679: PETSC_EXTERN PetscErrorCode TSAlpha2SetParams(TS, PetscReal, PetscReal, PetscReal, PetscReal);
1680: PETSC_EXTERN PetscErrorCode TSAlpha2GetParams(TS, PetscReal *, PetscReal *, PetscReal *, PetscReal *);
1682: /*S
1683: TSAlpha2PredictorFn - A callback to set the predictor (i.e., the initial guess for the nonlinear solver) in
1684: a second-order generalized-alpha time integrator.
1686: Calling Sequence:
1687: + ts - the `TS` context obtained from `TSCreate()`
1688: . X0 - the previous time step's state vector
1689: . V0 - the previous time step's first derivative of the state vector
1690: . A0 - the previous time step's second derivative of the state vector
1691: . X1 - the vector into which the initial guess for the current time step will be written
1692: - ctx - [optional] user-defined context for the predictor evaluation routine (may be `NULL`)
1694: Level: intermediate
1696: Note:
1697: The deprecated `TSAlpha2Predictor` still works as a replacement for `TSAlpha2PredictorFn` *.
1699: .seealso: [](ch_ts), `TS`, `TSAlpha2SetPredictor()`
1700: S*/
1701: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode TSAlpha2PredictorFn(TS ts, Vec X0, Vec V0, Vec A0, Vec X1, PetscCtx ctx);
1703: PETSC_EXTERN_TYPEDEF typedef TSAlpha2PredictorFn *TSAlpha2Predictor;
1705: PETSC_EXTERN PetscErrorCode TSAlpha2SetPredictor(TS, TSAlpha2PredictorFn *, void *);
1707: PETSC_EXTERN PetscErrorCode TSSetDM(TS, DM);
1708: PETSC_EXTERN PetscErrorCode TSGetDM(TS, DM *);
1710: PETSC_EXTERN PetscErrorCode SNESTSFormFunction(SNES, Vec, Vec, void *);
1711: PETSC_EXTERN PetscErrorCode SNESTSFormJacobian(SNES, Vec, Mat, Mat, void *);
1713: PETSC_EXTERN PetscErrorCode TSRHSJacobianTest(TS, PetscBool *);
1714: PETSC_EXTERN PetscErrorCode TSRHSJacobianTestTranspose(TS, PetscBool *);
1716: PETSC_EXTERN PetscErrorCode TSGetComputeInitialCondition(TS, PetscErrorCode (**)(TS, Vec));
1717: PETSC_EXTERN PetscErrorCode TSSetComputeInitialCondition(TS, PetscErrorCode (*)(TS, Vec));
1718: PETSC_EXTERN PetscErrorCode TSComputeInitialCondition(TS, Vec);
1719: PETSC_EXTERN PetscErrorCode TSGetComputeExactError(TS, PetscErrorCode (**)(TS, Vec, Vec));
1720: PETSC_EXTERN PetscErrorCode TSSetComputeExactError(TS, PetscErrorCode (*)(TS, Vec, Vec));
1721: PETSC_EXTERN PetscErrorCode TSComputeExactError(TS, Vec, Vec);
1722: PETSC_EXTERN PetscErrorCode PetscConvEstUseTS(PetscConvEst, PetscBool);
1724: PETSC_EXTERN PetscErrorCode TSSetMatStructure(TS, MatStructure);