Actual source code: petscts.h

petsc-3.4.4 2014-03-13
  1: /*
  2:    User interface for the timestepping package. This package
  3:    is for use in solving time-dependent PDEs.
  4: */
  7: #include <petscsnes.h>

  9: /*S
 10:      TS - Abstract PETSc object that manages all time-steppers (ODE integrators)

 12:    Level: beginner

 14:   Concepts: ODE solvers

 16: .seealso:  TSCreate(), TSSetType(), TSType, SNES, KSP, PC, TSDestroy()
 17: S*/
 18: typedef struct _p_TS* TS;

 20: /*J
 21:     TSType - String with the name of a PETSc TS method.

 23:    Level: beginner

 25: .seealso: TSSetType(), TS, TSRegister()
 26: J*/
 27: typedef const char* TSType;
 28: #define TSEULER           "euler"
 29: #define TSBEULER          "beuler"
 30: #define TSPSEUDO          "pseudo"
 31: #define TSCN              "cn"
 32: #define TSSUNDIALS        "sundials"
 33: #define TSRK              "rk"
 34: #define TSPYTHON          "python"
 35: #define TSTHETA           "theta"
 36: #define TSALPHA           "alpha"
 37: #define TSGL              "gl"
 38: #define TSSSP             "ssp"
 39: #define TSARKIMEX         "arkimex"
 40: #define TSROSW            "rosw"
 41: #define TSEIMEX           "eimex"
 42: /*E
 43:     TSProblemType - Determines the type of problem this TS object is to be used to solve

 45:    Level: beginner

 47: .seealso: TSCreate()
 48: E*/
 49: typedef enum {TS_LINEAR,TS_NONLINEAR} TSProblemType;

 51: /*E
 52:    TSEquationType - type of TS problem that is solved

 54:    Level: beginner

 56:    Developer Notes: this must match finclude/petscts.h

 58:    Supported types are:
 59:      TS_EQ_UNSPECIFIED (default)
 60:      TS_EQ_EXPLICIT {ODE and DAE index 1, 2, 3, HI}: F(t,U,U_t) := M(t) U_t - G(U,t) = 0
 61:      TS_EQ_IMPLICIT {ODE and DAE index 1, 2, 3, HI}: F(t,U,U_t) = 0

 63: .seealso: TSGetEquationType(), TSSetEquationType()
 64: E*/
 65: typedef enum {
 66:   TS_EQ_UNSPECIFIED               = -1,
 67:   TS_EQ_EXPLICIT                  = 0,
 68:   TS_EQ_ODE_EXPLICIT              = 1,
 69:   TS_EQ_DAE_SEMI_EXPLICIT_INDEX1  = 100,
 70:   TS_EQ_DAE_SEMI_EXPLICIT_INDEX2  = 200,
 71:   TS_EQ_DAE_SEMI_EXPLICIT_INDEX3  = 300,
 72:   TS_EQ_DAE_SEMI_EXPLICIT_INDEXHI = 500,
 73:   TS_EQ_IMPLICIT                  = 1000,
 74:   TS_EQ_ODE_IMPLICIT              = 1001,
 75:   TS_EQ_DAE_IMPLICIT_INDEX1       = 1100,
 76:   TS_EQ_DAE_IMPLICIT_INDEX2       = 1200,
 77:   TS_EQ_DAE_IMPLICIT_INDEX3       = 1300,
 78:   TS_EQ_DAE_IMPLICIT_INDEXHI      = 1500
 79: } TSEquationType;
 80: PETSC_EXTERN const char *const*TSEquationTypes;

 82: /*E
 83:    TSConvergedReason - reason a TS method has converged or not

 85:    Level: beginner

 87:    Developer Notes: this must match finclude/petscts.h

 89:    Each reason has its own manual page.

 91: .seealso: TSGetConvergedReason()
 92: E*/
 93: typedef enum {
 94:   TS_CONVERGED_ITERATING      = 0,
 95:   TS_CONVERGED_TIME           = 1,
 96:   TS_CONVERGED_ITS            = 2,
 97:   TS_CONVERGED_USER           = 3,
 98:   TS_DIVERGED_NONLINEAR_SOLVE = -1,
 99:   TS_DIVERGED_STEP_REJECTED   = -2
100: } TSConvergedReason;
101: PETSC_EXTERN const char *const*TSConvergedReasons;
102: /*MC
103:    TS_CONVERGED_ITERATING - this only occurs if TSGetConvergedReason() is called during the TSSolve()

105:    Level: beginner

107: .seealso: TSSolve(), TSGetConvergedReason(), TSGetAdapt()
108: M*/

110: /*MC
111:    TS_CONVERGED_TIME - the final time was reached

113:    Level: beginner

115: .seealso: TSSolve(), TSGetConvergedReason(), TSGetAdapt(), TSSetDuration(), TSGetSolveTime()
116: M*/

118: /*MC
119:    TS_CONVERGED_ITS - the maximum number of iterations was reached prior to the final time

121:    Level: beginner

123: .seealso: TSSolve(), TSGetConvergedReason(), TSGetAdapt(), TSSetDuration()
124: M*/
125: /*MC
126:    TS_CONVERGED_USER - user requested termination

128:    Level: beginner

130: .seealso: TSSolve(), TSGetConvergedReason(), TSSetConvergedReason(), TSSetDuration()
131: M*/

