Actual source code: petscts.h

petsc-3.5.4 2015-05-23
Report Typos and Errors
  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_CONVERGED_EVENT          = 4,
 99:   TS_DIVERGED_NONLINEAR_SOLVE = -1,
100:   TS_DIVERGED_STEP_REJECTED   = -2
101: } TSConvergedReason;
102: PETSC_EXTERN const char *const*TSConvergedReasons;

104: /*MC
105:    TS_CONVERGED_ITERATING - this only occurs if TSGetConvergedReason() is called during the TSSolve()

107:    Level: beginner

109: .seealso: TSSolve(), TSGetConvergedReason(), TSGetAdapt()
110: M*/

112: /*MC
113:    TS_CONVERGED_TIME - the final time was reached

115:    Level: beginner

117: .seealso: TSSolve(), TSGetConvergedReason(), TSGetAdapt(), TSSetDuration(), TSGetSolveTime()
118: M*/

120: /*MC
121:    TS_CONVERGED_ITS - the maximum number of iterations (time-steps) was reached prior to the final time

123:    Level: beginner

125: .seealso: TSSolve(), TSGetConvergedReason(), TSGetAdapt(), TSSetDuration()
126: M*/

128: /*MC
129:    TS_CONVERGED_USER - user requested termination

131:    Level: beginner

133: .seealso: TSSolve(), TSGetConvergedReason(), TSSetConvergedReason(), TSSetDuration()
134: M*/

136: /*MC
137:    TS_CONVERGED_EVENT - user requested termination on event detection

139:    Level: beginner

141: .seealso: TSSolve(), TSGetConvergedReason(), TSSetConvergedReason(), TSSetDuration()
142: M*/

144: /*MC
145:    TS_DIVERGED_NONLINEAR_SOLVE - too many nonlinear solves failed

147:    Level: beginner

149:    Notes: See TSSetMaxSNESFailures() for how to allow more nonlinear solver failures.

151: .seealso: TSSolve(), TSGetConvergedReason(), TSGetAdapt(), TSGetSNES(), SNESGetConvergedReason(), TSSetMaxSNESFailures()
152: M*/

154: /*MC
155:    TS_DIVERGED_STEP_REJECTED - too many steps were rejected

157:    Level: beginner

159:    Notes: See TSSetMaxStepRejections() for how to allow more step rejections.

161: .seealso: TSSolve(), TSGetConvergedReason(), TSGetAdapt(), TSSetMaxStepRejections()
162: M*/

164: /*E
165:    TSExactFinalTimeOption - option for handling of final time step

167:    Level: beginner

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

171: $  TS_EXACTFINALTIME_STEPOVER    - Don't do anything if final time is exceeded
172: $  TS_EXACTFINALTIME_INTERPOLATE - Interpolate back to final time
173: $  TS_EXACTFINALTIME_MATCHSTEP - Adapt final time step to match the final time
174: .seealso: TSGetConvergedReason(), TSSetExactFinalTime()

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


181: /* Logging support */
182: PETSC_EXTERN PetscClassId TS_CLASSID;
183: PETSC_EXTERN PetscClassId DMTS_CLASSID;

185: PETSC_EXTERN PetscErrorCode TSInitializePackage(void);

187: PETSC_EXTERN PetscErrorCode TSCreate(MPI_Comm,TS*);
188: PETSC_EXTERN PetscErrorCode TSDestroy(TS*);

190: PETSC_EXTERN PetscErrorCode TSSetProblemType(TS,TSProblemType);
191: PETSC_EXTERN PetscErrorCode TSGetProblemType(TS,TSProblemType*);
192: PETSC_EXTERN PetscErrorCode TSMonitor(TS,PetscInt,PetscReal,Vec);
193: PETSC_EXTERN PetscErrorCode TSMonitorSet(TS,PetscErrorCode(*)(TS,PetscInt,PetscReal,Vec,void*),void *,PetscErrorCode (*)(void**));
194: PETSC_EXTERN PetscErrorCode TSMonitorCancel(TS);

196: PETSC_EXTERN PetscErrorCode TSSetOptionsPrefix(TS,const char[]);
197: PETSC_EXTERN PetscErrorCode TSAppendOptionsPrefix(TS,const char[]);
198: PETSC_EXTERN PetscErrorCode TSGetOptionsPrefix(TS,const char *[]);
199: PETSC_EXTERN PetscErrorCode TSSetFromOptions(TS);
200: PETSC_EXTERN PetscErrorCode TSSetUp(TS);
201: PETSC_EXTERN PetscErrorCode TSReset(TS);

203: PETSC_EXTERN PetscErrorCode TSSetSolution(TS,Vec);
204: PETSC_EXTERN PetscErrorCode TSGetSolution(TS,Vec*);

206: PETSC_EXTERN PetscErrorCode TSSetDuration(TS,PetscInt,PetscReal);
207: PETSC_EXTERN PetscErrorCode TSGetDuration(TS,PetscInt*,PetscReal*);
208: PETSC_EXTERN PetscErrorCode TSSetExactFinalTime(TS,TSExactFinalTimeOption);

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

