-
Notifications
You must be signed in to change notification settings - Fork 9
/
DASPK.h
167 lines (138 loc) · 4.16 KB
/
DASPK.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
#ifndef DASPK_H
#define DASPK_H
#include "Definitions.h"
#include "Integrator.h"
#include "DaeDefinition.h"
#include "DataCollector.h"
#include "Jacobian.h"
#include "Preconditioner.h"
#include "DaspkRes.h"
#include "DaspkJac.h"
#include "DaspkPsol.h"
#include "Definitions.h"
#include "Vec.h"
#include "IntVec.h"
namespace Daetk
{
class DASPK : public Integrator
{
public:
DASPK();
virtual ~DASPK(){}
DASPK(DaeDefinition&,DataCollector&);
bool calculateSolution(const real& tout,Vec& solution,Vec& solutionPrime);
bool step(const real& tOut,real& tStep,Vec& solutionAtTStep, Vec& sP);
bool computeInitialConditions();
void setTolerances(real& atol,real& rtol);
void setTolerances(Vec& atol,Vec& rtol);
void setTstop(const real& tStop);
void useAnalyticJacobian(Jacobian& J);
void usePreconditioner(Preconditioner& P);
void useFullLinearSolver();
void useBandedLinearSolver(int kl,int ku);
void useKrylovSolver();
void useKrylovSolver(int maxl,int kmp,int nrmax,real& epli);
void setMaxStepSize(const real& tmax);
void setInitialStepSize(const real& h0);
void setMaxOrder(int maxOrder);
void setInitialConstraints(const IntVec& constraintFlag);
void enforceNonnegativity();
void findConsistentY0();
void findConsistentY0andY0Prime(const IntVec& variableFlag);
void excludeAlgebraicVariables( const IntVec& variableFlag);
void setIntialConditionCalcParms(int mxnit,int mxnj,int mxnh,int lsoff,
const real& stptol, const real& epinit);
void useExtraPrinting(int printLevel);
void reset();
void resetTstop();
void init();
private:
void collectData();
int nreOld,
njeOld,
netfOld,
ncfnOld,
ncflOld,
nniOld,
nliOld;
int idid,
kl,
ku,
maxord,
neq,
lrw,
liw,
maxl,
kmp,
nrmax,
mxnit,
mxnj,
mxnh,
lsoff,
lenwp,
leniwp;
real *atolp,
*rtolp,
tstop,
epli,
tmax,
h0,
stptol,
epinit,
t;
IntVec ipar,
info,
iwork,
cFlag,
avFlag;
Vec *vecAtol,
*vecRtol,
rpar,
rwork,
y,
yp;
DaeDefinition* dae;
DataCollector* data;
Jacobian* jacobian;
Preconditioner* preconditioner;
DaspkResidual DR;
DaspkJacobian DJ;
DaspkPsol DP;
};
typedef void (*GlobDaspkRes)(const real& t,real* y,real* yp,
real& cj,real* delta, int* ires, real* rpar,
int *ipar);
typedef void (*GlobDaspkPsol)(const int& neq, const real& t, real* y,
real* yp, real* savr,real* wk,
const real& cj,real* wght,real * wp,
int* iwp, real* b, const real& eplin, int* ier,
real* rpar,int* ipar);
#ifndef CRAYCC
extern "C" void F77NAME(ddaspk)(GlobDaspkRes res, const int& neq, real& t,
real* y, real* yp, const real& tout,
int* info, real* rtol, real* atol,
int& idid, real* rwork, int& lrw, int* iwork,
int& liw, real* rpar, int* ipar, void* jac,
GlobDaspkPsol psol);
extern "C" void F77NAME(sdaspk)(GlobDaspkRes res, const int& neq, real& t,
real* y, real* yp, const real& tout,
int* info, real* rtol, real* atol,
int& idid, real* rwork, int& lrw, int* iwork,
int& liw, real* rpar, int* ipar, void* jac,
GlobDaspkPsol psol);
#else
extern "C" void F77NAME(DDASPK)(GlobDaspkRes res, const int& neq, real& t,
real* y, real* yp, const real& tout,
int* info, real* rtol, real* atol,
int& idid, real* rwork, int& lrw, int* iwork,
int& liw, real* rpar, int* ipar, void* jac,
GlobDaspkPsol psol);
extern "C" void F77NAME(SDASPK)(GlobDaspkRes res, const int& neq, real& t,
real* y, real* yp, const real& tout,
int* info, real* rtol, real* atol,
int& idid, real* rwork, int& lrw, int* iwork,
int& liw, real* rpar, int* ipar, void* jac,
GlobDaspkPsol psol);
#endif
}//Daetk
#endif