xref: /petsc/include/petscts.h (revision d5ba7fb7d3f82433fc93946f26018f4b1c7683c8)
173f4d377SMatthew Knepley /* $Id: petscts.h,v 1.47 2001/08/06 15:42:42 bsmith Exp $ */
2818ad0c1SBarry Smith /*
3f64a0f93SLois Curfman McInnes    User interface for the timestepping package. This is package
4f64a0f93SLois Curfman McInnes    is for use in solving time-dependent PDEs.
5818ad0c1SBarry Smith */
60a835dfdSSatish Balay #if !defined(__PETSCTS_H)
70a835dfdSSatish Balay #define __PETSCTS_H
80a835dfdSSatish Balay #include "petscsnes.h"
9818ad0c1SBarry Smith 
10435da068SBarry Smith /*S
11435da068SBarry Smith      TS - Abstract PETSc object that manages all time-steppers (ODE integrators)
12435da068SBarry Smith 
13435da068SBarry Smith    Level: beginner
14435da068SBarry Smith 
15435da068SBarry Smith   Concepts: ODE solvers
16435da068SBarry Smith 
17435da068SBarry Smith .seealso:  TSCreate(), TSSetType(), TSType, SNES, SLES, KSP, PC
18435da068SBarry Smith S*/
19f09e8eb9SSatish Balay typedef struct _p_TS* TS;
20435da068SBarry Smith 
21435da068SBarry Smith /*E
22435da068SBarry Smith     TSType - String with the name of a PETSc TS method or the creation function
23435da068SBarry Smith        with an optional dynamic library name, for example
24435da068SBarry Smith        http://www.mcs.anl.gov/petsc/lib.a:mytscreate()
25435da068SBarry Smith 
26435da068SBarry Smith    Level: beginner
27435da068SBarry Smith 
28435da068SBarry Smith .seealso: TSSetType(), TS
29435da068SBarry Smith E*/
3082bf6240SBarry Smith #define TS_EULER           "euler"
3182bf6240SBarry Smith #define TS_BEULER          "beuler"
3282bf6240SBarry Smith #define TS_PSEUDO          "pseudo"
3367d5d79cSLois Curfman McInnes #define TS_CRANK_NICHOLSON "crank-nicholson"
3482bf6240SBarry Smith #define TS_PVODE           "pvode"
3582bf6240SBarry Smith typedef char *TSType;
3682bf6240SBarry Smith 
37000e7ae3SMatthew Knepley #define TS_SER_BEULER_BINARY "beuler_binary"
38000e7ae3SMatthew Knepley typedef char *TSSerializeType;
39000e7ae3SMatthew Knepley 
40435da068SBarry Smith /*E
41435da068SBarry Smith     TSProblemType - Determines the type of problem this TS object is to be used to solve
42435da068SBarry Smith 
43435da068SBarry Smith    Level: beginner
44435da068SBarry Smith 
45435da068SBarry Smith .seealso: TSCreate()
46435da068SBarry Smith E*/
4719bcc07fSBarry Smith typedef enum {TS_LINEAR,TS_NONLINEAR} TSProblemType;
48818ad0c1SBarry Smith 
49000e7ae3SMatthew Knepley /* Logging support */
50000e7ae3SMatthew Knepley extern int TS_COOKIE;
51*d5ba7fb7SMatthew Knepley extern int TS_Step, TS_PseudoComputeTimeStep, TS_FunctionEval, TS_JacobianEval;
52000e7ae3SMatthew Knepley 
538ba1e511SMatthew Knepley EXTERN int TSInitializePackage(char *);
548ba1e511SMatthew Knepley 
55ca44d042SBarry Smith EXTERN int TSCreate(MPI_Comm,TSProblemType,TS*);
56ca44d042SBarry Smith EXTERN int TSSetType(TS,TSType);
57ca44d042SBarry Smith EXTERN int TSGetProblemType(TS,TSProblemType*);
58ca44d042SBarry Smith EXTERN int TSDestroy(TS);
59818ad0c1SBarry Smith 
6019dc493eSBarry Smith EXTERN int TSSetMonitor(TS,int(*)(TS,int,PetscReal,Vec,void*),void *,int (*)(void*));
61ca44d042SBarry Smith EXTERN int TSClearMonitor(TS);
62ca44d042SBarry Smith EXTERN int TSGetType(TS,TSType*);
63818ad0c1SBarry Smith 
64ca44d042SBarry Smith EXTERN int TSSetOptionsPrefix(TS,char *);
65ca44d042SBarry Smith EXTERN int TSAppendOptionsPrefix(TS,char *);
66ca44d042SBarry Smith EXTERN int TSGetOptionsPrefix(TS,char **);
67ca44d042SBarry Smith EXTERN int TSSetFromOptions(TS);
68ca44d042SBarry Smith EXTERN int TSSetUp(TS);
69818ad0c1SBarry Smith 
70ca44d042SBarry Smith EXTERN int TSSetSolution(TS,Vec);
71ca44d042SBarry Smith EXTERN int TSGetSolution(TS,Vec*);
72818ad0c1SBarry Smith 
7319dc493eSBarry Smith EXTERN int TSSetDuration(TS,int,PetscReal);
74818ad0c1SBarry Smith 
7519dc493eSBarry Smith EXTERN int TSDefaultMonitor(TS,int,PetscReal,Vec,void*);
7619dc493eSBarry Smith EXTERN int TSVecViewMonitor(TS,int,PetscReal,Vec,void*);
7719dc493eSBarry Smith EXTERN int TSStep(TS,int *,PetscReal*);
78818ad0c1SBarry Smith 
7919dc493eSBarry Smith EXTERN int TSSetInitialTimeStep(TS,PetscReal,PetscReal);
8019dc493eSBarry Smith EXTERN int TSGetTimeStep(TS,PetscReal*);
8119dc493eSBarry Smith EXTERN int TSGetTime(TS,PetscReal*);
82ca44d042SBarry Smith EXTERN int TSGetTimeStepNumber(TS,int*);
8319dc493eSBarry Smith EXTERN int TSSetTimeStep(TS,PetscReal);
84818ad0c1SBarry Smith 
8519dc493eSBarry Smith EXTERN int TSSetRHSFunction(TS,int (*)(TS,PetscReal,Vec,Vec,void*),void*);
8619dc493eSBarry Smith EXTERN int TSSetRHSMatrix(TS,Mat,Mat,int (*)(TS,PetscReal,Mat*,Mat*,MatStructure*,void*),void*);
8719dc493eSBarry Smith EXTERN int TSSetRHSJacobian(TS,Mat,Mat,int(*)(TS,PetscReal,Vec,Mat*,Mat*,MatStructure*,void*),void*);
8819dc493eSBarry Smith EXTERN int TSSetRHSBoundaryConditions(TS,int (*)(TS,PetscReal,Vec,void*),void*);
89818ad0c1SBarry Smith 
9019dc493eSBarry Smith EXTERN int TSDefaultComputeJacobianColor(TS,PetscReal,Vec,Mat*,Mat*,MatStructure*,void*);
9119dc493eSBarry Smith EXTERN int TSDefaultComputeJacobian(TS,PetscReal,Vec,Mat*,Mat*,MatStructure*,void*);
92e34be4c2SBarry Smith 
93ca44d042SBarry Smith EXTERN int TSGetRHSMatrix(TS,Mat*,Mat*,void**);
94ca44d042SBarry Smith EXTERN int TSGetRHSJacobian(TS,Mat*,Mat*,void**);
95d4bb536fSBarry Smith 
96000e7ae3SMatthew Knepley extern int TSSetRhsBC(TS, int (*)(TS, Vec, void *));
97000e7ae3SMatthew Knepley extern int TSSetSystemMatrixBC(TS, int (*)(TS, Mat, Mat, void *));
98000e7ae3SMatthew Knepley extern int TSSetSolutionBC(TS, int (*)(TS, Vec, void *));
99000e7ae3SMatthew Knepley extern int TSSetPreStep(TS, int (*)(TS));
100000e7ae3SMatthew Knepley extern int TSSetUpdate(TS, int (*)(TS, double, double *));
101000e7ae3SMatthew Knepley extern int TSSetPostStep(TS, int (*)(TS));
102000e7ae3SMatthew Knepley extern int TSDefaultRhsBC(TS, Vec, void *);
103000e7ae3SMatthew Knepley extern int TSDefaultSystemMatrixBC(TS, Mat, Mat, void *);
104000e7ae3SMatthew Knepley extern int TSDefaultSolutionBC(TS, Vec, void *);
105000e7ae3SMatthew Knepley extern int TSDefaultPreStep(TS);
106000e7ae3SMatthew Knepley extern int TSDefaultUpdate(TS, double, double *);
107000e7ae3SMatthew Knepley extern int TSDefaultPostStep(TS);
108000e7ae3SMatthew Knepley extern int TSSetIdentity(TS, int (*)(TS, double, Mat *, void *));
109000e7ae3SMatthew Knepley 
11019dc493eSBarry Smith EXTERN int TSPseudoSetTimeStep(TS,int(*)(TS,PetscReal*,void*),void*);
11119dc493eSBarry Smith EXTERN int TSPseudoDefaultTimeStep(TS,PetscReal*,void*);
11219dc493eSBarry Smith EXTERN int TSPseudoComputeTimeStep(TS,PetscReal *);
113d8345c25SBarry Smith 
11419dc493eSBarry Smith EXTERN int TSPseudoSetVerifyTimeStep(TS,int(*)(TS,Vec,void*,PetscReal*,int*),void*);
11519dc493eSBarry Smith EXTERN int TSPseudoDefaultVerifyTimeStep(TS,Vec,void*,PetscReal*,int*);
11619dc493eSBarry Smith EXTERN int TSPseudoVerifyTimeStep(TS,Vec,PetscReal*,int*);
11719dc493eSBarry Smith EXTERN int TSPseudoSetTimeStepIncrement(TS,PetscReal);
118ca44d042SBarry Smith EXTERN int TSPseudoIncrementDtFromInitialDt(TS);
11921c89e3eSBarry Smith 
12019dc493eSBarry Smith EXTERN int TSComputeRHSFunction(TS,PetscReal,Vec,Vec);
12119dc493eSBarry Smith EXTERN int TSComputeRHSBoundaryConditions(TS,PetscReal,Vec);
12219dc493eSBarry Smith EXTERN int TSComputeRHSJacobian(TS,PetscReal,Vec,Mat*,Mat*,MatStructure*);
123818ad0c1SBarry Smith 
124b0a32e0cSBarry Smith extern PetscFList      TSList;
125ca44d042SBarry Smith EXTERN int        TSRegisterAll(char*);
126ca44d042SBarry Smith EXTERN int        TSRegisterDestroy(void);
1272bad1931SBarry Smith extern PetscTruth TSRegisterAllCalled;
128818ad0c1SBarry Smith 
129000e7ae3SMatthew Knepley EXTERN int TSRegister(const char[], const char[], const char[], int (*)(TS));
130000e7ae3SMatthew Knepley extern int TSSerializeRegister(const char [], const char [], const char [], int (*)(MPI_Comm, TS *, PetscViewer, PetscTruth));
131aa482453SBarry Smith #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
132f1af5d2fSBarry Smith #define TSRegisterDynamic(a,b,c,d) TSRegister(a,b,c,0)
133000e7ae3SMatthew Knepley #define TSSerializeRegisterDynamic(a,b,c,d) TSSerializeRegister(a,b,c,0)
1346df38c32SLois Curfman McInnes #else
135f1af5d2fSBarry Smith #define TSRegisterDynamic(a,b,c,d) TSRegister(a,b,c,d)
136000e7ae3SMatthew Knepley #define TSSerializeRegisterDynamic(a,b,c,d) TSSerializeRegister(a,b,c,d)
1376df38c32SLois Curfman McInnes #endif
1386df38c32SLois Curfman McInnes 
139000e7ae3SMatthew Knepley extern PetscFList TSSerializeList;
140000e7ae3SMatthew Knepley extern int TSSerializeRegisterAll(const char []);
141000e7ae3SMatthew Knepley extern int TSSerializeRegisterDestroy(void);
142000e7ae3SMatthew Knepley extern int TSSerializeRegisterAllCalled;
143000e7ae3SMatthew Knepley extern int TSSerialize(MPI_Comm comm, TS *, PetscViewer, PetscTruth);
144000e7ae3SMatthew Knepley extern int TSSetSerializeType(TS, TSSerializeType);
145000e7ae3SMatthew Knepley 
146ca44d042SBarry Smith EXTERN int TSGetSNES(TS,SNES*);
147ca44d042SBarry Smith EXTERN int TSGetSLES(TS,SLES*);
148818ad0c1SBarry Smith 
149b0a32e0cSBarry Smith EXTERN int TSView(TS,PetscViewer);
15021c89e3eSBarry Smith 
151ca44d042SBarry Smith EXTERN int TSSetApplicationContext(TS,void *);
152ca44d042SBarry Smith EXTERN int TSGetApplicationContext(TS,void **);
15321c89e3eSBarry Smith 
154b0a32e0cSBarry Smith EXTERN int TSLGMonitorCreate(char *,char *,int,int,int,int,PetscDrawLG *);
15519dc493eSBarry Smith EXTERN int TSLGMonitor(TS,int,PetscReal,Vec,void *);
156b0a32e0cSBarry Smith EXTERN int TSLGMonitorDestroy(PetscDrawLG);
1573914022bSBarry Smith 
15883e2fdc7SBarry Smith /*
15983e2fdc7SBarry Smith        PETSc interface to PVode
16083e2fdc7SBarry Smith */
161330e16abSSatish Balay #define PVODE_UNMODIFIED_GS PVODE_CLASSICAL_GS
162453b9e1bSBarry Smith typedef enum { PVODE_ADAMS,PVODE_BDF } TSPVodeType;
163330e16abSSatish Balay typedef enum { PVODE_MODIFIED_GS = 0,PVODE_CLASSICAL_GS = 1 } TSPVodeGramSchmidtType;
164ca44d042SBarry Smith EXTERN int TSPVodeSetType(TS,TSPVodeType);
165ca44d042SBarry Smith EXTERN int TSPVodeGetPC(TS,PC*);
16619dc493eSBarry Smith EXTERN int TSPVodeSetTolerance(TS,PetscReal,PetscReal);
167ca44d042SBarry Smith EXTERN int TSPVodeGetIterations(TS,int *,int *);
168ca44d042SBarry Smith EXTERN int TSPVodeSetGramSchmidtType(TS,TSPVodeGramSchmidtType);
169ca44d042SBarry Smith EXTERN int TSPVodeSetGMRESRestart(TS,int);
17019dc493eSBarry Smith EXTERN int TSPVodeSetLinearTolerance(TS,PetscReal);
171ca44d042SBarry Smith EXTERN int TSPVodeSetExactFinalTime(TS,PetscTruth);
17283e2fdc7SBarry Smith 
173818ad0c1SBarry Smith #endif
174818ad0c1SBarry Smith 
17521c89e3eSBarry Smith 
17621c89e3eSBarry Smith 
17721c89e3eSBarry Smith 
17821c89e3eSBarry Smith 
179