TURTLE
|
#include <particle_solver.hpp>
Public Member Functions | |
particle_solver (abstract_particle_set &in_pset, const int in_number_of_additional_states) | |
~particle_solver () noexcept(false) | |
int | setIteration (const int i) |
int | getIteration (void) |
std::string | getParticleSpeciesName () const |
int | setParticleSpeciesName (const std::string new_name) |
template<int state_size> | |
int | writeCheckpoint (particles_output_hdf5< partsize_t, particle_rnumber, state_size > *particles_output_writer) |
template<int state_size> | |
int | writeCheckpoint (const std::string file_name) |
template<int state_size> | |
int | writeCheckpointWithLabels (const std::string file_name) |
int | Euler (double dt, abstract_particle_rhs &rhs) |
int | Heun (double dt, abstract_particle_rhs &rhs) |
Implementation of the Heun integration method. | |
int | cRK4 (double dt, abstract_particle_rhs &rhs) |
Implementation of the classic 4th order Runge Kutta integration method. | |
Protected Types | |
using | particle_rnumber = abstract_particle_set::particle_rnumber |
using | partsize_t = abstract_particle_set::partsize_t |
Protected Attributes | |
abstract_particle_set * | pset |
std::vector< std::unique_ptr< particle_rnumber[]> > | additional_states |
const int | number_of_additional_states |
std::string | particle_species_name |
int | iteration |
Time-stepping and checkpointing functionality for particle systems.
This class implements the universal functionality of a particle solver: time-stepping methods and checkpointing, together with the associated bookkeeping.
We rely on predefined functionality of particle set objects, as well as "particle right-hand-side computers".
Development note: the additional_states
member is to be used for Adams-Bashforth time-stepping, not for Runge-Kutta k values. In particular values stored in additional_states
are used for check-pointing, so there's no sense to allocate this array unless strictly required as for the Adams-Bashforth scheme.
|
protected |
|
protected |
|
inline |
|
inline |
int particle_solver::cRK4 | ( | double | dt, |
abstract_particle_rhs & | rhs ) |
Implementation of the classic 4th order Runge Kutta integration method.
This is a fourth order Runge-Kutta time-stepping algorithm. We integrate the following first oder ODE:
\[ x'(t) = f(t, x(t)). \]
The initial condition is \( x_n \) (for time \( t_n \)), and we would like to integrate the equation forward for an interval \( h \). Then we must apply the following formulas:
\begin{eqnarray*} k_1 &=& f(t_n, x_n) \\ k_2 &=& f(t_n+frac{h}{2}, x_n + \frac{h}{2} k_1) \\ k_3 &=& f(t_n+frac{h}{2}, x_n + \frac{h}{2} k_2) \\ k_4 &=& f(t_n+h, x_n + h k_3) \\ x_{n+1} &=& x_n + \frac{h}{6}(k_1 + 2 k_2 + 2 k_3 + k_4) \end{eqnarray*}
int particle_solver::Euler | ( | double | dt, |
abstract_particle_rhs & | rhs ) |
|
inline |
|
inline |
int particle_solver::Heun | ( | double | dt, |
abstract_particle_rhs & | rhs ) |
Implementation of the Heun integration method.
This is a second order Runge-Kutta time-stepping algorithm. We integrate the following first oder ODE:
\[ x'(t) = f(t, x(t)). \]
The initial condition is \( x_n \) (for time \( t_n \)), and we would like to integrate the equation forward for an interval \( h \). Then we must apply the following formulas:
\begin{eqnarray*} k_1 &=& f(t_n, x_n) \\ k_2 &=& f(t_n+h, x_n + h k_1) \\ x_{n+1} &=& x_n + \frac{h}{2}(k_1 + k_2) \end{eqnarray*}
|
inline |
|
inline |
template int particle_solver::writeCheckpoint< 15 > | ( | const std::string | file_name | ) |
int particle_solver::writeCheckpoint | ( | particles_output_hdf5< partsize_t, particle_rnumber, state_size > * | particles_output_writer | ) |
template int particle_solver::writeCheckpointWithLabels< 15 > | ( | const std::string | file_name | ) |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |