xref: /petsc/include/petscts.h (revision f2ba6396f7b83edb93500ef33fbc29109fc954a4)
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
54e817cc15SEmil Constantinescu    TSEquationType - type of TS problem that is solved
55e817cc15SEmil Constantinescu 
56e817cc15SEmil Constantinescu    Level: beginner
57e817cc15SEmil Constantinescu 
58e817cc15SEmil Constantinescu    Developer Notes: this must match finclude/petscts.h
59e817cc15SEmil Constantinescu 
60e817cc15SEmil Constantinescu    Supported types are:
61e817cc15SEmil Constantinescu      TS_EQ_UNSPECIFIED (default)
62e817cc15SEmil 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
63e817cc15SEmil Constantinescu      TS_EQ_IMPLICIT {ODE and DAE index 1, 2, 3, HI}: F(t,U,U_t) = 0
64e817cc15SEmil Constantinescu 
65e817cc15SEmil Constantinescu .seealso: TSGetEquationType(), TSSetEquationType()
66e817cc15SEmil Constantinescu E*/
67e817cc15SEmil Constantinescu typedef enum {
68e817cc15SEmil Constantinescu   TS_EQ_UNSPECIFIED               = -1,
69e817cc15SEmil Constantinescu   TS_EQ_EXPLICIT                  = 0,
70e817cc15SEmil Constantinescu   TS_EQ_ODE_EXPLICIT              = 1,
71e817cc15SEmil Constantinescu   TS_EQ_DAE_SEMI_EXPLICIT_INDEX1  = 100,
72e817cc15SEmil Constantinescu   TS_EQ_DAE_SEMI_EXPLICIT_INDEX2  = 200,
73e817cc15SEmil Constantinescu   TS_EQ_DAE_SEMI_EXPLICIT_INDEX3  = 300,
74e817cc15SEmil Constantinescu   TS_EQ_DAE_SEMI_EXPLICIT_INDEXHI = 500,
75e817cc15SEmil Constantinescu   TS_EQ_IMPLICIT                  = 1000,
76e817cc15SEmil Constantinescu   TS_EQ_ODE_IMPLICIT              = 1001,
77e817cc15SEmil Constantinescu   TS_EQ_DAE_IMPLICIT_INDEX1       = 1100,
78e817cc15SEmil Constantinescu   TS_EQ_DAE_IMPLICIT_INDEX2       = 1200,
79e817cc15SEmil Constantinescu   TS_EQ_DAE_IMPLICIT_INDEX3       = 1300,
80e817cc15SEmil Constantinescu   TS_EQ_DAE_IMPLICIT_INDEXHI      = 1500,
81e817cc15SEmil Constantinescu } TSEquationType;
82e817cc15SEmil Constantinescu PETSC_EXTERN const char *const*TSEquationTypes;
83e817cc15SEmil Constantinescu 
84e817cc15SEmil 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);
211e817cc15SEmil Constantinescu PETSC_EXTERN PetscErrorCode TSGetEquationType(TS,TSEquationType*);
212e817cc15SEmil 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:
334*f2ba6396SBarry Smith   #include "petscts.h"
3351890ba74SBarry Smith   PetscErrorCode TSRegisterDynamic(const char *name, const char *path, const char *func_name, PetscErrorCode (*create_func)(TS))
33630de9b25SBarry Smith 
33730de9b25SBarry Smith   Not Collective
33830de9b25SBarry Smith 
33930de9b25SBarry Smith   Input Parameters:
34030de9b25SBarry Smith + name        - The name of a new user-defined creation routine
34130de9b25SBarry Smith . path        - The path (either absolute or relative) of the library containing this routine
34230de9b25SBarry Smith . func_name   - The name of the creation routine
34330de9b25SBarry Smith - create_func - The creation routine itself
34430de9b25SBarry Smith 
34530de9b25SBarry Smith   Notes:
34630de9b25SBarry Smith   TSRegisterDynamic() may be called multiple times to add several user-defined tses.
34730de9b25SBarry Smith 
34830de9b25SBarry Smith   If dynamic libraries are used, then the fourth input argument (create_func) is ignored.
34930de9b25SBarry Smith 
35030de9b25SBarry Smith   Sample usage:
35130de9b25SBarry Smith .vb
35230de9b25SBarry Smith   TSRegisterDynamic("my_ts", "/home/username/my_lib/lib/libO/solaris/libmy.a", "MyTSCreate", MyTSCreate);
35330de9b25SBarry Smith .ve
35430de9b25SBarry Smith 
35530de9b25SBarry Smith   Then, your ts type can be chosen with the procedural interface via
35630de9b25SBarry Smith .vb
35765f2c13aSKai Germaschewski     TS ts;
35865f2c13aSKai Germaschewski     TSCreate(MPI_Comm, &ts);
35965f2c13aSKai Germaschewski     TSSetType(ts, "my_ts")
36030de9b25SBarry Smith .ve
36130de9b25SBarry Smith   or at runtime via the option
36230de9b25SBarry Smith .vb
36330de9b25SBarry Smith     -ts_type my_ts
36430de9b25SBarry Smith .ve
36530de9b25SBarry Smith 
366ab901514SBarry Smith   Notes: $PETSC_ARCH occuring in pathname will be replaced with appropriate values.
36730de9b25SBarry Smith         If your function is not being put into a shared library then use TSRegister() instead
36830de9b25SBarry Smith 
36930de9b25SBarry Smith   Level: advanced
37030de9b25SBarry Smith 
37130de9b25SBarry Smith .keywords: TS, register
37230de9b25SBarry Smith .seealso: TSRegisterAll(), TSRegisterDestroy()
37330de9b25SBarry Smith M*/
374aa482453SBarry Smith #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
375f1af5d2fSBarry Smith #define TSRegisterDynamic(a,b,c,d) TSRegister(a,b,c,0)
3766df38c32SLois Curfman McInnes #else
377f1af5d2fSBarry Smith #define TSRegisterDynamic(a,b,c,d) TSRegister(a,b,c,d)
3786df38c32SLois Curfman McInnes #endif
3796df38c32SLois Curfman McInnes 
380014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGetSNES(TS,SNES*);
381deb2cd25SJed Brown PETSC_EXTERN PetscErrorCode TSSetSNES(TS,SNES);
382014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGetKSP(TS,KSP*);
383818ad0c1SBarry Smith 
384014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSView(TS,PetscViewer);
38555849f57SBarry Smith PETSC_EXTERN PetscErrorCode TSLoad(TS,PetscViewer);
38655849f57SBarry Smith 
38755849f57SBarry Smith #define TS_FILE_CLASSID 1211225
38821c89e3eSBarry Smith 
389014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSetApplicationContext(TS,void *);
390014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGetApplicationContext(TS,void *);
39121c89e3eSBarry Smith 
3920b039ecaSBarry Smith typedef struct _n_TSMonitorLGCtx*  TSMonitorLGCtx;
393a9f9c1f6SBarry Smith PETSC_EXTERN PetscErrorCode TSMonitorLGCtxCreate(MPI_Comm,const char[],const char[],int,int,int,int,PetscInt,TSMonitorLGCtx *);
394a9f9c1f6SBarry Smith PETSC_EXTERN PetscErrorCode TSMonitorLGCtxDestroy(TSMonitorLGCtx*);
3954f09c107SBarry Smith PETSC_EXTERN PetscErrorCode TSMonitorLGTimeStep(TS,PetscInt,PetscReal,Vec,void *);
3964f09c107SBarry Smith PETSC_EXTERN PetscErrorCode TSMonitorLGSolution(TS,PetscInt,PetscReal,Vec,void *);
3974f09c107SBarry Smith PETSC_EXTERN PetscErrorCode TSMonitorLGError(TS,PetscInt,PetscReal,Vec,void *);
398201da799SBarry Smith PETSC_EXTERN PetscErrorCode TSMonitorLGSNESIterations(TS,PetscInt,PetscReal,Vec,void *);
399201da799SBarry Smith PETSC_EXTERN PetscErrorCode TSMonitorLGKSPIterations(TS,PetscInt,PetscReal,Vec,void *);
400ef20d060SBarry Smith 
4018189c53fSBarry Smith typedef struct _n_TSMonitorSPEigCtx*  TSMonitorSPEigCtx;
4028189c53fSBarry Smith PETSC_EXTERN PetscErrorCode TSMonitorSPEigCtxCreate(MPI_Comm,const char[],const char[],int,int,int,int,PetscInt,TSMonitorSPEigCtx *);
4038189c53fSBarry Smith PETSC_EXTERN PetscErrorCode TSMonitorSPEigCtxDestroy(TSMonitorSPEigCtx*);
4048189c53fSBarry Smith PETSC_EXTERN PetscErrorCode TSMonitorSPEig(TS,PetscInt,PetscReal,Vec,void *);
4058189c53fSBarry Smith 
40676bdecfbSBarry Smith /*J
407815f1ad5SJed Brown    TSSSPType - string with the name of TSSSP scheme.
408815f1ad5SJed Brown 
409815f1ad5SJed Brown    Level: beginner
410815f1ad5SJed Brown 
411815f1ad5SJed Brown .seealso: TSSSPSetType(), TS
41276bdecfbSBarry Smith J*/
41319fd82e9SBarry Smith typedef const char* TSSSPType;
414815f1ad5SJed Brown #define TSSSPRKS2  "rks2"
415815f1ad5SJed Brown #define TSSSPRKS3  "rks3"
416815f1ad5SJed Brown #define TSSSPRK104 "rk104"
417815f1ad5SJed Brown 
41819fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode TSSSPSetType(TS,TSSSPType);
41919fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode TSSSPGetType(TS,TSSSPType*);
420014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSSPSetNumStages(TS,PetscInt);
421014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSSPGetNumStages(TS,PetscInt*);
422815f1ad5SJed Brown 
423ed657a08SJed Brown /*S
42484df9cb4SJed Brown    TSAdapt - Abstract object that manages time-step adaptivity
42584df9cb4SJed Brown 
42684df9cb4SJed Brown    Level: beginner
42784df9cb4SJed Brown 
42884df9cb4SJed Brown .seealso: TS, TSAdaptCreate(), TSAdaptType
42984df9cb4SJed Brown S*/
43084df9cb4SJed Brown typedef struct _p_TSAdapt *TSAdapt;
43184df9cb4SJed Brown 
43284df9cb4SJed Brown /*E
43384df9cb4SJed Brown     TSAdaptType - String with the name of TSAdapt scheme or the creation function
43484df9cb4SJed Brown        with an optional dynamic library name, for example
43584df9cb4SJed Brown        http://www.mcs.anl.gov/petsc/lib.a:mytsgladaptcreate()
43684df9cb4SJed Brown 
43784df9cb4SJed Brown    Level: beginner
43884df9cb4SJed Brown 
43984df9cb4SJed Brown .seealso: TSAdaptSetType(), TS
44084df9cb4SJed Brown E*/
441f8963224SJed Brown typedef const char *TSAdaptType;
44284df9cb4SJed Brown #define TSADAPTBASIC "basic"
443b0f836d7SJed Brown #define TSADAPTNONE  "none"
4448d59e960SJed Brown #define TSADAPTCFL   "cfl"
44584df9cb4SJed Brown 
44684df9cb4SJed Brown /*MC
44784df9cb4SJed Brown    TSAdaptRegisterDynamic - adds a TSAdapt implementation
44884df9cb4SJed Brown 
44984df9cb4SJed Brown    Synopsis:
450*f2ba6396SBarry Smith    #include "petscts.h"
45184df9cb4SJed Brown    PetscErrorCode TSAdaptRegisterDynamic(const char *name_scheme,const char *path,const char *name_create,PetscErrorCode (*routine_create)(TS))
45284df9cb4SJed Brown 
45384df9cb4SJed Brown    Not Collective
45484df9cb4SJed Brown 
45584df9cb4SJed Brown    Input Parameters:
45684df9cb4SJed Brown +  name_scheme - name of user-defined adaptivity scheme
45784df9cb4SJed Brown .  path - path (either absolute or relative) the library containing this scheme
45884df9cb4SJed Brown .  name_create - name of routine to create method context
45984df9cb4SJed Brown -  routine_create - routine to create method context
46084df9cb4SJed Brown 
46184df9cb4SJed Brown    Notes:
46284df9cb4SJed Brown    TSAdaptRegisterDynamic() may be called multiple times to add several user-defined families.
46384df9cb4SJed Brown 
46484df9cb4SJed Brown    If dynamic libraries are used, then the fourth input argument (routine_create)
46584df9cb4SJed Brown    is ignored.
46684df9cb4SJed Brown 
46784df9cb4SJed Brown    Sample usage:
46884df9cb4SJed Brown .vb
46984df9cb4SJed Brown    TSAdaptRegisterDynamic("my_scheme",/home/username/my_lib/lib/libO/solaris/mylib.a,
47084df9cb4SJed Brown                             "MySchemeCreate",MySchemeCreate);
47184df9cb4SJed Brown .ve
47284df9cb4SJed Brown 
47384df9cb4SJed Brown    Then, your scheme can be chosen with the procedural interface via
47484df9cb4SJed Brown $     TSAdaptSetType(ts,"my_scheme")
47584df9cb4SJed Brown    or at runtime via the option
47684df9cb4SJed Brown $     -ts_adapt_type my_scheme
47784df9cb4SJed Brown 
47884df9cb4SJed Brown    Level: advanced
47984df9cb4SJed Brown 
48084df9cb4SJed Brown    Notes: Environmental variables such as ${PETSC_ARCH}, ${PETSC_DIR}, ${PETSC_LIB_DIR},
48184df9cb4SJed Brown           and others of the form ${any_environmental_variable} occuring in pathname will be
48284df9cb4SJed Brown           replaced with appropriate values.
48384df9cb4SJed Brown 
48484df9cb4SJed Brown .keywords: TSAdapt, register
48584df9cb4SJed Brown 
48684df9cb4SJed Brown .seealso: TSAdaptRegisterAll()
48784df9cb4SJed Brown M*/
48884df9cb4SJed Brown #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
48984df9cb4SJed Brown #  define TSAdaptRegisterDynamic(a,b,c,d)  TSAdaptRegister(a,b,c,0)
49084df9cb4SJed Brown #else
49184df9cb4SJed Brown #  define TSAdaptRegisterDynamic(a,b,c,d)  TSAdaptRegister(a,b,c,d)
49284df9cb4SJed Brown #endif
49384df9cb4SJed Brown 
494ad6bc421SBarry Smith PETSC_EXTERN PetscErrorCode TSGetTSAdapt(TS,TSAdapt*);
495014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAdaptRegister(const char[],const char[],const char[],PetscErrorCode (*)(TSAdapt));
496014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAdaptRegisterAll(const char[]);
497014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAdaptRegisterDestroy(void);
498014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAdaptInitializePackage(const char[]);
499014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAdaptFinalizePackage(void);
500014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAdaptCreate(MPI_Comm,TSAdapt*);
50119fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode TSAdaptSetType(TSAdapt,TSAdaptType);
502014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAdaptSetOptionsPrefix(TSAdapt,const char[]);
503014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAdaptCandidatesClear(TSAdapt);
504014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAdaptCandidateAdd(TSAdapt,const char[],PetscInt,PetscInt,PetscReal,PetscReal,PetscBool);
505014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAdaptCandidatesGet(TSAdapt,PetscInt*,const PetscInt**,const PetscInt**,const PetscReal**,const PetscReal**);
506014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAdaptChoose(TSAdapt,TS,PetscReal,PetscInt*,PetscReal*,PetscBool*);
507014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAdaptCheckStage(TSAdapt,TS,PetscBool*);
508014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAdaptView(TSAdapt,PetscViewer);
509ad6bc421SBarry Smith PETSC_EXTERN PetscErrorCode TSAdaptLoad(TSAdapt,PetscViewer);
510014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAdaptSetFromOptions(TSAdapt);
511014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAdaptDestroy(TSAdapt*);
512014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAdaptSetMonitor(TSAdapt,PetscBool);
513014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAdaptSetStepLimits(TSAdapt,PetscReal,PetscReal);
5140873808bSJed Brown PETSC_EXTERN PetscErrorCode TSAdaptSetCheckStage(TSAdapt,PetscErrorCode(*)(TSAdapt,TS,PetscBool*));
51584df9cb4SJed Brown 
51684df9cb4SJed Brown /*S
517ed657a08SJed Brown    TSGLAdapt - Abstract object that manages time-step adaptivity
518ed657a08SJed Brown 
519ed657a08SJed Brown    Level: beginner
520ed657a08SJed Brown 
52184df9cb4SJed Brown    Developer Notes:
52284df9cb4SJed Brown    This functionality should be replaced by the TSAdapt.
52384df9cb4SJed Brown 
524ed657a08SJed Brown .seealso: TSGL, TSGLAdaptCreate(), TSGLAdaptType
525ed657a08SJed Brown S*/
526ed657a08SJed Brown typedef struct _p_TSGLAdapt *TSGLAdapt;
527ed657a08SJed Brown 
52876bdecfbSBarry Smith /*J
529ed657a08SJed Brown     TSGLAdaptType - String with the name of TSGLAdapt scheme or the creation function
530ed657a08SJed Brown        with an optional dynamic library name, for example
531ed657a08SJed Brown        http://www.mcs.anl.gov/petsc/lib.a:mytsgladaptcreate()
532ed657a08SJed Brown 
533ed657a08SJed Brown    Level: beginner
534ed657a08SJed Brown 
535ed657a08SJed Brown .seealso: TSGLAdaptSetType(), TS
53676bdecfbSBarry Smith J*/
537f8963224SJed Brown typedef const char *TSGLAdaptType;
538ed657a08SJed Brown #define TSGLADAPT_NONE "none"
539ed657a08SJed Brown #define TSGLADAPT_SIZE "size"
540ed657a08SJed Brown #define TSGLADAPT_BOTH "both"
541ed657a08SJed Brown 
542ed657a08SJed Brown /*MC
543ed657a08SJed Brown    TSGLAdaptRegisterDynamic - adds a TSGLAdapt implementation
544ed657a08SJed Brown 
545ed657a08SJed Brown    Synopsis:
546*f2ba6396SBarry Smith    #include "petscts.h"
5471890ba74SBarry Smith    PetscErrorCode TSGLAdaptRegisterDynamic(const char *name_scheme,const char *path,const char *name_create,PetscErrorCode (*routine_create)(TS))
548ed657a08SJed Brown 
549ed657a08SJed Brown    Not Collective
550ed657a08SJed Brown 
551ed657a08SJed Brown    Input Parameters:
552ed657a08SJed Brown +  name_scheme - name of user-defined adaptivity scheme
553ed657a08SJed Brown .  path - path (either absolute or relative) the library containing this scheme
554ed657a08SJed Brown .  name_create - name of routine to create method context
555ed657a08SJed Brown -  routine_create - routine to create method context
556ed657a08SJed Brown 
557ed657a08SJed Brown    Notes:
558ed657a08SJed Brown    TSGLAdaptRegisterDynamic() may be called multiple times to add several user-defined families.
559ed657a08SJed Brown 
560ed657a08SJed Brown    If dynamic libraries are used, then the fourth input argument (routine_create)
561ed657a08SJed Brown    is ignored.
562ed657a08SJed Brown 
563ed657a08SJed Brown    Sample usage:
564ed657a08SJed Brown .vb
565ed657a08SJed Brown    TSGLAdaptRegisterDynamic("my_scheme",/home/username/my_lib/lib/libO/solaris/mylib.a,
566ed657a08SJed Brown                             "MySchemeCreate",MySchemeCreate);
567ed657a08SJed Brown .ve
568ed657a08SJed Brown 
569ed657a08SJed Brown    Then, your scheme can be chosen with the procedural interface via
570ed657a08SJed Brown $     TSGLAdaptSetType(ts,"my_scheme")
571ed657a08SJed Brown    or at runtime via the option
572ed657a08SJed Brown $     -ts_adapt_type my_scheme
573ed657a08SJed Brown 
574ed657a08SJed Brown    Level: advanced
575ed657a08SJed Brown 
576ed657a08SJed Brown    Notes: Environmental variables such as ${PETSC_ARCH}, ${PETSC_DIR}, ${PETSC_LIB_DIR},
577ed657a08SJed Brown           and others of the form ${any_environmental_variable} occuring in pathname will be
578ed657a08SJed Brown           replaced with appropriate values.
579ed657a08SJed Brown 
580ed657a08SJed Brown .keywords: TSGLAdapt, register
581ed657a08SJed Brown 
582ed657a08SJed Brown .seealso: TSGLAdaptRegisterAll()
583ed657a08SJed Brown M*/
584ed657a08SJed Brown #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
585ed657a08SJed Brown #  define TSGLAdaptRegisterDynamic(a,b,c,d)  TSGLAdaptRegister(a,b,c,0)
586ed657a08SJed Brown #else
587ed657a08SJed Brown #  define TSGLAdaptRegisterDynamic(a,b,c,d)  TSGLAdaptRegister(a,b,c,d)
588ed657a08SJed Brown #endif
589ed657a08SJed Brown 
590014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGLAdaptRegister(const char[],const char[],const char[],PetscErrorCode (*)(TSGLAdapt));
591014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGLAdaptRegisterAll(const char[]);
592014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGLAdaptRegisterDestroy(void);
593014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGLAdaptInitializePackage(const char[]);
594014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGLAdaptFinalizePackage(void);
595014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGLAdaptCreate(MPI_Comm,TSGLAdapt*);
59619fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode TSGLAdaptSetType(TSGLAdapt,TSGLAdaptType);
597014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGLAdaptSetOptionsPrefix(TSGLAdapt,const char[]);
598014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGLAdaptChoose(TSGLAdapt,PetscInt,const PetscInt[],const PetscReal[],const PetscReal[],PetscInt,PetscReal,PetscReal,PetscInt*,PetscReal*,PetscBool *);
599014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGLAdaptView(TSGLAdapt,PetscViewer);
600014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGLAdaptSetFromOptions(TSGLAdapt);
601014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGLAdaptDestroy(TSGLAdapt*);
602ed657a08SJed Brown 
60376bdecfbSBarry Smith /*J
604ed657a08SJed Brown     TSGLAcceptType - String with the name of TSGLAccept scheme or the function
605ed657a08SJed Brown        with an optional dynamic library name, for example
606ed657a08SJed Brown        http://www.mcs.anl.gov/petsc/lib.a:mytsglaccept()
607ed657a08SJed Brown 
608ed657a08SJed Brown    Level: beginner
609ed657a08SJed Brown 
610ed657a08SJed Brown .seealso: TSGLSetAcceptType(), TS
61176bdecfbSBarry Smith J*/
612f8963224SJed Brown typedef const char *TSGLAcceptType;
613ed657a08SJed Brown #define TSGLACCEPT_ALWAYS "always"
614ed657a08SJed Brown 
615638cfed1SJed Brown PETSC_EXTERN_TYPEDEF typedef PetscErrorCode (*TSGLAcceptFunction)(TS,PetscReal,PetscReal,const PetscReal[],PetscBool *);
616014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGLAcceptRegister(const char[],const char[],const char[],TSGLAcceptFunction);
617ed657a08SJed Brown 
618ed657a08SJed Brown /*MC
619ed657a08SJed Brown    TSGLAcceptRegisterDynamic - adds a TSGL acceptance scheme
620ed657a08SJed Brown 
621ed657a08SJed Brown    Synopsis:
622*f2ba6396SBarry Smith    #include "petscts.h"
6231890ba74SBarry Smith    PetscErrorCode TSGLAcceptRegisterDynamic(const char *name_scheme,const char *path,const char *name_create,PetscErrorCode (*routine_create)(TS))
624ed657a08SJed Brown 
625ed657a08SJed Brown    Not Collective
626ed657a08SJed Brown 
627ed657a08SJed Brown    Input Parameters:
628ed657a08SJed Brown +  name_scheme - name of user-defined acceptance scheme
629ed657a08SJed Brown .  path - path (either absolute or relative) the library containing this scheme
630ed657a08SJed Brown .  name_create - name of routine to create method context
631ed657a08SJed Brown -  routine_create - routine to create method context
632ed657a08SJed Brown 
633ed657a08SJed Brown    Notes:
634ed657a08SJed Brown    TSGLAcceptRegisterDynamic() may be called multiple times to add several user-defined families.
635ed657a08SJed Brown 
636ed657a08SJed Brown    If dynamic libraries are used, then the fourth input argument (routine_create)
637ed657a08SJed Brown    is ignored.
638ed657a08SJed Brown 
639ed657a08SJed Brown    Sample usage:
640ed657a08SJed Brown .vb
641ed657a08SJed Brown    TSGLAcceptRegisterDynamic("my_scheme",/home/username/my_lib/lib/libO/solaris/mylib.a,
642ed657a08SJed Brown                              "MySchemeCreate",MySchemeCreate);
643ed657a08SJed Brown .ve
644ed657a08SJed Brown 
645ed657a08SJed Brown    Then, your scheme can be chosen with the procedural interface via
646ed657a08SJed Brown $     TSGLSetAcceptType(ts,"my_scheme")
647ed657a08SJed Brown    or at runtime via the option
648ed657a08SJed Brown $     -ts_gl_accept_type my_scheme
649ed657a08SJed Brown 
650ed657a08SJed Brown    Level: advanced
651ed657a08SJed Brown 
652ed657a08SJed Brown    Notes: Environmental variables such as ${PETSC_ARCH}, ${PETSC_DIR}, ${PETSC_LIB_DIR},
653ed657a08SJed Brown           and others of the form ${any_environmental_variable} occuring in pathname will be
654ed657a08SJed Brown           replaced with appropriate values.
655ed657a08SJed Brown 
656ed657a08SJed Brown .keywords: TSGL, TSGLAcceptType, register
657ed657a08SJed Brown 
658ed657a08SJed Brown .seealso: TSGLRegisterAll()
659ed657a08SJed Brown M*/
660ed657a08SJed Brown #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
661ed657a08SJed Brown #  define TSGLAcceptRegisterDynamic(a,b,c,d) TSGLAcceptRegister(a,b,c,0)
662ed657a08SJed Brown #else
663ed657a08SJed Brown #  define TSGLAcceptRegisterDynamic(a,b,c,d) TSGLAcceptRegister(a,b,c,d)
664ed657a08SJed Brown #endif
665ed657a08SJed Brown 
66676bdecfbSBarry Smith /*J
66718b56cb9SJed Brown   TSGLType - family of time integration method within the General Linear class
66818b56cb9SJed Brown 
66918b56cb9SJed Brown   Level: beginner
67018b56cb9SJed Brown 
67118b56cb9SJed Brown .seealso: TSGLSetType(), TSGLRegister()
67276bdecfbSBarry Smith J*/
67319fd82e9SBarry Smith typedef const char* TSGLType;
674ed657a08SJed Brown #define TSGL_IRKS   "irks"
67518b56cb9SJed Brown 
676ed657a08SJed Brown /*MC
677ed657a08SJed Brown    TSGLRegisterDynamic - adds a TSGL implementation
67818b56cb9SJed Brown 
679ed657a08SJed Brown    Synopsis:
680*f2ba6396SBarry Smith    #include "petscts.h"
6811890ba74SBarry Smith    PetscErrorCode TSGLRegisterDynamic(const char *name_scheme,const char *path,const char *name_create,PetscErrorCode (*routine_create)(TS))
682ed657a08SJed Brown 
683ed657a08SJed Brown    Not Collective
684ed657a08SJed Brown 
685ed657a08SJed Brown    Input Parameters:
686ed657a08SJed Brown +  name_scheme - name of user-defined general linear scheme
687ed657a08SJed Brown .  path - path (either absolute or relative) the library containing this scheme
688ed657a08SJed Brown .  name_create - name of routine to create method context
689ed657a08SJed Brown -  routine_create - routine to create method context
690ed657a08SJed Brown 
691ed657a08SJed Brown    Notes:
692ed657a08SJed Brown    TSGLRegisterDynamic() may be called multiple times to add several user-defined families.
693ed657a08SJed Brown 
694ed657a08SJed Brown    If dynamic libraries are used, then the fourth input argument (routine_create)
695ed657a08SJed Brown    is ignored.
696ed657a08SJed Brown 
697ed657a08SJed Brown    Sample usage:
698ed657a08SJed Brown .vb
699ed657a08SJed Brown    TSGLRegisterDynamic("my_scheme",/home/username/my_lib/lib/libO/solaris/mylib.a,
700ed657a08SJed Brown                        "MySchemeCreate",MySchemeCreate);
701ed657a08SJed Brown .ve
702ed657a08SJed Brown 
703ed657a08SJed Brown    Then, your scheme can be chosen with the procedural interface via
704ed657a08SJed Brown $     TSGLSetType(ts,"my_scheme")
705ed657a08SJed Brown    or at runtime via the option
706ed657a08SJed Brown $     -ts_gl_type my_scheme
707ed657a08SJed Brown 
708ed657a08SJed Brown    Level: advanced
709ed657a08SJed Brown 
710ed657a08SJed Brown    Notes: Environmental variables such as ${PETSC_ARCH}, ${PETSC_DIR}, ${PETSC_LIB_DIR},
711ed657a08SJed Brown           and others of the form ${any_environmental_variable} occuring in pathname will be
712ed657a08SJed Brown           replaced with appropriate values.
713ed657a08SJed Brown 
714ed657a08SJed Brown .keywords: TSGL, register
715ed657a08SJed Brown 
716ed657a08SJed Brown .seealso: TSGLRegisterAll()
717ed657a08SJed Brown M*/
718ed657a08SJed Brown #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
719ed657a08SJed Brown #  define TSGLRegisterDynamic(a,b,c,d)       TSGLRegister(a,b,c,0)
720ed657a08SJed Brown #else
721ed657a08SJed Brown #  define TSGLRegisterDynamic(a,b,c,d)       TSGLRegister(a,b,c,d)
722ed657a08SJed Brown #endif
723ed657a08SJed Brown 
724014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGLRegister(const char[],const char[],const char[],PetscErrorCode(*)(TS));
725014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGLRegisterAll(const char[]);
726014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGLRegisterDestroy(void);
727014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGLInitializePackage(const char[]);
728014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGLFinalizePackage(void);
72919fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode TSGLSetType(TS,TSGLType);
730014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGLGetAdapt(TS,TSGLAdapt*);
73119fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode TSGLSetAcceptType(TS,TSGLAcceptType);
73218b56cb9SJed Brown 
733020d8f30SJed Brown /*J
734020d8f30SJed Brown     TSARKIMEXType - String with the name of an Additive Runge-Kutta IMEX method.
735020d8f30SJed Brown 
736020d8f30SJed Brown    Level: beginner
737020d8f30SJed Brown 
738020d8f30SJed Brown .seealso: TSARKIMEXSetType(), TS, TSARKIMEX, TSARKIMEXRegister()
739020d8f30SJed Brown J*/
74019fd82e9SBarry Smith typedef const char* TSARKIMEXType;
741e817cc15SEmil Constantinescu #define TSARKIMEX1BEE   "1bee"
7421f80e275SEmil Constantinescu #define TSARKIMEXA2     "a2"
7431f80e275SEmil Constantinescu #define TSARKIMEXL2     "l2"
7441f80e275SEmil Constantinescu #define TSARKIMEXARS122 "ars122"
7451f80e275SEmil Constantinescu #define TSARKIMEX2C     "2c"
7468a381b04SJed Brown #define TSARKIMEX2D     "2d"
747a3a57f36SJed Brown #define TSARKIMEX2E     "2e"
7486cf0794eSJed Brown #define TSARKIMEXPRSSP2 "prssp2"
7498a381b04SJed Brown #define TSARKIMEX3      "3"
7506cf0794eSJed Brown #define TSARKIMEXBPR3   "bpr3"
7516cf0794eSJed Brown #define TSARKIMEXARS443 "ars443"
7528a381b04SJed Brown #define TSARKIMEX4      "4"
7538a381b04SJed Brown #define TSARKIMEX5      "5"
75419fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode TSARKIMEXGetType(TS ts,TSARKIMEXType*);
75519fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode TSARKIMEXSetType(TS ts,TSARKIMEXType);
756014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSARKIMEXSetFullyImplicit(TS,PetscBool);
75719fd82e9SBarry 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[]);
758014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSARKIMEXFinalizePackage(void);
759014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSARKIMEXInitializePackage(const char path[]);
760014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSARKIMEXRegisterDestroy(void);
761014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSARKIMEXRegisterAll(void);
7628a381b04SJed Brown 
763020d8f30SJed Brown /*J
764020d8f30SJed Brown     TSRosWType - String with the name of a Rosenbrock-W method.
765020d8f30SJed Brown 
766020d8f30SJed Brown    Level: beginner
767020d8f30SJed Brown 
768020d8f30SJed Brown .seealso: TSRosWSetType(), TS, TSROSW, TSRosWRegister()
769020d8f30SJed Brown J*/
77019fd82e9SBarry Smith typedef const char* TSRosWType;
77161692a83SJed Brown #define TSROSW2M          "2m"
77261692a83SJed Brown #define TSROSW2P          "2p"
773fe7e6d57SJed Brown #define TSROSWRA3PW       "ra3pw"
774fe7e6d57SJed Brown #define TSROSWRA34PW2     "ra34pw2"
775ef3c5b88SJed Brown #define TSROSWRODAS3      "rodas3"
776ef3c5b88SJed Brown #define TSROSWSANDU3      "sandu3"
777961f28d0SJed Brown #define TSROSWASSP3P3S1C  "assp3p3s1c"
778961f28d0SJed Brown #define TSROSWLASSP3P4S2C "lassp3p4s2c"
77943b21953SEmil Constantinescu #define TSROSWLLSSP3P4S2C "llssp3p4s2c"
780753f8adbSEmil Constantinescu #define TSROSWARK3        "ark3"
7813606a31eSEmil Constantinescu #define TSROSWTHETA1      "theta1"
7823606a31eSEmil Constantinescu #define TSROSWTHETA2      "theta2"
78342faf41dSJed Brown #define TSROSWGRK4T       "grk4t"
78442faf41dSJed Brown #define TSROSWSHAMP4      "shamp4"
78542faf41dSJed Brown #define TSROSWVELDD4      "veldd4"
78642faf41dSJed Brown #define TSROSW4L          "4l"
787b1c69cc3SEmil Constantinescu 
78819fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode TSRosWGetType(TS ts,TSRosWType*);
78919fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode TSRosWSetType(TS ts,TSRosWType);
790014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSRosWSetRecomputeJacobian(TS,PetscBool);
79119fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode TSRosWRegister(TSRosWType,PetscInt,PetscInt,const PetscReal[],const PetscReal[],const PetscReal[],const PetscReal[],PetscInt,const PetscReal[]);
79219fd82e9SBarry Smith PETSC_EXTERN PetscErrorCode TSRosWRegisterRos4(TSRosWType,PetscReal,PetscReal,PetscReal,PetscReal,PetscReal);
793014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSRosWFinalizePackage(void);
794014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSRosWInitializePackage(const char path[]);
795014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSRosWRegisterDestroy(void);
796014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSRosWRegisterAll(void);
797e27a552bSJed Brown 
79883e2fdc7SBarry Smith /*
7990f3b3ca1SHong Zhang        PETSc interface to Sundials
80083e2fdc7SBarry Smith */
8016dc17ff5SMatthew Knepley #ifdef PETSC_HAVE_SUNDIALS
8026fadb2cdSHong Zhang typedef enum { SUNDIALS_ADAMS=1,SUNDIALS_BDF=2} TSSundialsLmmType;
8036a6fc655SJed Brown PETSC_EXTERN const char *const TSSundialsLmmTypes[];
8046fadb2cdSHong Zhang typedef enum { SUNDIALS_MODIFIED_GS = 1,SUNDIALS_CLASSICAL_GS = 2 } TSSundialsGramSchmidtType;
8056a6fc655SJed Brown PETSC_EXTERN const char *const TSSundialsGramSchmidtTypes[];
806014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSundialsSetType(TS,TSSundialsLmmType);
807014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSundialsGetPC(TS,PC*);
808014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSundialsSetTolerance(TS,PetscReal,PetscReal);
809014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSundialsSetMinTimeStep(TS,PetscReal);
810014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSundialsSetMaxTimeStep(TS,PetscReal);
811014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSundialsGetIterations(TS,PetscInt *,PetscInt *);
812014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSundialsSetGramSchmidtType(TS,TSSundialsGramSchmidtType);
813014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSundialsSetGMRESRestart(TS,PetscInt);
814014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSundialsSetLinearTolerance(TS,PetscReal);
815014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSundialsMonitorInternalSteps(TS,PetscBool );
816014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSundialsGetParameters(TS,PetscInt *,long*[],double*[]);
817014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSundialsSetMaxl(TS,PetscInt);
8186dc17ff5SMatthew Knepley #endif
81983e2fdc7SBarry Smith 
820014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSRKSetTolerance(TS,PetscReal);
821262ff7bbSBarry Smith 
822014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSThetaSetTheta(TS,PetscReal);
823014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSThetaGetTheta(TS,PetscReal*);
824014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSThetaGetEndpoint(TS,PetscBool*);
825014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSThetaSetEndpoint(TS,PetscBool);
8260de4c49aSJed Brown 
827014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAlphaSetAdapt(TS,PetscErrorCode(*)(TS,PetscReal,Vec,Vec,PetscReal*,PetscBool*,void*),void*);
828014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAlphaAdaptDefault(TS,PetscReal,Vec,Vec,PetscReal*,PetscBool*,void*);
829014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAlphaSetRadius(TS,PetscReal);
830014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAlphaSetParams(TS,PetscReal,PetscReal,PetscReal);
831014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSAlphaGetParams(TS,PetscReal*,PetscReal*,PetscReal*);
83288df8a41SLisandro Dalcin 
833014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSSetDM(TS,DM);
834014dd563SJed Brown PETSC_EXTERN PetscErrorCode TSGetDM(TS,DM*);
8356c699258SBarry Smith 
836014dd563SJed Brown PETSC_EXTERN PetscErrorCode SNESTSFormFunction(SNES,Vec,Vec,void*);
837014dd563SJed Brown PETSC_EXTERN PetscErrorCode SNESTSFormJacobian(SNES,Vec,Mat*,Mat*,MatStructure*,void*);
8380f5c6efeSJed Brown 
839818ad0c1SBarry Smith #endif
840