Orrery
A GPU-accelerated N-body gravitational simulator
Loading...
Searching...
No Matches
orrery::integrators::RungeKutta4 Class Referencefinal

The classical fourth-order Runge-Kutta method. More...

#include <orrery/integrators/runge_kutta4.hpp>

Inheritance diagram for orrery::integrators::RungeKutta4:
orrery::integrators::Integrator

Public Member Functions

void step (core::ParticleData &data, core::Real timestep, AccelerationField &field) override
 Advance the configuration by one step of timestep.
std::string_view name () const noexcept override
 The method's name, for diagnostics output and test messages.
int order () const noexcept override
 The order of the method: the power of the timestep that the error after a fixed interval of simulated time falls with.
bool is_symplectic () const noexcept override
 Whether the method preserves the phase-space volume of the flow.
core::Index force_evaluations_per_step () const noexcept override
 Four, and the first of them is free.

Additional Inherited Members

Protected Member Functions inherited from orrery::integrators::Integrator
 Integrator (const Integrator &)=default
 Integrator (Integrator &&)=default
Integrator & operator= (const Integrator &)=default
Integrator & operator= (Integrator &&)=default

Detailed Description

The classical fourth-order Runge-Kutta method.

Holds four scratch arrays of the same length as the configuration. They are members rather than locals so that a step of a million particles does not allocate and free 96 MB every time it is called; the first step of a run sizes them and every step after finds them the right length already.

Member Function Documentation

◆ step()

void orrery::integrators::RungeKutta4::step ( core::ParticleData & data,
core::Real timestep,
AccelerationField & field )
overridevirtual

Advance the configuration by one step of timestep.

Requires the invariant above and restores it. A negative timestep is meaningful and is not an error: the symmetric methods here are exactly time-reversible, and stepping backwards is how a test asserts it.

Implements orrery::integrators::Integrator.

◆ name()

std::string_view orrery::integrators::RungeKutta4::name ( ) const
inlinenodiscardoverridevirtualnoexcept

The method's name, for diagnostics output and test messages.

Implements orrery::integrators::Integrator.

◆ order()

int orrery::integrators::RungeKutta4::order ( ) const
inlinenodiscardoverridevirtualnoexcept

The order of the method: the power of the timestep that the error after a fixed interval of simulated time falls with.

Implements orrery::integrators::Integrator.

◆ is_symplectic()

bool orrery::integrators::RungeKutta4::is_symplectic ( ) const
inlinenodiscardoverridevirtualnoexcept

Whether the method preserves the phase-space volume of the flow.

The property that decides whether the energy error stays inside a bounded envelope for ever or grows without limit, which for a simulation run over millions of steps matters more than the order does. ADR-0011 sets out the argument and the validation suite demonstrates it.

Implements orrery::integrators::Integrator.

◆ force_evaluations_per_step()

core::Index orrery::integrators::RungeKutta4::force_evaluations_per_step ( ) const
inlinenodiscardoverridevirtualnoexcept

Four, and the first of them is free.

The first stage needs the acceleration at the starting positions, which the invariant in integrator.hpp says is already there. The fourth evaluation is the one that restores that invariant at the new positions, so it is not spent twice either. The classical count and the count this implementation pays are the same number.

Implements orrery::integrators::Integrator.


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