Sandals  v0.0.0
A C++ library for ODEs/DAEs integration
Loading...
Searching...
No Matches
Ralston4.hh
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_HH
14#define SANDALS_RALSTON4_HH
15
16#include <Sandals.hh>
17#include <Sandals/RungeKutta.hh>
18
19namespace Sandals
20{
49 template <typename Real>
50 class Ralston4Tableau : public Tableau<Real, 4>
51 {
52 public:
53 using typename Tableau<Real, 4>::Type;
54 using typename Tableau<Real, 4>::Vector;
55 using typename Tableau<Real, 4>::Matrix;
56
61 this->name = "Ralston4";
62 this->type = Type::ERK;
63 this->order = 4;
64 Real s_5{std::sqrt(5.0)};
65 Real a_21{4.0/10.0};
66 Real a_31{(357.0/256.0) * s_5 - 2889.0/1024.0};
67 Real a_32{3785.0/1024.0 - (405.0/256.0) * s_5};
68 Real a_41{(1047.0/3020.0) * s_5 - 673.0/1208.0};
69 Real a_42{-975.0/2552.0 - (1523.0/1276.0) * s_5};
70 Real a_43{93408.0/48169.0 + (203968.0/240845.0) * s_5};
71 Real b_1{263.0/1812.0 + (2.0/151.0) * s_5};
72 Real b_2{125.0/3828.0 - (250.0/957.0) * s_5};
73 Real b_3{3426304.0/5924787.0 + (553984.0/1974929.0) * s_5};
74 Real b_4{10.0/41.0 - (4.0/123.0) * s_5};
75 Real c_2{2.0/5.0};
76 Real c_3{7.0/8.0 - (3.0/16.0) * s_5};
77 this->A << 0.0, 0.0, 0.0, 0.0,
78 a_21, 0.0, 0.0, 0.0,
79 a_31, a_32, 0.0, 0.0,
80 a_41, a_42, a_43, 0.0;
81 this->b << b_1, b_2, b_3, b_4;
82 this->c << 0.0, c_2, c_3, 1.0;
83 }
84 }; // class Ralston4Tableau
85
94 template <typename Real, Integer N, Integer M = 0>
95 class Ralston4 : public RungeKutta<Real, 4, N, M>
96 {
97 public:
99
103 Ralston4() : RungeKutta<Real, 4, N, M>(Ralston4Tableau<Real>()) {}
104
109 Ralston4(System t_system) : RungeKutta<Real, 4, N, M>(Ralston4Tableau<Real>(), t_system) {}
110
111 }; // class Ralston4
112
113} // namespace Sandals
114
115#endif // SANDALS_RALSTON4_HH
std::shared_ptr< Implicit< Real, N, M > > Pointer
Definition Implicit.hh:47
typename Implicit< Real, N, M >::Pointer System
Definition Ralston4.hh:98
Ralston4()
Definition Ralston4.hh:103
Ralston4(System t_system)
Definition Ralston4.hh:109
Butcher tableau for the Ralston's order 4 method.
Definition Ralston4.hh:51
Ralston4Tableau()
Definition Ralston4.hh:60
RungeKutta(const RungeKutta &)=delete
The namespace for the Sandals library.
Definition Sandals.hh:89
Struct container for the Butcher tableau of a Runge-Kutta method.
Definition Tableau.hh:38
enum class type :Integer {ERK=0, IRK=1, DIRK=2} Type
Definition Tableau.hh:42
Type type
Definition Tableau.hh:47
Integer order
Definition Tableau.hh:48
std::string name
Definition Tableau.hh:46
Eigen::Matrix< Real, S, S > Matrix
Definition Tableau.hh:44
Matrix A
Definition Tableau.hh:50
Eigen::Vector< Real, S > Vector
Definition Tableau.hh:43
Vector c
Definition Tableau.hh:53
Vector b
Definition Tableau.hh:51