File: Adaptive-Step_002dsize-Control.html

package info (click to toggle)
gsl-ref-html 1.10-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 4,496 kB
  • ctags: 2,955
  • sloc: makefile: 33
file content (173 lines) | stat: -rw-r--r-- 9,809 bytes parent folder | download
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
<html lang="en">
<head>
<title>Adaptive Step-size Control - GNU Scientific Library -- Reference Manual</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="GNU Scientific Library -- Reference Manual">
<meta name="generator" content="makeinfo 4.8">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Ordinary-Differential-Equations.html" title="Ordinary Differential Equations">
<link rel="prev" href="Stepping-Functions.html" title="Stepping Functions">
<link rel="next" href="Evolution.html" title="Evolution">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 The GSL Team.

Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2 or
any later version published by the Free Software Foundation; with the
Invariant Sections being ``GNU General Public License'' and ``Free Software
Needs Free Documentation'', the Front-Cover text being ``A GNU Manual'',
and with the Back-Cover Text being (a) (see below).  A copy of the
license is included in the section entitled ``GNU Free Documentation
License''.

(a) The Back-Cover Text is: ``You have freedom to copy and modify this
GNU Manual, like GNU software.''-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
  pre.display { font-family:inherit }
  pre.format  { font-family:inherit }
  pre.smalldisplay { font-family:inherit; font-size:smaller }
  pre.smallformat  { font-family:inherit; font-size:smaller }
  pre.smallexample { font-size:smaller }
  pre.smalllisp    { font-size:smaller }
  span.sc    { font-variant:small-caps }
  span.roman { font-family:serif; font-weight:normal; } 
  span.sansserif { font-family:sans-serif; font-weight:normal; } 
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Adaptive-Step-size-Control"></a>
<a name="Adaptive-Step_002dsize-Control"></a>
Next:&nbsp;<a rel="next" accesskey="n" href="Evolution.html">Evolution</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Stepping-Functions.html">Stepping Functions</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Ordinary-Differential-Equations.html">Ordinary Differential Equations</a>
<hr>
</div>

<h3 class="section">25.3 Adaptive Step-size Control</h3>

<p><a name="index-Adaptive-step_002dsize-control_002c-differential-equations-2062"></a>
The control function examines the proposed change to the solution
produced by a stepping function and attempts to determine the optimal
step-size for a user-specified level of error.

<div class="defun">
&mdash; Function: gsl_odeiv_control * <b>gsl_odeiv_control_standard_new</b> (<var>double eps_abs, double eps_rel, double a_y, double a_dydt</var>)<var><a name="index-gsl_005fodeiv_005fcontrol_005fstandard_005fnew-2063"></a></var><br>
<blockquote><p>The standard control object is a four parameter heuristic based on
absolute and relative errors <var>eps_abs</var> and <var>eps_rel</var>, and
scaling factors <var>a_y</var> and <var>a_dydt</var> for the system state
y(t) and derivatives y'(t) respectively.

        <p>The step-size adjustment procedure for this method begins by computing