212: typedef struct _n_TSMonitorDrawCtx*  TSMonitorDrawCtx;
213: PETSC_EXTERN PetscErrorCode TSMonitorDrawCtxCreate(MPI_Comm,const char[],const char[],int,int,int,int,PetscInt,TSMonitorDrawCtx *);
214: PETSC_EXTERN PetscErrorCode TSMonitorDrawCtxDestroy(TSMonitorDrawCtx*);
215: PETSC_EXTERN PetscErrorCode TSMonitorDrawSolution(TS,PetscInt,PetscReal,Vec,void*);
216: PETSC_EXTERN PetscErrorCode TSMonitorDrawSolutionPhase(TS,PetscInt,PetscReal,Vec,void*);
217: PETSC_EXTERN PetscErrorCode TSMonitorDrawError(TS,PetscInt,PetscReal,Vec,void*);

219: PETSC_EXTERN PetscErrorCode TSMonitorSolutionBinary(TS,PetscInt,PetscReal,Vec,void*);
220: PETSC_EXTERN PetscErrorCode TSMonitorSolutionVTK(TS,PetscInt,PetscReal,Vec,void*);
221: PETSC_EXTERN PetscErrorCode TSMonitorSolutionVTKDestroy(void*);

223: PETSC_EXTERN PetscErrorCode TSStep(TS);
224: PETSC_EXTERN PetscErrorCode TSEvaluateStep(TS,PetscInt,Vec,PetscBool*);
225: PETSC_EXTERN PetscErrorCode TSSolve(TS,Vec);
226: PETSC_EXTERN PetscErrorCode TSGetEquationType(TS,TSEquationType*);
227: PETSC_EXTERN PetscErrorCode TSSetEquationType(TS,TSEquationType);
228: PETSC_EXTERN PetscErrorCode TSGetConvergedReason(TS,TSConvergedReason*);
229: PETSC_EXTERN PetscErrorCode TSSetConvergedReason(TS,TSConvergedReason);
230: PETSC_EXTERN PetscErrorCode TSGetSolveTime(TS,PetscReal*);
231: PETSC_EXTERN PetscErrorCode TSGetSNESIterations(TS,PetscInt*);
232: PETSC_EXTERN PetscErrorCode TSGetKSPIterations(TS,PetscInt*);
233: PETSC_EXTERN PetscErrorCode TSGetStepRejections(TS,PetscInt*);
234: PETSC_EXTERN PetscErrorCode TSSetMaxStepRejections(TS,PetscInt);
235: PETSC_EXTERN PetscErrorCode TSGetSNESFailures(TS,PetscInt*);
236: PETSC_EXTERN PetscErrorCode TSSetMaxSNESFailures(TS,PetscInt);
237: PETSC_EXTERN PetscErrorCode TSSetErrorIfStepFails(TS,PetscBool);
238: PETSC_EXTERN PetscErrorCode TSRollBack(TS);

240: PETSC_EXTERN PetscErrorCode TSSetInitialTimeStep(TS,PetscReal,PetscReal);
241: PETSC_EXTERN PetscErrorCode TSGetTimeStep(TS,PetscReal*);
242: PETSC_EXTERN PetscErrorCode TSGetTime(TS,PetscReal*);
243: PETSC_EXTERN PetscErrorCode TSSetTime(TS,PetscReal);
244: PETSC_EXTERN PetscErrorCode TSGetTimeStepNumber(TS,PetscInt*);
245: PETSC_EXTERN PetscErrorCode TSSetTimeStep(TS,PetscReal);

247: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode (*TSRHSFunction)(TS,PetscReal,Vec,Vec,void*);
248: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode (*TSRHSJacobian)(TS,PetscReal,Vec,Mat,Mat,void*);
249: PETSC_EXTERN PetscErrorCode TSSetRHSFunction(TS,Vec,TSRHSFunction,void*);
250: PETSC_EXTERN PetscErrorCode TSGetRHSFunction(TS,Vec*,TSRHSFunction*,void**);
251: PETSC_EXTERN PetscErrorCode TSSetRHSJacobian(TS,Mat,Mat,TSRHSJacobian,void*);
252: PETSC_EXTERN PetscErrorCode TSGetRHSJacobian(TS,Mat*,Mat*,TSRHSJacobian*,void**);
253: PETSC_EXTERN PetscErrorCode TSRHSJacobianSetReuse(TS,PetscBool);

255: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode (*TSSolutionFunction)(TS,PetscReal,Vec,void*);
256: PETSC_EXTERN PetscErrorCode TSSetSolutionFunction(TS,TSSolutionFunction,void*);
257: PETSC_EXTERN PetscErrorCode TSSetForcingFunction(TS,PetscErrorCode (*)(TS,PetscReal,Vec,void*),void*);

259: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode (*TSIFunction)(TS,PetscReal,Vec,Vec,Vec,void*);
260: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode (*TSIJacobian)(TS,PetscReal,Vec,Vec,PetscReal,Mat,Mat,void*);
261: PETSC_EXTERN PetscErrorCode TSSetIFunction(TS,Vec,TSIFunction,void*);
262: PETSC_EXTERN PetscErrorCode TSGetIFunction(TS,Vec*,TSIFunction*,void**);
263: PETSC_EXTERN PetscErrorCode TSSetIJacobian(TS,Mat,Mat,TSIJacobian,void*);
264: PETSC_EXTERN PetscErrorCode TSGetIJacobian(TS,Mat*,Mat*,TSIJacobian*,void**);

