SpECTRE  v2024.04.12
TimeSteppers::AdamsBashforth Class Reference

#include <AdamsBashforth.hpp>

Classes

struct  Order
 

Public Types

using options = tmpl::list< Order >
 
- Public Types inherited from LtsTimeStepper
using provided_time_stepper_interfaces = tmpl::list< LtsTimeStepper, TimeStepper >
 
template<typename LocalVars , typename RemoteVars , typename Coupling >
using BoundaryHistoryType = TimeSteppers::BoundaryHistory< LocalVars, RemoteVars, std::invoke_result_t< const Coupling &, LocalVars, RemoteVars > >
 
template<typename LocalVars , typename RemoteVars , typename Coupling >
using BoundaryReturn = db::unprefix_variables< std::invoke_result_t< const Coupling &, LocalVars, RemoteVars > >
 Return type of boundary-related functions. The coupling returns the derivative of the variables, but this is multiplied by the time step so the return type should not have dt prefixes.
 
- Public Types inherited from TimeStepper
using provided_time_stepper_interfaces = tmpl::list< TimeStepper >
 

Public Member Functions

 AdamsBashforth (size_t order)
 
 AdamsBashforth (const AdamsBashforth &)=default
 
AdamsBashforthoperator= (const AdamsBashforth &)=default
 
 AdamsBashforth (AdamsBashforth &&)=default
 
AdamsBashforthoperator= (AdamsBashforth &&)=default
 
size_t order () const override
 The convergence order of the stepper. More...
 
size_t error_estimate_order () const override
 The convergence order of the stepper error measure. More...
 
uint64_t number_of_substeps () const override
 Number of substeps in this TimeStepper. More...
 
uint64_t number_of_substeps_for_error () const override
 Number of substeps in this TimeStepper when providing an error measure for adaptive time-stepping. More...
 
size_t number_of_past_steps () const override
 Number of past time steps needed for multi-step method. More...
 
double stable_step () const override
 Rough estimate of the maximum step size this method can take stably as a multiple of the step for Euler's method. More...
 
bool monotonic () const override
 Whether computational and temporal orderings of operations match. More...
 
TimeStepId next_time_id (const TimeStepId &current_id, const TimeDelta &time_step) const override
 The TimeStepId after the current substep. More...
 
TimeStepId next_time_id_for_error (const TimeStepId &current_id, const TimeDelta &time_step) const override
 The TimeStepId after the current substep when providing an error measure for adaptive time-stepping. More...
 
bool neighbor_data_required (const TimeStepId &next_substep_id, const TimeStepId &neighbor_data_id) const override
 Check whether a neighbor record is needed for boundary output. More...
 
bool neighbor_data_required (double dense_output_time, const TimeStepId &neighbor_data_id) const override
 Check whether a neighbor record is needed for boundary output. More...
 
 WRAPPED_PUPable_decl_template (AdamsBashforth)
 
 AdamsBashforth (CkMigrateMessage *)
 
void pup (PUP::er &p) override
 
- Public Member Functions inherited from LtsTimeStepper
 WRAPPED_PUPable_abstract (LtsTimeStepper)
 
template<typename LocalVars , typename RemoteVars , typename Coupling >
void add_boundary_delta (const gsl::not_null< BoundaryReturn< LocalVars, RemoteVars, Coupling > * > result, const gsl::not_null< BoundaryHistoryType< LocalVars, RemoteVars, Coupling > * > history, const TimeDelta &time_step, const Coupling &coupling) const
 Compute the change in a boundary quantity due to the coupling on the interface. More...
 
template<typename LocalVars , typename RemoteVars , typename Coupling >
void boundary_dense_output (const gsl::not_null< BoundaryReturn< LocalVars, RemoteVars, Coupling > * > result, const BoundaryHistoryType< LocalVars, RemoteVars, Coupling > &history, const double time, const Coupling &coupling) const
 Derived classes must implement this as a function with signature. More...
 
- Public Member Functions inherited from TimeStepper
 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
 Set u to the value at the end of the current substep. 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
 Set u to the value at the end of the current substep; 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 bool monotonic () const =0
 Whether computational and temporal orderings of operations match. 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...
 

Static Public Attributes

static constexpr const size_t minimum_order = 1
 
static constexpr const size_t maximum_order = 8
 
static constexpr Options::String help
 
