Sandals  v0.0.0
A C++ library for ODEs/DAEs integration
Loading...
Searching...
No Matches
Ralston4.hxx
Go to the documentation of this file.
1/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
2 * Copyright (c) 2025, Davide Stocco and Enrico Bertolazzi. *
3 * *
4 * The Sandals project is distributed under the BSD 2-Clause License. *
5 * *
6 * Davide Stocco Enrico Bertolazzi *
7 * University of Trento University of Trento *
8 * e-mail: davide.stocco@unitn.it e-mail: enrico.bertolazzi@unitn.it *
9\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
10
11#pragma once
12
13#ifndef SANDALS_RALSTON4_HXX
14#define SANDALS_RALSTON4_HXX
15
16namespace Sandals
17{
45 class Ralston4Tableau : public Tableau<4>
46 {
47 public:
48 using Tableau<4>::Type;
49 using Tableau<4>::Vector;
50 using Tableau<4>::Matrix;
51
56 this->name = "Ralston4";
57 this->type = Type::ERK;
58 this->order = 4;
59 Real s_5{std::sqrt(5.0)};
60 Real a_21{4.0/10.0};
61 Real a_31{(357.0/256.0) * s_5 - 2889.0/1024.0};
62 Real a_32{3785.0/1024.0 - (405.0/256.0) * s_5};
63 Real a_41{(1047.0/3020.0) * s_5 - 673.0/1208.0};
64 Real a_42{-975.0/2552.0 - (1523.0/1276.0) * s_5};
65 Real a_43{93408.0/48169.0 + (203968.0/240845.0) * s_5};
66 Real b_1{263.0/1812.0 + (2.0/151.0) * s_5};
67 Real b_2{125.0/3828.0 - (250.0/957.0) * s_5};
68 Real b_3{3426304.0/5924787.0 + (553984.0/1974929.0) * s_5};
69 Real b_4{10.0/41.0 - (4.0/123.0) * s_5};
70 Real c_2{2.0/5.0};
71 Real c_3{7.0/8.0 - (3.0/16.0) * s_5};
72 this->A << 0.0, 0.0, 0.0, 0.0,
73 a_21, 0.0, 0.0, 0.0,
74 a_31, a_32, 0.0, 0.0,
75 a_41, a_42, a_43, 0.0;
76 this->b << b_1, b_2, b_3, b_4;
77 this->c << 0.0, c_2, c_3, 1.0;
78 }
79 }; // class Ralston4Tableau
80
88 template <Integer N, Integer M = 0>
89 class Ralston4 : public RungeKutta<4, N, M>
90 {
91 public:
93
98
103 Ralston4(System t_system) : RungeKutta<4, N, M>(Ralston4Tableau(), t_system) {}
104
105 }; // class Ralston4
106
107} // namespace Sandals
108
109#endif // SANDALS_RALSTON4_HXX
std::shared_ptr< Implicit< N, M > > Pointer
Definition Implicit.hxx:42
Ralston4()
Definition Ralston4.hxx:97
Ralston4(System t_system)
Definition Ralston4.hxx:103
typename Implicit< N, M >::Pointer System
Definition Ralston4.hxx:92
Butcher tableau for the Ralston's order 4 method.
Definition Ralston4.hxx:46
Ralston4Tableau()
Definition Ralston4.hxx:55
RungeKutta(const RungeKutta &)=delete
The namespace for the Sandals library.
Definition Sandals.hh:73
double Real
Definition Sandals.hh:84
Struct container for the Butcher tableau of a Runge-Kutta method.
Definition Tableau.hxx:36
enum class type :Integer {ERK=0, IRK=1, DIRK=2} Type
Definition Tableau.hxx:37
Eigen::Matrix< Real, S, S > Matrix
Definition Tableau.hxx:39
Integer order
Definition Tableau.hxx:43
Type type
Definition Tableau.hxx:42
Eigen::Vector< Real, S > Vector
Definition Tableau.hxx:38
Matrix A
Definition Tableau.hxx:45
std::string name
Definition Tableau.hxx:41
Vector b
Definition Tableau.hxx:46
Vector c
Definition Tableau.hxx:48