266: PETSC_EXTERN PetscErrorCode TSComputeRHSFunctionLinear(TS,PetscReal,Vec,Vec,void*);
267: PETSC_EXTERN PetscErrorCode TSComputeRHSJacobianConstant(TS,PetscReal,Vec,Mat,Mat,void*);
268: PETSC_EXTERN PetscErrorCode TSComputeIFunctionLinear(TS,PetscReal,Vec,Vec,Vec,void*);
269: PETSC_EXTERN PetscErrorCode TSComputeIJacobianConstant(TS,PetscReal,Vec,Vec,PetscReal,Mat,Mat,void*);
270: PETSC_EXTERN PetscErrorCode TSComputeSolutionFunction(TS,PetscReal,Vec);
271: PETSC_EXTERN PetscErrorCode TSComputeForcingFunction(TS,PetscReal,Vec);

273: PETSC_EXTERN PetscErrorCode TSSetPreStep(TS, PetscErrorCode (*)(TS));
274: PETSC_EXTERN PetscErrorCode TSSetPreStage(TS, PetscErrorCode (*)(TS,PetscReal));
275: PETSC_EXTERN PetscErrorCode TSSetPostStage(TS, PetscErrorCode (*)(TS,PetscReal,PetscInt,Vec*));
276: PETSC_EXTERN PetscErrorCode TSSetPostStep(TS, PetscErrorCode (*)(TS));
277: PETSC_EXTERN PetscErrorCode TSPreStep(TS);
278: PETSC_EXTERN PetscErrorCode TSPreStage(TS,PetscReal);
279: PETSC_EXTERN PetscErrorCode TSPostStage(TS,PetscReal,PetscInt,Vec*);
280: PETSC_EXTERN PetscErrorCode TSPostStep(TS);
281: PETSC_EXTERN PetscErrorCode TSSetRetainStages(TS,PetscBool);
282: PETSC_EXTERN PetscErrorCode TSInterpolate(TS,PetscReal,Vec);
283: PETSC_EXTERN PetscErrorCode TSSetTolerances(TS,PetscReal,Vec,PetscReal,Vec);
284: PETSC_EXTERN PetscErrorCode TSGetTolerances(TS,PetscReal*,Vec*,PetscReal*,Vec*);
285: PETSC_EXTERN PetscErrorCode TSErrorNormWRMS(TS,Vec,PetscReal*);
286: PETSC_EXTERN PetscErrorCode TSSetCFLTimeLocal(TS,PetscReal);
287: PETSC_EXTERN PetscErrorCode TSGetCFLTime(TS,PetscReal*);

289: PETSC_EXTERN PetscErrorCode TSPseudoSetTimeStep(TS,PetscErrorCode(*)(TS,PetscReal*,void*),void*);
290: PETSC_EXTERN PetscErrorCode TSPseudoTimeStepDefault(TS,PetscReal*,void*);
291: PETSC_EXTERN PetscErrorCode TSPseudoComputeTimeStep(TS,PetscReal *);
292: PETSC_EXTERN PetscErrorCode TSPseudoSetMaxTimeStep(TS,PetscReal);

294: PETSC_EXTERN PetscErrorCode TSPseudoSetVerifyTimeStep(TS,PetscErrorCode(*)(TS,Vec,void*,PetscReal*,PetscBool *),void*);
295: PETSC_EXTERN PetscErrorCode TSPseudoVerifyTimeStepDefault(TS,Vec,void*,PetscReal*,PetscBool *);
296: PETSC_EXTERN PetscErrorCode TSPseudoVerifyTimeStep(TS,Vec,PetscReal*,PetscBool *);
297: PETSC_EXTERN PetscErrorCode TSPseudoSetTimeStepIncrement(TS,PetscReal);
298: PETSC_EXTERN PetscErrorCode TSPseudoIncrementDtFromInitialDt(TS);

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

302: PETSC_EXTERN PetscErrorCode TSComputeRHSFunction(TS,PetscReal,Vec,Vec);
303: PETSC_EXTERN PetscErrorCode TSComputeRHSJacobian(TS,PetscReal,Vec,Mat,Mat);
304: PETSC_EXTERN PetscErrorCode TSComputeIFunction(TS,PetscReal,Vec,Vec,Vec,PetscBool);
305: PETSC_EXTERN PetscErrorCode TSComputeIJacobian(TS,PetscReal,Vec,Vec,PetscReal,Mat,Mat,PetscBool);
306: PETSC_EXTERN PetscErrorCode TSComputeLinearStability(TS,PetscReal,PetscReal,PetscReal*,PetscReal*);

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

