SpECTRE  v2022.08.01
TimeStepper Class Referenceabstract

Abstract base class for TimeSteppers. More...

#include <TimeStepper.hpp>

Public Member Functions

 WRAPPED_PUPable_abstract (TimeStepper)
 
template<typename Vars >
void update_u (const gsl::not_null< Vars * > u, const gsl::not_null< TimeSteppers::History< Vars > * > history, const TimeDelta &time_step) const
 Add the change for the current substep to u. More...
 
template<typename Vars , typename ErrVars >
bool update_u (const gsl::not_null< Vars * > u, const gsl::not_null< ErrVars * > u_error, const gsl::not_null< TimeSteppers::History< Vars > * > history, const TimeDelta &time_step) const
 Add the change for the current substep to u; report the error measure when available. More...
 
template<typename Vars >
bool dense_update_u (const gsl::not_null< Vars * > u, const TimeSteppers::History< Vars > &history, const double time) const
 Compute the solution value at a time between steps. To evaluate at a time within a given step, call this method at the start of the step containing the time. The function returns true on success, otherwise the call should be retried after the next substep. More...
 
virtual size_t order () const =0
 The convergence order of the stepper. More...
 
virtual size_t error_estimate_order () const =0
 The convergence order of the stepper error measure. More...
 
virtual uint64_t number_of_substeps () const =0
 Number of substeps in this TimeStepper. More...
 
virtual uint64_t number_of_substeps_for_error () const =0
 Number of substeps in this TimeStepper when providing an error measure for adaptive time-stepping. More...
 
virtual size_t number_of_past_steps () const =0
 Number of past time steps needed for multi-step method. More...
 
virtual double stable_step () const =0
 Rough estimate of the maximum step size this method can take stably as a multiple of the step for Euler's method. More...
 
virtual TimeStepId next_time_id (const TimeStepId &current_id, const TimeDelta &time_step) const =0
 The TimeStepId after the current substep. More...
 
virtual TimeStepId next_time_id_for_error (const TimeStepId &current_id, const TimeDelta &time_step) const =0
 The TimeStepId after the current substep when providing an error measure for adaptive time-stepping. More...
 
template<typename Vars >
bool can_change_step_size (const TimeStepId &time_id, const TimeSteppers::History< Vars > &history) const
 Whether a change in the step size is allowed before taking a step. More...
 

Detailed Description

Abstract base class for TimeSteppers.

Several of the member functions of this class are templated and perform type erasure before forwarding their arguments to the derived classes. This is implemented using the macros TIME_STEPPER_DECLARE_OVERLOADS, which must be placed in a private section of the class body, and TIME_STEPPER_DEFINE_OVERLOADS(derived_class), which must be placed in the cpp file.

Member Function Documentation

◆ can_change_step_size()

template<typename Vars >
bool TimeStepper::can_change_step_size ( const TimeStepId time_id,
const TimeSteppers::History< Vars > &  history 
) const
inline

Whether a change in the step size is allowed before taking a step.

Derived classes must implement this as a function with signature

template <typename T>
bool can_change_step_size_impl(const TimeStepId& time_id,
const UntypedHistory<T>& history) const;
A unique identifier for the temporal state of an integrated system.
Definition: TimeStepId.hpp:25

◆ dense_update_u()

template<typename Vars >
bool TimeStepper::dense_update_u ( const gsl::not_null< Vars * >  u,
const TimeSteppers::History< Vars > &  history,
const double  time 
) const
inline

Compute the solution value at a time between steps. To evaluate at a time within a given step, call this method at the start of the step containing the time. The function returns true on success, otherwise the call should be retried after the next substep.

Derived classes must implement this as a function with signature

template <typename T>
bool dense_update_u_impl(
const UntypedHistory<T>& history, double time) const;
Require a pointer to not be a nullptr
Definition: Gsl.hpp:183

◆ error_estimate_order()

virtual size_t TimeStepper::error_estimate_order ( ) const
pure virtual

◆ next_time_id()

virtual TimeStepId TimeStepper::next_time_id ( const TimeStepId current_id,
const TimeDelta time_step 
) const
pure virtual

The TimeStepId after the current substep.

Implemented in TimeSteppers::AdamsBashforthN, and TimeSteppers::RungeKutta.

◆ next_time_id_for_error()

virtual TimeStepId TimeStepper::next_time_id_for_error ( const TimeStepId current_id,
const TimeDelta time_step 
) const
pure virtual

The TimeStepId after the current substep when providing an error measure for adaptive time-stepping.

Certain substep methods (e.g. embedded RK4(3)) require additional steps when providing an error measure of the integration.

Implemented in LtsTimeStepper, and TimeSteppers::RungeKutta.

◆ number_of_past_steps()

virtual size_t TimeStepper::number_of_past_steps ( ) const
pure virtual

Number of past time steps needed for multi-step method.

Implemented in TimeSteppers::AdamsBashforthN, and TimeSteppers::RungeKutta.

◆ number_of_substeps()

virtual uint64_t TimeStepper::number_of_substeps ( ) const
pure virtual

Number of substeps in this TimeStepper.

Implemented in LtsTimeStepper, and TimeSteppers::RungeKutta.

◆ number_of_substeps_for_error()

virtual uint64_t TimeStepper::number_of_substeps_for_error ( ) const
pure virtual

Number of substeps in this TimeStepper when providing an error measure for adaptive time-stepping.

Details

Certain substep methods (e.g. embedded RK4(3)) require additional steps when providing an error measure of the integration.

Implemented in LtsTimeStepper, and TimeSteppers::RungeKutta.

◆ order()

virtual size_t TimeStepper::order ( ) const
pure virtual

◆ stable_step()

virtual double TimeStepper::stable_step ( ) const
pure virtual

Rough estimate of the maximum step size this method can take stably as a multiple of the step for Euler's method.

Implemented in TimeSteppers::AdamsBashforthN, TimeSteppers::Cerk2, TimeSteppers::Cerk3, TimeSteppers::Cerk4, TimeSteppers::Cerk5, TimeSteppers::DormandPrince5, TimeSteppers::RungeKutta3, and TimeSteppers::RungeKutta4.

◆ update_u() [1/2]

template<typename Vars , typename ErrVars >
bool TimeStepper::update_u ( const gsl::not_null< Vars * >  u,
const gsl::not_null< ErrVars * >  u_error,
const gsl::not_null< TimeSteppers::History< Vars > * >  history,
const TimeDelta time_step 
) const
inline

Add the change for the current substep to u; report the error measure when available.

For a substep method, the error measure will only be available on full steps. For a multistep method, the error measure will only be available when a sufficient number of steps are available in the history to compare two orders of step. Whenever the error measure is unavailable, u_error is unchanged and the function return is false.

Derived classes must implement this as a function with signature

template <typename T>
bool update_u_impl(gsl::not_null<T*> u, gsl::not_null<T*> u_error,
gsl::not_null<UntypedHistory<T>*> history,
const TimeDelta& time_step) const;
Represents an interval of time within a single slab.
Definition: Time.hpp:88

◆ update_u() [2/2]

template<typename Vars >
void TimeStepper::update_u ( const gsl::not_null< Vars * >  u,
const gsl::not_null< TimeSteppers::History< Vars > * >  history,
const TimeDelta time_step 
) const
inline

Add the change for the current substep to u.

Derived classes must implement this as a function with signature

template <typename T>
void update_u_impl(gsl::not_null<T*> u,
gsl::not_null<UntypedHistory<T>*> history,
const TimeDelta& time_step) const;

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