133: /*MC
134:    TS_DIVERGED_NONLINEAR_SOLVE - too many nonlinear solves failed

136:    Level: beginner

138: .seealso: TSSolve(), TSGetConvergedReason(), TSGetAdapt(), TSGetSNES(), SNESGetConvergedReason()
139: M*/

141: /*MC
142:    TS_DIVERGED_STEP_REJECTED - too many steps were rejected

144:    Level: beginner

146: .seealso: TSSolve(), TSGetConvergedReason(), TSGetAdapt()
147: M*/

149: /*E
150:    TSExactFinalTimeOption - option for handling of final time step

152:    Level: beginner

154:    Developer Notes: this must match finclude/petscts.h

156: $  TS_EXACTFINALTIME_STEPOVER    - Don't do anything if final time is exceeded
157: $  TS_EXACTFINALTIME_INTERPOLATE - Interpolate back to final time
158: $  TS_EXACTFINALTIME_MATCHSTEP - Adapt final time step to match the final time
159: .seealso: TSGetConvergedReason(), TSSetExactFinalTime()

161: E*/
162: typedef enum {TS_EXACTFINALTIME_STEPOVER=0,TS_EXACTFINALTIME_INTERPOLATE=1,TS_EXACTFINALTIME_MATCHSTEP=2} TSExactFinalTimeOption;
163: PETSC_EXTERN const char *const TSExactFinalTimeOptions[];


166: /* Logging support */
167: PETSC_EXTERN PetscClassId TS_CLASSID;
168: PETSC_EXTERN PetscClassId DMTS_CLASSID;

170: PETSC_EXTERN PetscErrorCode TSInitializePackage(void);

172: PETSC_EXTERN PetscErrorCode TSCreate(MPI_Comm,TS*);
173: PETSC_EXTERN PetscErrorCode TSDestroy(TS*);

175: PETSC_EXTERN PetscErrorCode TSSetProblemType(TS,TSProblemType);
176: PETSC_EXTERN PetscErrorCode TSGetProblemType(TS,TSProblemType*);
177: PETSC_EXTERN PetscErrorCode TSMonitor(TS,PetscInt,PetscReal,Vec);
178: PETSC_EXTERN PetscErrorCode TSMonitorSet(TS,PetscErrorCode(*)(TS,PetscInt,PetscReal,Vec,void*),void *,PetscErrorCode (*)(void**));
179: PETSC_EXTERN PetscErrorCode TSMonitorCancel(TS);

181: PETSC_EXTERN PetscErrorCode TSSetOptionsPrefix(TS,const char[]);
182: PETSC_EXTERN PetscErrorCode TSAppendOptionsPrefix(TS,const char[]);
183: PETSC_EXTERN PetscErrorCode TSGetOptionsPrefix(TS,const char *[]);
184: PETSC_EXTERN PetscErrorCode TSSetFromOptions(TS);
185: PETSC_EXTERN PetscErrorCode TSSetUp(TS);
186: PETSC_EXTERN PetscErrorCode TSReset(TS);

188: PETSC_EXTERN PetscErrorCode TSSetSolution(TS,Vec);
189: PETSC_EXTERN PetscErrorCode TSGetSolution(TS,Vec*);

191: PETSC_EXTERN PetscErrorCode TSSetDuration(TS,PetscInt,PetscReal);
192: PETSC_EXTERN PetscErrorCode TSGetDuration(TS,PetscInt*,PetscReal*);
193: PETSC_EXTERN PetscErrorCode TSSetExactFinalTime(TS,TSExactFinalTimeOption);

195: PETSC_EXTERN PetscErrorCode TSMonitorDefault(TS,PetscInt,PetscReal,Vec,void*);

197: typedef struct _n_TSMonitorDrawCtx*  TSMonitorDrawCtx;
198: PETSC_EXTERN PetscErrorCode TSMonitorDrawCtxCreate(MPI_Comm,const char[],const char[],int,int,int,int,PetscInt,TSMonitorDrawCtx *);
199: PETSC_EXTERN PetscErrorCode TSMonitorDrawCtxDestroy(TSMonitorDrawCtx*);
200: PETSC_EXTERN PetscErrorCode TSMonitorDrawSolution(TS,PetscInt,PetscReal,Vec,void*);
201: PETSC_EXTERN PetscErrorCode TSMonitorDrawSolutionPhase(TS,PetscInt,PetscReal,Vec,void*);
202: PETSC_EXTERN PetscErrorCode TSMonitorDrawError(TS,PetscInt,PetscReal,Vec,void*);

204: PETSC_EXTERN PetscErrorCode TSMonitorSolutionBinary(TS,PetscInt,PetscReal,Vec,void*);
205: PETSC_EXTERN PetscErrorCode TSMonitorSolutionVTK(TS,PetscInt,PetscReal,Vec,void*);
206: PETSC_EXTERN PetscErrorCode TSMonitorSolutionVTKDestroy(void*);

