Sandals  v0.0.0
A C++ library for ODEs/DAEs integration
Loading...
Searching...
No Matches
Fehlberg45.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_FEHELBERG45_HH
14#define SANDALS_FEHELBERG45_HH
15
16#include <Sandals.hh>
17#include <Sandals/RungeKutta.hh>
18
19namespace Sandals
20{
41 template <typename Real>
42 class Fehlberg45Tableau : public Tableau<Real, 6>
43 {
44 public:
45 using typename Tableau<Real, 6>::Type;
46 using typename Tableau<Real, 6>::Vector;
47 using typename Tableau<Real, 6>::Matrix;
48
53 this->name = "Fehlberg45";
54 this->type = Type::ERK;
55 this->order = 4;
56 this->order_e = 5;
57 this->is_embedded = true;
58 this->A << 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
59 1.0/4.0, 0.0, 0.0, 0.0, 0.0, 0.0,
60 3.0/32.0, 9.0/32.0, 0.0, 0.0, 0.0, 0.0,
61 1932.0/2197.0, -7200.0/2197.0, 7296.0/2197.0, 0.0, 0.0, 0.0,
62 439.0/216.0, -8.0, 3680.0/513.0, -845.0/4104.0, 0.0, 0.0,
63 -8.0/27.0, 2.0, -3544.0/2565.0, 1859.0/4104.0, -11.0/40.0, 0.0;
64 this->b << 25.0/216.0, 0.0, 1408.0/2565.0, 2197.0/4104.0, -1.0/5.0, 0.0;
65 this->b_e << 16.0/135.0, 0.0, 6656.0/12825.0, 28561.0/56430.0, -9.0/50.0, 2.0/55.0;
66 this->c << 0.0, 1.0/4.0, 3.0/8.0, 12.0/13.0, 1.0, 1.0/2.0;
67 }
68 }; // class Fehlberg45Tableau
69
78 template <typename Real, Integer N, Integer M = 0>
79 class Fehlberg45 : public RungeKutta<Real, 6, N, M>
80 {
81 public:
83
87 Fehlberg45() : RungeKutta<Real, 6, N, M>(Fehlberg45Tableau<Real>()) {}
88
93 Fehlberg45(System t_system) : RungeKutta<Real, 6, N, M>(Fehlberg45Tableau<Real>(), t_system) {}
94
95 }; // class Fehlberg45
96
97} // namespace Sandals
98
99#endif // SANDALS_FEHELBERG45_HH
typename Implicit< Real, N, M >::Pointer System
Definition Fehlberg45.hh:82
Fehlberg45()
Definition Fehlberg45.hh:87
Fehlberg45(System t_system)
Definition Fehlberg45.hh:93
Butcher tableau for the Runge-Kutta-Fehlberg 4(5) method.
Definition Fehlberg45.hh:43
Fehlberg45Tableau()
Definition Fehlberg45.hh:52
std::shared_ptr< Implicit< Real, N, M > > Pointer
Definition Implicit.hh:47
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
Vector b_e
Definition Tableau.hh:52
Integer order_e
Definition Tableau.hh:49
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
bool is_embedded
Definition Tableau.hh:54