DiFfRG
Loading...
Searching...
No Matches
boost_rk.hh
Go to the documentation of this file.
1#pragma once
2
3// external libraries
4#include <boost/numeric/odeint.hpp>
5#include <boost/numeric/odeint/external/eigen/eigen.hpp>
6
7// DiFfRG
15
16namespace DiFfRG
17{
18 template <int prec> struct stepperChoice {
19 static_assert(prec == 0 || prec == 1, "Only precisions 0 and 1 are supported!");
20
21 using error_stepper_type_0 = boost::numeric::odeint::runge_kutta_cash_karp54<Eigen::VectorXd>;
22 using error_stepper_type_1 = boost::numeric::odeint::runge_kutta_fehlberg78<Eigen::VectorXd>;
23
24 using value = std::conditional_t<prec == 0, error_stepper_type_0, error_stepper_type_1>;
25 };
26
36 template <typename VectorType, typename SparseMatrixType, uint dim, int prec>
37 class TimeStepperBoostRK : public AbstractTimestepper<VectorType, SparseMatrixType, dim>
38 {
40
41 public:
42 using NumberType = typename Base::NumberType;
45
47 using Base::Base;
50
52
56 virtual void run(AbstractFlowingVariables<NumberType> *initial_condition, const double t_start,
57 const double t_stop) override;
58
59 private:
60 void run(VectorType &initial_data, const double t_start, const double t_stop);
61 void run(BlockVectorType &initial_data, const double t_start, const double t_stop);
62 void run_vars(VectorType &initial_data, const double t_start, const double t_stop);
63 };
64
71 template <typename VectorType, typename SparseMatrixType = dealii::SparseMatrix<get_type::NumberType<VectorType>>,
72 uint dim = 0>
74
81 template <typename VectorType, typename SparseMatrixType = dealii::SparseMatrix<get_type::NumberType<VectorType>>,
82 uint dim = 0>
84} // namespace DiFfRG
A class to set up initial data for whatever discretization we have chosen. Also used to switch/manage...
Definition abstract_data.hh:18
The abstract base class for all timestepping algorithms. It provides a standard constructor which pop...
Definition abstract_timestepper.hh:46
VectorType VectorType
Definition abstract_timestepper.hh:49
dealii::BlockVector< NumberType > BlockVectorType
Definition abstract_timestepper.hh:54
int verbosity
Definition abstract_timestepper.hh:144
AbstractAssembler< VectorType, SparseMatrixType, dim > * assembler
Definition abstract_timestepper.hh:134
void console_out(const double t, const std::string name, const int verbosity_level, const double calc_dt_ms=-1.0) const
Definition abstract_timestepper.hh:170
DataOutput< dim, VectorType > * data_out
Definition abstract_timestepper.hh:135
AbstractAdaptor< VectorType > * adaptor
Definition abstract_timestepper.hh:136
typename get_type::NumberType< VectorType > NumberType
Definition abstract_timestepper.hh:50
typename get_type::InverseSparseMatrixType< SparseMatrixType > InverseSparseMatrixType
Definition abstract_timestepper.hh:52
struct DiFfRG::AbstractTimestepper::implicitParameters impl
const JSONValue json
Definition abstract_timestepper.hh:133
struct DiFfRG::AbstractTimestepper::explicitParameters expl
double output_dt
Definition abstract_timestepper.hh:145
A class to perform time stepping using adaptive Boost Runge-Kutta methods. This stepper uses adaptive...
Definition boost_rk.hh:38
typename Base::NumberType NumberType
Definition boost_rk.hh:42
void run(BlockVectorType &initial_data, const double t_start, const double t_stop)
virtual void run(AbstractFlowingVariables< NumberType > *initial_condition, const double t_start, const double t_stop) override
Run the time stepping algorithm.
void run_vars(VectorType &initial_data, const double t_start, const double t_stop)
typename Base::BlockVectorType BlockVectorType
Definition boost_rk.hh:44
typename Base::InverseSparseMatrixType InverseSparseMatrixType
Definition boost_rk.hh:43
typename stepperChoice< prec >::value error_stepper_type
Definition boost_rk.hh:51
void run(VectorType &initial_data, const double t_start, const double t_stop)
Definition complex_math.hh:14
Definition boost_rk.hh:18
boost::numeric::odeint::runge_kutta_fehlberg78< Eigen::VectorXd > error_stepper_type_1
Definition boost_rk.hh:22
boost::numeric::odeint::runge_kutta_cash_karp54< Eigen::VectorXd > error_stepper_type_0
Definition boost_rk.hh:21
std::conditional_t< prec==0, error_stepper_type_0, error_stepper_type_1 > value
Definition boost_rk.hh:24