208: PETSC_EXTERN PetscErrorCode TSStep(TS);
209: PETSC_EXTERN PetscErrorCode TSEvaluateStep(TS,PetscInt,Vec,PetscBool*);
210: PETSC_EXTERN PetscErrorCode TSSolve(TS,Vec);
211: PETSC_EXTERN PetscErrorCode TSGetEquationType(TS,TSEquationType*);
212: PETSC_EXTERN PetscErrorCode TSSetEquationType(TS,TSEquationType);
213: PETSC_EXTERN PetscErrorCode TSGetConvergedReason(TS,TSConvergedReason*);
214: PETSC_EXTERN PetscErrorCode TSSetConvergedReason(TS,TSConvergedReason);
215: PETSC_EXTERN PetscErrorCode TSGetSolveTime(TS,PetscReal*);
216: PETSC_EXTERN PetscErrorCode TSGetSNESIterations(TS,PetscInt*);
217: PETSC_EXTERN PetscErrorCode TSGetKSPIterations(TS,PetscInt*);
218: PETSC_EXTERN PetscErrorCode TSGetStepRejections(TS,PetscInt*);
219: PETSC_EXTERN PetscErrorCode TSSetMaxStepRejections(TS,PetscInt);
220: PETSC_EXTERN PetscErrorCode TSGetSNESFailures(TS,PetscInt*);
221: PETSC_EXTERN PetscErrorCode TSSetMaxSNESFailures(TS,PetscInt);
222: PETSC_EXTERN PetscErrorCode TSSetErrorIfStepFails(TS,PetscBool);

224: PETSC_EXTERN PetscErrorCode TSSetInitialTimeStep(TS,PetscReal,PetscReal);
225: PETSC_EXTERN PetscErrorCode TSGetTimeStep(TS,PetscReal*);
226: PETSC_EXTERN PetscErrorCode TSGetTime(TS,PetscReal*);
227: PETSC_EXTERN PetscErrorCode TSSetTime(TS,PetscReal);
228: PETSC_EXTERN PetscErrorCode TSGetTimeStepNumber(TS,PetscInt*);
229: PETSC_EXTERN PetscErrorCode TSSetTimeStep(TS,PetscReal);

231: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode (*TSRHSFunction)(TS,PetscReal,Vec,Vec,void*);
232: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode (*TSRHSJacobian)(TS,PetscReal,Vec,Mat*,Mat*,MatStructure*,void*);
233: PETSC_EXTERN PetscErrorCode TSSetRHSFunction(TS,Vec,TSRHSFunction,void*);
234: PETSC_EXTERN PetscErrorCode TSGetRHSFunction(TS,Vec*,TSRHSFunction*,void**);
235: PETSC_EXTERN PetscErrorCode TSSetRHSJacobian(TS,Mat,Mat,TSRHSJacobian,void*);
236: PETSC_EXTERN PetscErrorCode TSGetRHSJacobian(TS,Mat*,Mat*,TSRHSJacobian*,void**);
237: PETSC_EXTERN PetscErrorCode TSRHSJacobianSetReuse(TS,PetscBool);

239: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode (*TSSolutionFunction)(TS,PetscReal,Vec,void*);
240: PETSC_EXTERN PetscErrorCode TSSetSolutionFunction(TS,TSSolutionFunction,void*);
241: PETSC_EXTERN PetscErrorCode TSSetForcingFunction(TS,PetscErrorCode (*TSForcingFunction)(TS,PetscReal,Vec,void*),void*);

243: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode (*TSIFunction)(TS,PetscReal,Vec,Vec,Vec,void*);
244: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode (*TSIJacobian)(TS,PetscReal,Vec,Vec,PetscReal,Mat*,Mat*,MatStructure*,void*);
245: PETSC_EXTERN PetscErrorCode TSSetIFunction(TS,Vec,TSIFunction,void*);
246: PETSC_EXTERN PetscErrorCode TSGetIFunction(TS,Vec*,TSIFunction*,void**);
247: PETSC_EXTERN PetscErrorCode TSSetIJacobian(TS,Mat,Mat,TSIJacobian,void*);
248: PETSC_EXTERN PetscErrorCode TSGetIJacobian(TS,Mat*,Mat*,TSIJacobian*,void**);

250: PETSC_EXTERN PetscErrorCode TSComputeRHSFunctionLinear(TS,PetscReal,Vec,Vec,void*);
251: PETSC_EXTERN PetscErrorCode TSComputeRHSJacobianConstant(TS,PetscReal,Vec,Mat*,Mat*,MatStructure*,void*);
252: PETSC_EXTERN PetscErrorCode TSComputeIFunctionLinear(TS,PetscReal,Vec,Vec,Vec,void*);
253: PETSC_EXTERN PetscErrorCode TSComputeIJacobianConstant(TS,PetscReal,Vec,Vec,PetscReal,Mat*,Mat*,MatStructure*,void*);
254: PETSC_EXTERN PetscErrorCode TSComputeSolutionFunction(TS,PetscReal,Vec);
255: PETSC_EXTERN PetscErrorCode TSComputeForcingFunction(TS,PetscReal,Vec);