- Static Public Attributes inherited from LtsTimeStepper
static constexpr bool local_time_stepping = true
 
- Static Public Attributes inherited from TimeStepper
static constexpr bool local_time_stepping = false
 
static constexpr bool imex = false
 

Friends

bool operator== (const AdamsBashforth &lhs, const AdamsBashforth &rhs)
 

Detailed Description

An Nth order Adams-Bashforth time stepper.

The stable step size factors for different orders are given by:

Order CFL Factor
1 1
2 1 / 2
3 3 / 11
4 3 / 20
5 45 / 551
6 5 / 114
7 945 / 40663
8 945 / 77432

Local time stepping calculation

\(\newcommand\tL{t^L}\newcommand\tR{t^R}\newcommand\tU{\tilde{t}\!} \newcommand\mat{\mathbf}\)

Suppose the local and remote sides of the interface are evaluated at times \(\ldots, \tL_{-1}, \tL_0, \tL_1, \ldots\) and \(\ldots, \tR_{-1}, \tR_0, \tR_1, \ldots\), respectively, with the starting location of the numbering arbitrary in each case. Let the step we wish to calculate the effect of be the step from \(\tL_{m_S}\) to \(\tL_{m_S+1}\). We call the sequence produced from the union of the local and remote time sequences \(\ldots, \tU_{-1}, \tU_0, \tU_1, \ldots\). For example, one possible sequence of times is:

\begin{equation} \begin{aligned} \text{Local side:} \\ \text{Union times:} \\ \text{Remote side:} \end{aligned} \cdots \begin{gathered} \, \\ \tU_1 \\ \tR_5 \end{gathered} \leftarrow \Delta \tU_1 \rightarrow \begin{gathered} \tL_4 \\ \tU_2 \\ \, \end{gathered} \leftarrow \Delta \tU_2 \rightarrow \begin{gathered} \, \\ \tU_3 \\ \tR_6 \end{gathered} \leftarrow \Delta \tU_3 \rightarrow \begin{gathered} \, \\ \tU_4 \\ \tR_7 \end{gathered} \leftarrow \Delta \tU_4 \rightarrow \begin{gathered} \tL_5 \\ \tU_5 \\ \, \end{gathered} \cdots \end{equation}

We call the indices of the step's start and end times in the union time sequence \(n_S\) and \(n_E\), respectively. We define \(n^L_m\) to be the union-time index corresponding to \(\tL_m\) and \(m^L_n\) to be the index of the last local time not later than \(\tU_n\) and similarly for the remote side. So for the above example, \(n^L_4 = 2\) and \(m^R_2 = 5\), and if we wish to compute the step from \(\tL_4\) to \(\tL_5\) we would have \(m_S = 4\), \(n_S = 2\), and \(n_E = 5\).

If we wish to evaluate the change over this step to \(k\)th order, we can write the change in the value as a linear combination of the values of the coupling between the elements at unequal times:

\begin{equation} \mat{F}_{m_S} = \mspace{-10mu} \sum_{q^L = m_S-(k-1)}^{m_S} \, \sum_{q^R = m^R_{n_S}-(k-1)}^{m^R_{n_E-1}} \mspace{-10mu} \mat{D}_{q^Lq^R} I_{q^Lq^R}, \end{equation}

where \(\mat{D}_{q^Lq^R}\) is the coupling function evaluated between data from \(\tL_{q^L}\) and \(\tR_{q^R}\). The coefficients can be written as the sum of three terms,

\begin{equation} I_{q^Lq^R} = I^E_{q^Lq^R} + I^R_{q^Lq^R} + I^L_{q^Lq^R}, \end{equation}

which can be interpreted as a contribution from equal-time evaluations and contributions related to the remote and local evaluation times. These are given by

\begin{align} I^E_{q^Lq^R} &= \mspace{-10mu} \sum_{n=n_S}^{\min\left\{n_E, n^L+k\right\}-1} \mspace{-10mu} \tilde{\alpha}_{n,n-n^L} \Delta \tU_n &&\text{if $\tL_{q^L} = \tR_{q^R}$, otherwise 0} \\ I^R_{q^Lq^R} &= \ell_{q^L - m_S + k}\!\left( \tU_{n^R}; \tL_{m_S - (k-1)}, \ldots, \tL_{m_S}\right) \mspace{-10mu} \sum_{n=\max\left\{n_S, n^R\right\}} ^{\min\left\{n_E, n^R+k\right\}-1} \mspace{-10mu} \tilde{\alpha}_{n,n-n^R} \Delta \tU_n &&\text{if $\tR_{q^R}$ is not in $\{\tL_{\vphantom{|}\cdots}\}$, otherwise 0} \\ I^L_{q^Lq^R} &= \mspace{-10mu} \sum_{n=\max\left\{n_S, n^R\right\}} ^{\min\left\{n_E, n^L+k, n^R_{q^R+k}\right\}-1} \mspace{-10mu} \ell_{q^R - m^R_n + k}\!\left(\tU_{n^L}; \tR_{m^R_n - (k-1)}, \ldots, \tR_{m^R_n}\right) \tilde{\alpha}_{n,n-n^L} \Delta \tU_n &&\text{if $\tL_{q^L}$ is not in $\{\tR_{\vphantom{|}\cdots}\}$, otherwise 0,} \end{align}

where for brevity we write \(n^L = n^L_{q^L}\) and \(n^R = n^R_{q^R}\), and where \(\ell_a(t; x_1, \ldots, x_k)\) a Lagrange interpolating polynomial and \(\tilde{\alpha}_{nj}\) is the \(j\)th coefficient for an Adams-Bashforth step over the union times from step \(n\) to step \(n+1\).

Member Function Documentation

◆ error_estimate_order()

size_t TimeSteppers::AdamsBashforth::error_estimate_order ( ) const
overridevirtual

The convergence order of the stepper error measure.

Implements TimeStepper.

◆ monotonic()

bool TimeSteppers::AdamsBashforth::monotonic ( ) const
overridevirtual

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.

Warning
This guarantee only holds if the time steps themselves are monotonic, which can be violated during initialization.

Implements TimeStepper.

◆ neighbor_data_required() [1/2]

bool TimeSteppers::AdamsBashforth::neighbor_data_required ( const TimeStepId next_substep_id,
const TimeStepId neighbor_data_id 
) const
overridevirtual

Check whether a neighbor record is needed for boundary output.

In order to perform boundary output, all records from the neighbor with TimeStepIds for which this method returns true should have been added to the history. Versions are provided for a substep and for dense output.

Implements LtsTimeStepper.

◆ neighbor_data_required() [2/2]

bool TimeSteppers::AdamsBashforth::neighbor_data_required ( double  dense_output_time,
const TimeStepId neighbor_data_id 
) const
overridevirtual

Check whether a neighbor record is needed for boundary output.

In order to perform boundary output, all records from the neighbor with TimeStepIds for which this method returns true should have been added to the history. Versions are provided for a substep and for dense output.

Implements LtsTimeStepper.

◆ next_time_id()

TimeStepId TimeSteppers::AdamsBashforth::next_time_id ( const TimeStepId current_id,
const TimeDelta time_step 
) const
overridevirtual

The TimeStepId after the current substep.

Implements TimeStepper.

◆ next_time_id_for_error()

TimeStepId TimeSteppers::AdamsBashforth::next_time_id_for_error ( const TimeStepId current_id,
const TimeDelta time_step 
) const
overridevirtual

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.

Implements TimeStepper.

◆ number_of_past_steps()

size_t TimeSteppers::AdamsBashforth::number_of_past_steps ( ) const
overridevirtual

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

Implements TimeStepper.

◆ number_of_substeps()

uint64_t TimeSteppers::AdamsBashforth::number_of_substeps ( ) const
overridevirtual

Number of substeps in this TimeStepper.

Implements TimeStepper.

◆ number_of_substeps_for_error()

uint64_t TimeSteppers::AdamsBashforth::number_of_substeps_for_error ( ) const
overridevirtual

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.

Implements TimeStepper.

◆ order()

size_t TimeSteppers::AdamsBashforth::order ( ) const
overridevirtual

The convergence order of the stepper.

Implements TimeStepper.

◆ stable_step()

double TimeSteppers::AdamsBashforth::stable_step ( ) const
overridevirtual

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

Implements TimeStepper.

Member Data Documentation

◆ help

constexpr Options::String TimeSteppers::AdamsBashforth::help
staticconstexpr
Initial value:
= {
"An Adams-Bashforth Nth order time-stepper."}

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