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