257: PETSC_EXTERN PetscErrorCode TSSetPreStep(TS, PetscErrorCode (*)(TS));
258: PETSC_EXTERN PetscErrorCode TSSetPreStage(TS, PetscErrorCode (*)(TS,PetscReal));
259: PETSC_EXTERN PetscErrorCode TSSetPostStep(TS, PetscErrorCode (*)(TS));
260: PETSC_EXTERN PetscErrorCode TSPreStep(TS);
261: PETSC_EXTERN PetscErrorCode TSPreStage(TS,PetscReal);
262: PETSC_EXTERN PetscErrorCode TSPostStep(TS);
263: PETSC_EXTERN PetscErrorCode TSSetRetainStages(TS,PetscBool);
264: PETSC_EXTERN PetscErrorCode TSInterpolate(TS,PetscReal,Vec);
265: PETSC_EXTERN PetscErrorCode TSSetTolerances(TS,PetscReal,Vec,PetscReal,Vec);
266: PETSC_EXTERN PetscErrorCode TSGetTolerances(TS,PetscReal*,Vec*,PetscReal*,Vec*);
267: PETSC_EXTERN PetscErrorCode TSErrorNormWRMS(TS,Vec,PetscReal*);
268: PETSC_EXTERN PetscErrorCode TSSetCFLTimeLocal(TS,PetscReal);
269: PETSC_EXTERN PetscErrorCode TSGetCFLTime(TS,PetscReal*);

271: PETSC_EXTERN PetscErrorCode TSPseudoSetTimeStep(TS,PetscErrorCode(*)(TS,PetscReal*,void*),void*);
272: PETSC_EXTERN PetscErrorCode TSPseudoTimeStepDefault(TS,PetscReal*,void*);
273: PETSC_EXTERN PetscErrorCode TSPseudoComputeTimeStep(TS,PetscReal *);
274: PETSC_EXTERN PetscErrorCode TSPseudoSetMaxTimeStep(TS,PetscReal);

276: PETSC_EXTERN PetscErrorCode TSPseudoSetVerifyTimeStep(TS,PetscErrorCode(*)(TS,Vec,void*,PetscReal*,PetscBool *),void*);
277: PETSC_EXTERN PetscErrorCode TSPseudoVerifyTimeStepDefault(TS,Vec,void*,PetscReal*,PetscBool *);
278: PETSC_EXTERN PetscErrorCode TSPseudoVerifyTimeStep(TS,Vec,PetscReal*,PetscBool *);
279: PETSC_EXTERN PetscErrorCode TSPseudoSetTimeStepIncrement(TS,PetscReal);
280: PETSC_EXTERN PetscErrorCode TSPseudoIncrementDtFromInitialDt(TS);

282: PETSC_EXTERN PetscErrorCode TSPythonSetType(TS,const char[]);

284: PETSC_EXTERN PetscErrorCode TSComputeRHSFunction(TS,PetscReal,Vec,Vec);
285: PETSC_EXTERN PetscErrorCode TSComputeRHSJacobian(TS,PetscReal,Vec,Mat*,Mat*,MatStructure*);
286: PETSC_EXTERN PetscErrorCode TSComputeIFunction(TS,PetscReal,Vec,Vec,Vec,PetscBool);
287: PETSC_EXTERN PetscErrorCode TSComputeIJacobian(TS,PetscReal,Vec,Vec,PetscReal,Mat*,Mat*,MatStructure*,PetscBool);
288: PETSC_EXTERN PetscErrorCode TSComputeLinearStability(TS,PetscReal,PetscReal,PetscReal*,PetscReal*);

290: PETSC_EXTERN PetscErrorCode TSVISetVariableBounds(TS,Vec,Vec);

292: PETSC_EXTERN PetscErrorCode DMTSSetRHSFunction(DM,TSRHSFunction,void*);
293: PETSC_EXTERN PetscErrorCode DMTSGetRHSFunction(DM,TSRHSFunction*,void**);
294: PETSC_EXTERN PetscErrorCode DMTSSetRHSJacobian(DM,TSRHSJacobian,void*);
295: PETSC_EXTERN PetscErrorCode DMTSGetRHSJacobian(DM,TSRHSJacobian*,void**);
296: PETSC_EXTERN PetscErrorCode DMTSSetIFunction(DM,TSIFunction,void*);
297: PETSC_EXTERN PetscErrorCode DMTSGetIFunction(DM,TSIFunction*,void**);
298: PETSC_EXTERN PetscErrorCode DMTSSetIJacobian(DM,TSIJacobian,void*);
299: PETSC_EXTERN PetscErrorCode DMTSGetIJacobian(DM,TSIJacobian*,void**);
300: PETSC_EXTERN PetscErrorCode DMTSSetSolutionFunction(DM,TSSolutionFunction,void*);
301: PETSC_EXTERN PetscErrorCode DMTSGetSolutionFunction(DM,TSSolutionFunction*,void**);
302: PETSC_EXTERN PetscErrorCode DMTSSetForcingFunction(DM,PetscErrorCode (*TSForcingFunction)(TS,PetscReal,Vec,void*),void*);
303: PETSC_EXTERN PetscErrorCode DMTSGetForcingFunction(DM,PetscErrorCode (**TSForcingFunction)(TS,PetscReal,Vec,void*),void**);

305: PETSC_EXTERN PetscErrorCode DMTSSetIFunctionSerialize(DM,PetscErrorCode (*)(void*,PetscViewer),PetscErrorCode (*)(void**,PetscViewer));
306: PETSC_EXTERN PetscErrorCode DMTSSetIJacobianSerialize(DM,PetscErrorCode (*)(void*,PetscViewer),PetscErrorCode (*)(void**,PetscViewer));

