TURTLE
Loading...
Searching...
No Matches
Public Member Functions | Protected Types | Protected Attributes
particle_solver Class Reference

#include <particle_solver.hpp>

Collaboration diagram for particle_solver:
Collaboration graph
[legend]

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_setpset
 
std::vector< std::unique_ptr< particle_rnumber[]> > additional_states
 
const int number_of_additional_states
 
std::string particle_species_name
 
int iteration
 

Detailed Description

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.

Member Typedef Documentation

◆ particle_rnumber

◆ partsize_t

Constructor & Destructor Documentation

◆ particle_solver()

particle_solver::particle_solver ( abstract_particle_set & in_pset,
const int in_number_of_additional_states )
inline

◆ ~particle_solver()

particle_solver::~particle_solver ( )
inline

Member Function Documentation

◆ cRK4()

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*}

◆ Euler()

int particle_solver::Euler ( double dt,
abstract_particle_rhs & rhs )

◆ getIteration()

int particle_solver::getIteration ( void )
inline

◆ getParticleSpeciesName()

std::string particle_solver::getParticleSpeciesName ( ) const
inline

◆ Heun()

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*}

◆ setIteration()

int particle_solver::setIteration ( const int i)
inline

◆ setParticleSpeciesName()

int particle_solver::setParticleSpeciesName ( const std::string new_name)
inline

◆ writeCheckpoint() [1/2]

template<int state_size>
template int particle_solver::writeCheckpoint< 15 > ( const std::string file_name)

◆ writeCheckpoint() [2/2]

template<int state_size>
int particle_solver::writeCheckpoint ( particles_output_hdf5< partsize_t, particle_rnumber, state_size > * particles_output_writer)

◆ writeCheckpointWithLabels()

template<int state_size>
template int particle_solver::writeCheckpointWithLabels< 15 > ( const std::string file_name)

Field Documentation

◆ additional_states

std::vector<std::unique_ptr<particle_rnumber[]> > particle_solver::additional_states
protected

◆ iteration

int particle_solver::iteration
protected

◆ number_of_additional_states

const int particle_solver::number_of_additional_states
protected

◆ particle_species_name

std::string particle_solver::particle_species_name
protected

◆ pset

abstract_particle_set* particle_solver::pset
protected

The documentation for this class was generated from the following files: