Date: 2013-07-02T14:51:59+00:00

Actual source code: petscts.h
petsc-3.4.2 2013-07-02

      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**);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    341: #define TS_FILE_CLASSID 1211225

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

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

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

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

    363:    Level: beginner

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

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

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

    382:    Level: beginner

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

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

    391:    Level: beginner

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

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

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

    424:    Level: beginner

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

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

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

    436:    Level: beginner

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

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

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

    460:    Level: beginner

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

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

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

    473:   Level: beginner

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

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

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

    491:    Level: beginner

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

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

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

    504:    Level: beginner

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

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

    534:    Level: beginner

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

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

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

    588: PETSC_EXTERN PetscErrorCode TSRKSetTolerance(TS,PetscReal);

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

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

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

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

    607: #endif