308: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode (*DMDATSRHSFunctionLocal)(DMDALocalInfo*,PetscReal,void*,void*,void*);
309: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode (*DMDATSRHSJacobianLocal)(DMDALocalInfo*,PetscReal,void*,Mat,Mat,MatStructure*,void*);
310: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode (*DMDATSIFunctionLocal)(DMDALocalInfo*,PetscReal,void*,void*,void*,void*);
311: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode (*DMDATSIJacobianLocal)(DMDALocalInfo*,PetscReal,void*,void*,PetscReal,Mat,Mat,MatStructure*,void*);

313: PETSC_EXTERN PetscErrorCode DMDATSSetRHSFunctionLocal(DM,InsertMode,PetscErrorCode (*)(DMDALocalInfo*,PetscReal,void*,void*,void*),void *);
314: PETSC_EXTERN PetscErrorCode DMDATSSetRHSJacobianLocal(DM,PetscErrorCode (*)(DMDALocalInfo*,PetscReal,void*,Mat,Mat,MatStructure*,void*),void *);
315: PETSC_EXTERN PetscErrorCode DMDATSSetIFunctionLocal(DM,InsertMode,PetscErrorCode (*)(DMDALocalInfo*,PetscReal,void*,void*,void*,void*),void *);
316: PETSC_EXTERN PetscErrorCode DMDATSSetIJacobianLocal(DM,PetscErrorCode (*)(DMDALocalInfo*,PetscReal,void*,void*,PetscReal,Mat,Mat,MatStructure*,void*),void *);

318: typedef struct {
319:   Vec         ray;
320:   VecScatter  scatter;
321:   PetscViewer viewer;
322: } TSMonitorDMDARayCtx;
323: PETSC_EXTERN PetscErrorCode TSMonitorDMDARayDestroy(void**);
324: PETSC_EXTERN PetscErrorCode TSMonitorDMDARay(TS,PetscInt,PetscReal,Vec,void*);


327: /* Dynamic creation and loading functions */
328: PETSC_EXTERN PetscFunctionList TSList;
329: PETSC_EXTERN PetscBool         TSRegisterAllCalled;
330: PETSC_EXTERN PetscErrorCode TSGetType(TS,TSType*);
331: PETSC_EXTERN PetscErrorCode TSSetType(TS,TSType);
332: PETSC_EXTERN PetscErrorCode TSRegister(const char[], PetscErrorCode (*)(TS));
333: PETSC_EXTERN PetscErrorCode TSRegisterAll(void);

335: PETSC_EXTERN PetscErrorCode TSGetSNES(TS,SNES*);
336: PETSC_EXTERN PetscErrorCode TSSetSNES(TS,SNES);
337: PETSC_EXTERN PetscErrorCode TSGetKSP(TS,KSP*);

339: PETSC_EXTERN PetscErrorCode TSView(TS,PetscViewer);
340: PETSC_EXTERN PetscErrorCode TSLoad(TS,PetscViewer);

342: #define TS_FILE_CLASSID 1211225

344: PETSC_EXTERN PetscErrorCode TSSetApplicationContext(TS,void *);
345: PETSC_EXTERN PetscErrorCode TSGetApplicationContext(TS,void *);

347: typedef struct _n_TSMonitorLGCtx*  TSMonitorLGCtx;
348: PETSC_EXTERN PetscErrorCode TSMonitorLGCtxCreate(MPI_Comm,const char[],const char[],int,int,int,int,PetscInt,TSMonitorLGCtx *);
349: PETSC_EXTERN PetscErrorCode TSMonitorLGCtxDestroy(TSMonitorLGCtx*);
350: PETSC_EXTERN PetscErrorCode TSMonitorLGTimeStep(TS,PetscInt,PetscReal,Vec,void *);
351: PETSC_EXTERN PetscErrorCode TSMonitorLGSolution(TS,PetscInt,PetscReal,Vec,void *);
352: PETSC_EXTERN PetscErrorCode TSMonitorLGError(TS,PetscInt,PetscReal,Vec,void *);
353: PETSC_EXTERN PetscErrorCode TSMonitorLGSNESIterations(TS,PetscInt,PetscReal,Vec,void *);
354: PETSC_EXTERN PetscErrorCode TSMonitorLGKSPIterations(TS,PetscInt,PetscReal,Vec,void *);

356: typedef struct _n_TSMonitorSPEigCtx*  TSMonitorSPEigCtx;
357: PETSC_EXTERN PetscErrorCode TSMonitorSPEigCtxCreate(MPI_Comm,const char[],const char[],int,int,int,int,PetscInt,TSMonitorSPEigCtx *);
358: PETSC_EXTERN PetscErrorCode TSMonitorSPEigCtxDestroy(TSMonitorSPEigCtx*);
359: PETSC_EXTERN PetscErrorCode TSMonitorSPEig(TS,PetscInt,PetscReal,Vec,void *);

361: /*J
362:    TSSSPType - string with the name of TSSSP scheme.

364:    Level: beginner

366: .seealso: TSSSPSetType(), TS
367: J*/
368: typedef const char* TSSSPType;
369: #define TSSSPRKS2  "rks2"
370: #define TSSSPRKS3  "rks3"
371: #define TSSSPRK104 "rk104"

373: PETSC_EXTERN PetscErrorCode TSSSPSetType(TS,TSSSPType);
374: PETSC_EXTERN PetscErrorCode TSSSPGetType(TS,TSSSPType*);
375: PETSC_EXTERN PetscErrorCode TSSSPSetNumStages(TS,PetscInt);
376: PETSC_EXTERN PetscErrorCode TSSSPGetNumStages(TS,PetscInt*);
377: PETSC_EXTERN PetscErrorCode TSSSPFinalizePackage(void);
378: PETSC_EXTERN PetscErrorCode TSSSPInitializePackage(void);

380: /*S
381:    TSAdapt - Abstract object that manages time-step adaptivity

383:    Level: beginner

385: .seealso: TS, TSAdaptCreate(), TSAdaptType
386: S*/
387: typedef struct _p_TSAdapt *TSAdapt;

389: /*E
390:     TSAdaptType - String with the name of TSAdapt scheme.

392:    Level: beginner

394: .seealso: TSAdaptSetType(), TS
395: E*/
396: typedef const char *TSAdaptType;
397: #define TSADAPTBASIC "basic"
398: #define TSADAPTNONE  "none"
399: #define TSADAPTCFL   "cfl"

401: PETSC_EXTERN PetscErrorCode TSGetAdapt(TS,TSAdapt*);
402: PETSC_EXTERN PetscErrorCode TSAdaptRegister(const char[],PetscErrorCode (*)(TSAdapt));
403: PETSC_EXTERN PetscErrorCode TSAdaptRegisterAll(void);
404: PETSC_EXTERN PetscErrorCode TSAdaptInitializePackage(void);
405: PETSC_EXTERN PetscErrorCode TSAdaptFinalizePackage(void);
406: PETSC_EXTERN PetscErrorCode TSAdaptCreate(MPI_Comm,TSAdapt*);
407: PETSC_EXTERN PetscErrorCode TSAdaptSetType(TSAdapt,TSAdaptType);
408: PETSC_EXTERN PetscErrorCode TSAdaptSetOptionsPrefix(TSAdapt,const char[]);
409: PETSC_EXTERN PetscErrorCode TSAdaptCandidatesClear(TSAdapt);
410: PETSC_EXTERN PetscErrorCode TSAdaptCandidateAdd(TSAdapt,const char[],PetscInt,PetscInt,PetscReal,PetscReal,PetscBool);
411: PETSC_EXTERN PetscErrorCode TSAdaptCandidatesGet(TSAdapt,PetscInt*,const PetscInt**,const PetscInt**,const PetscReal**,const PetscReal**);
412: PETSC_EXTERN PetscErrorCode TSAdaptChoose(TSAdapt,TS,PetscReal,PetscInt*,PetscReal*,PetscBool*);
413: PETSC_EXTERN PetscErrorCode TSAdaptCheckStage(TSAdapt,TS,PetscBool*);
414: PETSC_EXTERN PetscErrorCode TSAdaptView(TSAdapt,PetscViewer);
415: PETSC_EXTERN PetscErrorCode TSAdaptLoad(TSAdapt,PetscViewer);
416: PETSC_EXTERN PetscErrorCode TSAdaptSetFromOptions(TSAdapt);
417: PETSC_EXTERN PetscErrorCode TSAdaptDestroy(TSAdapt*);
418: PETSC_EXTERN PetscErrorCode TSAdaptSetMonitor(TSAdapt,PetscBool);
419: PETSC_EXTERN PetscErrorCode TSAdaptSetStepLimits(TSAdapt,PetscReal,PetscReal);
420: PETSC_EXTERN PetscErrorCode TSAdaptSetCheckStage(TSAdapt,PetscErrorCode(*)(TSAdapt,TS,PetscBool*));

422: /*S
423:    TSGLAdapt - Abstract object that manages time-step adaptivity

425:    Level: beginner

427:    Developer Notes:
428:    This functionality should be replaced by the TSAdapt.

430: .seealso: TSGL, TSGLAdaptCreate(), TSGLAdaptType
431: S*/
432: typedef struct _p_TSGLAdapt *TSGLAdapt;

434: /*J
435:     TSGLAdaptType - String with the name of TSGLAdapt scheme

437:    Level: beginner

439: .seealso: TSGLAdaptSetType(), TS
440: J*/
441: typedef const char *TSGLAdaptType;
442: #define TSGLADAPT_NONE "none"
443: #define TSGLADAPT_SIZE "size"
444: #define TSGLADAPT_BOTH "both"

446: PETSC_EXTERN PetscErrorCode TSGLAdaptRegister(const char[],PetscErrorCode (*)(TSGLAdapt));
447: PETSC_EXTERN PetscErrorCode TSGLAdaptRegisterAll(void);
448: PETSC_EXTERN PetscErrorCode TSGLAdaptInitializePackage(void);
449: PETSC_EXTERN PetscErrorCode TSGLAdaptFinalizePackage(void);
450: PETSC_EXTERN PetscErrorCode TSGLAdaptCreate(MPI_Comm,TSGLAdapt*);
451: PETSC_EXTERN PetscErrorCode TSGLAdaptSetType(TSGLAdapt,TSGLAdaptType);
452: PETSC_EXTERN PetscErrorCode TSGLAdaptSetOptionsPrefix(TSGLAdapt,const char[]);
453: PETSC_EXTERN PetscErrorCode TSGLAdaptChoose(TSGLAdapt,PetscInt,const PetscInt[],const PetscReal[],const PetscReal[],PetscInt,PetscReal,PetscReal,PetscInt*,PetscReal*,PetscBool *);
454: PETSC_EXTERN PetscErrorCode TSGLAdaptView(TSGLAdapt,PetscViewer);
455: PETSC_EXTERN PetscErrorCode TSGLAdaptSetFromOptions(TSGLAdapt);
456: PETSC_EXTERN PetscErrorCode TSGLAdaptDestroy(TSGLAdapt*);

458: /*J
459:     TSGLAcceptType - String with the name of TSGLAccept scheme

461:    Level: beginner

463: .seealso: TSGLSetAcceptType(), TS
464: J*/
465: typedef const char *TSGLAcceptType;
466: #define TSGLACCEPT_ALWAYS "always"

468: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode (*TSGLAcceptFunction)(TS,PetscReal,PetscReal,const PetscReal[],PetscBool *);
469: PETSC_EXTERN PetscErrorCode TSGLAcceptRegister(const char[],TSGLAcceptFunction);

471: /*J
472:   TSGLType - family of time integration method within the General Linear class

474:   Level: beginner

476: .seealso: TSGLSetType(), TSGLRegister()
477: J*/
478: typedef const char* TSGLType;
479: #define TSGL_IRKS   "irks"

481: PETSC_EXTERN PetscErrorCode TSGLRegister(const char[],PetscErrorCode(*)(TS));
482: PETSC_EXTERN PetscErrorCode TSGLRegisterAll(void);
483: PETSC_EXTERN PetscErrorCode TSGLInitializePackage(void);
484: PETSC_EXTERN PetscErrorCode TSGLFinalizePackage(void);
485: PETSC_EXTERN PetscErrorCode TSGLSetType(TS,TSGLType);
486: PETSC_EXTERN PetscErrorCode TSGLGetAdapt(TS,TSGLAdapt*);
487: PETSC_EXTERN PetscErrorCode TSGLSetAcceptType(TS,TSGLAcceptType);

489: /*J
490:     TSEIMEXType - String with the name of an Extrapolated IMEX method.

492:    Level: beginner

494: .seealso: TSEIMEXSetType(), TS, TSEIMEX, TSEIMEXRegister()
495: J*/
496: #define TSEIMEXType   char*

498: PETSC_EXTERN PetscErrorCode TSEIMEXSetMaxRows(TS ts,PetscInt);
499: PETSC_EXTERN PetscErrorCode TSEIMEXSetRowCol(TS ts,PetscInt,PetscInt);
500: PETSC_EXTERN PetscErrorCode TSEIMEXSetOrdAdapt(TS,PetscBool);

502: /*J
503:     TSARKIMEXType - String with the name of an Additive Runge-Kutta IMEX method.

505:    Level: beginner

507: .seealso: TSARKIMEXSetType(), TS, TSARKIMEX, TSARKIMEXRegister()
508: J*/
509: typedef const char* TSARKIMEXType;
510: #define TSARKIMEX1BEE   "1bee"
511: #define TSARKIMEXA2     "a2"
512: #define TSARKIMEXL2     "l2"
513: #define TSARKIMEXARS122 "ars122"
514: #define TSARKIMEX2C     "2c"
515: #define TSARKIMEX2D     "2d"
516: #define TSARKIMEX2E     "2e"
517: #define TSARKIMEXPRSSP2 "prssp2"
518: #define TSARKIMEX3      "3"
519: #define TSARKIMEXBPR3   "bpr3"
520: #define TSARKIMEXARS443 "ars443"
521: #define TSARKIMEX4      "4"
522: #define TSARKIMEX5      "5"
523: PETSC_EXTERN PetscErrorCode TSARKIMEXGetType(TS ts,TSARKIMEXType*);
524: PETSC_EXTERN PetscErrorCode TSARKIMEXSetType(TS ts,TSARKIMEXType);
525: PETSC_EXTERN PetscErrorCode TSARKIMEXSetFullyImplicit(TS,PetscBool);
526: 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[]);
527: PETSC_EXTERN PetscErrorCode TSARKIMEXFinalizePackage(void);
528: PETSC_EXTERN PetscErrorCode TSARKIMEXInitializePackage(void);
529: PETSC_EXTERN PetscErrorCode TSARKIMEXRegisterDestroy(void);
530: PETSC_EXTERN PetscErrorCode TSARKIMEXRegisterAll(void);

532: /*J
533:     TSRosWType - String with the name of a Rosenbrock-W method.

535:    Level: beginner

537: .seealso: TSRosWSetType(), TS, TSROSW, TSRosWRegister()
538: J*/
539: typedef const char* TSRosWType;
540: #define TSROSW2M          "2m"
541: #define TSROSW2P          "2p"
542: #define TSROSWRA3PW       "ra3pw"
543: #define TSROSWRA34PW2     "ra34pw2"
544: #define TSROSWRODAS3      "rodas3"
545: #define TSROSWSANDU3      "sandu3"
546: #define TSROSWASSP3P3S1C  "assp3p3s1c"
547: #define TSROSWLASSP3P4S2C "lassp3p4s2c"
548: #define TSROSWLLSSP3P4S2C "llssp3p4s2c"
549: #define TSROSWARK3        "ark3"
550: #define TSROSWTHETA1      "theta1"
551: #define TSROSWTHETA2      "theta2"
552: #define TSROSWGRK4T       "grk4t"
553: #define TSROSWSHAMP4      "shamp4"
554: #define TSROSWVELDD4      "veldd4"
555: #define TSROSW4L          "4l"