310: PETSC_EXTERN PetscErrorCode DMTSSetRHSFunction(DM,TSRHSFunction,void*);
311: PETSC_EXTERN PetscErrorCode DMTSGetRHSFunction(DM,TSRHSFunction*,void**);
312: PETSC_EXTERN PetscErrorCode DMTSSetRHSJacobian(DM,TSRHSJacobian,void*);
313: PETSC_EXTERN PetscErrorCode DMTSGetRHSJacobian(DM,TSRHSJacobian*,void**);
314: PETSC_EXTERN PetscErrorCode DMTSSetIFunction(DM,TSIFunction,void*);
315: PETSC_EXTERN PetscErrorCode DMTSGetIFunction(DM,TSIFunction*,void**);
316: PETSC_EXTERN PetscErrorCode DMTSSetIJacobian(DM,TSIJacobian,void*);
317: PETSC_EXTERN PetscErrorCode DMTSGetIJacobian(DM,TSIJacobian*,void**);
318: PETSC_EXTERN PetscErrorCode DMTSSetSolutionFunction(DM,TSSolutionFunction,void*);
319: PETSC_EXTERN PetscErrorCode DMTSGetSolutionFunction(DM,TSSolutionFunction*,void**);
320: PETSC_EXTERN PetscErrorCode DMTSSetForcingFunction(DM,PetscErrorCode (*)(TS,PetscReal,Vec,void*),void*);
321: PETSC_EXTERN PetscErrorCode DMTSGetForcingFunction(DM,PetscErrorCode (**)(TS,PetscReal,Vec,void*),void**);

323: PETSC_EXTERN PetscErrorCode DMTSSetIFunctionLocal(DM,PetscErrorCode (*)(DM,PetscReal,Vec,Vec,Vec,void*),void*);
324: PETSC_EXTERN PetscErrorCode DMTSSetIJacobianLocal(DM,PetscErrorCode (*)(DM,PetscReal,Vec,Vec,PetscReal,Mat,Mat,void*),void*);
325: PETSC_EXTERN PetscErrorCode DMTSSetRHSFunctionLocal(DM,PetscErrorCode (*)(DM,PetscReal,Vec,Vec,void*),void*);

327: PETSC_EXTERN PetscErrorCode DMTSSetIFunctionSerialize(DM,PetscErrorCode (*)(void*,PetscViewer),PetscErrorCode (*)(void**,PetscViewer));
328: PETSC_EXTERN PetscErrorCode DMTSSetIJacobianSerialize(DM,PetscErrorCode (*)(void*,PetscViewer),PetscErrorCode (*)(void**,PetscViewer));

330: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode (*DMDATSRHSFunctionLocal)(DMDALocalInfo*,PetscReal,void*,void*,void*);
331: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode (*DMDATSRHSJacobianLocal)(DMDALocalInfo*,PetscReal,void*,Mat,Mat,void*);
332: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode (*DMDATSIFunctionLocal)(DMDALocalInfo*,PetscReal,void*,void*,void*,void*);
333: PETSC_EXTERN_TYPEDEF typedef PetscErrorCode (*DMDATSIJacobianLocal)(DMDALocalInfo*,PetscReal,void*,void*,PetscReal,Mat,Mat,void*);

335: PETSC_EXTERN PetscErrorCode DMDATSSetRHSFunctionLocal(DM,InsertMode,PetscErrorCode (*)(DMDALocalInfo*,PetscReal,void*,void*,void*),void *);
336: PETSC_EXTERN PetscErrorCode DMDATSSetRHSJacobianLocal(DM,PetscErrorCode (*)(DMDALocalInfo*,PetscReal,void*,Mat,Mat,void*),void *);
337: PETSC_EXTERN PetscErrorCode DMDATSSetIFunctionLocal(DM,InsertMode,PetscErrorCode (*)(DMDALocalInfo*,PetscReal,void*,void*,void*,void*),void *);
338: PETSC_EXTERN PetscErrorCode DMDATSSetIJacobianLocal(DM,PetscErrorCode (*)(DMDALocalInfo*,PetscReal,void*,void*,PetscReal,Mat,Mat,void*),void *);

340: PETSC_EXTERN PetscErrorCode DMPlexTSGetGeometry(DM, Vec *, Vec *, PetscReal *);
341: PETSC_EXTERN PetscErrorCode TSComputeRHSFunctionLocalDMPlex(DM, PetscReal, Vec, Vec, void *);
342: PETSC_EXTERN PetscErrorCode DMPlexTSSetRHSFunctionLocal(DM, void (*)(const PetscReal[], const PetscReal[], const PetscScalar[], const PetscScalar[], PetscScalar[], void *), void *);

344: typedef struct _n_TSMonitorLGCtx*  TSMonitorLGCtx;
345: typedef struct {
346:   Vec            ray;
347:   VecScatter     scatter;
348:   PetscViewer    viewer;
349:   TSMonitorLGCtx lgctx;
350: } TSMonitorDMDARayCtx;
351: PETSC_EXTERN PetscErrorCode TSMonitorDMDARayDestroy(void**);
352: PETSC_EXTERN PetscErrorCode TSMonitorDMDARay(TS,PetscInt,PetscReal,Vec,void*);
353: PETSC_EXTERN PetscErrorCode TSMonitorLGDMDARay(TS,PetscInt,PetscReal,Vec,void*);