the desired error level D_i for each component,

     <pre class="example">          D_i = eps_abs + eps_rel * (a_y |y_i| + a_dydt h |y'_i|)
</pre>
        <p class="noindent">and comparing it with the observed error E_i = |yerr_i|.  If the
observed error <var>E</var> exceeds the desired error level <var>D</var> by more
than 10% for any component then the method reduces the step-size by an
appropriate factor,

     <pre class="example">          h_new = h_old * S * (E/D)^(-1/q)
</pre>
        <p class="noindent">where q is the consistency order of the method (e.g. q=4 for
4(5) embedded RK), and S is a safety factor of 0.9. The ratio
E/D is taken to be the maximum of the ratios
E_i/D_i.

        <p>If the observed error E is less than 50% of the desired error
level <var>D</var> for the maximum ratio E_i/D_i then the algorithm
takes the opportunity to increase the step-size to bring the error in
line with the desired level,

     <pre class="example">          h_new = h_old * S * (E/D)^(-1/(q+1))
</pre>
        <p class="noindent">This encompasses all the standard error scaling methods. To avoid
uncontrolled changes in the stepsize, the overall scaling factor is
limited to the range 1/5 to 5. 
</p></blockquote></div>

<div class="defun">
&mdash; Function: gsl_odeiv_control * <b>gsl_odeiv_control_y_new</b> (<var>double eps_abs, double eps_rel</var>)<var><a name="index-gsl_005fodeiv_005fcontrol_005fy_005fnew-2064"></a></var><br>
<blockquote><p>This function creates a new control object which will keep the local
error on each step within an absolute error of <var>eps_abs</var> and
relative error of <var>eps_rel</var> with respect to the solution y_i(t). 
This is equivalent to the standard control object with <var>a_y</var>=1 and
<var>a_dydt</var>=0. 
</p></blockquote></div>

<div class="defun">
&mdash; Function: gsl_odeiv_control * <b>gsl_odeiv_control_yp_new</b> (<var>double eps_abs, double eps_rel</var>)<var><a name="index-gsl_005fodeiv_005fcontrol_005fyp_005fnew-2065"></a></var><br>
<blockquote><p>This function creates a new control object which will keep the local
error on each step within an absolute error of <var>eps_abs</var> and
relative error of <var>eps_rel</var> with respect to the derivatives of the
solution y'_i(t).  This is equivalent to the standard control
object with <var>a_y</var>=0 and <var>a_dydt</var>=1. 
</p></blockquote></div>

<div class="defun">
&mdash; Function: gsl_odeiv_control * <b>gsl_odeiv_control_scaled_new</b> (<var>double eps_abs, double eps_rel, double a_y, double a_dydt, const double scale_abs</var>[]<var>, size_t dim</var>)<var><a name="index-gsl_005fodeiv_005fcontrol_005fscaled_005fnew-2066"></a></var><br>
<blockquote><p>This function creates a new control object which uses the same algorithm
as <code>gsl_odeiv_control_standard_new</code> but with an absolute error
which is scaled for each component by the array <var>scale_abs</var>. 
The formula for D_i for this control object is,

     <pre class="example">          D_i = eps_abs * s_i + eps_rel * (a_y |y_i| + a_dydt h |y'_i|)
</pre>
        <p class="noindent">where s_i is the i-th component of the array <var>scale_abs</var>. 
The same error control heuristic is used by the Matlab <span class="sc">ode</span> suite. 
</p></blockquote></div>

<div class="defun">
&mdash; Function: gsl_odeiv_control * <b>gsl_odeiv_control_alloc</b> (<var>const gsl_odeiv_control_type * T</var>)<var><a name="index-gsl_005fodeiv_005fcontrol_005falloc-2067"></a></var><br>
<blockquote><p>This function returns a pointer to a newly allocated instance of a
control function of type <var>T</var>.  This function is only needed for
defining new types of control functions.  For most purposes the standard
control functions described above should be sufficient. 
</p></blockquote></div>

<div class="defun">
&mdash; Function: int <b>gsl_odeiv_control_init</b> (<var>gsl_odeiv_control * c, double eps_abs, double eps_rel, double a_y, double a_dydt</var>)<var><a name="index-gsl_005fodeiv_005fcontrol_005finit-2068"></a></var><br>
<blockquote><p>This function initializes the control function <var>c</var> with the
parameters <var>eps_abs</var> (absolute error), <var>eps_rel</var> (relative
error), <var>a_y</var> (scaling factor for y) and <var>a_dydt</var> (scaling
factor for derivatives). 
</p></blockquote></div>

<div class="defun">
&mdash; Function: void <b>gsl_odeiv_control_free</b> (<var>gsl_odeiv_control * c</var>)<var><a name="index-gsl_005fodeiv_005fcontrol_005ffree-2069"></a></var><br>
<blockquote><p>This function frees all the memory associated with the control function
<var>c</var>. 
</p></blockquote></div>

<div class="defun">
&mdash; Function: int <b>gsl_odeiv_control_hadjust</b> (<var>gsl_odeiv_control * c, gsl_odeiv_step * s, const double y</var>[]<var>, const double yerr</var>[]<var>, const double dydt</var>[]<var>, double * h</var>)<var><a name="index-gsl_005fodeiv_005fcontrol_005fhadjust-2070"></a></var><br>
<blockquote><p>This function adjusts the step-size <var>h</var> using the control function
<var>c</var>, and the current values of <var>y</var>, <var>yerr</var> and <var>dydt</var>. 
The stepping function <var>step</var> is also needed to determine the order
of the method.  If the error in the y-values <var>yerr</var> is found to be
too large then the step-size <var>h</var> is reduced and the function returns
<code>GSL_ODEIV_HADJ_DEC</code>.  If the error is sufficiently small then
<var>h</var> may be increased and <code>GSL_ODEIV_HADJ_INC</code> is returned.  The
function returns <code>GSL_ODEIV_HADJ_NIL</code> if the step-size is
unchanged.  The goal of the function is to estimate the largest
step-size which satisfies the user-specified accuracy requirements for
the current point. 
</p></blockquote></div>

<div class="defun">
&mdash; Function: const char * <b>gsl_odeiv_control_name</b> (<var>const gsl_odeiv_control * c</var>)<var><a name="index-gsl_005fodeiv_005fcontrol_005fname-2071"></a></var><br>
<blockquote><p>This function returns a pointer to the name of the control function. 
For example,

     <pre class="example">          printf ("control method is '%s'\n",
                  gsl_odeiv_control_name (c));
</pre>
        <p class="noindent">would print something like <code>control method is 'standard'</code>
</p></blockquote></div>

<hr>The GNU Scientific Library - a free numerical library licensed under the GNU GPL<br>Back to the <a href="/software/gsl/">GNU Scientific Library Homepage</a></body></html>