3 boost/numeric/odeint/stepper/symplectic_rkn_sb3a_mclachlan.hpp
6 Implementation of the symplectic MacLachlan stepper for separable Hamiltonian system.
9 Copyright 2011-2013 Karsten Ahnert
10 Copyright 2011-2013 Mario Mulansky
12 Distributed under the Boost Software License, Version 1.0.
13 (See accompanying file LICENSE_1_0.txt or
14 copy at http://www.boost.org/LICENSE_1_0.txt)
18 #ifndef BOOST_NUMERIC_ODEINT_STEPPER_SYMPLECTIC_RKN_SB3A_MCLACHLAN_HPP_INCLUDED
19 #define BOOST_NUMERIC_ODEINT_STEPPER_SYMPLECTIC_RKN_SB3A_MCLACHLAN_HPP_INCLUDED
22 #include <boost/numeric/odeint/stepper/base/symplectic_rkn_stepper_base.hpp>
24 #include <boost/numeric/odeint/algebra/range_algebra.hpp>
25 #include <boost/numeric/odeint/algebra/default_operations.hpp>
26 #include <boost/numeric/odeint/algebra/algebra_dispatcher.hpp>
27 #include <boost/numeric/odeint/algebra/operations_dispatcher.hpp>
29 #include <boost/numeric/odeint/util/resizer.hpp>
31 #include <boost/array.hpp>
40 namespace symplectic_rkn_sb3a_mclachlan {
43 exp( a1 t A ) exp( b1 t B )
44 exp( a2 t A ) exp( b2 t B )
45 exp( a3 t A ) exp( b3 t B ) exp( a3 t A )
46 exp( b2 t B ) exp( a2 t A )
47 exp( b1 t B ) exp( a1 t A )
50 template< class Value >
51 struct coef_a_type : public boost::array< Value , 6 >
55 (*this)[0] = static_cast< Value >( 0.40518861839525227722 );
56 (*this)[1] = static_cast< Value >( -0.28714404081652408900 );
57 (*this)[2] = static_cast< Value >( 1 ) / static_cast< Value >( 2 ) - ( (*this)[0] + (*this)[1] );
58 (*this)[3] = (*this)[2];
59 (*this)[4] = (*this)[1];
60 (*this)[5] = (*this)[0];
65 template< class Value >
66 struct coef_b_type : public boost::array< Value , 6 >
70 (*this)[0] = static_cast< Value >( -3 ) / static_cast< Value >( 73 );
71 (*this)[1] = static_cast< Value >( 17 ) / static_cast< Value >( 59 );
72 (*this)[2] = static_cast< Value >( 1 ) - static_cast< Value >( 2 ) * ( (*this)[0] + (*this)[1] );
73 (*this)[3] = (*this)[1];
74 (*this)[4] = (*this)[0];
75 (*this)[5] = static_cast< Value >( 0 );
79 } // namespace symplectic_rkn_sb3a_mclachlan
81 #endif // DOXYGEN_SKIP
87 class Momentum = Coor ,
88 class Value = double ,
89 class CoorDeriv = Coor ,
90 class MomentumDeriv = Coor ,
92 class Algebra = typename algebra_dispatcher< Coor >::algebra_type ,
93 class Operations = typename operations_dispatcher< Coor >::operations_type ,
94 class Resizer = initially_resizer
97 class symplectic_rkn_sb3a_mclachlan :
98 public symplectic_nystroem_stepper_base
101 Coor , Momentum , Value , CoorDeriv , MomentumDeriv , Time , Algebra , Operations , Resizer
104 class symplectic_rkn_sb3a_mclachlan : public symplectic_nystroem_stepper_base
109 typedef symplectic_nystroem_stepper_base
112 Coor , Momentum , Value , CoorDeriv , MomentumDeriv , Time , Algebra , Operations , Resizer
115 typedef typename stepper_base_type::algebra_type algebra_type;
116 typedef typename stepper_base_type::value_type value_type;
119 symplectic_rkn_sb3a_mclachlan( const algebra_type &algebra = algebra_type() )
121 detail::symplectic_rkn_sb3a_mclachlan::coef_a_type< value_type >() ,
122 detail::symplectic_rkn_sb3a_mclachlan::coef_b_type< value_type >() ,
128 /************* DOXYGEN ***********/
131 * \class symplectic_rkn_sb3a_mclachlan
132 * \brief Implement of the symmetric B3A method of Runge-Kutta-Nystroem method of sixth order.
134 * The method is of fourth order and has six stages. It is described HERE. This method cannot be used
135 * with multiprecision types since the coefficients are not defined analytically.
137 * ToDo Add reference to the paper.
139 * \tparam Order The order of the stepper.
140 * \tparam Coor The type representing the coordinates q.
141 * \tparam Momentum The type representing the coordinates p.
142 * \tparam Value The basic value type. Should be something like float, double or a high-precision type.
143 * \tparam CoorDeriv The type representing the time derivative of the coordinate dq/dt.
144 * \tparam MomemtnumDeriv The type representing the time derivative of the momentum dp/dt.
145 * \tparam Time The type representing the time t.
146 * \tparam Algebra The algebra.
147 * \tparam Operations The operations.
148 * \tparam Resizer The resizer policy.
152 * \fn symplectic_rkn_sb3a_mclachlan::symplectic_rkn_sb3a_mclachlan( const algebra_type &algebra )
153 * \brief Constructs the symplectic_rkn_sb3a_mclachlan. This constructor can be used as a default
154 * constructor if the algebra has a default constructor.
155 * \param algebra A copy of algebra is made and stored inside explicit_stepper_base.
158 } // namespace odeint
159 } // namespace numeric
162 #endif // BOOST_NUMERIC_ODEINT_STEPPER_SYMPLECTIC_RKN_SB3A_MCLACHLAN_HPP_INCLUDED