356: /* Dynamic creation and loading functions */
357: PETSC_EXTERN PetscFunctionList TSList;
358: PETSC_EXTERN PetscBool         TSRegisterAllCalled;
359: PETSC_EXTERN PetscErrorCode TSGetType(TS,TSType*);
360: PETSC_EXTERN PetscErrorCode TSSetType(TS,TSType);
361: PETSC_EXTERN PetscErrorCode TSRegister(const char[], PetscErrorCode (*)(TS));
362: PETSC_EXTERN PetscErrorCode TSRegisterAll(void);

364: PETSC_EXTERN PetscErrorCode TSGetSNES(TS,SNES*);
365: PETSC_EXTERN PetscErrorCode TSSetSNES(TS,SNES);
366: PETSC_EXTERN PetscErrorCode TSGetKSP(TS,KSP*);

368: PETSC_EXTERN PetscErrorCode TSView(TS,PetscViewer);
369: PETSC_EXTERN PetscErrorCode TSLoad(TS,PetscViewer);
370: PETSC_STATIC_INLINE PetscErrorCode TSViewFromOptions(TS A,const char prefix[],const char name[]) {return PetscObjectViewFromOptions((PetscObject)A,prefix,name);}

372: #define TS_FILE_CLASSID 1211225

374: PETSC_EXTERN PetscErrorCode TSSetApplicationContext(TS,void *);
375: PETSC_EXTERN PetscErrorCode TSGetApplicationContext(TS,void *);

377: PETSC_EXTERN PetscErrorCode TSMonitorLGCtxCreate(MPI_Comm,const char[],const char[],int,int,int,int,PetscInt,TSMonitorLGCtx *);
378: PETSC_EXTERN PetscErrorCode TSMonitorLGCtxDestroy(TSMonitorLGCtx*);
379: PETSC_EXTERN PetscErrorCode TSMonitorLGTimeStep(TS,PetscInt,PetscReal,Vec,void *);
380: PETSC_EXTERN PetscErrorCode TSMonitorLGSolution(TS,PetscInt,PetscReal,Vec,void *);
381: PETSC_EXTERN PetscErrorCode TSMonitorLGError(TS,PetscInt,PetscReal,Vec,void *);
382: PETSC_EXTERN PetscErrorCode TSMonitorLGSNESIterations(TS,PetscInt,PetscReal,Vec,void *);
383: PETSC_EXTERN PetscErrorCode TSMonitorLGKSPIterations(TS,PetscInt,PetscReal,Vec,void *);

385: typedef struct _n_TSMonitorSPEigCtx*  TSMonitorSPEigCtx;
386: PETSC_EXTERN PetscErrorCode TSMonitorSPEigCtxCreate(MPI_Comm,const char[],const char[],int,int,int,int,PetscInt,TSMonitorSPEigCtx *);
387: PETSC_EXTERN PetscErrorCode TSMonitorSPEigCtxDestroy(TSMonitorSPEigCtx*);
388: PETSC_EXTERN PetscErrorCode TSMonitorSPEig(TS,PetscInt,PetscReal,Vec,void *);

390: PETSC_EXTERN PetscErrorCode TSSetEventMonitor(TS,PetscInt,PetscInt*,PetscBool*,PetscErrorCode (*)(TS,PetscReal,Vec,PetscScalar*,void*),PetscErrorCode (*)(TS,PetscInt,PetscInt[],PetscReal,Vec,void*),void*);
391: /*J
392:    TSSSPType - string with the name of TSSSP scheme.

394:    Level: beginner

396: .seealso: TSSSPSetType(), TS
397: J*/
398: typedef const char* TSSSPType;
399: #define TSSSPRKS2  "rks2"
400: #define TSSSPRKS3  "rks3"
401: #define TSSSPRK104 "rk104"

403: PETSC_EXTERN PetscErrorCode TSSSPSetType(TS,TSSSPType);
404: PETSC_EXTERN PetscErrorCode TSSSPGetType(TS,TSSSPType*);
405: PETSC_EXTERN PetscErrorCode TSSSPSetNumStages(TS,PetscInt);
406: PETSC_EXTERN PetscErrorCode TSSSPGetNumStages(TS,PetscInt*);
407: PETSC_EXTERN PetscErrorCode TSSSPFinalizePackage(void);
408: PETSC_EXTERN PetscErrorCode TSSSPInitializePackage(void);

410: /*S
411:    TSAdapt - Abstract object that manages time-step adaptivity

413:    Level: beginner

415: .seealso: TS, TSAdaptCreate(), TSAdaptType
416: S*/
417: typedef struct _p_TSAdapt *TSAdapt;

419: /*E
420:     TSAdaptType - String with the name of TSAdapt scheme.

422:    Level: beginner

424: .seealso: TSAdaptSetType(), TS
425: E*/
426: typedef const char *TSAdaptType;
427: #define TSADAPTBASIC "basic"
428: #define TSADAPTNONE  "none"
429: #define TSADAPTCFL   "cfl"

