3998
|
1 CLASS = "DASPK" |
|
2 |
4044
|
3 INCLUDE = "DAE.h" |
|
4 |
3998
|
5 OPTION |
|
6 NAME = "absolute tolerance" |
4050
|
7 DOC_ITEM |
|
8 Absolute tolerance. May be either vector or scalar. If a vector, it |
|
9 must match the dimension of the state vector, and the relative |
|
10 tolerance must also be a vector of the same length. |
|
11 END_DOC_ITEM |
3998
|
12 TYPE = "Array<double>" |
|
13 SET_ARG_TYPE = "const $TYPE&" |
|
14 INIT_BODY |
|
15 $OPTVAR.resize (1); |
|
16 $OPTVAR(0) = ::sqrt (DBL_EPSILON); |
|
17 END_INIT_BODY |
|
18 SET_CODE |
|
19 void set_$OPT (double val) |
|
20 { |
|
21 $OPTVAR.resize (1); |
|
22 $OPTVAR(0) = (val > 0.0) ? val : ::sqrt (DBL_EPSILON); |
4049
|
23 reset = true; |
3998
|
24 } |
|
25 |
|
26 void set_$OPT (const $TYPE& val) |
4049
|
27 { $OPTVAR = val; reset = true; } |
3998
|
28 END_SET_CODE |
|
29 END_OPTION |
|
30 |
|
31 OPTION |
|
32 NAME = "relative tolerance" |
4050
|
33 DOC_ITEM |
|
34 Relative tolerance. May be either vector or scalar. If a vector, it |
|
35 must match the dimension of the state vector, and the absolute |
|
36 tolerance must also be a vector of the same length. |
|
37 |
|
38 The local error test applied at each integration step is |
|
39 |
|
40 @example |
|
41 abs (local error in x(i)) <= rtol(i) * abs (Y(i)) + atol(i) |
|
42 @end example |
|
43 END_DOC_ITEM |
3998
|
44 TYPE = "Array<double>" |
|
45 SET_ARG_TYPE = "const $TYPE&" |
|
46 INIT_BODY |
|
47 $OPTVAR.resize (1); |
|
48 $OPTVAR(0) = ::sqrt (DBL_EPSILON); |
|
49 END_INIT_BODY |
|
50 SET_CODE |
|
51 void set_$OPT (double val) |
|
52 { |
|
53 $OPTVAR.resize (1); |
|
54 $OPTVAR(0) = (val > 0.0) ? val : ::sqrt (DBL_EPSILON); |
4049
|
55 reset = true; |
3998
|
56 } |
|
57 |
|
58 void set_$OPT (const $TYPE& val) |
4049
|
59 { $OPTVAR = val; reset = true; } |
3998
|
60 END_SET_CODE |
|
61 END_OPTION |
|
62 |
|
63 OPTION |
4044
|
64 NAME = "compute consistent initial condition" |
4050
|
65 DOC_ITEM |
|
66 Denoting the differential variables in the state vector by @samp{Y_d} |
|
67 and the algebraic variables by @samp{Y_a}, @code{ddaspk} can solve |
|
68 one of two initialization problems: |
|
69 |
|
70 @enumerate |
|
71 @item Given Y_d, calculate Y_a and Y'_d |
|
72 @item Given Y', calculate Y. |
|
73 @end enumerate |
|
74 |
|
75 In either case, initial values for the given components are input, and |
|
76 initial guesses for the unknown components must also be provided as |
|
77 input. Set this option to 1 to solve the first problem, or 2 to solve |
|
78 the second (the default default is 0, so you must provide a set of |
|
79 initial conditions that are consistent). |
|
80 |
|
81 If this option is set to a nonzero value, you must also set the |
|
82 @code{\"algebraic variables\"} option to declare which variables in the |
|
83 problem are algebraic. |
|
84 END_DOC_ITEM |
|
85 TYPE = "int" |
|
86 INIT_VALUE = "0" |
|
87 SET_EXPR = "val" |
|
88 END_OPTION |
|
89 |
|
90 OPTION |
|
91 NAME = "use initial condition heuristics" |
|
92 DOC_ITEM |
|
93 Set to a nonzero value to use the initial condition heuristics options |
|
94 described below. |
|
95 END_DOC_ITEM |
|
96 TYPE = "int" |
|
97 INIT_VALUE = "0" |
|
98 SET_EXPR = "val" |
|
99 END_OPTION |
|
100 |
|
101 OPTION |
|
102 NAME = "initial condition heuristics" |
|
103 DOC_ITEM |
|
104 A vector of the following parameters that can be used to control the |
|
105 initial condition calculation. |
|
106 |
|
107 @table @code |
|
108 @item MXNIT |
|
109 Maximum number of Newton iterations (default is 5). |
|
110 @item MXNJ |
|
111 Maximum number of Jacobian evaluations (default is 6). |
|
112 @item MXNH |
|
113 Maximum number of values of the artificial stepsize parameter to be |
|
114 tried if the @code{\"compute consistent initial condition\"} option has |
|
115 been set to 1 (default is 5). |
|
116 |
|
117 Note that the maximum number of Newton iterations allowed in all is |
|
118 @code{MXNIT*MXNJ*MXNH} if the @code{\"compute consistent initial |
|
119 condition\"} option has been set to 1 and @code{MXNIT*MXNJ} if it is |
|
120 set to 2. |
|
121 @item LSOFF |
|
122 Set to a nonzero value to disable the linesearch algorithm (default is |
|
123 0). |
|
124 @item STPTOL |
|
125 Minimum scaled step in linesearch algorithm (default is eps^(2/3)). |
|
126 @item EPINIT |
|
127 Swing factor in the Newton iteration convergence test. The test is |
|
128 applied to the residual vector, premultiplied by the approximate |
|
129 Jacobian. For convergence, the weighted RMS norm of this vector |
|
130 (scaled by the error weights) must be less than @code{EPINIT*EPCON}, |
|
131 where @code{EPCON} = 0.33 is the analogous test constant used in the |
|
132 time steps. The default is @code{EPINIT} = 0.01. |
|
133 @end table |
|
134 END_DOC_ITEM |
|
135 TYPE = "Array<double>" |
|
136 SET_ARG_TYPE = "const $TYPE&" |
|
137 INIT_BODY |
4548
|
138 $OPTVAR.resize (6); |
4050
|
139 $OPTVAR(0) = 5.0; |
|
140 $OPTVAR(1) = 6.0; |
|
141 $OPTVAR(2) = 5.0; |
|
142 $OPTVAR(3) = 0.0; |
|
143 $OPTVAR(4) = ::pow (DBL_EPSILON, 2.0/3.0); |
|
144 $OPTVAR(5) = 0.01; |
|
145 END_INIT_BODY |
|
146 SET_EXPR = "val" |
|
147 END_OPTION |
|
148 |
|
149 OPTION |
|
150 NAME = "print initial condition info" |
|
151 DOC_ITEM |
|
152 Set this option to a nonzero value to display detailed information |
|
153 about the initial condition calculation (default is 0). |
|
154 END_DOC_ITEM |
|
155 TYPE = "int" |
|
156 INIT_VALUE = "0" |
|
157 SET_EXPR = "val" |
|
158 END_OPTION |
|
159 |
|
160 OPTION |
|
161 NAME = "exclude algebraic variables from error test" |
|
162 DOC_ITEM |
|
163 Set to a nonzero value to exclude algebraic variables from the error |
|
164 test. You must also set the @code{\"algebraic variables\"} option to |
|
165 declare which variables in the problem are algebraic (default is 0). |
|
166 END_DOC_ITEM |
4044
|
167 TYPE = "int" |
|
168 INIT_VALUE = "0" |
|
169 SET_EXPR = "val" |
|
170 END_OPTION |
|
171 |
|
172 OPTION |
4047
|
173 NAME = "algebraic variables" |
4050
|
174 DOC_ITEM |
|
175 A vector of the same length as the state vector. A nonzero element |
|
176 indicates that the corresponding element of the state vector is an |
|
177 algebraic variable (i.e., its derivative does not appear explicitly |
|
178 in the equation set. |
|
179 |
|
180 This option is required by the |
|
181 @code{compute consistent initial condition\"} and |
|
182 @code{\"exclude algebraic variables from error test\"} options. |
|
183 END_DOC_ITEM |
4047
|
184 TYPE = "Array<int>" |
|
185 SET_ARG_TYPE = const $TYPE& |
|
186 INIT_BODY |
|
187 $OPTVAR.resize (1); |
|
188 $OPTVAR(0) = 0; |
|
189 END_INIT_BODY |
|
190 SET_CODE |
|
191 void set_$OPT (int val) |
|
192 { |
|
193 $OPTVAR.resize (1); |
|
194 $OPTVAR(0) = val; |
4049
|
195 reset = true; |
4047
|
196 } |
|
197 |
|
198 void set_$OPT (const $TYPE& val) |
4049
|
199 { $OPTVAR = val; reset = true; } |
4047
|
200 END_SET_CODE |
|
201 END_OPTION |
|
202 |
|
203 OPTION |
4044
|
204 NAME = "enforce inequality constraints" |
4050
|
205 DOC_ITEM |
|
206 Set to one of the following values to enforce the inequality |
|
207 constraints specified by the @code{\"inequality constraint types\"} |
|
208 option (default is 0). |
|
209 |
|
210 @enumerate |
|
211 @item To have constraint checking only in the initial condition calculation. |
|
212 @item To enforce constraint checking during the integration. |
|
213 @item To enforce both options 1 and 2. |
|
214 @end enumerate |
|
215 END_DOC_ITEM |
4044
|
216 TYPE = "int" |
|
217 INIT_VALUE = "0" |
|
218 SET_EXPR = "val" |
|
219 END_OPTION |
|
220 |
|
221 OPTION |
|
222 NAME = "inequality constraint types" |
4050
|
223 DOC_ITEM |
|
224 A vector of the same length as the state specifying the type of |
|
225 inequality constraint. Each element of the vector corresponds to an |
|
226 element of the state and should be assigned one of the following |
|
227 codes |
|
228 |
|
229 @table @asis |
|
230 @item -2 |
|
231 Less than zero. |
|
232 @item -1 |
|
233 Less than or equal to zero. |
|
234 @item 0 |
|
235 Not constrained. |
|
236 @item 1 |
|
237 Greater than or equal to zero. |
|
238 @item 2 |
|
239 Greater than zero. |
|
240 @end table |
|
241 |
|
242 This option only has an effect if the |
|
243 @code{\"enforce inequality constraints\"} option is nonzero. |
|
244 END_DOC_ITEM |
4044
|
245 TYPE = "Array<int>" |
|
246 SET_ARG_TYPE = const $TYPE& |
|
247 INIT_BODY |
|
248 $OPTVAR.resize (1); |
|
249 $OPTVAR(0) = 0; |
|
250 END_INIT_BODY |
|
251 SET_CODE |
|
252 void set_$OPT (int val) |
|
253 { |
|
254 $OPTVAR.resize (1); |
4047
|
255 $OPTVAR(0) = val; |
4049
|
256 reset = true; |
4044
|
257 } |
|
258 |
|
259 void set_$OPT (const $TYPE& val) |
4049
|
260 { $OPTVAR = val; reset = true; } |
4044
|
261 END_SET_CODE |
|
262 END_OPTION |
|
263 |
|
264 OPTION |
3998
|
265 NAME = "initial step size" |
4050
|
266 DOC_ITEM |
|
267 Differential-algebraic problems may occaisionally suffer from severe |
|
268 scaling difficulties on the first step. If you know a great deal |
|
269 about the scaling of your problem, you can help to alleviate this |
|
270 problem by specifying an initial stepsize (default is computed |
|
271 automatically). |
|
272 END_DOC_ITEM |
3998
|
273 TYPE = "double" |
|
274 INIT_VALUE = "-1.0" |
|
275 SET_EXPR = "(val >= 0.0) ? val : -1.0" |
|
276 END_OPTION |
|
277 |
|
278 OPTION |
4044
|
279 NAME = "maximum order" |
4050
|
280 DOC_ITEM |
|
281 Restrict the maximum order of the solution method. This option must |
|
282 be between 1 and 5, inclusive (default is 5). |
|
283 END_DOC_ITEM |
4044
|
284 TYPE = "int" |
4050
|
285 INIT_VALUE = "5" |
4044
|
286 SET_EXPR = "val" |
|
287 END_OPTION |
|
288 |
|
289 OPTION |
3998
|
290 NAME = "maximum step size" |
4050
|
291 DOC_ITEM |
|
292 Setting the maximum stepsize will avoid passing over very large |
|
293 regions (default is not specified). |
|
294 END_DOC_ITEM |
3998
|
295 TYPE = "double" |
|
296 INIT_VALUE = "-1.0" |
|
297 SET_EXPR = "(val >= 0.0) ? val : -1.0" |
|
298 END_OPTION |