xref: /petsc/include/petscts.h (revision e817cc15174f6f79177f5b1f0a3e719402b14a67)
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 
1694b7f48cSBarry Smith .seealso:  TSCreate(), TSSetType(), TSType, SNES, KSP, PC
17435da068SBarry Smith S*/
18f09e8eb9SSatish Balay typedef struct _p_TS* TS;
19435da068SBarry Smith 
2076bdecfbSBarry Smith /*J
21435da068SBarry Smith     TSType - String with the name of a PETSc TS method or the creation function
22435da068SBarry Smith        with an optional dynamic library name, for example
23435da068SBarry Smith        http://www.mcs.anl.gov/petsc/lib.a:mytscreate()
24435da068SBarry Smith 
25435da068SBarry Smith    Level: beginner
26435da068SBarry Smith 
27435da068SBarry Smith .seealso: TSSetType(), TS
2876bdecfbSBarry Smith J*/
2919fd82e9SBarry Smith typedef const char* TSType;
309596e0b4SJed Brown #define TSEULER           "euler"
319596e0b4SJed Brown #define TSBEULER          "beuler"
329596e0b4SJed Brown #define TSPSEUDO          "pseudo"
334d91e141SJed Brown #define TSCN              "cn"
349596e0b4SJed Brown #define TSSUNDIALS        "sundials"
354d91e141SJed Brown #define TSRK              "rk"
369596e0b4SJed Brown #define TSPYTHON          "python"
379596e0b4SJed Brown #define TSTHETA           "theta"
3888df8a41SLisandro Dalcin #define TSALPHA           "alpha"
399596e0b4SJed Brown #define TSGL              "gl"
40ef7bb5aaSJed Brown #define TSSSP             "ssp"
418a381b04SJed Brown #define TSARKIMEX         "arkimex"
42e27a552bSJed Brown #define TSROSW            "rosw"
4382bf6240SBarry Smith 
44435da068SBarry Smith /*E
45435da068SBarry Smith     TSProblemType - Determines the type of problem this TS object is to be used to solve
46435da068SBarry Smith 
47435da068SBarry Smith    Level: beginner
48435da068SBarry Smith 
49435da068SBarry Smith .seealso: TSCreate()
50435da068SBarry Smith E*/
5119bcc07fSBarry Smith typedef enum {TS_LINEAR,TS_NONLINEAR} TSProblemType;
52818ad0c1SBarry Smith 
53b93fea0eSJed Brown /*E
54*e817cc15SEmil Constantinescu    TSEquationType - type of TS problem that is solved
55*e817cc15SEmil Constantinescu 
56*e817cc15SEmil Constantinescu    Level: beginner
57*e817cc15SEmil Constantinescu 
58*e817cc15SEmil Constantinescu    Developer Notes: this must match finclude/petscts.h
59*e817cc15SEmil Constantinescu 
60*e817cc15SEmil Constantinescu    Supported types are:
61*e817cc15SEmil Constantinescu      TS_EQ_UNSPECIFIED (default)
62*e817cc15SEmil 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
63*e817cc15SEmil Constantinescu      TS_EQ_IMPLICIT {ODE and DAE index 1, 2, 3, HI}: F(t,U,U_t) = 0
64*e817cc15SEmil Constantinescu 
65*e817cc15SEmil Constantinescu .seealso: TSGetEquationType(), TSSetEquationType()
66*e817cc15SEmil Constantinescu E*/
67*e817cc15SEmil Constantinescu typedef enum {
68*e817cc15SEmil Constantinescu   TS_EQ_UNSPECIFIED               = -1,
69*e817cc15SEmil Constantinescu   TS_EQ_EXPLICIT                  = 0,
70*e817cc15SEmil Constantinescu   TS_EQ_ODE_EXPLICIT              = 1,
71*e817cc15SEmil Constantinescu   TS_EQ_DAE_SEMI_EXPLICIT_INDEX1  = 100,
72*e817cc15SEmil Constantinescu   TS_EQ_DAE_SEMI_EXPLICIT_INDEX2  = 200,
73*e817cc15SEmil Constantinescu   TS_EQ_DAE_SEMI_EXPLICIT_INDEX3  = 300,
74*e817cc15SEmil Constantinescu   TS_EQ_DAE_SEMI_EXPLICIT_INDEXHI = 500,
75*e817cc15SEmil Constantinescu   TS_EQ_IMPLICIT                  = 1000,
76*e817cc15SEmil Constantinescu   TS_EQ_ODE_IMPLICIT              = 1001,
77*e817cc15SEmil Constantinescu   TS_EQ_DAE_IMPLICIT_INDEX1       = 1100,
78*e817cc15SEmil Constantinescu   TS_EQ_DAE_IMPLICIT_INDEX2       = 1200,
79*e817cc15SEmil Constantinescu   TS_EQ_DAE_IMPLICIT_INDEX3       = 1300,
80*e817cc15SEmil Constantinescu   TS_EQ_DAE_IMPLICIT_INDEXHI      = 1500,
81*e817cc15SEmil Constantinescu } TSEquationType;
82*e817cc15SEmil Constantinescu PETSC_EXTERN const char *const*TSEquationTypes;
83*e817cc15SEmil Constantinescu 
84*e817cc15SEmil Constantinescu /*E
85b93fea0eSJed Brown    TSConvergedReason - reason a TS method has converged or not
86b93fea0eSJed Brown 
87b93fea0eSJed Brown    Level: beginner
88b93fea0eSJed Brown 
89b93fea0eSJed Brown    Developer Notes: this must match finclude/petscts.h
90b93fea0eSJed Brown 
91b93fea0eSJed Brown    Each reason has its own manual page.
92b93fea0eSJed Brown 
93b93fea0eSJed Brown .seealso: TSGetConvergedReason()
94b93fea0eSJed Brown E*/
95193ac0bcSJed Brown typedef enum {
96193ac0bcSJed Brown   TS_CONVERGED_ITERATING      = 0,
97193ac0bcSJed Brown   TS_CONVERGED_TIME           = 1,
98193ac0bcSJed Brown   TS_CONVERGED_ITS            = 2,
99d6ad946cSShri Abhyankar   TS_CONVERGED_USER           = 3,
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;
104b93fea0eSJed Brown /*MC
105b93fea0eSJed Brown    TS_CONVERGED_ITERATING - this only occurs if TSGetConvergedReason() is called during the TSSolve()
106b93fea0eSJed Brown 
107b93fea0eSJed Brown    Level: beginner
108b93fea0eSJed Brown 
109ad6bc421SBarry Smith .seealso: TSSolve(), TSGetConvergedReason(), TSGetTSAdapt()
110b93fea0eSJed Brown M*/
111b93fea0eSJed Brown 
112b93fea0eSJed Brown /*MC
113b93fea0eSJed Brown    TS_CONVERGED_TIME - the final time was reached
114b93fea0eSJed Brown 
115b93fea0eSJed Brown    Level: beginner
116b93fea0eSJed Brown 
117ad6bc421SBarry Smith .seealso: TSSolve(), TSGetConvergedReason(), TSGetTSAdapt(), TSSetDuration(), TSGetSolveTime()
118b93fea0eSJed Brown M*/
119b93fea0eSJed Brown 
120b93fea0eSJed Brown /*MC
121b93fea0eSJed Brown    TS_CONVERGED_ITS - the maximum number of iterations was reached prior to the final time
122b93fea0eSJed Brown 
123b93fea0eSJed Brown    Level: beginner
124b93fea0eSJed Brown 
125ad6bc421SBarry Smith .seealso: TSSolve(), TSGetConvergedReason(), TSGetTSAdapt(), TSSetDuration()
126b93fea0eSJed Brown M*/
127d6ad946cSShri Abhyankar /*MC
128d6ad946cSShri Abhyankar    TS_CONVERGED_USER - user requested termination
129d6ad946cSShri Abhyankar 
130d6ad946cSShri Abhyankar    Level: beginner
131d6ad946cSShri Abhyankar 
132d6ad946cSShri Abhyankar .seealso: TSSolve(), TSGetConvergedReason(), TSSetConvergedReason(), TSSetDuration()
133d6ad946cSShri Abhyankar M*/
134b93fea0eSJed Brown 
135b93fea0eSJed Brown /*MC
136b93fea0eSJed Brown    TS_DIVERGED_NONLINEAR_SOLVE - too many nonlinear solves failed
137b93fea0eSJed Brown 
138b93fea0eSJed Brown    Level: beginner
139b93fea0eSJed Brown 
140ad6bc421SBarry Smith .seealso: TSSolve(), TSGetConvergedReason(), TSGetTSAdapt(), TSGetSNES(), SNESGetConvergedReason()
141b93fea0eSJed Brown M*/
142b93fea0eSJed Brown 
143b93fea0eSJed Brown /*MC
144b93fea0eSJed Brown    TS_DIVERGED_STEP_REJECTED - too many steps were rejected
145b93fea0eSJed Brown 
146b93fea0eSJed Brown    Level: beginner
147b93fea0eSJed Brown 
148ad6bc421SBarry Smith .seealso: TSSolve(), TSGetConvergedReason(), TSGetTSAdapt()
149b93fea0eSJed Brown M*/
150b93fea0eSJed Brown 
151d6ad946cSShri Abhyankar /*E
152d6ad946cSShri Abhyankar    TSExactFinalTimeOption - option for handling of final time step
153d6ad946cSShri Abhyankar 
154d6ad946cSShri Abhyankar    Level: beginner
155d6ad946cSShri Abhyankar 
156d6ad946cSShri Abhyankar    Developer Notes: this must match finclude/petscts.h
157d6ad946cSShri Abhyankar 
158d6ad946cSShri Abhyankar $  TS_EXACTFINALTIME_STEPOVER    - Don't do anything if final time is exceeded
159d6ad946cSShri Abhyankar $  TS_EXACTFINALTIME_INTERPOLATE - Interpolate back to final time
160d6ad946cSShri Abhyankar $  TS_EXACTFINALTIME_MATCHSTEP - Adapt final time step to match the final time
161d6ad946cSShri Abhyankar .seealso: TSGetConvergedReason()
162d6ad946cSShri Abhyankar E*/
163d6ad946cSShri Abhyankar typedef enum {TS_EXACTFINALTIME_STEPOVER=0,TS_EXACTFINALTIME_INTERPOLATE=1,TS_EXACTFINALTIME_MATCHSTEP=2} TSExactFinalTimeOption;
164d6ad946cSShri Abhyankar PETSC_EXTERN const char *const TSExactFinalTimeOptions[];
165d6ad946cSShri Abhyankar 
166d6ad946cSShri Abhyankar 
167000e7ae3SMatthew Knepley /* Logging support */
168014dd563SJed Brown PETSC_EXTERN PetscClassId TS_CLASSID;
169d74926cbSBarry Smith PETSC_EXTERN PetscClassId DMTS_CLASSID;
170000e7ae3SMatthew Knepley 
171014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSInitializePackage(const char[]);
1728ba1e511SMatthew Knepley 
173014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSCreate(MPI_Comm,TS*);
174014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSDestroy(TS*);
175818ad0c1SBarry Smith 
176014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSetProblemType(TS,TSProblemType);
177014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGetProblemType(TS,TSProblemType*);
178014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSMonitor(TS,PetscInt,PetscReal,Vec);
179014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSMonitorSet(TS,PetscErrorCode(*)(TS,PetscInt,PetscReal,Vec,void*),void *,PetscErrorCode (*)(void**));
180014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSMonitorCancel(TS);
181818ad0c1SBarry Smith 
182014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSetOptionsPrefix(TS,const char[]);
183014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAppendOptionsPrefix(TS,const char[]);
184014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGetOptionsPrefix(TS,const char *[]);
185014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSetFromOptions(TS);
186014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSetUp(TS);
187014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSReset(TS);
188818ad0c1SBarry Smith 
189014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSetSolution(TS,Vec);
190014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGetSolution(TS,Vec*);
191818ad0c1SBarry Smith 
192014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSetDuration(TS,PetscInt,PetscReal);
193014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGetDuration(TS,PetscInt*,PetscReal*);
19449354f04SShri Abhyankar PETSC_EXTERN PetscErrorCode TSSetExactFinalTime(TS,TSExactFinalTimeOption);
195818ad0c1SBarry Smith 
196014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSMonitorDefault(TS,PetscInt,PetscReal,Vec,void*);
19783a4ac43SBarry Smith 
19883a4ac43SBarry Smith typedef struct _n_TSMonitorDrawCtx*  TSMonitorDrawCtx;
19983a4ac43SBarry Smith PETSC_EXTERN PetscErrorCode TSMonitorDrawCtxCreate(MPI_Comm,const char[],const char[],int,int,int,int,PetscInt,TSMonitorDrawCtx *);
20083a4ac43SBarry Smith PETSC_EXTERN PetscErrorCode TSMonitorDrawCtxDestroy(TSMonitorDrawCtx*);
20183a4ac43SBarry Smith PETSC_EXTERN PetscErrorCode TSMonitorDrawSolution(TS,PetscInt,PetscReal,Vec,void*);
20283a4ac43SBarry Smith PETSC_EXTERN PetscErrorCode TSMonitorDrawError(TS,PetscInt,PetscReal,Vec,void*);
20383a4ac43SBarry Smith 
204014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSMonitorSolutionBinary(TS,PetscInt,PetscReal,Vec,void*);
205014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSMonitorSolutionVTK(TS,PetscInt,PetscReal,Vec,void*);
206014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSMonitorSolutionVTKDestroy(void*);
207fb1732b5SBarry Smith 
208014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSStep(TS);
209014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSEvaluateStep(TS,PetscInt,Vec,PetscBool*);
210cc708dedSBarry Smith PETSC_EXTERN PetscErrorCode TSSolve(TS,Vec);
211*e817cc15SEmil Constantinescu PETSC_EXTERN PetscErrorCode TSGetEquationType(TS,TSEquationType*);
212*e817cc15SEmil Constantinescu PETSC_EXTERN PetscErrorCode TSSetEquationType(TS,TSEquationType);
213014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGetConvergedReason(TS,TSConvergedReason*);
214d6ad946cSShri Abhyankar PETSC_EXTERN PetscErrorCode TSSetConvergedReason(TS,TSConvergedReason);
215487e0bb9SJed Brown PETSC_EXTERN PetscErrorCode TSGetSolveTime(TS,PetscReal*);
2165ef26d82SJed Brown PETSC_EXTERN PetscErrorCode TSGetSNESIterations(TS,PetscInt*);
2175ef26d82SJed Brown PETSC_EXTERN PetscErrorCode TSGetKSPIterations(TS,PetscInt*);
218cef5090cSJed Brown PETSC_EXTERN PetscErrorCode TSGetStepRejections(TS,PetscInt*);
219cef5090cSJed Brown PETSC_EXTERN PetscErrorCode TSSetMaxStepRejections(TS,PetscInt);
220cef5090cSJed Brown PETSC_EXTERN PetscErrorCode TSGetSNESFailures(TS,PetscInt*);
221cef5090cSJed Brown PETSC_EXTERN PetscErrorCode TSSetMaxSNESFailures(TS,PetscInt);
222cef5090cSJed Brown PETSC_EXTERN PetscErrorCode TSSetErrorIfStepFails(TS,PetscBool);
223818ad0c1SBarry Smith 
224014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSetInitialTimeStep(TS,PetscReal,PetscReal);
225014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGetTimeStep(TS,PetscReal*);
226014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGetTime(TS,PetscReal*);
227014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSetTime(TS,PetscReal);
228014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGetTimeStepNumber(TS,PetscInt*);
229014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSetTimeStep(TS,PetscReal);
230818ad0c1SBarry Smith 
231638cfed1SJed Brown PETSC_EXTERN_TYPEDEF typedef PetscErrorCode (*TSRHSFunction)(TS,PetscReal,Vec,Vec,void*);
232638cfed1SJed Brown PETSC_EXTERN_TYPEDEF typedef PetscErrorCode (*TSRHSJacobian)(TS,PetscReal,Vec,Mat*,Mat*,MatStructure*,void*);
233014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSetRHSFunction(TS,Vec,TSRHSFunction,void*);
234014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGetRHSFunction(TS,Vec*,TSRHSFunction*,void**);
235014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSetRHSJacobian(TS,Mat,Mat,TSRHSJacobian,void*);
236014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGetRHSJacobian(TS,Mat*,Mat*,TSRHSJacobian*,void**);
237818ad0c1SBarry Smith 
238ef20d060SBarry Smith PETSC_EXTERN_TYPEDEF typedef PetscErrorCode (*TSSolutionFunction)(TS,PetscReal,Vec,void*);
239ef20d060SBarry Smith PETSC_EXTERN PetscErrorCode TSSetSolutionFunction(TS,TSSolutionFunction,void*);
240ef20d060SBarry Smith 
241638cfed1SJed Brown PETSC_EXTERN_TYPEDEF typedef PetscErrorCode (*TSIFunction)(TS,PetscReal,Vec,Vec,Vec,void*);
242638cfed1SJed Brown PETSC_EXTERN_TYPEDEF typedef PetscErrorCode (*TSIJacobian)(TS,PetscReal,Vec,Vec,PetscReal,Mat*,Mat*,MatStructure*,void*);
243014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSetIFunction(TS,Vec,TSIFunction,void*);
244014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGetIFunction(TS,Vec*,TSIFunction*,void**);
245014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSetIJacobian(TS,Mat,Mat,TSIJacobian,void*);
246014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGetIJacobian(TS,Mat*,Mat*,TSIJacobian*,void**);
247316643e7SJed Brown 
248014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSComputeRHSFunctionLinear(TS,PetscReal,Vec,Vec,void*);
249014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSComputeRHSJacobianConstant(TS,PetscReal,Vec,Mat*,Mat*,MatStructure*,void*);
250014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSComputeIFunctionLinear(TS,PetscReal,Vec,Vec,Vec,void*);
251014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSComputeIJacobianConstant(TS,PetscReal,Vec,Vec,PetscReal,Mat*,Mat*,MatStructure*,void*);
2521c8a10a0SJed Brown PETSC_EXTERN PetscErrorCode TSComputeSolutionFunction(TS,PetscReal,Vec);
253e34be4c2SBarry Smith 
254014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSetPreStep(TS, PetscErrorCode (*)(TS));
255b8123daeSJed Brown PETSC_EXTERN PetscErrorCode TSSetPreStage(TS, PetscErrorCode (*)(TS,PetscReal));
256014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSetPostStep(TS, PetscErrorCode (*)(TS));
257014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSPreStep(TS);
258b8123daeSJed Brown PETSC_EXTERN PetscErrorCode TSPreStage(TS,PetscReal);
259014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSPostStep(TS);
260014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSetRetainStages(TS,PetscBool);
261014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSInterpolate(TS,PetscReal,Vec);
262014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSetTolerances(TS,PetscReal,Vec,PetscReal,Vec);
263c5033834SJed Brown PETSC_EXTERN PetscErrorCode TSGetTolerances(TS,PetscReal*,Vec*,PetscReal*,Vec*);
264014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSErrorNormWRMS(TS,Vec,PetscReal*);
265014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSetCFLTimeLocal(TS,PetscReal);
266014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGetCFLTime(TS,PetscReal*);
267000e7ae3SMatthew Knepley 
268014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSPseudoSetTimeStep(TS,PetscErrorCode(*)(TS,PetscReal*,void*),void*);
269014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSPseudoDefaultTimeStep(TS,PetscReal*,void*);
270014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSPseudoComputeTimeStep(TS,PetscReal *);
271014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSPseudoSetMaxTimeStep(TS,PetscReal);
272d8345c25SBarry Smith 
273014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSPseudoSetVerifyTimeStep(TS,PetscErrorCode(*)(TS,Vec,void*,PetscReal*,PetscBool *),void*);
274014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSPseudoDefaultVerifyTimeStep(TS,Vec,void*,PetscReal*,PetscBool *);
275014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSPseudoVerifyTimeStep(TS,Vec,PetscReal*,PetscBool *);
276014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSPseudoSetTimeStepIncrement(TS,PetscReal);
277014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSPseudoIncrementDtFromInitialDt(TS);
27821c89e3eSBarry Smith 
279014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSPythonSetType(TS,const char[]);
2801d6018f0SLisandro Dalcin 
281014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSComputeRHSFunction(TS,PetscReal,Vec,Vec);
282014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSComputeRHSJacobian(TS,PetscReal,Vec,Mat*,Mat*,MatStructure*);
283014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSComputeIFunction(TS,PetscReal,Vec,Vec,Vec,PetscBool);
284014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSComputeIJacobian(TS,PetscReal,Vec,Vec,PetscReal,Mat*,Mat*,MatStructure*,PetscBool);
285f9c1d6abSBarry Smith PETSC_EXTERN PetscErrorCode TSComputeLinearStability(TS,PetscReal,PetscReal,PetscReal*,PetscReal*);
286818ad0c1SBarry Smith 
287014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSVISetVariableBounds(TS,Vec,Vec);
288d6ebe24aSShri Abhyankar 
28924989b8cSPeter Brune PETSC_EXTERN PetscErrorCode DMTSSetRHSFunction(DM,TSRHSFunction,void*);
29024989b8cSPeter Brune PETSC_EXTERN PetscErrorCode DMTSGetRHSFunction(DM,TSRHSFunction*,void**);
29124989b8cSPeter Brune PETSC_EXTERN PetscErrorCode DMTSSetRHSJacobian(DM,TSRHSJacobian,void*);
29224989b8cSPeter Brune PETSC_EXTERN PetscErrorCode DMTSGetRHSJacobian(DM,TSRHSJacobian*,void**);
29324989b8cSPeter Brune PETSC_EXTERN PetscErrorCode DMTSSetIFunction(DM,TSIFunction,void*);
29424989b8cSPeter Brune PETSC_EXTERN PetscErrorCode DMTSGetIFunction(DM,TSIFunction*,void**);
29524989b8cSPeter Brune PETSC_EXTERN PetscErrorCode DMTSSetIJacobian(DM,TSIJacobian,void*);
29624989b8cSPeter Brune PETSC_EXTERN PetscErrorCode DMTSGetIJacobian(DM,TSIJacobian*,void**);
297ef20d060SBarry Smith PETSC_EXTERN PetscErrorCode DMTSSetSolutionFunction(DM,TSSolutionFunction,void*);
298ef20d060SBarry Smith PETSC_EXTERN PetscErrorCode DMTSGetSolutionFunction(DM,TSSolutionFunction*,void**);
299c7a10e08SBarry Smith PETSC_EXTERN PetscErrorCode DMTSSetIFunctionSerialize(DM,PetscErrorCode (*)(void*,PetscViewer),PetscErrorCode (*)(void**,PetscViewer));
300c7a10e08SBarry Smith PETSC_EXTERN PetscErrorCode DMTSSetIJacobianSerialize(DM,PetscErrorCode (*)(void*,PetscViewer),PetscErrorCode (*)(void**,PetscViewer));
30124989b8cSPeter Brune 
3026c6b9e74SPeter Brune PETSC_EXTERN_TYPEDEF typedef PetscErrorCode (*DMDATSRHSFunctionLocal)(DMDALocalInfo*,PetscReal,void*,void*,void*);
3036c6b9e74SPeter Brune PETSC_EXTERN_TYPEDEF typedef PetscErrorCode (*DMDATSRHSJacobianLocal)(DMDALocalInfo*,PetscReal,void*,Mat,Mat,MatStructure*,void*);
3046c6b9e74SPeter Brune PETSC_EXTERN_TYPEDEF typedef PetscErrorCode (*DMDATSIFunctionLocal)(DMDALocalInfo*,PetscReal,void*,void*,void*,void*);
3056c6b9e74SPeter Brune PETSC_EXTERN_TYPEDEF typedef PetscErrorCode (*DMDATSIJacobianLocal)(DMDALocalInfo*,PetscReal,void*,void*,PetscReal,Mat,Mat,MatStructure*,void*);
3066c6b9e74SPeter Brune 
3076c6b9e74SPeter Brune PETSC_EXTERN PetscErrorCode DMDATSSetRHSFunctionLocal(DM,InsertMode,PetscErrorCode (*)(DMDALocalInfo*,PetscReal,void*,void*,void*),void *);
3086c6b9e74SPeter Brune PETSC_EXTERN PetscErrorCode DMDATSSetRHSJacobianLocal(DM,PetscErrorCode (*)(DMDALocalInfo*,PetscReal,void*,Mat,Mat,MatStructure*,void*),void *);
3096c6b9e74SPeter Brune PETSC_EXTERN PetscErrorCode DMDATSSetIFunctionLocal(DM,InsertMode,PetscErrorCode (*)(DMDALocalInfo*,PetscReal,void*,void*,void*,void*),void *);
3106c6b9e74SPeter Brune PETSC_EXTERN PetscErrorCode DMDATSSetIJacobianLocal(DM,PetscErrorCode (*)(DMDALocalInfo*,PetscReal,void*,void*,PetscReal,Mat,Mat,MatStructure*,void*),void *);
3116c6b9e74SPeter Brune 
312d1212d36SBarry Smith typedef struct {
313d1212d36SBarry Smith   Vec         ray;
314d1212d36SBarry Smith   VecScatter  scatter;
315d1212d36SBarry Smith   PetscViewer viewer;
316d1212d36SBarry Smith } TSMonitorDMDARayCtx;
317d1212d36SBarry Smith PETSC_EXTERN PetscErrorCode TSMonitorDMDARayDestroy(void**);
318d1212d36SBarry Smith PETSC_EXTERN PetscErrorCode TSMonitorDMDARay(TS,PetscInt,PetscReal,Vec,void*);
319d1212d36SBarry Smith 
320d1212d36SBarry Smith 
321bdad233fSMatthew Knepley /* Dynamic creation and loading functions */
322014dd563SJed Brown PETSC_EXTERN PetscFList TSList;
323014dd563SJed Brown PETSC_EXTERN PetscBool TSRegisterAllCalled;
32419fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode TSGetType(TS,TSType*);
32519fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode TSSetType(TS,TSType);
326014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSRegister(const char[], const char[], const char[], PetscErrorCode (*)(TS));
327014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSRegisterAll(const char[]);
328014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSRegisterDestroy(void);
32930de9b25SBarry Smith 
33030de9b25SBarry Smith /*MC
33130de9b25SBarry Smith   TSRegisterDynamic - Adds a creation method to the TS package.
33230de9b25SBarry Smith 
33330de9b25SBarry Smith   Synopsis:
3341890ba74SBarry Smith   PetscErrorCode TSRegisterDynamic(const char *name, const char *path, const char *func_name, PetscErrorCode (*create_func)(TS))
33530de9b25SBarry Smith 
33630de9b25SBarry Smith   Not Collective
33730de9b25SBarry Smith 
33830de9b25SBarry Smith   Input Parameters:
33930de9b25SBarry Smith + name        - The name of a new user-defined creation routine
34030de9b25SBarry Smith . path        - The path (either absolute or relative) of the library containing this routine
34130de9b25SBarry Smith . func_name   - The name of the creation routine
34230de9b25SBarry Smith - create_func - The creation routine itself
34330de9b25SBarry Smith 
34430de9b25SBarry Smith   Notes:
34530de9b25SBarry Smith   TSRegisterDynamic() may be called multiple times to add several user-defined tses.
34630de9b25SBarry Smith 
34730de9b25SBarry Smith   If dynamic libraries are used, then the fourth input argument (create_func) is ignored.
34830de9b25SBarry Smith 
34930de9b25SBarry Smith   Sample usage:
35030de9b25SBarry Smith .vb
35130de9b25SBarry Smith   TSRegisterDynamic("my_ts", "/home/username/my_lib/lib/libO/solaris/libmy.a", "MyTSCreate", MyTSCreate);
35230de9b25SBarry Smith .ve
35330de9b25SBarry Smith 
35430de9b25SBarry Smith   Then, your ts type can be chosen with the procedural interface via
35530de9b25SBarry Smith .vb
35665f2c13aSKai Germaschewski     TS ts;
35765f2c13aSKai Germaschewski     TSCreate(MPI_Comm, &ts);
35865f2c13aSKai Germaschewski     TSSetType(ts, "my_ts")
35930de9b25SBarry Smith .ve
36030de9b25SBarry Smith   or at runtime via the option
36130de9b25SBarry Smith .vb
36230de9b25SBarry Smith     -ts_type my_ts
36330de9b25SBarry Smith .ve
36430de9b25SBarry Smith 
365ab901514SBarry Smith   Notes: $PETSC_ARCH occuring in pathname will be replaced with appropriate values.
36630de9b25SBarry Smith         If your function is not being put into a shared library then use TSRegister() instead
36730de9b25SBarry Smith 
36830de9b25SBarry Smith   Level: advanced
36930de9b25SBarry Smith 
37030de9b25SBarry Smith .keywords: TS, register
37130de9b25SBarry Smith .seealso: TSRegisterAll(), TSRegisterDestroy()
37230de9b25SBarry Smith M*/
373aa482453SBarry Smith #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
374f1af5d2fSBarry Smith #define TSRegisterDynamic(a,b,c,d) TSRegister(a,b,c,0)
3756df38c32SLois Curfman McInnes #else
376f1af5d2fSBarry Smith #define TSRegisterDynamic(a,b,c,d) TSRegister(a,b,c,d)
3776df38c32SLois Curfman McInnes #endif
3786df38c32SLois Curfman McInnes 
379014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGetSNES(TS,SNES*);
380deb2cd25SJed Brown PETSC_EXTERN PetscErrorCode TSSetSNES(TS,SNES);
381014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGetKSP(TS,KSP*);
382818ad0c1SBarry Smith 
383014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSView(TS,PetscViewer);
38455849f57SBarry Smith PETSC_EXTERN PetscErrorCode TSLoad(TS,PetscViewer);
38555849f57SBarry Smith 
38655849f57SBarry Smith #define TS_FILE_CLASSID 1211225
38721c89e3eSBarry Smith 
388014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSetApplicationContext(TS,void *);
389014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGetApplicationContext(TS,void *);
39021c89e3eSBarry Smith 
3910b039ecaSBarry Smith typedef struct _n_TSMonitorLGCtx*  TSMonitorLGCtx;
392a9f9c1f6SBarry Smith PETSC_EXTERN PetscErrorCode TSMonitorLGCtxCreate(MPI_Comm,const char[],const char[],int,int,int,int,PetscInt,TSMonitorLGCtx *);
393a9f9c1f6SBarry Smith PETSC_EXTERN PetscErrorCode TSMonitorLGCtxDestroy(TSMonitorLGCtx*);
3944f09c107SBarry Smith PETSC_EXTERN PetscErrorCode TSMonitorLGTimeStep(TS,PetscInt,PetscReal,Vec,void *);
3954f09c107SBarry Smith PETSC_EXTERN PetscErrorCode TSMonitorLGSolution(TS,PetscInt,PetscReal,Vec,void *);
3964f09c107SBarry Smith PETSC_EXTERN PetscErrorCode TSMonitorLGError(TS,PetscInt,PetscReal,Vec,void *);
397201da799SBarry Smith PETSC_EXTERN PetscErrorCode TSMonitorLGSNESIterations(TS,PetscInt,PetscReal,Vec,void *);
398201da799SBarry Smith PETSC_EXTERN PetscErrorCode TSMonitorLGKSPIterations(TS,PetscInt,PetscReal,Vec,void *);
399ef20d060SBarry Smith 
4008189c53fSBarry Smith typedef struct _n_TSMonitorSPEigCtx*  TSMonitorSPEigCtx;
4018189c53fSBarry Smith PETSC_EXTERN PetscErrorCode TSMonitorSPEigCtxCreate(MPI_Comm,const char[],const char[],int,int,int,int,PetscInt,TSMonitorSPEigCtx *);
4028189c53fSBarry Smith PETSC_EXTERN PetscErrorCode TSMonitorSPEigCtxDestroy(TSMonitorSPEigCtx*);
4038189c53fSBarry Smith PETSC_EXTERN PetscErrorCode TSMonitorSPEig(TS,PetscInt,PetscReal,Vec,void *);
4048189c53fSBarry Smith 
40576bdecfbSBarry Smith /*J
406815f1ad5SJed Brown    TSSSPType - string with the name of TSSSP scheme.
407815f1ad5SJed Brown 
408815f1ad5SJed Brown    Level: beginner
409815f1ad5SJed Brown 
410815f1ad5SJed Brown .seealso: TSSSPSetType(), TS
41176bdecfbSBarry Smith J*/
41219fd82e9SBarry Smith typedef const char* TSSSPType;
413815f1ad5SJed Brown #define TSSSPRKS2  "rks2"
414815f1ad5SJed Brown #define TSSSPRKS3  "rks3"
415815f1ad5SJed Brown #define TSSSPRK104 "rk104"
416815f1ad5SJed Brown 
41719fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode TSSSPSetType(TS,TSSSPType);
41819fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode TSSSPGetType(TS,TSSSPType*);
419014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSSPSetNumStages(TS,PetscInt);
420014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSSPGetNumStages(TS,PetscInt*);
421815f1ad5SJed Brown 
422ed657a08SJed Brown /*S
42384df9cb4SJed Brown    TSAdapt - Abstract object that manages time-step adaptivity
42484df9cb4SJed Brown 
42584df9cb4SJed Brown    Level: beginner
42684df9cb4SJed Brown 
42784df9cb4SJed Brown .seealso: TS, TSAdaptCreate(), TSAdaptType
42884df9cb4SJed Brown S*/
42984df9cb4SJed Brown typedef struct _p_TSAdapt *TSAdapt;
43084df9cb4SJed Brown 
43184df9cb4SJed Brown /*E
43284df9cb4SJed Brown     TSAdaptType - String with the name of TSAdapt scheme or the creation function
43384df9cb4SJed Brown        with an optional dynamic library name, for example
43484df9cb4SJed Brown        http://www.mcs.anl.gov/petsc/lib.a:mytsgladaptcreate()
43584df9cb4SJed Brown 
43684df9cb4SJed Brown    Level: beginner
43784df9cb4SJed Brown 
43884df9cb4SJed Brown .seealso: TSAdaptSetType(), TS
43984df9cb4SJed Brown E*/
440f8963224SJed Brown typedef const char *TSAdaptType;
44184df9cb4SJed Brown #define TSADAPTBASIC "basic"
442b0f836d7SJed Brown #define TSADAPTNONE  "none"
4438d59e960SJed Brown #define TSADAPTCFL   "cfl"
44484df9cb4SJed Brown 
44584df9cb4SJed Brown /*MC
44684df9cb4SJed Brown    TSAdaptRegisterDynamic - adds a TSAdapt implementation
44784df9cb4SJed Brown 
44884df9cb4SJed Brown    Synopsis:
44984df9cb4SJed Brown    PetscErrorCode TSAdaptRegisterDynamic(const char *name_scheme,const char *path,const char *name_create,PetscErrorCode (*routine_create)(TS))
45084df9cb4SJed Brown 
45184df9cb4SJed Brown    Not Collective
45284df9cb4SJed Brown 
45384df9cb4SJed Brown    Input Parameters:
45484df9cb4SJed Brown +  name_scheme - name of user-defined adaptivity scheme
45584df9cb4SJed Brown .  path - path (either absolute or relative) the library containing this scheme
45684df9cb4SJed Brown .  name_create - name of routine to create method context
45784df9cb4SJed Brown -  routine_create - routine to create method context
45884df9cb4SJed Brown 
45984df9cb4SJed Brown    Notes:
46084df9cb4SJed Brown    TSAdaptRegisterDynamic() may be called multiple times to add several user-defined families.
46184df9cb4SJed Brown 
46284df9cb4SJed Brown    If dynamic libraries are used, then the fourth input argument (routine_create)
46384df9cb4SJed Brown    is ignored.
46484df9cb4SJed Brown 
46584df9cb4SJed Brown    Sample usage:
46684df9cb4SJed Brown .vb
46784df9cb4SJed Brown    TSAdaptRegisterDynamic("my_scheme",/home/username/my_lib/lib/libO/solaris/mylib.a,
46884df9cb4SJed Brown                             "MySchemeCreate",MySchemeCreate);
46984df9cb4SJed Brown .ve
47084df9cb4SJed Brown 
47184df9cb4SJed Brown    Then, your scheme can be chosen with the procedural interface via
47284df9cb4SJed Brown $     TSAdaptSetType(ts,"my_scheme")
47384df9cb4SJed Brown    or at runtime via the option
47484df9cb4SJed Brown $     -ts_adapt_type my_scheme
47584df9cb4SJed Brown 
47684df9cb4SJed Brown    Level: advanced
47784df9cb4SJed Brown 
47884df9cb4SJed Brown    Notes: Environmental variables such as ${PETSC_ARCH}, ${PETSC_DIR}, ${PETSC_LIB_DIR},
47984df9cb4SJed Brown           and others of the form ${any_environmental_variable} occuring in pathname will be
48084df9cb4SJed Brown           replaced with appropriate values.
48184df9cb4SJed Brown 
48284df9cb4SJed Brown .keywords: TSAdapt, register
48384df9cb4SJed Brown 
48484df9cb4SJed Brown .seealso: TSAdaptRegisterAll()
48584df9cb4SJed Brown M*/
48684df9cb4SJed Brown #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
48784df9cb4SJed Brown #  define TSAdaptRegisterDynamic(a,b,c,d)  TSAdaptRegister(a,b,c,0)
48884df9cb4SJed Brown #else
48984df9cb4SJed Brown #  define TSAdaptRegisterDynamic(a,b,c,d)  TSAdaptRegister(a,b,c,d)
49084df9cb4SJed Brown #endif
49184df9cb4SJed Brown 
492ad6bc421SBarry Smith PETSC_EXTERN PetscErrorCode TSGetTSAdapt(TS,TSAdapt*);
493014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAdaptRegister(const char[],const char[],const char[],PetscErrorCode (*)(TSAdapt));
494014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAdaptRegisterAll(const char[]);
495014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAdaptRegisterDestroy(void);
496014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAdaptInitializePackage(const char[]);
497014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAdaptFinalizePackage(void);
498014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAdaptCreate(MPI_Comm,TSAdapt*);
49919fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode TSAdaptSetType(TSAdapt,TSAdaptType);
500014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAdaptSetOptionsPrefix(TSAdapt,const char[]);
501014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAdaptCandidatesClear(TSAdapt);
502014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAdaptCandidateAdd(TSAdapt,const char[],PetscInt,PetscInt,PetscReal,PetscReal,PetscBool);
503014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAdaptCandidatesGet(TSAdapt,PetscInt*,const PetscInt**,const PetscInt**,const PetscReal**,const PetscReal**);
504014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAdaptChoose(TSAdapt,TS,PetscReal,PetscInt*,PetscReal*,PetscBool*);
505014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAdaptCheckStage(TSAdapt,TS,PetscBool*);
506014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAdaptView(TSAdapt,PetscViewer);
507ad6bc421SBarry Smith PETSC_EXTERN PetscErrorCode TSAdaptLoad(TSAdapt,PetscViewer);
508014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAdaptSetFromOptions(TSAdapt);
509014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAdaptDestroy(TSAdapt*);
510014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAdaptSetMonitor(TSAdapt,PetscBool);
511014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAdaptSetStepLimits(TSAdapt,PetscReal,PetscReal);
5120873808bSJed Brown PETSC_EXTERN PetscErrorCode TSAdaptSetCheckStage(TSAdapt,PetscErrorCode(*)(TSAdapt,TS,PetscBool*));
51384df9cb4SJed Brown 
51484df9cb4SJed Brown /*S
515ed657a08SJed Brown    TSGLAdapt - Abstract object that manages time-step adaptivity
516ed657a08SJed Brown 
517ed657a08SJed Brown    Level: beginner
518ed657a08SJed Brown 
51984df9cb4SJed Brown    Developer Notes:
52084df9cb4SJed Brown    This functionality should be replaced by the TSAdapt.
52184df9cb4SJed Brown 
522ed657a08SJed Brown .seealso: TSGL, TSGLAdaptCreate(), TSGLAdaptType
523ed657a08SJed Brown S*/
524ed657a08SJed Brown typedef struct _p_TSGLAdapt *TSGLAdapt;
525ed657a08SJed Brown 
52676bdecfbSBarry Smith /*J
527ed657a08SJed Brown     TSGLAdaptType - String with the name of TSGLAdapt scheme or the creation function
528ed657a08SJed Brown        with an optional dynamic library name, for example
529ed657a08SJed Brown        http://www.mcs.anl.gov/petsc/lib.a:mytsgladaptcreate()
530ed657a08SJed Brown 
531ed657a08SJed Brown    Level: beginner
532ed657a08SJed Brown 
533ed657a08SJed Brown .seealso: TSGLAdaptSetType(), TS
53476bdecfbSBarry Smith J*/
535f8963224SJed Brown typedef const char *TSGLAdaptType;
536ed657a08SJed Brown #define TSGLADAPT_NONE "none"
537ed657a08SJed Brown #define TSGLADAPT_SIZE "size"
538ed657a08SJed Brown #define TSGLADAPT_BOTH "both"
539ed657a08SJed Brown 
540ed657a08SJed Brown /*MC
541ed657a08SJed Brown    TSGLAdaptRegisterDynamic - adds a TSGLAdapt implementation
542ed657a08SJed Brown 
543ed657a08SJed Brown    Synopsis:
5441890ba74SBarry Smith    PetscErrorCode TSGLAdaptRegisterDynamic(const char *name_scheme,const char *path,const char *name_create,PetscErrorCode (*routine_create)(TS))
545ed657a08SJed Brown 
546ed657a08SJed Brown    Not Collective
547ed657a08SJed Brown 
548ed657a08SJed Brown    Input Parameters:
549ed657a08SJed Brown +  name_scheme - name of user-defined adaptivity scheme
550ed657a08SJed Brown .  path - path (either absolute or relative) the library containing this scheme
551ed657a08SJed Brown .  name_create - name of routine to create method context
552ed657a08SJed Brown -  routine_create - routine to create method context
553ed657a08SJed Brown 
554ed657a08SJed Brown    Notes:
555ed657a08SJed Brown    TSGLAdaptRegisterDynamic() may be called multiple times to add several user-defined families.
556ed657a08SJed Brown 
557ed657a08SJed Brown    If dynamic libraries are used, then the fourth input argument (routine_create)
558ed657a08SJed Brown    is ignored.
559ed657a08SJed Brown 
560ed657a08SJed Brown    Sample usage:
561ed657a08SJed Brown .vb
562ed657a08SJed Brown    TSGLAdaptRegisterDynamic("my_scheme",/home/username/my_lib/lib/libO/solaris/mylib.a,
563ed657a08SJed Brown                             "MySchemeCreate",MySchemeCreate);
564ed657a08SJed Brown .ve
565ed657a08SJed Brown 
566ed657a08SJed Brown    Then, your scheme can be chosen with the procedural interface via
567ed657a08SJed Brown $     TSGLAdaptSetType(ts,"my_scheme")
568ed657a08SJed Brown    or at runtime via the option
569ed657a08SJed Brown $     -ts_adapt_type my_scheme
570ed657a08SJed Brown 
571ed657a08SJed Brown    Level: advanced
572ed657a08SJed Brown 
573ed657a08SJed Brown    Notes: Environmental variables such as ${PETSC_ARCH}, ${PETSC_DIR}, ${PETSC_LIB_DIR},
574ed657a08SJed Brown           and others of the form ${any_environmental_variable} occuring in pathname will be
575ed657a08SJed Brown           replaced with appropriate values.
576ed657a08SJed Brown 
577ed657a08SJed Brown .keywords: TSGLAdapt, register
578ed657a08SJed Brown 
579ed657a08SJed Brown .seealso: TSGLAdaptRegisterAll()
580ed657a08SJed Brown M*/
581ed657a08SJed Brown #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
582ed657a08SJed Brown #  define TSGLAdaptRegisterDynamic(a,b,c,d)  TSGLAdaptRegister(a,b,c,0)
583ed657a08SJed Brown #else
584ed657a08SJed Brown #  define TSGLAdaptRegisterDynamic(a,b,c,d)  TSGLAdaptRegister(a,b,c,d)
585ed657a08SJed Brown #endif
586ed657a08SJed Brown 
587014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGLAdaptRegister(const char[],const char[],const char[],PetscErrorCode (*)(TSGLAdapt));
588014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGLAdaptRegisterAll(const char[]);
589014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGLAdaptRegisterDestroy(void);
590014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGLAdaptInitializePackage(const char[]);
591014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGLAdaptFinalizePackage(void);
592014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGLAdaptCreate(MPI_Comm,TSGLAdapt*);
59319fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode TSGLAdaptSetType(TSGLAdapt,TSGLAdaptType);
594014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGLAdaptSetOptionsPrefix(TSGLAdapt,const char[]);
595014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGLAdaptChoose(TSGLAdapt,PetscInt,const PetscInt[],const PetscReal[],const PetscReal[],PetscInt,PetscReal,PetscReal,PetscInt*,PetscReal*,PetscBool *);
596014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGLAdaptView(TSGLAdapt,PetscViewer);
597014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGLAdaptSetFromOptions(TSGLAdapt);
598014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGLAdaptDestroy(TSGLAdapt*);
599ed657a08SJed Brown 
60076bdecfbSBarry Smith /*J
601ed657a08SJed Brown     TSGLAcceptType - String with the name of TSGLAccept scheme or the function
602ed657a08SJed Brown        with an optional dynamic library name, for example
603ed657a08SJed Brown        http://www.mcs.anl.gov/petsc/lib.a:mytsglaccept()
604ed657a08SJed Brown 
605ed657a08SJed Brown    Level: beginner
606ed657a08SJed Brown 
607ed657a08SJed Brown .seealso: TSGLSetAcceptType(), TS
60876bdecfbSBarry Smith J*/
609f8963224SJed Brown typedef const char *TSGLAcceptType;
610ed657a08SJed Brown #define TSGLACCEPT_ALWAYS "always"
611ed657a08SJed Brown 
612638cfed1SJed Brown PETSC_EXTERN_TYPEDEF typedef PetscErrorCode (*TSGLAcceptFunction)(TS,PetscReal,PetscReal,const PetscReal[],PetscBool *);
613014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGLAcceptRegister(const char[],const char[],const char[],TSGLAcceptFunction);
614ed657a08SJed Brown 
615ed657a08SJed Brown /*MC
616ed657a08SJed Brown    TSGLAcceptRegisterDynamic - adds a TSGL acceptance scheme
617ed657a08SJed Brown 
618ed657a08SJed Brown    Synopsis:
6191890ba74SBarry Smith    PetscErrorCode TSGLAcceptRegisterDynamic(const char *name_scheme,const char *path,const char *name_create,PetscErrorCode (*routine_create)(TS))
620ed657a08SJed Brown 
621ed657a08SJed Brown    Not Collective
622ed657a08SJed Brown 
623ed657a08SJed Brown    Input Parameters:
624ed657a08SJed Brown +  name_scheme - name of user-defined acceptance scheme
625ed657a08SJed Brown .  path - path (either absolute or relative) the library containing this scheme
626ed657a08SJed Brown .  name_create - name of routine to create method context
627ed657a08SJed Brown -  routine_create - routine to create method context
628ed657a08SJed Brown 
629ed657a08SJed Brown    Notes:
630ed657a08SJed Brown    TSGLAcceptRegisterDynamic() may be called multiple times to add several user-defined families.
631ed657a08SJed Brown 
632ed657a08SJed Brown    If dynamic libraries are used, then the fourth input argument (routine_create)
633ed657a08SJed Brown    is ignored.
634ed657a08SJed Brown 
635ed657a08SJed Brown    Sample usage:
636ed657a08SJed Brown .vb
637ed657a08SJed Brown    TSGLAcceptRegisterDynamic("my_scheme",/home/username/my_lib/lib/libO/solaris/mylib.a,
638ed657a08SJed Brown                              "MySchemeCreate",MySchemeCreate);
639ed657a08SJed Brown .ve
640ed657a08SJed Brown 
641ed657a08SJed Brown    Then, your scheme can be chosen with the procedural interface via
642ed657a08SJed Brown $     TSGLSetAcceptType(ts,"my_scheme")
643ed657a08SJed Brown    or at runtime via the option
644ed657a08SJed Brown $     -ts_gl_accept_type my_scheme
645ed657a08SJed Brown 
646ed657a08SJed Brown    Level: advanced
647ed657a08SJed Brown 
648ed657a08SJed Brown    Notes: Environmental variables such as ${PETSC_ARCH}, ${PETSC_DIR}, ${PETSC_LIB_DIR},
649ed657a08SJed Brown           and others of the form ${any_environmental_variable} occuring in pathname will be
650ed657a08SJed Brown           replaced with appropriate values.
651ed657a08SJed Brown 
652ed657a08SJed Brown .keywords: TSGL, TSGLAcceptType, register
653ed657a08SJed Brown 
654ed657a08SJed Brown .seealso: TSGLRegisterAll()
655ed657a08SJed Brown M*/
656ed657a08SJed Brown #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
657ed657a08SJed Brown #  define TSGLAcceptRegisterDynamic(a,b,c,d) TSGLAcceptRegister(a,b,c,0)
658ed657a08SJed Brown #else
659ed657a08SJed Brown #  define TSGLAcceptRegisterDynamic(a,b,c,d) TSGLAcceptRegister(a,b,c,d)
660ed657a08SJed Brown #endif
661ed657a08SJed Brown 
66276bdecfbSBarry Smith /*J
66318b56cb9SJed Brown   TSGLType - family of time integration method within the General Linear class
66418b56cb9SJed Brown 
66518b56cb9SJed Brown   Level: beginner
66618b56cb9SJed Brown 
66718b56cb9SJed Brown .seealso: TSGLSetType(), TSGLRegister()
66876bdecfbSBarry Smith J*/
66919fd82e9SBarry Smith typedef const char* TSGLType;
670ed657a08SJed Brown #define TSGL_IRKS   "irks"
67118b56cb9SJed Brown 
672ed657a08SJed Brown /*MC
673ed657a08SJed Brown    TSGLRegisterDynamic - adds a TSGL implementation
67418b56cb9SJed Brown 
675ed657a08SJed Brown    Synopsis:
6761890ba74SBarry Smith    PetscErrorCode TSGLRegisterDynamic(const char *name_scheme,const char *path,const char *name_create,PetscErrorCode (*routine_create)(TS))
677ed657a08SJed Brown 
678ed657a08SJed Brown    Not Collective
679ed657a08SJed Brown 
680ed657a08SJed Brown    Input Parameters:
681ed657a08SJed Brown +  name_scheme - name of user-defined general linear scheme
682ed657a08SJed Brown .  path - path (either absolute or relative) the library containing this scheme
683ed657a08SJed Brown .  name_create - name of routine to create method context
684ed657a08SJed Brown -  routine_create - routine to create method context
685ed657a08SJed Brown 
686ed657a08SJed Brown    Notes:
687ed657a08SJed Brown    TSGLRegisterDynamic() may be called multiple times to add several user-defined families.
688ed657a08SJed Brown 
689ed657a08SJed Brown    If dynamic libraries are used, then the fourth input argument (routine_create)
690ed657a08SJed Brown    is ignored.
691ed657a08SJed Brown 
692ed657a08SJed Brown    Sample usage:
693ed657a08SJed Brown .vb
694ed657a08SJed Brown    TSGLRegisterDynamic("my_scheme",/home/username/my_lib/lib/libO/solaris/mylib.a,
695ed657a08SJed Brown                        "MySchemeCreate",MySchemeCreate);
696ed657a08SJed Brown .ve
697ed657a08SJed Brown 
698ed657a08SJed Brown    Then, your scheme can be chosen with the procedural interface via
699ed657a08SJed Brown $     TSGLSetType(ts,"my_scheme")
700ed657a08SJed Brown    or at runtime via the option
701ed657a08SJed Brown $     -ts_gl_type my_scheme
702ed657a08SJed Brown 
703ed657a08SJed Brown    Level: advanced
704ed657a08SJed Brown 
705ed657a08SJed Brown    Notes: Environmental variables such as ${PETSC_ARCH}, ${PETSC_DIR}, ${PETSC_LIB_DIR},
706ed657a08SJed Brown           and others of the form ${any_environmental_variable} occuring in pathname will be
707ed657a08SJed Brown           replaced with appropriate values.
708ed657a08SJed Brown 
709ed657a08SJed Brown .keywords: TSGL, register
710ed657a08SJed Brown 
711ed657a08SJed Brown .seealso: TSGLRegisterAll()
712ed657a08SJed Brown M*/
713ed657a08SJed Brown #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
714ed657a08SJed Brown #  define TSGLRegisterDynamic(a,b,c,d)       TSGLRegister(a,b,c,0)
715ed657a08SJed Brown #else
716ed657a08SJed Brown #  define TSGLRegisterDynamic(a,b,c,d)       TSGLRegister(a,b,c,d)
717ed657a08SJed Brown #endif
718ed657a08SJed Brown 
719014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGLRegister(const char[],const char[],const char[],PetscErrorCode(*)(TS));
720014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGLRegisterAll(const char[]);
721014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGLRegisterDestroy(void);
722014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGLInitializePackage(const char[]);
723014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGLFinalizePackage(void);
72419fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode TSGLSetType(TS,TSGLType);
725014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGLGetAdapt(TS,TSGLAdapt*);
72619fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode TSGLSetAcceptType(TS,TSGLAcceptType);
72718b56cb9SJed Brown 
728020d8f30SJed Brown /*J
729020d8f30SJed Brown     TSARKIMEXType - String with the name of an Additive Runge-Kutta IMEX method.
730020d8f30SJed Brown 
731020d8f30SJed Brown    Level: beginner
732020d8f30SJed Brown 
733020d8f30SJed Brown .seealso: TSARKIMEXSetType(), TS, TSARKIMEX, TSARKIMEXRegister()
734020d8f30SJed Brown J*/
73519fd82e9SBarry Smith typedef const char* TSARKIMEXType;
736*e817cc15SEmil Constantinescu #define TSARKIMEX1BEE   "1bee"
7371f80e275SEmil Constantinescu #define TSARKIMEXA2     "a2"
7381f80e275SEmil Constantinescu #define TSARKIMEXL2     "l2"
7391f80e275SEmil Constantinescu #define TSARKIMEXARS122 "ars122"
7401f80e275SEmil Constantinescu #define TSARKIMEX2C     "2c"
7418a381b04SJed Brown #define TSARKIMEX2D     "2d"
742a3a57f36SJed Brown #define TSARKIMEX2E     "2e"
7436cf0794eSJed Brown #define TSARKIMEXPRSSP2 "prssp2"
7448a381b04SJed Brown #define TSARKIMEX3      "3"
7456cf0794eSJed Brown #define TSARKIMEXBPR3   "bpr3"
7466cf0794eSJed Brown #define TSARKIMEXARS443 "ars443"
7478a381b04SJed Brown #define TSARKIMEX4      "4"
7488a381b04SJed Brown #define TSARKIMEX5      "5"
74919fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode TSARKIMEXGetType(TS ts,TSARKIMEXType*);
75019fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode TSARKIMEXSetType(TS ts,TSARKIMEXType);
751014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSARKIMEXSetFullyImplicit(TS,PetscBool);
75219fd82e9SBarry 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[]);
753014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSARKIMEXFinalizePackage(void);
754014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSARKIMEXInitializePackage(const char path[]);
755014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSARKIMEXRegisterDestroy(void);
756014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSARKIMEXRegisterAll(void);
7578a381b04SJed Brown 
758020d8f30SJed Brown /*J
759020d8f30SJed Brown     TSRosWType - String with the name of a Rosenbrock-W method.
760020d8f30SJed Brown 
761020d8f30SJed Brown    Level: beginner
762020d8f30SJed Brown 
763020d8f30SJed Brown .seealso: TSRosWSetType(), TS, TSROSW, TSRosWRegister()
764020d8f30SJed Brown J*/
76519fd82e9SBarry Smith typedef const char* TSRosWType;
76661692a83SJed Brown #define TSROSW2M          "2m"
76761692a83SJed Brown #define TSROSW2P          "2p"
768fe7e6d57SJed Brown #define TSROSWRA3PW       "ra3pw"
769fe7e6d57SJed Brown #define TSROSWRA34PW2     "ra34pw2"
770ef3c5b88SJed Brown #define TSROSWRODAS3      "rodas3"
771ef3c5b88SJed Brown #define TSROSWSANDU3      "sandu3"
772961f28d0SJed Brown #define TSROSWASSP3P3S1C  "assp3p3s1c"
773961f28d0SJed Brown #define TSROSWLASSP3P4S2C "lassp3p4s2c"
77443b21953SEmil Constantinescu #define TSROSWLLSSP3P4S2C "llssp3p4s2c"
775753f8adbSEmil Constantinescu #define TSROSWARK3        "ark3"
7763606a31eSEmil Constantinescu #define TSROSWTHETA1      "theta1"
7773606a31eSEmil Constantinescu #define TSROSWTHETA2      "theta2"
77842faf41dSJed Brown #define TSROSWGRK4T       "grk4t"
77942faf41dSJed Brown #define TSROSWSHAMP4      "shamp4"
78042faf41dSJed Brown #define TSROSWVELDD4      "veldd4"
78142faf41dSJed Brown #define TSROSW4L          "4l"
782b1c69cc3SEmil Constantinescu 
78319fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode TSRosWGetType(TS ts,TSRosWType*);
78419fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode TSRosWSetType(TS ts,TSRosWType);
785014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSRosWSetRecomputeJacobian(TS,PetscBool);
78619fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode TSRosWRegister(TSRosWType,PetscInt,PetscInt,const PetscReal[],const PetscReal[],const PetscReal[],const PetscReal[],PetscInt,const PetscReal[]);
78719fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode TSRosWRegisterRos4(TSRosWType,PetscReal,PetscReal,PetscReal,PetscReal,PetscReal);
788014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSRosWFinalizePackage(void);
789014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSRosWInitializePackage(const char path[]);
790014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSRosWRegisterDestroy(void);
791014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSRosWRegisterAll(void);
792e27a552bSJed Brown 
79383e2fdc7SBarry Smith /*
7940f3b3ca1SHong Zhang        PETSc interface to Sundials
79583e2fdc7SBarry Smith */
7966dc17ff5SMatthew Knepley #ifdef PETSC_HAVE_SUNDIALS
7976fadb2cdSHong Zhang typedef enum { SUNDIALS_ADAMS=1,SUNDIALS_BDF=2} TSSundialsLmmType;
7986a6fc655SJed Brown PETSC_EXTERN const char *const TSSundialsLmmTypes[];
7996fadb2cdSHong Zhang typedef enum { SUNDIALS_MODIFIED_GS = 1,SUNDIALS_CLASSICAL_GS = 2 } TSSundialsGramSchmidtType;
8006a6fc655SJed Brown PETSC_EXTERN const char *const TSSundialsGramSchmidtTypes[];
801014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSundialsSetType(TS,TSSundialsLmmType);
802014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSundialsGetPC(TS,PC*);
803014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSundialsSetTolerance(TS,PetscReal,PetscReal);
804014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSundialsSetMinTimeStep(TS,PetscReal);
805014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSundialsSetMaxTimeStep(TS,PetscReal);
806014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSundialsGetIterations(TS,PetscInt *,PetscInt *);
807014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSundialsSetGramSchmidtType(TS,TSSundialsGramSchmidtType);
808014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSundialsSetGMRESRestart(TS,PetscInt);
809014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSundialsSetLinearTolerance(TS,PetscReal);
810014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSundialsMonitorInternalSteps(TS,PetscBool );
811014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSundialsGetParameters(TS,PetscInt *,long*[],double*[]);
812014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSundialsSetMaxl(TS,PetscInt);
8136dc17ff5SMatthew Knepley #endif
81483e2fdc7SBarry Smith 
815014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSRKSetTolerance(TS,PetscReal);
816262ff7bbSBarry Smith 
817014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSThetaSetTheta(TS,PetscReal);
818014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSThetaGetTheta(TS,PetscReal*);
819014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSThetaGetEndpoint(TS,PetscBool*);
820014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSThetaSetEndpoint(TS,PetscBool);
8210de4c49aSJed Brown 
822014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAlphaSetAdapt(TS,PetscErrorCode(*)(TS,PetscReal,Vec,Vec,PetscReal*,PetscBool*,void*),void*);
823014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAlphaAdaptDefault(TS,PetscReal,Vec,Vec,PetscReal*,PetscBool*,void*);
824014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAlphaSetRadius(TS,PetscReal);
825014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAlphaSetParams(TS,PetscReal,PetscReal,PetscReal);
826014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAlphaGetParams(TS,PetscReal*,PetscReal*,PetscReal*);
82788df8a41SLisandro Dalcin 
828014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSetDM(TS,DM);
829014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGetDM(TS,DM*);
8306c699258SBarry Smith 
831014dd563SJed Brown PETSC_EXTERN PetscErrorCode SNESTSFormFunction(SNES,Vec,Vec,void*);
832014dd563SJed Brown PETSC_EXTERN PetscErrorCode SNESTSFormJacobian(SNES,Vec,Mat*,Mat*,MatStructure*,void*);
8330f5c6efeSJed Brown 
834818ad0c1SBarry Smith #endif
835