431: PETSC_EXTERN PetscErrorCode TSGetAdapt(TS,TSAdapt*);
432: PETSC_EXTERN PetscErrorCode TSAdaptRegister(const char[],PetscErrorCode (*)(TSAdapt));
433: PETSC_EXTERN PetscErrorCode TSAdaptRegisterAll(void);
434: PETSC_EXTERN PetscErrorCode TSAdaptInitializePackage(void);
435: PETSC_EXTERN PetscErrorCode TSAdaptFinalizePackage(void);
436: PETSC_EXTERN PetscErrorCode TSAdaptCreate(MPI_Comm,TSAdapt*);
437: PETSC_EXTERN PetscErrorCode TSAdaptSetType(TSAdapt,TSAdaptType);
438: PETSC_EXTERN PetscErrorCode TSAdaptSetOptionsPrefix(TSAdapt,const char[]);
439: PETSC_EXTERN PetscErrorCode TSAdaptCandidatesClear(TSAdapt);
440: PETSC_EXTERN PetscErrorCode TSAdaptCandidateAdd(TSAdapt,const char[],PetscInt,PetscInt,PetscReal,PetscReal,PetscBool);
441: PETSC_EXTERN PetscErrorCode TSAdaptCandidatesGet(TSAdapt,PetscInt*,const PetscInt**,const PetscInt**,const PetscReal**,const PetscReal**);
442: PETSC_EXTERN PetscErrorCode TSAdaptChoose(TSAdapt,TS,PetscReal,PetscInt*,PetscReal*,PetscBool*);
443: PETSC_EXTERN PetscErrorCode TSAdaptCheckStage(TSAdapt,TS,PetscBool*);
444: PETSC_EXTERN PetscErrorCode TSAdaptView(TSAdapt,PetscViewer);
445: PETSC_EXTERN PetscErrorCode TSAdaptLoad(TSAdapt,PetscViewer);
446: PETSC_EXTERN PetscErrorCode TSAdaptSetFromOptions(TSAdapt);
447: PETSC_EXTERN PetscErrorCode TSAdaptDestroy(TSAdapt*);
448: PETSC_EXTERN PetscErrorCode TSAdaptSetMonitor(TSAdapt,PetscBool);
449: PETSC_EXTERN PetscErrorCode TSAdaptSetStepLimits(TSAdapt,PetscReal,PetscReal);
450: PETSC_EXTERN PetscErrorCode TSAdaptSetCheckStage(TSAdapt,PetscErrorCode(*)(TSAdapt,TS,PetscBool*));

452: /*S
453:    TSGLAdapt - Abstract object that manages time-step adaptivity

455:    Level: beginner

457:    Developer Notes:
458:    This functionality should be replaced by the TSAdapt.

460: .seealso: TSGL, TSGLAdaptCreate(), TSGLAdaptType
461: S*/
462: typedef struct _p_TSGLAdapt *TSGLAdapt;

464: /*J
465:     TSGLAdaptType - String with the name of TSGLAdapt scheme

467:    Level: beginner

469: .seealso: TSGLAdaptSetType(), TS
470: J*/
471: typedef const char *TSGLAdaptType;
472: #define TSGLADAPT_NONE "none"
473: #define TSGLADAPT_SIZE "size"
474: #define TSGLADAPT_BOTH "both"

476: PETSC_EXTERN PetscErrorCode TSGLAdaptRegister(const char[],PetscErrorCode (*)(TSGLAdapt));
477: PETSC_EXTERN PetscErrorCode TSGLAdaptRegisterAll(void);
478: PETSC_EXTERN PetscErrorCode TSGLAdaptInitializePackage(void);
479: PETSC_EXTERN PetscErrorCode TSGLAdaptFinalizePackage(void);
480: PETSC_EXTERN PetscErrorCode TSGLAdaptCreate(MPI_Comm,TSGLAdapt*);
481: PETSC_EXTERN PetscErrorCode TSGLAdaptSetType(TSGLAdapt,TSGLAdaptType);
482: PETSC_EXTERN PetscErrorCode TSGLAdaptSetOptionsPrefix(TSGLAdapt,const char[]);
483: PETSC_EXTERN PetscErrorCode TSGLAdaptChoose(TSGLAdapt,PetscInt,const PetscInt[],const PetscReal[],const PetscReal[],PetscInt,PetscReal,PetscReal,PetscInt*,PetscReal*,PetscBool *);
484: PETSC_EXTERN PetscErrorCode TSGLAdaptView(TSGLAdapt,PetscViewer);
485: PETSC_EXTERN PetscErrorCode TSGLAdaptSetFromOptions(TSGLAdapt);
486: PETSC_EXTERN PetscErrorCode TSGLAdaptDestroy(TSGLAdapt*);

488: /*J
489:     TSGLAcceptType - String with the name of TSGLAccept scheme

491:    Level: beginner

493: .seealso: TSGLSetAcceptType(), TS
494: J*/
495: typedef const char *TSGLAcceptType;
496: #define TSGLACCEPT_ALWAYS "always"

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

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

504:   Level: beginner

506: .seealso: TSGLSetType(), TSGLRegister()
507: J*/
508: typedef const char* TSGLType;
509: #define TSGL_IRKS   "irks"

