29enum class Ordre_RK { UN , RATIO_DEUX , DEUX_CLASSIQUE , DEUX_WILLIAMSON , TROIS_CLASSIQUE , TROIS_WILLIAMSON , QUATRE_CLASSIQUE , QUATRE_CLASSIQUE_3_8 , QUATRE_WILLIAMSON };
41 double temps_futur(
int i)
const override
54 int faire_un_pas_de_temps_eqn_base(
Equation_base& eq)
override {
return faire_un_pas_de_temps_eqn_base_generique<_ORDRE_>(eq); }
57 static constexpr int NW = 100;
61 Cerr << finl <<
"**** Advice (printed only on the first " << nw <<
" time steps) ****" << finl;
62 Cerr <<
"You are using Runge Kutta schema ! If you wish to increase the time step, try facsec between 1 and 2/3/4 (depends on the order of the scheme)." << finl;
66 static constexpr double SQRT2 = 1.4142135623730950488016887242096980785696718753769480731766797, SQRT2_2 = SQRT2 / 2.;
69 static constexpr ARR2 A2 = { 0.0, SQRT2 - 2. };
70 static constexpr ARR2 B2 = { SQRT2_2, SQRT2_2 };
72 static constexpr ARR3 A3 = { 0.0, -5. / 9., -153. / 128. };
73 static constexpr ARR3 B3 = { 1. / 3., 15. / 16., 8. / 15. };
75 static constexpr ARR3 A4 = { 0.0, -1. /2. , -2. };
76 static constexpr ARR3 B4 = { 1. / 2., 1. , 1. / 6. };
79 static constexpr std::array<ARR1, 1> BUTCHER_2 = { { { 1. / 2. } } };
80 static constexpr std::array<ARR2, 2> BUTCHER_3 = { { { 1. / 2., 0. }, { -1., 2. } } };
81 static constexpr std::array<ARR3, 3> BUTCHER_4 = { { { 1. / 2., 0. , 0.}, { 0., 1. / 2., 0.}, { 0. , 0., 1. } } };
82 static constexpr std::array<ARR3, 3> BUTCHER_4_3_8 = { { { 1. / 3., 0. , 0.}, { -1. / 3., 1., 0.}, { 1. , -1., 1. } } };
84 static constexpr std::array<ARR4, 4> BUTCHER_TAB = { {
86 { 1. / 6., 2. / 3., 1. / 6., 0. },
87 { 1. / 6., 1. / 3., 1. / 3., 1. / 6. },
88 { 1. / 8., 3. / 8., 3. / 8., 1. / 8. }
93 template<Ordre_RK _O_ = _ORDRE_,
int NB>
94 std::enable_if_t<_O_ == Ordre_RK::DEUX_WILLIAMSON, std::array<double, NB>>
95 inline const get_a() {
return A2; }
97 template<Ordre_RK _O_ = _ORDRE_,
int NB>
98 std::enable_if_t<_O_ != Ordre_RK::DEUX_WILLIAMSON, std::array<double, NB>>
99 inline const get_a() {
return _ORDRE_ == Ordre_RK::TROIS_WILLIAMSON ? A3 : A4; }
101 template<Ordre_RK _O_ = _ORDRE_,
int NB>
102 std::enable_if_t<_O_ == Ordre_RK::DEUX_WILLIAMSON, std::array<double, NB>>
103 inline const get_b() {
return B2; }
105 template<Ordre_RK _O_ = _ORDRE_,
int NB>
106 std::enable_if_t<_O_ != Ordre_RK::DEUX_WILLIAMSON, std::array<double, NB>>
107 inline const get_b() {
return _ORDRE_ == Ordre_RK::TROIS_WILLIAMSON ? B3 : B4; }
109 template<Ordre_RK _O_ = _ORDRE_>
110 std::enable_if_t<_O_ == Ordre_RK::DEUX_WILLIAMSON || _O_ == Ordre_RK::TROIS_WILLIAMSON || _O_ == Ordre_RK::QUATRE_WILLIAMSON, int>
111 faire_un_pas_de_temps_eqn_base_generique(Equation_base& eq);
113 template<Ordre_RK _O_ = _ORDRE_,
int NB>
114 std::enable_if_t<_O_ == Ordre_RK::DEUX_CLASSIQUE, std::array<std::array<double, NB>, NB> >
115 inline const get_butcher_coeff() {
return BUTCHER_2; }
117 template<Ordre_RK _O_ = _ORDRE_,
int NB>
118 std::enable_if_t<_O_ == Ordre_RK::TROIS_CLASSIQUE, std::array<std::array<double, NB>, NB> >
119 inline const get_butcher_coeff() {
return BUTCHER_3; }
121 template<Ordre_RK _O_ = _ORDRE_,
int NB>
122 std::enable_if_t<_O_ == Ordre_RK::QUATRE_CLASSIQUE || _O_ == Ordre_RK::QUATRE_CLASSIQUE_3_8, std::array<std::array<double, NB>, NB> >
123 inline const get_butcher_coeff() {
return _O_ == Ordre_RK::QUATRE_CLASSIQUE ? BUTCHER_4 : BUTCHER_4_3_8; }
125 template<Ordre_RK _O_ = _ORDRE_>
126 std::enable_if_t<_O_ == Ordre_RK::DEUX_CLASSIQUE || _O_ == Ordre_RK::TROIS_CLASSIQUE || _O_ == Ordre_RK::QUATRE_CLASSIQUE || _O_ == Ordre_RK::QUATRE_CLASSIQUE_3_8, int>
127 faire_un_pas_de_temps_eqn_base_generique(Equation_base& eq);
130 template<Ordre_RK _O_ = _ORDRE_> std::enable_if_t<_O_ == Ordre_RK::UN || _O_ == Ordre_RK::RATIO_DEUX, int>
131 faire_un_pas_de_temps_eqn_base_generique(Equation_base& eq) {
throw; }