]>
Commit | Line | Data |
---|---|---|
1 | [/============================================================================ | |
2 | Boost.odeint | |
3 | ||
4 | Copyright 2011-2012 Karsten Ahnert | |
5 | Copyright 2011-2012 Mario Mulansky | |
6 | ||
7 | Use, modification and distribution is subject to the Boost Software License, | |
8 | Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at | |
9 | http://www.boost.org/LICENSE_1_0.txt) | |
10 | =============================================================================/] | |
11 | ||
12 | [table Adaptive step size algorithms | |
13 | [ [Stepper] [Tolerance formula] [Norm] [Step size adaption] ] | |
14 | [ [`controlled_runge_kutta`] | |
15 | [ | |
16 | ['val = || | err[subl i] | / ( __epsilon[subl abs] + __epsilon[subl rel] * ( a[subl x] | x[subl i] | + a[subl dxdt] | | dxdt[subl i] | )|| ] | |
17 | ] | |
18 | [['||x|| = max( x[subl i] )]] | |
19 | [ | |
20 | ['val > 1 : dt[subl new] = dt[subl current] max( 0.9 pow( val , -1 / ( O[subl E] - 1 ) ) , 0.2 )] | |
21 | ||
22 | ['val < 0.5 : dt[subl new] = dt[subl current] min( 0.9 pow( val , -1 / O[subl S] ) , 5 )] | |
23 | ||
24 | ['else : dt[subl new] = dt[subl current]] | |
25 | ] ] | |
26 | [ [`rosenbrock4_controller`] | |
27 | [ | |
28 | ['val = || err[subl i] / ( __epsilon[subl abs] + __epsilon[subl rel] max( | x[subl i] | , | xold[subl i] | ) ) || ] | |
29 | ] | |
30 | [['||x||=(__Sigma[subl i] x[subl i][super 2])[super 1/2]]] | |
31 | [ | |
32 | ['fac = max( 1 / 6 , min( 5 , pow( val , 1 / 4 ) / 0.9 ) ] | |
33 | ||
34 | ['fac2 = max( 1 / 6 , min( 5 , dt[subl old] / dt[subl current] pow( val[super 2] / val[subl old] , 1 / 4 ) / 0.9 ) ] | |
35 | ||
36 | ['val > 1 : dt[subl new] = dt[subl current] / fac ] | |
37 | ||
38 | ['val < 1 : dt[subl new] = dt[subl current] / max( fac , fac2 ) ] | |
39 | ] | |
40 | ] | |
41 | [ [bulirsch_stoer] [['tol=1/2]] [-] [['dt[subl new] = dt[subl old][super 1/a]]] ] | |
42 | ] | |
43 | ||
44 | [/ | |
45 | ||
46 | safe = 0.9 , fac1 = 5.0 , fac2 = 1.0 / 6.0 | |
47 | ||
48 | value_type fac_pred = ( m_dt_old / dt ) * pow( err * err / m_err_old , 0.25 ) / safe; | |
49 | fac_pred = std::max( fac2 , std::min( fac1 , fac_pred ) ); | |
50 | fac = std::max( fac , fac_pred ); | |
51 | dt_new = dt / fac; | |
52 | ||
53 | ||
54 | fac = max( fac2 , min( fac1 , pow( err , 0.25 ) / safe ) ) | |
55 | ] |