511: PETSC_EXTERN PetscErrorCode TSGLRegister(const char[],PetscErrorCode(*)(TS));
512: PETSC_EXTERN PetscErrorCode TSGLRegisterAll(void);
513: PETSC_EXTERN PetscErrorCode TSGLInitializePackage(void);
514: PETSC_EXTERN PetscErrorCode TSGLFinalizePackage(void);
515: PETSC_EXTERN PetscErrorCode TSGLSetType(TS,TSGLType);
516: PETSC_EXTERN PetscErrorCode TSGLGetAdapt(TS,TSGLAdapt*);
517: PETSC_EXTERN PetscErrorCode TSGLSetAcceptType(TS,TSGLAcceptType);

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

522:    Level: beginner

524: .seealso: TSEIMEXSetType(), TS, TSEIMEX, TSEIMEXRegister()
525: J*/
526: #define TSEIMEXType   char*

528: PETSC_EXTERN PetscErrorCode TSEIMEXSetMaxRows(TS ts,PetscInt);
529: PETSC_EXTERN PetscErrorCode TSEIMEXSetRowCol(TS ts,PetscInt,PetscInt);
530: PETSC_EXTERN PetscErrorCode TSEIMEXSetOrdAdapt(TS,PetscBool);

532: /*J
533:     TSRKType - String with the name of a Runge-Kutta method.

535:    Level: beginner

537: .seealso: TSRKSetType(), TS, TSRK, TSRKRegister()
538: J*/
539: typedef const char* TSRKType;
540: #define TSRK1FE   "1fe"
541: #define TSRK2A    "2a"
542: #define TSRK3     "3"
543: #define TSRK3BS   "3bs"
544: #define TSRK4     "4"
545: #define TSRK5F    "5f"
546: #define TSRK5DP   "5dp"
547: PETSC_EXTERN PetscErrorCode TSRKGetType(TS ts,TSRKType*);
548: PETSC_EXTERN PetscErrorCode TSRKSetType(TS ts,TSRKType);
549: PETSC_EXTERN PetscErrorCode TSRKSetFullyImplicit(TS,PetscBool);
550: PETSC_EXTERN PetscErrorCode TSRKRegister(TSRKType,PetscInt,PetscInt,const PetscReal[],const PetscReal[],const PetscReal[],const PetscReal[],PetscInt,const PetscReal[]);
551: PETSC_EXTERN PetscErrorCode TSRKFinalizePackage(void);
552: PETSC_EXTERN PetscErrorCode TSRKInitializePackage(void);
553: PETSC_EXTERN PetscErrorCode TSRKRegisterDestroy(void);
554: PETSC_EXTERN PetscErrorCode TSRKRegisterAll(void);

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

559:    Level: beginner

561: .seealso: TSARKIMEXSetType(), TS, TSARKIMEX, TSARKIMEXRegister()
562: J*/
563: typedef const char* TSARKIMEXType;
564: #define TSARKIMEX1BEE   "1bee"
565: #define TSARKIMEXA2     "a2"
566: #define TSARKIMEXL2     "l2"
567: #define TSARKIMEXARS122 "ars122"
568: #define TSARKIMEX2C     "2c"
569: #define TSARKIMEX2D     "2d"
570: #define TSARKIMEX2E     "2e"
571: #define TSARKIMEXPRSSP2 "prssp2"
572: #define TSARKIMEX3      "3"
573: #define TSARKIMEXBPR3   "bpr3"
574: #define TSARKIMEXARS443 "ars443"
575: #define TSARKIMEX4      "4"
576: #define TSARKIMEX5      "5"
577: PETSC_EXTERN PetscErrorCode TSARKIMEXGetType(TS ts,TSARKIMEXType*);
578: PETSC_EXTERN PetscErrorCode TSARKIMEXSetType(TS ts,TSARKIMEXType);
579: PETSC_EXTERN PetscErrorCode TSARKIMEXSetFullyImplicit(TS,PetscBool);
580: 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[]);
581: PETSC_EXTERN PetscErrorCode TSARKIMEXFinalizePackage(void);
582: PETSC_EXTERN PetscErrorCode TSARKIMEXInitializePackage(void);
583: PETSC_EXTERN PetscErrorCode TSARKIMEXRegisterDestroy(void);
584: PETSC_EXTERN PetscErrorCode TSARKIMEXRegisterAll(void);

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

589:    Level: beginner

591: .seealso: TSRosWSetType(), TS, TSROSW, TSRosWRegister()
592: J*/
593: typedef const char* TSRosWType;
594: #define TSROSW2M          "2m"
595: #define TSROSW2P          "2p"
596: #define TSROSWRA3PW       "ra3pw"
597: #define TSROSWRA34PW2     "ra34pw2"
598: #define TSROSWRODAS3      "rodas3"
599: #define TSROSWSANDU3      "sandu3"
600: #define TSROSWASSP3P3S1C  "assp3p3s1c"
601: #define TSROSWLASSP3P4S2C "lassp3p4s2c"
602: #define TSROSWLLSSP3P4S2C "llssp3p4s2c"
603: #define TSROSWARK3        "ark3"
604: #define TSROSWTHETA1      "theta1"
605: #define TSROSWTHETA2      "theta2"
606: #define TSROSWGRK4T       "grk4t"
607: #define TSROSWSHAMP4      "shamp4"
608: #define TSROSWVELDD4      "veldd4"
609: #define TSROSW4L          "4l"

