xref: /petsc/include/petscts.h (revision a4868fbc4d0e1bc605ee4be00d60e05230d9fd04)
1818ad0c1SBarry Smith /*
2316643e7SJed Brown    User interface for the timestepping package. This package
3f64a0f93SLois Curfman McInnes    is for use in solving time-dependent PDEs.
4818ad0c1SBarry Smith */
50a835dfdSSatish Balay #if !defined(__PETSCTS_H)
60a835dfdSSatish Balay #define __PETSCTS_H
72c8e378dSBarry Smith #include <petscsnes.h>
8818ad0c1SBarry Smith 
9435da068SBarry Smith /*S
10435da068SBarry Smith      TS - Abstract PETSc object that manages all time-steppers (ODE integrators)
11435da068SBarry Smith 
12435da068SBarry Smith    Level: beginner
13435da068SBarry Smith 
14435da068SBarry Smith   Concepts: ODE solvers
15435da068SBarry Smith 
168f6c3df8SBarry Smith .seealso:  TSCreate(), TSSetType(), TSType, SNES, KSP, PC, TSDestroy()
17435da068SBarry Smith S*/
18f09e8eb9SSatish Balay typedef struct _p_TS* TS;
19435da068SBarry Smith 
2076bdecfbSBarry Smith /*J
218f6c3df8SBarry Smith     TSType - String with the name of a PETSc TS method.
22435da068SBarry Smith 
23435da068SBarry Smith    Level: beginner
24435da068SBarry Smith 
258f6c3df8SBarry Smith .seealso: TSSetType(), TS, TSRegister()
2676bdecfbSBarry Smith J*/
2719fd82e9SBarry Smith typedef const char* TSType;
289596e0b4SJed Brown #define TSEULER           "euler"
299596e0b4SJed Brown #define TSBEULER          "beuler"
309596e0b4SJed Brown #define TSPSEUDO          "pseudo"
314d91e141SJed Brown #define TSCN              "cn"
329596e0b4SJed Brown #define TSSUNDIALS        "sundials"
334d91e141SJed Brown #define TSRK              "rk"
349596e0b4SJed Brown #define TSPYTHON          "python"
359596e0b4SJed Brown #define TSTHETA           "theta"
3688df8a41SLisandro Dalcin #define TSALPHA           "alpha"
379596e0b4SJed Brown #define TSGL              "gl"
38ef7bb5aaSJed Brown #define TSSSP             "ssp"
398a381b04SJed Brown #define TSARKIMEX         "arkimex"
40e27a552bSJed Brown #define TSROSW            "rosw"
417d5697caSHong Zhang #define TSEIMEX           "eimex"
42abadfa0fSMatthew G. Knepley #define TSMIMEX           "mimex"
43435da068SBarry Smith /*E
44435da068SBarry Smith     TSProblemType - Determines the type of problem this TS object is to be used to solve
45435da068SBarry Smith 
46435da068SBarry Smith    Level: beginner
47435da068SBarry Smith 
48435da068SBarry Smith .seealso: TSCreate()
49435da068SBarry Smith E*/
5019bcc07fSBarry Smith typedef enum {TS_LINEAR,TS_NONLINEAR} TSProblemType;
51818ad0c1SBarry Smith 
52b93fea0eSJed Brown /*E
53e817cc15SEmil Constantinescu    TSEquationType - type of TS problem that is solved
54e817cc15SEmil Constantinescu 
55e817cc15SEmil Constantinescu    Level: beginner
56e817cc15SEmil Constantinescu 
578fb42493SBarry Smith    Developer Notes: this must match petsc-finclude/petscts.h
58e817cc15SEmil Constantinescu 
59e817cc15SEmil Constantinescu    Supported types are:
60e817cc15SEmil Constantinescu      TS_EQ_UNSPECIFIED (default)
61e817cc15SEmil Constantinescu      TS_EQ_EXPLICIT {ODE and DAE index 1, 2, 3, HI}: F(t,U,U_t) := M(t) U_t - G(U,t) = 0
62e817cc15SEmil Constantinescu      TS_EQ_IMPLICIT {ODE and DAE index 1, 2, 3, HI}: F(t,U,U_t) = 0
63e817cc15SEmil Constantinescu 
64e817cc15SEmil Constantinescu .seealso: TSGetEquationType(), TSSetEquationType()
65e817cc15SEmil Constantinescu E*/
66e817cc15SEmil Constantinescu typedef enum {
67e817cc15SEmil Constantinescu   TS_EQ_UNSPECIFIED               = -1,
68e817cc15SEmil Constantinescu   TS_EQ_EXPLICIT                  = 0,
69e817cc15SEmil Constantinescu   TS_EQ_ODE_EXPLICIT              = 1,
70e817cc15SEmil Constantinescu   TS_EQ_DAE_SEMI_EXPLICIT_INDEX1  = 100,
71e817cc15SEmil Constantinescu   TS_EQ_DAE_SEMI_EXPLICIT_INDEX2  = 200,
72e817cc15SEmil Constantinescu   TS_EQ_DAE_SEMI_EXPLICIT_INDEX3  = 300,
73e817cc15SEmil Constantinescu   TS_EQ_DAE_SEMI_EXPLICIT_INDEXHI = 500,
74e817cc15SEmil Constantinescu   TS_EQ_IMPLICIT                  = 1000,
75e817cc15SEmil Constantinescu   TS_EQ_ODE_IMPLICIT              = 1001,
76e817cc15SEmil Constantinescu   TS_EQ_DAE_IMPLICIT_INDEX1       = 1100,
77e817cc15SEmil Constantinescu   TS_EQ_DAE_IMPLICIT_INDEX2       = 1200,
78e817cc15SEmil Constantinescu   TS_EQ_DAE_IMPLICIT_INDEX3       = 1300,
7919436ca2SJed Brown   TS_EQ_DAE_IMPLICIT_INDEXHI      = 1500
80e817cc15SEmil Constantinescu } TSEquationType;
81e817cc15SEmil Constantinescu PETSC_EXTERN const char *const*TSEquationTypes;
82e817cc15SEmil Constantinescu 
83e817cc15SEmil Constantinescu /*E
84b93fea0eSJed Brown    TSConvergedReason - reason a TS method has converged or not
85b93fea0eSJed Brown 
86b93fea0eSJed Brown    Level: beginner
87b93fea0eSJed Brown 
888fb42493SBarry Smith    Developer Notes: this must match petsc-finclude/petscts.h
89b93fea0eSJed Brown 
90b93fea0eSJed Brown    Each reason has its own manual page.
91b93fea0eSJed Brown 
92b93fea0eSJed Brown .seealso: TSGetConvergedReason()
93b93fea0eSJed Brown E*/
94193ac0bcSJed Brown typedef enum {
95193ac0bcSJed Brown   TS_CONVERGED_ITERATING      = 0,
96193ac0bcSJed Brown   TS_CONVERGED_TIME           = 1,
97193ac0bcSJed Brown   TS_CONVERGED_ITS            = 2,
98d6ad946cSShri Abhyankar   TS_CONVERGED_USER           = 3,
992b7db910SShri Abhyankar   TS_CONVERGED_EVENT          = 4,
100193ac0bcSJed Brown   TS_DIVERGED_NONLINEAR_SOLVE = -1,
101193ac0bcSJed Brown   TS_DIVERGED_STEP_REJECTED   = -2
102193ac0bcSJed Brown } TSConvergedReason;
103014dd563SJed Brown PETSC_EXTERN const char *const*TSConvergedReasons;
1041957e957SBarry Smith 
105b93fea0eSJed Brown /*MC
106b93fea0eSJed Brown    TS_CONVERGED_ITERATING - this only occurs if TSGetConvergedReason() is called during the TSSolve()
107b93fea0eSJed Brown 
108b93fea0eSJed Brown    Level: beginner
109b93fea0eSJed Brown 
110552698daSJed Brown .seealso: TSSolve(), TSGetConvergedReason(), TSGetAdapt()
111b93fea0eSJed Brown M*/
112b93fea0eSJed Brown 
113b93fea0eSJed Brown /*MC
114b93fea0eSJed Brown    TS_CONVERGED_TIME - the final time was reached
115b93fea0eSJed Brown 
116b93fea0eSJed Brown    Level: beginner
117b93fea0eSJed Brown 
118552698daSJed Brown .seealso: TSSolve(), TSGetConvergedReason(), TSGetAdapt(), TSSetDuration(), TSGetSolveTime()
119b93fea0eSJed Brown M*/
120b93fea0eSJed Brown 
121b93fea0eSJed Brown /*MC
1221957e957SBarry Smith    TS_CONVERGED_ITS - the maximum number of iterations (time-steps) was reached prior to the final time
123b93fea0eSJed Brown 
124b93fea0eSJed Brown    Level: beginner
125b93fea0eSJed Brown 
126552698daSJed Brown .seealso: TSSolve(), TSGetConvergedReason(), TSGetAdapt(), TSSetDuration()
127b93fea0eSJed Brown M*/
1281957e957SBarry Smith 
129d6ad946cSShri Abhyankar /*MC
130d6ad946cSShri Abhyankar    TS_CONVERGED_USER - user requested termination
131d6ad946cSShri Abhyankar 
132d6ad946cSShri Abhyankar    Level: beginner
133d6ad946cSShri Abhyankar 
134d6ad946cSShri Abhyankar .seealso: TSSolve(), TSGetConvergedReason(), TSSetConvergedReason(), TSSetDuration()
135b93fea0eSJed Brown M*/
136b93fea0eSJed Brown 
137b93fea0eSJed Brown /*MC
138d76fc68cSShri Abhyankar    TS_CONVERGED_EVENT - user requested termination on event detection
139d76fc68cSShri Abhyankar 
140d76fc68cSShri Abhyankar    Level: beginner
141d76fc68cSShri Abhyankar 
142d76fc68cSShri Abhyankar .seealso: TSSolve(), TSGetConvergedReason(), TSSetConvergedReason(), TSSetDuration()
143d76fc68cSShri Abhyankar M*/
144d76fc68cSShri Abhyankar 
145d76fc68cSShri Abhyankar /*MC
146b93fea0eSJed Brown    TS_DIVERGED_NONLINEAR_SOLVE - too many nonlinear solves failed
147b93fea0eSJed Brown 
148b93fea0eSJed Brown    Level: beginner
149b93fea0eSJed Brown 
1501957e957SBarry Smith    Notes: See TSSetMaxSNESFailures() for how to allow more nonlinear solver failures.
1511957e957SBarry Smith 
1521957e957SBarry Smith .seealso: TSSolve(), TSGetConvergedReason(), TSGetAdapt(), TSGetSNES(), SNESGetConvergedReason(), TSSetMaxSNESFailures()
153b93fea0eSJed Brown M*/
154b93fea0eSJed Brown 
155b93fea0eSJed Brown /*MC
156b93fea0eSJed Brown    TS_DIVERGED_STEP_REJECTED - too many steps were rejected
157b93fea0eSJed Brown 
158b93fea0eSJed Brown    Level: beginner
159b93fea0eSJed Brown 
1601957e957SBarry Smith    Notes: See TSSetMaxStepRejections() for how to allow more step rejections.
1611957e957SBarry Smith 
1621957e957SBarry Smith .seealso: TSSolve(), TSGetConvergedReason(), TSGetAdapt(), TSSetMaxStepRejections()
163b93fea0eSJed Brown M*/
164b93fea0eSJed Brown 
165d6ad946cSShri Abhyankar /*E
166d6ad946cSShri Abhyankar    TSExactFinalTimeOption - option for handling of final time step
167d6ad946cSShri Abhyankar 
168d6ad946cSShri Abhyankar    Level: beginner
169d6ad946cSShri Abhyankar 
1708fb42493SBarry Smith    Developer Notes: this must match petsc-finclude/petscts.h
171d6ad946cSShri Abhyankar 
172d6ad946cSShri Abhyankar $  TS_EXACTFINALTIME_STEPOVER    - Don't do anything if final time is exceeded
173d6ad946cSShri Abhyankar $  TS_EXACTFINALTIME_INTERPOLATE - Interpolate back to final time
174d6ad946cSShri Abhyankar $  TS_EXACTFINALTIME_MATCHSTEP - Adapt final time step to match the final time
1754ceb6c04SBarry Smith .seealso: TSGetConvergedReason(), TSSetExactFinalTime()
1764ceb6c04SBarry Smith 
177d6ad946cSShri Abhyankar E*/
178d6ad946cSShri Abhyankar typedef enum {TS_EXACTFINALTIME_STEPOVER=0,TS_EXACTFINALTIME_INTERPOLATE=1,TS_EXACTFINALTIME_MATCHSTEP=2} TSExactFinalTimeOption;
179d6ad946cSShri Abhyankar PETSC_EXTERN const char *const TSExactFinalTimeOptions[];
180d6ad946cSShri Abhyankar 
181d6ad946cSShri Abhyankar 
182000e7ae3SMatthew Knepley /* Logging support */
183014dd563SJed Brown PETSC_EXTERN PetscClassId TS_CLASSID;
184d74926cbSBarry Smith PETSC_EXTERN PetscClassId DMTS_CLASSID;
185000e7ae3SMatthew Knepley 
186607a6623SBarry Smith PETSC_EXTERN PetscErrorCode TSInitializePackage(void);
1878ba1e511SMatthew Knepley 
188014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSCreate(MPI_Comm,TS*);
189014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSDestroy(TS*);
190818ad0c1SBarry Smith 
191014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSetProblemType(TS,TSProblemType);
192014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGetProblemType(TS,TSProblemType*);
193014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSMonitor(TS,PetscInt,PetscReal,Vec);
194014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSMonitorSet(TS,PetscErrorCode(*)(TS,PetscInt,PetscReal,Vec,void*),void *,PetscErrorCode (*)(void**));
195014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSMonitorCancel(TS);
196818ad0c1SBarry Smith 
197014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSetOptionsPrefix(TS,const char[]);
198014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAppendOptionsPrefix(TS,const char[]);
199014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGetOptionsPrefix(TS,const char *[]);
200014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSetFromOptions(TS);
201014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSetUp(TS);
202014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSReset(TS);
203818ad0c1SBarry Smith 
204014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSetSolution(TS,Vec);
205014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGetSolution(TS,Vec*);
206818ad0c1SBarry Smith 
207bc952696SBarry Smith /*S
208bc952696SBarry Smith      TSTrajectory - Abstract PETSc object that storing the trajectory (solution of ODE/ADE at each time step and stage)
209bc952696SBarry Smith 
210bc952696SBarry Smith    Level: advanced
211bc952696SBarry Smith 
212bc952696SBarry Smith   Concepts: ODE solvers, adjoint
213bc952696SBarry Smith 
214bc952696SBarry Smith .seealso:  TSCreate(), TSSetType(), TSType, SNES, KSP, PC, TSDestroy()
215bc952696SBarry Smith S*/
216bc952696SBarry Smith typedef struct _p_TSTrajectory* TSTrajectory;
217bc952696SBarry Smith 
218bc952696SBarry Smith /*J
219bc952696SBarry Smith     TSTrajectoryType - String with the name of a PETSc TS trajectory storage method
220bc952696SBarry Smith 
221bc952696SBarry Smith    Level: intermediate
222bc952696SBarry Smith 
223bc952696SBarry Smith .seealso: TSSetType(), TS, TSRegister(), TSTrajectoryCreate(), TSTrajectorySetType()
224bc952696SBarry Smith J*/
225bc952696SBarry Smith typedef const char* TSTrajectoryType;
226bc952696SBarry Smith #define TSTRAJECTORYBASIC      "basic"
2271c8c567eSBarry Smith #define TSTRAJECTORYSINGLEFILE "singlefile"
228bc952696SBarry Smith 
229bc952696SBarry Smith PETSC_EXTERN PetscFunctionList TSTrajectoryList;
230bc952696SBarry Smith PETSC_EXTERN PetscClassId      TSTRAJECTORY_CLASSID;
231bc952696SBarry Smith PETSC_EXTERN PetscBool         TSTrajectoryRegisterAllCalled;
232bc952696SBarry Smith 
233bc952696SBarry Smith PETSC_EXTERN PetscErrorCode TSSetSaveTrajectory(TS);
234bc952696SBarry Smith 
235bc952696SBarry Smith PETSC_EXTERN PetscErrorCode TSTrajectoryCreate(MPI_Comm,TSTrajectory*);
236bc952696SBarry Smith PETSC_EXTERN PetscErrorCode TSTrajectoryDestroy(TSTrajectory*);
237bc952696SBarry Smith PETSC_EXTERN PetscErrorCode TSTrajectorySetType(TSTrajectory,const TSTrajectoryType);
238bc952696SBarry Smith PETSC_EXTERN PetscErrorCode TSTrajectorySet(TSTrajectory,TS,PetscInt,PetscReal,Vec);
239bc952696SBarry Smith PETSC_EXTERN PetscErrorCode TSTrajectoryGet(TSTrajectory,TS,PetscInt,PetscReal);
240bc952696SBarry Smith PETSC_EXTERN PetscErrorCode TSTrajectorySetFromOptions(TSTrajectory);
241bc952696SBarry Smith PETSC_EXTERN PetscErrorCode TSTrajectoryRegisterAll(void);
242bc952696SBarry Smith 
2430cf82b59SBarry Smith PETSC_EXTERN PetscErrorCode TSAdjointSetCostGradients(TS,PetscInt,Vec*,Vec*);
2440cf82b59SBarry Smith PETSC_EXTERN PetscErrorCode TSAdjointGetCostGradients(TS,PetscInt*,Vec**,Vec**);
245d4aa0a58SBarry Smith 
2465bf8c567SBarry Smith PETSC_EXTERN PetscErrorCode TSAdjointSetRHSJacobian(TS,Mat,PetscErrorCode(*)(TS,PetscReal,Vec,Mat,void*),void*);
247d8151eeaSBarry Smith PETSC_EXTERN PetscErrorCode TSAdjointSetCostIntegrand(TS,PetscInt,PetscErrorCode (*)(TS,PetscReal,Vec,Vec,void*),PetscErrorCode (*)(TS,PetscReal,Vec,Vec*,void*),PetscErrorCode (*)(TS,PetscReal,Vec,Vec*,void*),void*);
2482c39e106SBarry Smith PETSC_EXTERN PetscErrorCode TSAdjointGetCostIntegral(TS,Vec*);
2492c39e106SBarry Smith PETSC_EXTERN PetscErrorCode TSAdjointSolve(TS);
25073b18844SBarry Smith PETSC_EXTERN PetscErrorCode TSAdjointSetSteps(TS,PetscInt);
251d4aa0a58SBarry Smith 
2525bf8c567SBarry Smith PETSC_EXTERN PetscErrorCode TSAdjointComputeRHSJacobian(TS,PetscReal,Vec,Mat);
25373b18844SBarry Smith PETSC_EXTERN PetscErrorCode TSAdjointStep(TS);
254f6a906c0SBarry Smith PETSC_EXTERN PetscErrorCode TSAdjointSetUp(TS);
255d4aa0a58SBarry Smith PETSC_EXTERN PetscErrorCode TSAdjointComputeDRDPFunction(TS,PetscReal,Vec,Vec*);
256d4aa0a58SBarry Smith PETSC_EXTERN PetscErrorCode TSAdjointComputeDRDYFunction(TS,PetscReal,Vec,Vec*);
257d4aa0a58SBarry Smith PETSC_EXTERN PetscErrorCode TSAdjointComputeCostIntegrand(TS,PetscReal,Vec,Vec);
258c235aa8dSHong Zhang 
259014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSetDuration(TS,PetscInt,PetscReal);
260014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGetDuration(TS,PetscInt*,PetscReal*);
26149354f04SShri Abhyankar PETSC_EXTERN PetscErrorCode TSSetExactFinalTime(TS,TSExactFinalTimeOption);
262818ad0c1SBarry Smith 
263014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSMonitorDefault(TS,PetscInt,PetscReal,Vec,void*);
26483a4ac43SBarry Smith 
26583a4ac43SBarry Smith typedef struct _n_TSMonitorDrawCtx*  TSMonitorDrawCtx;
26683a4ac43SBarry Smith PETSC_EXTERN PetscErrorCode TSMonitorDrawCtxCreate(MPI_Comm,const char[],const char[],int,int,int,int,PetscInt,TSMonitorDrawCtx *);
26783a4ac43SBarry Smith PETSC_EXTERN PetscErrorCode TSMonitorDrawCtxDestroy(TSMonitorDrawCtx*);
26883a4ac43SBarry Smith PETSC_EXTERN PetscErrorCode TSMonitorDrawSolution(TS,PetscInt,PetscReal,Vec,void*);
2692d5ee99bSBarry Smith PETSC_EXTERN PetscErrorCode TSMonitorDrawSolutionPhase(TS,PetscInt,PetscReal,Vec,void*);
27083a4ac43SBarry Smith PETSC_EXTERN PetscErrorCode TSMonitorDrawError(TS,PetscInt,PetscReal,Vec,void*);
27183a4ac43SBarry Smith 
272014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSMonitorSolutionBinary(TS,PetscInt,PetscReal,Vec,void*);
273014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSMonitorSolutionVTK(TS,PetscInt,PetscReal,Vec,void*);
274014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSMonitorSolutionVTKDestroy(void*);
275fb1732b5SBarry Smith 
276014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSStep(TS);
277014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSEvaluateStep(TS,PetscInt,Vec,PetscBool*);
278cc708dedSBarry Smith PETSC_EXTERN PetscErrorCode TSSolve(TS,Vec);
279e817cc15SEmil Constantinescu PETSC_EXTERN PetscErrorCode TSGetEquationType(TS,TSEquationType*);
280e817cc15SEmil Constantinescu PETSC_EXTERN PetscErrorCode TSSetEquationType(TS,TSEquationType);
281014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGetConvergedReason(TS,TSConvergedReason*);
282d6ad946cSShri Abhyankar PETSC_EXTERN PetscErrorCode TSSetConvergedReason(TS,TSConvergedReason);
283487e0bb9SJed Brown PETSC_EXTERN PetscErrorCode TSGetSolveTime(TS,PetscReal*);
2845ef26d82SJed Brown PETSC_EXTERN PetscErrorCode TSGetSNESIterations(TS,PetscInt*);
2855ef26d82SJed Brown PETSC_EXTERN PetscErrorCode TSGetKSPIterations(TS,PetscInt*);
286cef5090cSJed Brown PETSC_EXTERN PetscErrorCode TSGetStepRejections(TS,PetscInt*);
287cef5090cSJed Brown PETSC_EXTERN PetscErrorCode TSSetMaxStepRejections(TS,PetscInt);
288cef5090cSJed Brown PETSC_EXTERN PetscErrorCode TSGetSNESFailures(TS,PetscInt*);
289cef5090cSJed Brown PETSC_EXTERN PetscErrorCode TSSetMaxSNESFailures(TS,PetscInt);
290cef5090cSJed Brown PETSC_EXTERN PetscErrorCode TSSetErrorIfStepFails(TS,PetscBool);
29124655328SShri PETSC_EXTERN PetscErrorCode TSRollBack(TS);
2922c18e0fdSBarry Smith PETSC_EXTERN PetscErrorCode TSGetTotalSteps(TS,PetscInt*);
293d2daff3dSHong Zhang 
294ff22ae23SHong Zhang PETSC_EXTERN PetscErrorCode TSGetStages(TS,PetscInt*,Vec**);
295818ad0c1SBarry Smith 
296014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSetInitialTimeStep(TS,PetscReal,PetscReal);
297014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGetTimeStep(TS,PetscReal*);
298014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGetTime(TS,PetscReal*);
299014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSetTime(TS,PetscReal);
300014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGetTimeStepNumber(TS,PetscInt*);
301014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSetTimeStep(TS,PetscReal);
302e5e524a1SHong Zhang PETSC_EXTERN PetscErrorCode TSGetPrevTime(TS,PetscReal*);
303818ad0c1SBarry Smith 
304638cfed1SJed Brown PETSC_EXTERN_TYPEDEF typedef PetscErrorCode (*TSRHSFunction)(TS,PetscReal,Vec,Vec,void*);
305d1e9a80fSBarry Smith PETSC_EXTERN_TYPEDEF typedef PetscErrorCode (*TSRHSJacobian)(TS,PetscReal,Vec,Mat,Mat,void*);
306014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSetRHSFunction(TS,Vec,TSRHSFunction,void*);
307014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGetRHSFunction(TS,Vec*,TSRHSFunction*,void**);
308014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSetRHSJacobian(TS,Mat,Mat,TSRHSJacobian,void*);
309014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGetRHSJacobian(TS,Mat*,Mat*,TSRHSJacobian*,void**);
310e1244c69SJed Brown PETSC_EXTERN PetscErrorCode TSRHSJacobianSetReuse(TS,PetscBool);
311818ad0c1SBarry Smith 
312ef20d060SBarry Smith PETSC_EXTERN_TYPEDEF typedef PetscErrorCode (*TSSolutionFunction)(TS,PetscReal,Vec,void*);
313ef20d060SBarry Smith PETSC_EXTERN PetscErrorCode TSSetSolutionFunction(TS,TSSolutionFunction,void*);
314f8b49ee9SBarry Smith PETSC_EXTERN PetscErrorCode TSSetForcingFunction(TS,PetscErrorCode (*)(TS,PetscReal,Vec,void*),void*);
315ef20d060SBarry Smith 
316638cfed1SJed Brown PETSC_EXTERN_TYPEDEF typedef PetscErrorCode (*TSIFunction)(TS,PetscReal,Vec,Vec,Vec,void*);
317d1e9a80fSBarry Smith PETSC_EXTERN_TYPEDEF typedef PetscErrorCode (*TSIJacobian)(TS,PetscReal,Vec,Vec,PetscReal,Mat,Mat,void*);
318014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSetIFunction(TS,Vec,TSIFunction,void*);
319014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGetIFunction(TS,Vec*,TSIFunction*,void**);
320014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSetIJacobian(TS,Mat,Mat,TSIJacobian,void*);
321014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGetIJacobian(TS,Mat*,Mat*,TSIJacobian*,void**);
322316643e7SJed Brown 
323014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSComputeRHSFunctionLinear(TS,PetscReal,Vec,Vec,void*);
324d1e9a80fSBarry Smith PETSC_EXTERN PetscErrorCode TSComputeRHSJacobianConstant(TS,PetscReal,Vec,Mat,Mat,void*);
325014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSComputeIFunctionLinear(TS,PetscReal,Vec,Vec,Vec,void*);
326d1e9a80fSBarry Smith PETSC_EXTERN PetscErrorCode TSComputeIJacobianConstant(TS,PetscReal,Vec,Vec,PetscReal,Mat,Mat,void*);
3271c8a10a0SJed Brown PETSC_EXTERN PetscErrorCode TSComputeSolutionFunction(TS,PetscReal,Vec);
3289b7cd975SBarry Smith PETSC_EXTERN PetscErrorCode TSComputeForcingFunction(TS,PetscReal,Vec);
329847ff0e1SMatthew G. Knepley PETSC_EXTERN PetscErrorCode TSComputeIJacobianDefaultColor(TS,PetscReal,Vec,Vec,PetscReal,Mat,Mat,void*);
330e34be4c2SBarry Smith 
331014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSetPreStep(TS, PetscErrorCode (*)(TS));
332b8123daeSJed Brown PETSC_EXTERN PetscErrorCode TSSetPreStage(TS, PetscErrorCode (*)(TS,PetscReal));
3339be3e283SDebojyoti Ghosh PETSC_EXTERN PetscErrorCode TSSetPostStage(TS, PetscErrorCode (*)(TS,PetscReal,PetscInt,Vec*));
334014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSetPostStep(TS, PetscErrorCode (*)(TS));
335014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSPreStep(TS);
336b8123daeSJed Brown PETSC_EXTERN PetscErrorCode TSPreStage(TS,PetscReal);
3379be3e283SDebojyoti Ghosh PETSC_EXTERN PetscErrorCode TSPostStage(TS,PetscReal,PetscInt,Vec*);
338014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSPostStep(TS);
339014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSetRetainStages(TS,PetscBool);
340014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSInterpolate(TS,PetscReal,Vec);
341014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSetTolerances(TS,PetscReal,Vec,PetscReal,Vec);
342c5033834SJed Brown PETSC_EXTERN PetscErrorCode TSGetTolerances(TS,PetscReal*,Vec*,PetscReal*,Vec*);
343b29392e1SShri PETSC_EXTERN PetscErrorCode TSSetDifferentialEquationsIS(TS,IS);
344*a4868fbcSLisandro Dalcin PETSC_EXTERN PetscErrorCode TSErrorWeightedNormInfinity(TS,Vec,Vec,PetscReal*);
345*a4868fbcSLisandro Dalcin PETSC_EXTERN PetscErrorCode TSErrorWeightedNorm2(TS,Vec,Vec,PetscReal*);
346*a4868fbcSLisandro Dalcin PETSC_EXTERN PetscErrorCode TSErrorWeightedNorm(TS,Vec,Vec,NormType,PetscReal*);
347014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSetCFLTimeLocal(TS,PetscReal);
348014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGetCFLTime(TS,PetscReal*);
349000e7ae3SMatthew Knepley 
350014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSPseudoSetTimeStep(TS,PetscErrorCode(*)(TS,PetscReal*,void*),void*);
3518d359177SBarry Smith PETSC_EXTERN PetscErrorCode TSPseudoTimeStepDefault(TS,PetscReal*,void*);
352014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSPseudoComputeTimeStep(TS,PetscReal *);
353014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSPseudoSetMaxTimeStep(TS,PetscReal);
354d8345c25SBarry Smith 
355014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSPseudoSetVerifyTimeStep(TS,PetscErrorCode(*)(TS,Vec,void*,PetscReal*,PetscBool *),void*);
3568d359177SBarry Smith PETSC_EXTERN PetscErrorCode TSPseudoVerifyTimeStepDefault(TS,Vec,void*,PetscReal*,PetscBool *);
357014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSPseudoVerifyTimeStep(TS,Vec,PetscReal*,PetscBool *);
358014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSPseudoSetTimeStepIncrement(TS,PetscReal);
359014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSPseudoIncrementDtFromInitialDt(TS);
36021c89e3eSBarry Smith 
361014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSPythonSetType(TS,const char[]);
3621d6018f0SLisandro Dalcin 
363014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSComputeRHSFunction(TS,PetscReal,Vec,Vec);
364d1e9a80fSBarry Smith PETSC_EXTERN PetscErrorCode TSComputeRHSJacobian(TS,PetscReal,Vec,Mat,Mat);
365014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSComputeIFunction(TS,PetscReal,Vec,Vec,Vec,PetscBool);
366d1e9a80fSBarry Smith PETSC_EXTERN PetscErrorCode TSComputeIJacobian(TS,PetscReal,Vec,Vec,PetscReal,Mat,Mat,PetscBool);
367f9c1d6abSBarry Smith PETSC_EXTERN PetscErrorCode TSComputeLinearStability(TS,PetscReal,PetscReal,PetscReal*,PetscReal*);
368818ad0c1SBarry Smith 
369014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSVISetVariableBounds(TS,Vec,Vec);
370d6ebe24aSShri Abhyankar 
37124989b8cSPeter Brune PETSC_EXTERN PetscErrorCode DMTSSetRHSFunction(DM,TSRHSFunction,void*);
37224989b8cSPeter Brune PETSC_EXTERN PetscErrorCode DMTSGetRHSFunction(DM,TSRHSFunction*,void**);
37324989b8cSPeter Brune PETSC_EXTERN PetscErrorCode DMTSSetRHSJacobian(DM,TSRHSJacobian,void*);
37424989b8cSPeter Brune PETSC_EXTERN PetscErrorCode DMTSGetRHSJacobian(DM,TSRHSJacobian*,void**);
37524989b8cSPeter Brune PETSC_EXTERN PetscErrorCode DMTSSetIFunction(DM,TSIFunction,void*);
37624989b8cSPeter Brune PETSC_EXTERN PetscErrorCode DMTSGetIFunction(DM,TSIFunction*,void**);
37724989b8cSPeter Brune PETSC_EXTERN PetscErrorCode DMTSSetIJacobian(DM,TSIJacobian,void*);
37824989b8cSPeter Brune PETSC_EXTERN PetscErrorCode DMTSGetIJacobian(DM,TSIJacobian*,void**);
379ef20d060SBarry Smith PETSC_EXTERN PetscErrorCode DMTSSetSolutionFunction(DM,TSSolutionFunction,void*);
380ef20d060SBarry Smith PETSC_EXTERN PetscErrorCode DMTSGetSolutionFunction(DM,TSSolutionFunction*,void**);
381f8b49ee9SBarry Smith PETSC_EXTERN PetscErrorCode DMTSSetForcingFunction(DM,PetscErrorCode (*)(TS,PetscReal,Vec,void*),void*);
382f8b49ee9SBarry Smith PETSC_EXTERN PetscErrorCode DMTSGetForcingFunction(DM,PetscErrorCode (**)(TS,PetscReal,Vec,void*),void**);
383924a1b8fSMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMTSGetMinRadius(DM,PetscReal*);
384924a1b8fSMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMTSSetMinRadius(DM,PetscReal);
385274e9618SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMTSCheckFromOptions(TS, Vec, void (**)(const PetscReal[], PetscScalar *, void *), void **);
3869b7cd975SBarry Smith 
387d433e6cbSMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMTSSetIFunctionLocal(DM,PetscErrorCode (*)(DM,PetscReal,Vec,Vec,Vec,void*),void*);
388d433e6cbSMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMTSSetIJacobianLocal(DM,PetscErrorCode (*)(DM,PetscReal,Vec,Vec,PetscReal,Mat,Mat,void*),void*);
389d433e6cbSMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMTSSetRHSFunctionLocal(DM,PetscErrorCode (*)(DM,PetscReal,Vec,Vec,void*),void*);
3906c6b9e74SPeter Brune 
3916c6b9e74SPeter Brune PETSC_EXTERN PetscErrorCode DMTSSetIFunctionSerialize(DM,PetscErrorCode (*)(void*,PetscViewer),PetscErrorCode (*)(void**,PetscViewer));
3926c6b9e74SPeter Brune PETSC_EXTERN PetscErrorCode DMTSSetIJacobianSerialize(DM,PetscErrorCode (*)(void*,PetscViewer),PetscErrorCode (*)(void**,PetscViewer));
3936c6b9e74SPeter Brune 
3946c6b9e74SPeter Brune PETSC_EXTERN_TYPEDEF typedef PetscErrorCode (*DMDATSRHSFunctionLocal)(DMDALocalInfo*,PetscReal,void*,void*,void*);
395d1e9a80fSBarry Smith PETSC_EXTERN_TYPEDEF typedef PetscErrorCode (*DMDATSRHSJacobianLocal)(DMDALocalInfo*,PetscReal,void*,Mat,Mat,void*);
3966c6b9e74SPeter Brune PETSC_EXTERN_TYPEDEF typedef PetscErrorCode (*DMDATSIFunctionLocal)(DMDALocalInfo*,PetscReal,void*,void*,void*,void*);
397d1e9a80fSBarry Smith PETSC_EXTERN_TYPEDEF typedef PetscErrorCode (*DMDATSIJacobianLocal)(DMDALocalInfo*,PetscReal,void*,void*,PetscReal,Mat,Mat,void*);
3986c6b9e74SPeter Brune 
3996c6b9e74SPeter Brune PETSC_EXTERN PetscErrorCode DMDATSSetRHSFunctionLocal(DM,InsertMode,PetscErrorCode (*)(DMDALocalInfo*,PetscReal,void*,void*,void*),void *);
400d1e9a80fSBarry Smith PETSC_EXTERN PetscErrorCode DMDATSSetRHSJacobianLocal(DM,PetscErrorCode (*)(DMDALocalInfo*,PetscReal,void*,Mat,Mat,void*),void *);
4016c6b9e74SPeter Brune PETSC_EXTERN PetscErrorCode DMDATSSetIFunctionLocal(DM,InsertMode,PetscErrorCode (*)(DMDALocalInfo*,PetscReal,void*,void*,void*,void*),void *);
402d1e9a80fSBarry Smith PETSC_EXTERN PetscErrorCode DMDATSSetIJacobianLocal(DM,PetscErrorCode (*)(DMDALocalInfo*,PetscReal,void*,void*,PetscReal,Mat,Mat,void*),void *);
4036c6b9e74SPeter Brune 
404b6aca0f9SMatthew G. Knepley PETSC_EXTERN PetscErrorCode DMPlexTSGetGeometryFVM(DM, Vec *, Vec *, PetscReal *);
4056dbbd306SMatthew G. Knepley 
406be1b0d75SMatthew G. Knepley typedef struct _n_TSMonitorLGCtx*  TSMonitorLGCtx;
407d1212d36SBarry Smith typedef struct {
408d1212d36SBarry Smith   Vec            ray;
409d1212d36SBarry Smith   VecScatter     scatter;
410d1212d36SBarry Smith   PetscViewer    viewer;
41151b4a12fSMatthew G. Knepley   TSMonitorLGCtx lgctx;
412d1212d36SBarry Smith } TSMonitorDMDARayCtx;
413d1212d36SBarry Smith PETSC_EXTERN PetscErrorCode TSMonitorDMDARayDestroy(void**);
414d1212d36SBarry Smith PETSC_EXTERN PetscErrorCode TSMonitorDMDARay(TS,PetscInt,PetscReal,Vec,void*);
41551b4a12fSMatthew G. Knepley PETSC_EXTERN PetscErrorCode TSMonitorLGDMDARay(TS,PetscInt,PetscReal,Vec,void*);
416d1212d36SBarry Smith 
417d1212d36SBarry Smith 
418bdad233fSMatthew Knepley /* Dynamic creation and loading functions */
419140e18c1SBarry Smith PETSC_EXTERN PetscFunctionList TSList;
42019fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode TSGetType(TS,TSType*);
42119fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode TSSetType(TS,TSType);
422bdf89e91SBarry Smith PETSC_EXTERN PetscErrorCode TSRegister(const char[], PetscErrorCode (*)(TS));
42330de9b25SBarry Smith 
424014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGetSNES(TS,SNES*);
425deb2cd25SJed Brown PETSC_EXTERN PetscErrorCode TSSetSNES(TS,SNES);
426014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGetKSP(TS,KSP*);
427818ad0c1SBarry Smith 
428014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSView(TS,PetscViewer);
42955849f57SBarry Smith PETSC_EXTERN PetscErrorCode TSLoad(TS,PetscViewer);
430ce1779c8SBarry Smith PETSC_STATIC_INLINE PetscErrorCode TSViewFromOptions(TS A,const char prefix[],const char name[]) {return PetscObjectViewFromOptions((PetscObject)A,prefix,name);}
43155849f57SBarry Smith 
43255849f57SBarry Smith 
43355849f57SBarry Smith #define TS_FILE_CLASSID 1211225
43421c89e3eSBarry Smith 
435014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSetApplicationContext(TS,void *);
436014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGetApplicationContext(TS,void *);
43721c89e3eSBarry Smith 
438a9f9c1f6SBarry Smith PETSC_EXTERN PetscErrorCode TSMonitorLGCtxCreate(MPI_Comm,const char[],const char[],int,int,int,int,PetscInt,TSMonitorLGCtx *);
439a9f9c1f6SBarry Smith PETSC_EXTERN PetscErrorCode TSMonitorLGCtxDestroy(TSMonitorLGCtx*);
4404f09c107SBarry Smith PETSC_EXTERN PetscErrorCode TSMonitorLGTimeStep(TS,PetscInt,PetscReal,Vec,void *);
4414f09c107SBarry Smith PETSC_EXTERN PetscErrorCode TSMonitorLGSolution(TS,PetscInt,PetscReal,Vec,void *);
44231152f8aSBarry Smith PETSC_EXTERN PetscErrorCode TSMonitorLGSetVariableNames(TS,const char * const*);
443b3d3934dSBarry Smith PETSC_EXTERN PetscErrorCode TSMonitorLGGetVariableNames(TS,const char *const **);
444e673d494SBarry Smith PETSC_EXTERN PetscErrorCode TSMonitorLGCtxSetVariableNames(TSMonitorLGCtx,const char * const *);
445a66092f1SBarry Smith PETSC_EXTERN PetscErrorCode TSMonitorLGSetDisplayVariables(TS,const char * const*);
446a66092f1SBarry Smith PETSC_EXTERN PetscErrorCode TSMonitorLGCtxSetDisplayVariables(TSMonitorLGCtx,const char * const*);
4477684fa3eSBarry Smith PETSC_EXTERN PetscErrorCode TSMonitorLGSetTransform(TS,PetscErrorCode (*)(void*,Vec,Vec*),PetscErrorCode (*)(void*),void*);
4487684fa3eSBarry Smith PETSC_EXTERN PetscErrorCode TSMonitorLGCtxSetTransform(TSMonitorLGCtx,PetscErrorCode (*)(void*,Vec,Vec*),PetscErrorCode (*)(void*),void *);
4494f09c107SBarry Smith PETSC_EXTERN PetscErrorCode TSMonitorLGError(TS,PetscInt,PetscReal,Vec,void *);
450201da799SBarry Smith PETSC_EXTERN PetscErrorCode TSMonitorLGSNESIterations(TS,PetscInt,PetscReal,Vec,void *);
451201da799SBarry Smith PETSC_EXTERN PetscErrorCode TSMonitorLGKSPIterations(TS,PetscInt,PetscReal,Vec,void *);
452ef20d060SBarry Smith 
453b3d3934dSBarry Smith typedef struct _n_TSMonitorEnvelopeCtx*  TSMonitorEnvelopeCtx;
454b3d3934dSBarry Smith PETSC_EXTERN PetscErrorCode TSMonitorEnvelopeCtxCreate(TS,TSMonitorEnvelopeCtx*);
455b3d3934dSBarry Smith PETSC_EXTERN PetscErrorCode TSMonitorEnvelope(TS,PetscInt,PetscReal,Vec,void*);
456b3d3934dSBarry Smith PETSC_EXTERN PetscErrorCode TSMonitorEnvelopeGetBounds(TS,Vec*,Vec*);
457b3d3934dSBarry Smith PETSC_EXTERN PetscErrorCode TSMonitorEnvelopeCtxDestroy(TSMonitorEnvelopeCtx*);
458b3d3934dSBarry Smith 
4598189c53fSBarry Smith typedef struct _n_TSMonitorSPEigCtx*  TSMonitorSPEigCtx;
4608189c53fSBarry Smith PETSC_EXTERN PetscErrorCode TSMonitorSPEigCtxCreate(MPI_Comm,const char[],const char[],int,int,int,int,PetscInt,TSMonitorSPEigCtx *);
4618189c53fSBarry Smith PETSC_EXTERN PetscErrorCode TSMonitorSPEigCtxDestroy(TSMonitorSPEigCtx*);
4628189c53fSBarry Smith PETSC_EXTERN PetscErrorCode TSMonitorSPEig(TS,PetscInt,PetscReal,Vec,void *);
4633914022bSBarry Smith 
464031fbad4SShri Abhyankar PETSC_EXTERN PetscErrorCode TSSetEventMonitor(TS,PetscInt,PetscInt*,PetscBool*,PetscErrorCode (*)(TS,PetscReal,Vec,PetscScalar*,void*),PetscErrorCode (*)(TS,PetscInt,PetscInt[],PetscReal,Vec,PetscBool,void*),void*);
46576bdecfbSBarry Smith /*J
466815f1ad5SJed Brown    TSSSPType - string with the name of TSSSP scheme.
467815f1ad5SJed Brown 
468815f1ad5SJed Brown    Level: beginner
469815f1ad5SJed Brown 
470815f1ad5SJed Brown .seealso: TSSSPSetType(), TS
47176bdecfbSBarry Smith J*/
47219fd82e9SBarry Smith typedef const char* TSSSPType;
473815f1ad5SJed Brown #define TSSSPRKS2  "rks2"
474815f1ad5SJed Brown #define TSSSPRKS3  "rks3"
475815f1ad5SJed Brown #define TSSSPRK104 "rk104"
476815f1ad5SJed Brown 
47719fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode TSSSPSetType(TS,TSSSPType);
47819fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode TSSSPGetType(TS,TSSSPType*);
479014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSSPSetNumStages(TS,PetscInt);
480014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSSPGetNumStages(TS,PetscInt*);
481787849ffSJed Brown PETSC_EXTERN PetscErrorCode TSSSPFinalizePackage(void);
482787849ffSJed Brown PETSC_EXTERN PetscErrorCode TSSSPInitializePackage(void);
483815f1ad5SJed Brown 
484ed657a08SJed Brown /*S
48584df9cb4SJed Brown    TSAdapt - Abstract object that manages time-step adaptivity
48684df9cb4SJed Brown 
48784df9cb4SJed Brown    Level: beginner
48884df9cb4SJed Brown 
48984df9cb4SJed Brown .seealso: TS, TSAdaptCreate(), TSAdaptType
49084df9cb4SJed Brown S*/
49184df9cb4SJed Brown typedef struct _p_TSAdapt *TSAdapt;
49284df9cb4SJed Brown 
49384df9cb4SJed Brown /*E
4948f6c3df8SBarry Smith     TSAdaptType - String with the name of TSAdapt scheme.
49584df9cb4SJed Brown 
49684df9cb4SJed Brown    Level: beginner
49784df9cb4SJed Brown 
49884df9cb4SJed Brown .seealso: TSAdaptSetType(), TS
49984df9cb4SJed Brown E*/
500f8963224SJed Brown typedef const char *TSAdaptType;
50184df9cb4SJed Brown #define TSADAPTBASIC "basic"
502b0f836d7SJed Brown #define TSADAPTNONE  "none"
5038d59e960SJed Brown #define TSADAPTCFL   "cfl"
50484df9cb4SJed Brown 
505552698daSJed Brown PETSC_EXTERN PetscErrorCode TSGetAdapt(TS,TSAdapt*);
506bdf89e91SBarry Smith PETSC_EXTERN PetscErrorCode TSAdaptRegister(const char[],PetscErrorCode (*)(TSAdapt));
507607a6623SBarry Smith PETSC_EXTERN PetscErrorCode TSAdaptInitializePackage(void);
508014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAdaptFinalizePackage(void);
509014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAdaptCreate(MPI_Comm,TSAdapt*);
51019fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode TSAdaptSetType(TSAdapt,TSAdaptType);
511014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAdaptSetOptionsPrefix(TSAdapt,const char[]);
512014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAdaptCandidatesClear(TSAdapt);
513014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAdaptCandidateAdd(TSAdapt,const char[],PetscInt,PetscInt,PetscReal,PetscReal,PetscBool);
514014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAdaptCandidatesGet(TSAdapt,PetscInt*,const PetscInt**,const PetscInt**,const PetscReal**,const PetscReal**);
515014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAdaptChoose(TSAdapt,TS,PetscReal,PetscInt*,PetscReal*,PetscBool*);
516014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAdaptCheckStage(TSAdapt,TS,PetscBool*);
517014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAdaptView(TSAdapt,PetscViewer);
518ad6bc421SBarry Smith PETSC_EXTERN PetscErrorCode TSAdaptLoad(TSAdapt,PetscViewer);
5198c34d3f5SBarry Smith PETSC_EXTERN PetscErrorCode TSAdaptSetFromOptions(PetscOptions*,TSAdapt);
520014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAdaptDestroy(TSAdapt*);
521014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAdaptSetMonitor(TSAdapt,PetscBool);
522014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAdaptSetStepLimits(TSAdapt,PetscReal,PetscReal);
5230873808bSJed Brown PETSC_EXTERN PetscErrorCode TSAdaptSetCheckStage(TSAdapt,PetscErrorCode(*)(TSAdapt,TS,PetscBool*));
52484df9cb4SJed Brown 
52584df9cb4SJed Brown /*S
526ed657a08SJed Brown    TSGLAdapt - Abstract object that manages time-step adaptivity
527ed657a08SJed Brown 
528ed657a08SJed Brown    Level: beginner
529ed657a08SJed Brown 
53084df9cb4SJed Brown    Developer Notes:
53184df9cb4SJed Brown    This functionality should be replaced by the TSAdapt.
53284df9cb4SJed Brown 
533ed657a08SJed Brown .seealso: TSGL, TSGLAdaptCreate(), TSGLAdaptType
534ed657a08SJed Brown S*/
535ed657a08SJed Brown typedef struct _p_TSGLAdapt *TSGLAdapt;
536ed657a08SJed Brown 
53776bdecfbSBarry Smith /*J
5388f6c3df8SBarry Smith     TSGLAdaptType - String with the name of TSGLAdapt scheme
539ed657a08SJed Brown 
540ed657a08SJed Brown    Level: beginner
541ed657a08SJed Brown 
542ed657a08SJed Brown .seealso: TSGLAdaptSetType(), TS
54376bdecfbSBarry Smith J*/
544f8963224SJed Brown typedef const char *TSGLAdaptType;
545ed657a08SJed Brown #define TSGLADAPT_NONE "none"
546ed657a08SJed Brown #define TSGLADAPT_SIZE "size"
547ed657a08SJed Brown #define TSGLADAPT_BOTH "both"
548ed657a08SJed Brown 
549bdf89e91SBarry Smith PETSC_EXTERN PetscErrorCode TSGLAdaptRegister(const char[],PetscErrorCode (*)(TSGLAdapt));
550607a6623SBarry Smith PETSC_EXTERN PetscErrorCode TSGLAdaptInitializePackage(void);
551014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGLAdaptFinalizePackage(void);
552014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGLAdaptCreate(MPI_Comm,TSGLAdapt*);
55319fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode TSGLAdaptSetType(TSGLAdapt,TSGLAdaptType);
554014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGLAdaptSetOptionsPrefix(TSGLAdapt,const char[]);
555014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGLAdaptChoose(TSGLAdapt,PetscInt,const PetscInt[],const PetscReal[],const PetscReal[],PetscInt,PetscReal,PetscReal,PetscInt*,PetscReal*,PetscBool *);
556014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGLAdaptView(TSGLAdapt,PetscViewer);
5578c34d3f5SBarry Smith PETSC_EXTERN PetscErrorCode TSGLAdaptSetFromOptions(PetscOptions*,TSGLAdapt);
558014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGLAdaptDestroy(TSGLAdapt*);
559ed657a08SJed Brown 
56076bdecfbSBarry Smith /*J
5618f6c3df8SBarry Smith     TSGLAcceptType - String with the name of TSGLAccept scheme
562ed657a08SJed Brown 
563ed657a08SJed Brown    Level: beginner
564ed657a08SJed Brown 
565ed657a08SJed Brown .seealso: TSGLSetAcceptType(), TS
56676bdecfbSBarry Smith J*/
567f8963224SJed Brown typedef const char *TSGLAcceptType;
568ed657a08SJed Brown #define TSGLACCEPT_ALWAYS "always"
569ed657a08SJed Brown 
570638cfed1SJed Brown PETSC_EXTERN_TYPEDEF typedef PetscErrorCode (*TSGLAcceptFunction)(TS,PetscReal,PetscReal,const PetscReal[],PetscBool *);
571bdf89e91SBarry Smith PETSC_EXTERN PetscErrorCode TSGLAcceptRegister(const char[],TSGLAcceptFunction);
572ed657a08SJed Brown 
57376bdecfbSBarry Smith /*J
57418b56cb9SJed Brown   TSGLType - family of time integration method within the General Linear class
57518b56cb9SJed Brown 
57618b56cb9SJed Brown   Level: beginner
57718b56cb9SJed Brown 
57818b56cb9SJed Brown .seealso: TSGLSetType(), TSGLRegister()
57976bdecfbSBarry Smith J*/
58019fd82e9SBarry Smith typedef const char* TSGLType;
581ed657a08SJed Brown #define TSGL_IRKS   "irks"
58218b56cb9SJed Brown 
583bdf89e91SBarry Smith PETSC_EXTERN PetscErrorCode TSGLRegister(const char[],PetscErrorCode(*)(TS));
584607a6623SBarry Smith PETSC_EXTERN PetscErrorCode TSGLInitializePackage(void);
585014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGLFinalizePackage(void);
58619fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode TSGLSetType(TS,TSGLType);
587014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGLGetAdapt(TS,TSGLAdapt*);
58819fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode TSGLSetAcceptType(TS,TSGLAcceptType);
58918b56cb9SJed Brown 
590020d8f30SJed Brown /*J
5917d5697caSHong Zhang     TSEIMEXType - String with the name of an Extrapolated IMEX method.
5927d5697caSHong Zhang 
5937d5697caSHong Zhang    Level: beginner
5947d5697caSHong Zhang 
5957d5697caSHong Zhang .seealso: TSEIMEXSetType(), TS, TSEIMEX, TSEIMEXRegister()
5967d5697caSHong Zhang J*/
5977d5697caSHong Zhang #define TSEIMEXType   char*
5987d5697caSHong Zhang 
5997d5697caSHong Zhang PETSC_EXTERN PetscErrorCode TSEIMEXSetMaxRows(TS ts,PetscInt);
6007d5697caSHong Zhang PETSC_EXTERN PetscErrorCode TSEIMEXSetRowCol(TS ts,PetscInt,PetscInt);
6017d5697caSHong Zhang PETSC_EXTERN PetscErrorCode TSEIMEXSetOrdAdapt(TS,PetscBool);
6027d5697caSHong Zhang 
6037d5697caSHong Zhang /*J
604f68a32c8SEmil Constantinescu     TSRKType - String with the name of a Runge-Kutta method.
605f68a32c8SEmil Constantinescu 
606f68a32c8SEmil Constantinescu    Level: beginner
607f68a32c8SEmil Constantinescu 
608f68a32c8SEmil Constantinescu .seealso: TSRKSetType(), TS, TSRK, TSRKRegister()
609f68a32c8SEmil Constantinescu J*/
610f68a32c8SEmil Constantinescu typedef const char* TSRKType;
611f68a32c8SEmil Constantinescu #define TSRK1FE   "1fe"
612fdefd5e5SDebojyoti Ghosh #define TSRK2A    "2a"
613f68a32c8SEmil Constantinescu #define TSRK3     "3"
614fdefd5e5SDebojyoti Ghosh #define TSRK3BS   "3bs"
615f68a32c8SEmil Constantinescu #define TSRK4     "4"
616fdefd5e5SDebojyoti Ghosh #define TSRK5F    "5f"
617fdefd5e5SDebojyoti Ghosh #define TSRK5DP   "5dp"
618f68a32c8SEmil Constantinescu PETSC_EXTERN PetscErrorCode TSRKGetType(TS ts,TSRKType*);
619f68a32c8SEmil Constantinescu PETSC_EXTERN PetscErrorCode TSRKSetType(TS ts,TSRKType);
620f68a32c8SEmil Constantinescu PETSC_EXTERN PetscErrorCode TSRKSetFullyImplicit(TS,PetscBool);
621f68a32c8SEmil Constantinescu PETSC_EXTERN PetscErrorCode TSRKRegister(TSRKType,PetscInt,PetscInt,const PetscReal[],const PetscReal[],const PetscReal[],const PetscReal[],PetscInt,const PetscReal[]);
622f68a32c8SEmil Constantinescu PETSC_EXTERN PetscErrorCode TSRKFinalizePackage(void);
623f68a32c8SEmil Constantinescu PETSC_EXTERN PetscErrorCode TSRKInitializePackage(void);
624f68a32c8SEmil Constantinescu PETSC_EXTERN PetscErrorCode TSRKRegisterDestroy(void);
625f68a32c8SEmil Constantinescu 
626f68a32c8SEmil Constantinescu /*J
627020d8f30SJed Brown     TSARKIMEXType - String with the name of an Additive Runge-Kutta IMEX method.
628020d8f30SJed Brown 
629020d8f30SJed Brown    Level: beginner
630020d8f30SJed Brown 
631020d8f30SJed Brown .seealso: TSARKIMEXSetType(), TS, TSARKIMEX, TSARKIMEXRegister()
632020d8f30SJed Brown J*/
63319fd82e9SBarry Smith typedef const char* TSARKIMEXType;
634e817cc15SEmil Constantinescu #define TSARKIMEX1BEE   "1bee"
6351f80e275SEmil Constantinescu #define TSARKIMEXA2     "a2"
6361f80e275SEmil Constantinescu #define TSARKIMEXL2     "l2"
6371f80e275SEmil Constantinescu #define TSARKIMEXARS122 "ars122"
6381f80e275SEmil Constantinescu #define TSARKIMEX2C     "2c"
6398a381b04SJed Brown #define TSARKIMEX2D     "2d"
640a3a57f36SJed Brown #define TSARKIMEX2E     "2e"
6416cf0794eSJed Brown #define TSARKIMEXPRSSP2 "prssp2"
6428a381b04SJed Brown #define TSARKIMEX3      "3"
6436cf0794eSJed Brown #define TSARKIMEXBPR3   "bpr3"
6446cf0794eSJed Brown #define TSARKIMEXARS443 "ars443"
6458a381b04SJed Brown #define TSARKIMEX4      "4"
6468a381b04SJed Brown #define TSARKIMEX5      "5"
64719fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode TSARKIMEXGetType(TS ts,TSARKIMEXType*);
64819fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode TSARKIMEXSetType(TS ts,TSARKIMEXType);
649014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSARKIMEXSetFullyImplicit(TS,PetscBool);
65019fd82e9SBarry Smith 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[]);
651014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSARKIMEXFinalizePackage(void);
652607a6623SBarry Smith PETSC_EXTERN PetscErrorCode TSARKIMEXInitializePackage(void);
653014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSARKIMEXRegisterDestroy(void);
6548a381b04SJed Brown 
655020d8f30SJed Brown /*J
656020d8f30SJed Brown     TSRosWType - String with the name of a Rosenbrock-W method.
657020d8f30SJed Brown 
658020d8f30SJed Brown    Level: beginner
659020d8f30SJed Brown 
660020d8f30SJed Brown .seealso: TSRosWSetType(), TS, TSROSW, TSRosWRegister()
661020d8f30SJed Brown J*/
66219fd82e9SBarry Smith typedef const char* TSRosWType;
66361692a83SJed Brown #define TSROSW2M          "2m"
66461692a83SJed Brown #define TSROSW2P          "2p"
665fe7e6d57SJed Brown #define TSROSWRA3PW       "ra3pw"
666fe7e6d57SJed Brown #define TSROSWRA34PW2     "ra34pw2"
667ef3c5b88SJed Brown #define TSROSWRODAS3      "rodas3"
668ef3c5b88SJed Brown #define TSROSWSANDU3      "sandu3"
669961f28d0SJed Brown #define TSROSWASSP3P3S1C  "assp3p3s1c"
670961f28d0SJed Brown #define TSROSWLASSP3P4S2C "lassp3p4s2c"
67143b21953SEmil Constantinescu #define TSROSWLLSSP3P4S2C "llssp3p4s2c"
672753f8adbSEmil Constantinescu #define TSROSWARK3        "ark3"
6733606a31eSEmil Constantinescu #define TSROSWTHETA1      "theta1"
6743606a31eSEmil Constantinescu #define TSROSWTHETA2      "theta2"
67542faf41dSJed Brown #define TSROSWGRK4T       "grk4t"
67642faf41dSJed Brown #define TSROSWSHAMP4      "shamp4"
67742faf41dSJed Brown #define TSROSWVELDD4      "veldd4"
67842faf41dSJed Brown #define TSROSW4L          "4l"
679b1c69cc3SEmil Constantinescu 
68019fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode TSRosWGetType(TS ts,TSRosWType*);
68119fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode TSRosWSetType(TS ts,TSRosWType);
682014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSRosWSetRecomputeJacobian(TS,PetscBool);
68319fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode TSRosWRegister(TSRosWType,PetscInt,PetscInt,const PetscReal[],const PetscReal[],const PetscReal[],const PetscReal[],PetscInt,const PetscReal[]);
68419fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode TSRosWRegisterRos4(TSRosWType,PetscReal,PetscReal,PetscReal,PetscReal,PetscReal);
685014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSRosWFinalizePackage(void);
686607a6623SBarry Smith PETSC_EXTERN PetscErrorCode TSRosWInitializePackage(void);
687014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSRosWRegisterDestroy(void);
688e27a552bSJed Brown 
68983e2fdc7SBarry Smith /*
6900f3b3ca1SHong Zhang        PETSc interface to Sundials
69183e2fdc7SBarry Smith */
6926dc17ff5SMatthew Knepley #ifdef PETSC_HAVE_SUNDIALS
6936fadb2cdSHong Zhang typedef enum { SUNDIALS_ADAMS=1,SUNDIALS_BDF=2} TSSundialsLmmType;
6946a6fc655SJed Brown PETSC_EXTERN const char *const TSSundialsLmmTypes[];
6956fadb2cdSHong Zhang typedef enum { SUNDIALS_MODIFIED_GS = 1,SUNDIALS_CLASSICAL_GS = 2 } TSSundialsGramSchmidtType;
6966a6fc655SJed Brown PETSC_EXTERN const char *const TSSundialsGramSchmidtTypes[];
697014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSundialsSetType(TS,TSSundialsLmmType);
698014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSundialsGetPC(TS,PC*);
699014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSundialsSetTolerance(TS,PetscReal,PetscReal);
700014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSundialsSetMinTimeStep(TS,PetscReal);
701014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSundialsSetMaxTimeStep(TS,PetscReal);
702014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSundialsGetIterations(TS,PetscInt *,PetscInt *);
703014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSundialsSetGramSchmidtType(TS,TSSundialsGramSchmidtType);
704014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSundialsSetGMRESRestart(TS,PetscInt);
705014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSundialsSetLinearTolerance(TS,PetscReal);
706014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSundialsMonitorInternalSteps(TS,PetscBool );
707014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSundialsGetParameters(TS,PetscInt *,long*[],double*[]);
708014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSundialsSetMaxl(TS,PetscInt);
7096dc17ff5SMatthew Knepley #endif
71083e2fdc7SBarry Smith 
711014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSThetaSetTheta(TS,PetscReal);
712014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSThetaGetTheta(TS,PetscReal*);
713014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSThetaGetEndpoint(TS,PetscBool*);
714014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSThetaSetEndpoint(TS,PetscBool);
7150de4c49aSJed Brown 
716014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAlphaSetAdapt(TS,PetscErrorCode(*)(TS,PetscReal,Vec,Vec,PetscReal*,PetscBool*,void*),void*);
717014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAlphaAdaptDefault(TS,PetscReal,Vec,Vec,PetscReal*,PetscBool*,void*);
718014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAlphaSetRadius(TS,PetscReal);
719014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAlphaSetParams(TS,PetscReal,PetscReal,PetscReal);
720014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAlphaGetParams(TS,PetscReal*,PetscReal*,PetscReal*);
72188df8a41SLisandro Dalcin 
722014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSetDM(TS,DM);
723014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGetDM(TS,DM*);
7246c699258SBarry Smith 
725014dd563SJed Brown PETSC_EXTERN PetscErrorCode SNESTSFormFunction(SNES,Vec,Vec,void*);
726d1e9a80fSBarry Smith PETSC_EXTERN PetscErrorCode SNESTSFormJacobian(SNES,Vec,Mat,Mat,void*);
7270f5c6efeSJed Brown 
728818ad0c1SBarry Smith #endif
729