SpECTRE  2021.08.02
TimeSteppers::RungeKutta4 Class Reference

#include <RungeKutta4.hpp>

Public Types

using options = tmpl::list<>
 

Public Member Functions

 RungeKutta4 (const RungeKutta4 &) noexcept=default
 
RungeKutta4operator= (const RungeKutta4 &) noexcept=default
 
 RungeKutta4 (RungeKutta4 &&) noexcept=default
 
RungeKutta4operator= (RungeKutta4 &&) noexcept=default
 
template<typename Vars , typename DerivVars >
void update_u (gsl::not_null< Vars * > u, gsl::not_null< History< Vars, DerivVars > * > history, const TimeDelta &time_step) const noexcept
 
template<typename Vars , typename ErrVars , typename DerivVars >
bool update_u (gsl::not_null< Vars * > u, gsl::not_null< ErrVars * > u_error, gsl::not_null< History< Vars, DerivVars > * > history, const TimeDelta &time_step) const noexcept
 
template<typename Vars , typename DerivVars >
bool dense_update_u (gsl::not_null< Vars * > u, const History< Vars, DerivVars > &history, double time) const noexcept
 
size_t order () const noexcept override
 
size_t error_estimate_order () const noexcept override
 
uint64_t number_of_substeps () const noexcept override
 
uint64_t number_of_substeps_for_error () const noexcept override
 
size_t number_of_past_steps () const noexcept override
 
double stable_step () const noexcept override
 
TimeStepId next_time_id (const TimeStepId &current_id, const TimeDelta &time_step) const noexcept override
 
TimeStepId next_time_id_for_error (const TimeStepId &current_id, const TimeDelta &time_step) const noexcept override
 
template<typename Vars , typename DerivVars >
bool can_change_step_size (const TimeStepId &time_id, const TimeSteppers::History< Vars, DerivVars > &) const noexcept
 
 WRAPPED_PUPable_decl_template (RungeKutta4)
 
 RungeKutta4 (CkMigrateMessage *) noexcept
 
void pup (PUP::er &p) noexcept override
 
template<typename Vars , typename DerivVars >
void update_u (const gsl::not_null< Vars * > u, const gsl::not_null< History< Vars, DerivVars > * > history, const TimeDelta &time_step) const noexcept
 
template<typename Vars , typename ErrVars , typename DerivVars >
bool update_u (const gsl::not_null< Vars * > u, const gsl::not_null< ErrVars * > u_error, const gsl::not_null< History< Vars, DerivVars > * > history, const TimeDelta &time_step) const noexcept
 
template<typename Vars , typename DerivVars >
bool dense_update_u (const gsl::not_null< Vars * > u, const History< Vars, DerivVars > &history, const double time) const noexcept
 

Static Public Attributes

static constexpr Options::String help
 

Detailed Description

The standard 4th-order Runge-Kutta method, given e.g. in https://en.wikipedia.org/wiki/Runge-Kutta_methods that solves equations of the form

\begin{eqnarray} \frac{du}{dt} & = & \mathcal{L}(t,u). \end{eqnarray}

Given a solution \(u(t^n)=u^n\), this stepper computes \(u(t^{n+1})=u^{n+1}\) using the following equations:

\begin{eqnarray} v^{(1)} & = & u^n + dt\cdot \mathcal{L}(t^n, u^n)/2,\\ v^{(2)} & = & u^n + dt\cdot \mathcal{L}(t^n + dt/2, v^{(1)})/2,\\ v^{(3)} & = & u^n + dt\cdot \mathcal{L}(t^n + dt/2, v^{(2)}),\\ v^{(4)} & = & u^n + dt\cdot \mathcal{L}(t^n + dt, v^{(3)}),\\ u^{n+1} & = & (2v^{(1)} + 4v^{(2)} + 2v^{(3)} + v^{(4)} - 3 u^n)/6. \end{eqnarray}

Note that in the implementation, the expression for \(u^{n+1}\) is computed simultaneously with \(v^{(4)}\), so that there are actually only four substeps per step.

Member Data Documentation

◆ help

constexpr Options::String TimeSteppers::RungeKutta4::help
staticconstexpr
Initial value:
= {
"The standard fourth-order Runge-Kutta time-stepper."}