SpECTRE
v2024.12.16
|
Abstract base class for TimeSteppers. More...
#include <TimeStepper.hpp>
Public Types | |
using | provided_time_stepper_interfaces = implementation defined |
Public Member Functions | |
WRAPPED_PUPable_abstract (TimeStepper) | |
template<typename Vars > | |
void | update_u (const gsl::not_null< Vars * > u, const TimeSteppers::History< Vars > &history, const TimeDelta &time_step) const |
Set u to the value at the end of the current substep. More... | |
template<typename Vars > | |
std::optional< StepperErrorEstimate > | update_u (const gsl::not_null< Vars * > u, const TimeSteppers::History< Vars > &history, const TimeDelta &time_step, const std::optional< StepperErrorTolerances > &tolerances) const |
Set u to the value at the end of the current substep; report the error measure when available. More... | |
template<typename Vars > | |
void | clean_history (const gsl::not_null< TimeSteppers::History< Vars > * > history) const |
Remove old entries from the history. 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 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 bool | monotonic () const =0 |
Whether computational and temporal orderings of operations match. More... | |
virtual TimeStepId | next_time_id (const TimeStepId ¤t_id, const TimeDelta &time_step) const =0 |
The TimeStepId after the current substep. More... | |
virtual TimeStepId | next_time_id_for_error (const TimeStepId ¤t_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. Step sizes can never be changed on a substep. More... | |
Static Public Attributes | |
static constexpr bool | local_time_stepping = false |
static constexpr bool | imex = false |
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.
|
inline |
Whether a change in the step size is allowed before taking a step. Step sizes can never be changed on a substep.
Derived classes must implement this as a function with signature
|
inline |
Remove old entries from the history.
This should be called after update_u and dense output. Afterward, the history will generally require a new entry to be added before it can be used by the TimeStepper.
Derived classes must implement this as a function with signature
|
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.
The change from the partial step will be added to the initial value, so u
should generally be initialized to *history.complete_step_start().value
. (TimeStepper implementations are required to keep this value in the history.)
Derived classes must implement this as a function with signature
|
pure virtual |
Whether computational and temporal orderings of operations match.
If this method returns true, then, for two time-stepper operations occurring at different simulation times, the temporally earlier operation will be performed first. These operations include RHS evaluation, dense output, and neighbor communication. In particular, dense output never requires performing a RHS evaluation later than the output time, so control systems measurements cannot cause deadlocks.
Implemented in TimeSteppers::AdamsBashforth, TimeSteppers::AdamsMoultonPc< Monotonic >, TimeSteppers::Rk3HesthavenSsp, and TimeSteppers::RungeKutta.
|
pure virtual |
The TimeStepId after the current substep.
Implemented in TimeSteppers::AdamsBashforth, TimeSteppers::AdamsMoultonPc< Monotonic >, TimeSteppers::Rk3HesthavenSsp, and TimeSteppers::RungeKutta.
|
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 TimeSteppers::AdamsBashforth, TimeSteppers::AdamsMoultonPc< Monotonic >, TimeSteppers::Rk3HesthavenSsp, and TimeSteppers::RungeKutta.
|
pure virtual |
Number of past time steps needed for multi-step method.
Implemented in TimeSteppers::AdamsBashforth, TimeSteppers::AdamsMoultonPc< Monotonic >, TimeSteppers::Rk3HesthavenSsp, and TimeSteppers::RungeKutta.
|
pure virtual |
Number of substeps in this TimeStepper.
Implemented in TimeSteppers::AdamsBashforth, TimeSteppers::AdamsMoultonPc< Monotonic >, TimeSteppers::Rk3HesthavenSsp, and TimeSteppers::RungeKutta.
|
pure virtual |
Number of substeps in this TimeStepper 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 TimeSteppers::AdamsBashforth, TimeSteppers::AdamsMoultonPc< Monotonic >, TimeSteppers::Rk3HesthavenSsp, and TimeSteppers::RungeKutta.
|
pure virtual |
The convergence order of the stepper.
Implemented in TimeSteppers::AdamsBashforth, TimeSteppers::AdamsMoultonPc< Monotonic >, TimeSteppers::ClassicalRungeKutta4, TimeSteppers::DormandPrince5, TimeSteppers::Heun2, TimeSteppers::Rk3HesthavenSsp, TimeSteppers::Rk3Kennedy, TimeSteppers::Rk3Owren, TimeSteppers::Rk3Pareschi, TimeSteppers::Rk4Kennedy, TimeSteppers::Rk4Owren, TimeSteppers::Rk5Owren, and TimeSteppers::Rk5Tsitouras.
|
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::AdamsBashforth, TimeSteppers::AdamsMoultonPc< Monotonic >, TimeSteppers::ClassicalRungeKutta4, TimeSteppers::DormandPrince5, TimeSteppers::Heun2, TimeSteppers::Rk3HesthavenSsp, TimeSteppers::Rk3Kennedy, TimeSteppers::Rk3Owren, TimeSteppers::Rk3Pareschi, TimeSteppers::Rk4Kennedy, TimeSteppers::Rk4Owren, TimeSteppers::Rk5Owren, and TimeSteppers::Rk5Tsitouras.
|
inline |
Set u
to the value at the end of the current substep.
Derived classes must implement this as a function with signature
|
inline |
Set u
to the value at the end of the current substep; 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, the return value is empty
If tolerances
is empty, no error measures are calculated, but any additional substeps necessary for error estimation are still taken. This is useful when a system integrates multiple variables in separate calls to the TimeStepper, but only uses estimates from some of them.
Derived classes must implement this as a function with signature