611: PETSC_EXTERN PetscErrorCode TSRosWGetType(TS ts,TSRosWType*);
612: PETSC_EXTERN PetscErrorCode TSRosWSetType(TS ts,TSRosWType);
613: PETSC_EXTERN PetscErrorCode TSRosWSetRecomputeJacobian(TS,PetscBool);
614: PETSC_EXTERN PetscErrorCode TSRosWRegister(TSRosWType,PetscInt,PetscInt,const PetscReal[],const PetscReal[],const PetscReal[],const PetscReal[],PetscInt,const PetscReal[]);
615: PETSC_EXTERN PetscErrorCode TSRosWRegisterRos4(TSRosWType,PetscReal,PetscReal,PetscReal,PetscReal,PetscReal);
616: PETSC_EXTERN PetscErrorCode TSRosWFinalizePackage(void);
617: PETSC_EXTERN PetscErrorCode TSRosWInitializePackage(void);
618: PETSC_EXTERN PetscErrorCode TSRosWRegisterDestroy(void);
619: PETSC_EXTERN PetscErrorCode TSRosWRegisterAll(void);

621: /*
622:        PETSc interface to Sundials
623: */
624: #ifdef PETSC_HAVE_SUNDIALS
625: typedef enum { SUNDIALS_ADAMS=1,SUNDIALS_BDF=2} TSSundialsLmmType;
626: PETSC_EXTERN const char *const TSSundialsLmmTypes[];
627: typedef enum { SUNDIALS_MODIFIED_GS = 1,SUNDIALS_CLASSICAL_GS = 2 } TSSundialsGramSchmidtType;
628: PETSC_EXTERN const char *const TSSundialsGramSchmidtTypes[];
629: PETSC_EXTERN PetscErrorCode TSSundialsSetType(TS,TSSundialsLmmType);
630: PETSC_EXTERN PetscErrorCode TSSundialsGetPC(TS,PC*);
631: PETSC_EXTERN PetscErrorCode TSSundialsSetTolerance(TS,PetscReal,PetscReal);
632: PETSC_EXTERN PetscErrorCode TSSundialsSetMinTimeStep(TS,PetscReal);
633: PETSC_EXTERN PetscErrorCode TSSundialsSetMaxTimeStep(TS,PetscReal);
634: PETSC_EXTERN PetscErrorCode TSSundialsGetIterations(TS,PetscInt *,PetscInt *);
635: PETSC_EXTERN PetscErrorCode TSSundialsSetGramSchmidtType(TS,TSSundialsGramSchmidtType);
636: PETSC_EXTERN PetscErrorCode TSSundialsSetGMRESRestart(TS,PetscInt);
637: PETSC_EXTERN PetscErrorCode TSSundialsSetLinearTolerance(TS,PetscReal);
638: PETSC_EXTERN PetscErrorCode TSSundialsMonitorInternalSteps(TS,PetscBool );
639: PETSC_EXTERN PetscErrorCode TSSundialsGetParameters(TS,PetscInt *,long*[],double*[]);
640: PETSC_EXTERN PetscErrorCode TSSundialsSetMaxl(TS,PetscInt);
641: #endif

643: PETSC_EXTERN PetscErrorCode TSThetaSetTheta(TS,PetscReal);
644: PETSC_EXTERN PetscErrorCode TSThetaGetTheta(TS,PetscReal*);
645: PETSC_EXTERN PetscErrorCode TSThetaGetEndpoint(TS,PetscBool*);
646: PETSC_EXTERN PetscErrorCode TSThetaSetEndpoint(TS,PetscBool);

648: PETSC_EXTERN PetscErrorCode TSAlphaSetAdapt(TS,PetscErrorCode(*)(TS,PetscReal,Vec,Vec,PetscReal*,PetscBool*,void*),void*);
649: PETSC_EXTERN PetscErrorCode TSAlphaAdaptDefault(TS,PetscReal,Vec,Vec,PetscReal*,PetscBool*,void*);
650: PETSC_EXTERN PetscErrorCode TSAlphaSetRadius(TS,PetscReal);
651: PETSC_EXTERN PetscErrorCode TSAlphaSetParams(TS,PetscReal,PetscReal,PetscReal);
652: PETSC_EXTERN PetscErrorCode TSAlphaGetParams(TS,PetscReal*,PetscReal*,PetscReal*);

654: PETSC_EXTERN PetscErrorCode TSSetDM(TS,DM);
655: PETSC_EXTERN PetscErrorCode TSGetDM(TS,DM*);

657: PETSC_EXTERN PetscErrorCode SNESTSFormFunction(SNES,Vec,Vec,void*);
658: PETSC_EXTERN PetscErrorCode SNESTSFormJacobian(SNES,Vec,Mat,Mat,void*);

660: #endif