File: controlled_stepper_table.qbk

package info (click to toggle)
boost1.90 1.90.0-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 593,120 kB
  • sloc: cpp: 4,190,908; xml: 196,648; python: 34,618; ansic: 23,145; asm: 5,468; sh: 3,774; makefile: 1,161; perl: 1,020; sql: 728; ruby: 676; yacc: 478; java: 77; lisp: 24; csh: 6
file content (55 lines) | stat: -rw-r--r-- 2,010 bytes parent folder | download | duplicates (12)
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
[/============================================================================
  Boost.odeint

  Copyright 2011-2012 Karsten Ahnert
  Copyright 2011-2012 Mario Mulansky

  Use, modification and distribution is subject to the Boost Software License,
  Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  http://www.boost.org/LICENSE_1_0.txt)
=============================================================================/]

[table Adaptive step size algorithms
  [ [Stepper] [Tolerance formula] [Norm] [Step size adaption] ]
  [ [`controlled_runge_kutta`]
    [
      ['val = || | err[subl i] | / ( __epsilon[subl abs] + __epsilon[subl rel] * ( a[subl x] | x[subl i] | + a[subl dxdt] | | dxdt[subl i] | )|| ]
    ]
    [['||x|| = max( x[subl i] )]]
    [
      ['val > 1   : dt[subl new] = dt[subl current] max( 0.9 pow( val , -1 / ( O[subl E] - 1 ) ) , 0.2 )]

      ['val < 0.5 : dt[subl new] = dt[subl current] min( 0.9 pow( val , -1 / O[subl S] ) , 5 )]

      ['else : dt[subl new] = dt[subl current]]
    ] ]
  [ [`rosenbrock4_controller`]
    [
      ['val = || err[subl i] / ( __epsilon[subl abs] + __epsilon[subl rel] max( | x[subl i] | , | xold[subl i] | ) ) || ]
    ]
    [['||x||=(__Sigma[subl i] x[subl i][super 2])[super 1/2]]]
    [
      ['fac = max( 1 / 6 , min( 5 , pow( val , 1 / 4 ) / 0.9 ) ]

      ['fac2 = max( 1 / 6 , min( 5 , dt[subl old] / dt[subl current] pow( val[super 2] / val[subl old] , 1 / 4 ) / 0.9 ) ]

      ['val > 1 : dt[subl new] = dt[subl current] / fac ]

      ['val < 1 : dt[subl new] = dt[subl current] / max( fac , fac2 ) ]
    ]
  ]
  [ [bulirsch_stoer] [['tol=1/2]] [-] [['dt[subl new] = dt[subl old][super 1/a]]] ]
]

[/

safe = 0.9 , fac1 = 5.0 , fac2 = 1.0 / 6.0

value_type fac_pred = ( m_dt_old / dt ) * pow( err * err / m_err_old , 0.25 ) / safe;
        fac_pred = std::max( fac2 , std::min( fac1 , fac_pred ) );
        fac = std::max( fac , fac_pred );
        dt_new = dt / fac;


fac = max( fac2 , min( fac1 , pow( err , 0.25 ) / safe ) )
]