557: PETSC_EXTERN PetscErrorCode TSRosWGetType(TS ts,TSRosWType*);
558: PETSC_EXTERN PetscErrorCode TSRosWSetType(TS ts,TSRosWType);
559: PETSC_EXTERN PetscErrorCode TSRosWSetRecomputeJacobian(TS,PetscBool);
560: PETSC_EXTERN PetscErrorCode TSRosWRegister(TSRosWType,PetscInt,PetscInt,const PetscReal[],const PetscReal[],const PetscReal[],const PetscReal[],PetscInt,const PetscReal[]);
561: PETSC_EXTERN PetscErrorCode TSRosWRegisterRos4(TSRosWType,PetscReal,PetscReal,PetscReal,PetscReal,PetscReal);
562: PETSC_EXTERN PetscErrorCode TSRosWFinalizePackage(void);
563: PETSC_EXTERN PetscErrorCode TSRosWInitializePackage(void);
564: PETSC_EXTERN PetscErrorCode TSRosWRegisterDestroy(void);
565: PETSC_EXTERN PetscErrorCode TSRosWRegisterAll(void);

567: /*
568:        PETSc interface to Sundials
569: */
570: #ifdef PETSC_HAVE_SUNDIALS
571: typedef enum { SUNDIALS_ADAMS=1,SUNDIALS_BDF=2} TSSundialsLmmType;
572: PETSC_EXTERN const char *const TSSundialsLmmTypes[];
573: typedef enum { SUNDIALS_MODIFIED_GS = 1,SUNDIALS_CLASSICAL_GS = 2 } TSSundialsGramSchmidtType;
574: PETSC_EXTERN const char *const TSSundialsGramSchmidtTypes[];
575: PETSC_EXTERN PetscErrorCode TSSundialsSetType(TS,TSSundialsLmmType);
576: PETSC_EXTERN PetscErrorCode TSSundialsGetPC(TS,PC*);
577: PETSC_EXTERN PetscErrorCode TSSundialsSetTolerance(TS,PetscReal,PetscReal);
578: PETSC_EXTERN PetscErrorCode TSSundialsSetMinTimeStep(TS,PetscReal);
579: PETSC_EXTERN PetscErrorCode TSSundialsSetMaxTimeStep(TS,PetscReal);
580: PETSC_EXTERN PetscErrorCode TSSundialsGetIterations(TS,PetscInt *,PetscInt *);
581: PETSC_EXTERN PetscErrorCode TSSundialsSetGramSchmidtType(TS,TSSundialsGramSchmidtType);
582: PETSC_EXTERN PetscErrorCode TSSundialsSetGMRESRestart(TS,PetscInt);
583: PETSC_EXTERN PetscErrorCode TSSundialsSetLinearTolerance(TS,PetscReal);
584: PETSC_EXTERN PetscErrorCode TSSundialsMonitorInternalSteps(TS,PetscBool );
585: PETSC_EXTERN PetscErrorCode TSSundialsGetParameters(TS,PetscInt *,long*[],double*[]);
586: PETSC_EXTERN PetscErrorCode TSSundialsSetMaxl(TS,PetscInt);
587: #endif

589: PETSC_EXTERN PetscErrorCode TSRKSetTolerance(TS,PetscReal);

591: PETSC_EXTERN PetscErrorCode TSThetaSetTheta(TS,PetscReal);
592: PETSC_EXTERN PetscErrorCode TSThetaGetTheta(TS,PetscReal*);
593: PETSC_EXTERN PetscErrorCode TSThetaGetEndpoint(TS,PetscBool*);
594: PETSC_EXTERN PetscErrorCode TSThetaSetEndpoint(TS,PetscBool);

596: PETSC_EXTERN PetscErrorCode TSAlphaSetAdapt(TS,PetscErrorCode(*)(TS,PetscReal,Vec,Vec,PetscReal*,PetscBool*,void*),void*);
597: PETSC_EXTERN PetscErrorCode TSAlphaAdaptDefault(TS,PetscReal,Vec,Vec,PetscReal*,PetscBool*,void*);
598: PETSC_EXTERN PetscErrorCode TSAlphaSetRadius(TS,PetscReal);
599: PETSC_EXTERN PetscErrorCode TSAlphaSetParams(TS,PetscReal,PetscReal,PetscReal);
600: PETSC_EXTERN PetscErrorCode TSAlphaGetParams(TS,PetscReal*,PetscReal*,PetscReal*);

602: PETSC_EXTERN PetscErrorCode TSSetDM(TS,DM);
603: PETSC_EXTERN PetscErrorCode TSGetDM(TS,DM*);

605: PETSC_EXTERN PetscErrorCode SNESTSFormFunction(SNES,Vec,Vec,void*);
606: PETSC_EXTERN PetscErrorCode SNESTSFormJacobian(SNES,Vec,Mat*,Mat*,MatStructure*,void*);

608: #endif