SpECTRE  v2024.06.18
Time

Code related to the representation of time during simulations. More...

Namespaces

namespace  SelfStart
 Definition of the integrator self-starting procedure.
 
namespace  StepChoosers
 Holds all the StepChoosers.
 
namespace  TimeSequences
 Holds all the TimeSequences.
 

Classes

class  DenseTriggers::Times
 Trigger at specified times. More...
 
struct  Actions::AdvanceTime
 Advance time one substep. More...
 
struct  Actions::ChangeStepSize< StepChoosersToUse >
 Adjust the step size for local time stepping. More...
 
struct  Actions::CleanHistory< System, CleanBoundaryHistory >
 Clean time stepper history after a substep. More...
 
struct  Actions::RecordTimeStepperData< System >
 Records the variables and their time derivatives in the time stepper history. More...
 
struct  SelfStart::Tags::InitialValue< Tag >
 The initial value of a quantity. The contents are stored in a tuple to avoid putting duplicate tensors into the DataBox. More...
 
struct  SelfStart::Actions::Initialize< System >
 Prepares the evolution for time-stepper self-starting. More...
 
struct  SelfStart::Actions::CheckForCompletion< ExitTag, System >
 Resets the state for the next iteration if the current order is complete, and exits the self-start loop if the required order has been reached. More...
 
struct  SelfStart::Actions::CheckForOrderIncrease
 If we have taken enough steps for this order, set the next time to the start time and increment the slab number. More...
 
struct  SelfStart::Actions::Cleanup
 Cleans up after the self-start procedure. More...
 
struct  Actions::UpdateU< System >
 Perform variable updates for one substep. More...
 
struct  ApproximateTime
 Time-like interface to a double for use with dense output. More...
 
struct  ApproximateTimeDelta
 TimeDelta-like interface to a double for use with dense output. More...
 
struct  Actions::ChangeSlabSize
 Adjust the slab size based on previous executions of Events::ChangeSlabSize. More...
 
class  Events::ChangeSlabSize
 Trigger a slab size change. More...
 
struct  evolution_comparator< T, Comparator >
 Implementation of evolution_less, evolution_greater, evolution_less_equal, and evolution_greater_equal. More...
 
struct  OptionTags::InitialSlabSize
 The initial slab size. More...
 
struct  OptionTags::InitialTime
 The time at which to start the simulation. More...
 
struct  OptionTags::InitialTimeStep
 The initial time step taken by the time stepper. This may be overridden by an adaptive stepper. More...
 
struct  OptionTags::StepChoosers
 
struct  OptionTags::TimeStepper< StepperType >
 
class  Slab
 A chunk of time. Every element must reach slab boundaries exactly, no matter how it actually takes time steps to get there. The simulation can only be assumed to have global data available at slab boundaries. More...
 
struct  Tags::IsUsingTimeSteppingErrorControlCompute< LocalTimeStepping >
 A tag that is true if the ErrorControl step chooser is one of the option-created Events. More...
 
struct  Tags::StepperErrorTolerancesCompute< EvolvedVariableTag, LocalTimeStepping >
 A tag that contains the error tolerances if the ErrorControl step chooser is one of the option-created Events. More...
 
class  StepChooser< StepChooserUse >
 StepChoosers suggest upper bounds on step sizes. See TimeStepRequest for details on how the results are used. More...
 
struct  StepperErrorEstimate
 Estimate of the TimeStepper truncation error. More...
 
struct  StepperErrorTolerances
 Tolerances used for time step error control. More...
 
struct  Tags::HistoryEvolvedVariables< Tag >
 Tag for the TimeStepper history. More...
 
struct  Tags::IsUsingTimeSteppingErrorControl
 Tag for reporting whether the ErrorControl step chooser is in use. More...
 
struct  Tags::StepChoosers
 Tag for a vector of StepChoosers. More...
 
struct  Tags::StepperErrors< Tag >
 Tag for the stepper error measures. More...
 
struct  Tags::StepperErrorTolerances< Tag >
 Tag for the stepper error tolerances. More...
 
struct  Tags::Time
 Tag for the current time as a double. More...
 
struct  Tags::TimeAndPrevious< Index >
 Tag for the current and previous time as doubles. More...
 
struct  Tags::TimeStep
 Tag for step size. More...
 
struct  Tags::TimeStepId
 Tag for TimeStepId for the algorithm state. More...
 
struct  Tags::ConcreteTimeStepper< StepperType >
 The evolution TimeStepper. The template parameter should be one of the time stepper base classes, such as TimeStepper or LtsTimeStepper. More...
 
struct  Tags::TimeStepper< StepperInterface >
 Access to a time stepper through the StepperInterface interface (such as TimeStepper or LtsTimeStepper). More...
 
struct  Tags::TimeStepperRef< StepperInterface, StepperType >
 Reference tag to provide access to the time stepper through its provided interfaces, such as Tags::TimeStepper<TimeStepper> and Tags::TimeStepper<LtsTimeStepper>. Usually added through the time_stepper_ref_tags alias. More...
 
class  Time
 The time in a simulation. Times can be safely compared for exact equality as long as they do not belong to overlapping unequal slabs. More...
 
class  TimeDelta
 Represents an interval of time within a single slab. More...
 
class  TimeStepId
 A unique identifier for the temporal state of an integrated system. More...
 
class  Triggers::NearTimes
 Trigger in intervals surrounding particular times. More...
 
class  Triggers::OnSubsteps
 
class  Triggers::SlabCompares
 Trigger based on a comparison with the slab number. More...
 
class  Triggers::Slabs
 Trigger at specified numbers of slabs after the simulation start. More...
 
class  Triggers::TimeCompares
 Trigger based on a comparison with the time. More...
 
class  Triggers::Times
 Trigger at particular times. More...
 

Typedefs

template<typename StepActions , typename System >
using SelfStart::self_start_procedure = tmpl::flatten< tmpl::list< SelfStart::Actions::Initialize< System >, ::Actions::Label< detail::PhaseStart >, SelfStart::Actions::CheckForCompletion< detail::PhaseEnd, System >, ::Actions::AdvanceTime, SelfStart::Actions::CheckForOrderIncrease, StepActions, ::Actions::Goto< detail::PhaseStart >, ::Actions::Label< detail::PhaseEnd >, SelfStart::Actions::Cleanup, ::Actions::AdvanceTime, Parallel::Actions::TerminatePhase > >
 The list of actions required to self-start an integrator. More...
 
template<typename T = void>
using evolution_less = evolution_comparator< T, std::less >
 Ordering functors that reverse their order when time runs backwards. See evolution_comparator and evolution_comparator<void,Comparator> for the provided interface. More...
 
template<typename T = void>
using evolution_greater = evolution_comparator< T, std::greater >
 
template<typename T = void>
using evolution_less_equal = evolution_comparator< T, std::less_equal >
 
template<typename T = void>
using evolution_greater_equal = evolution_comparator< T, std::greater_equal >
 
template<typename TagList >
using Tags::get_all_history_tags = tmpl::filter< TagList, tt::is_a<::Tags::HistoryEvolvedVariables, tmpl::_1 > >
 From a list of tags TagList, extract all tags that are template specializations of HistoryEvolvedVariables.
 
template<typename StepperType >
using time_stepper_ref_tags = tmpl::transform< typename StepperType::provided_time_stepper_interfaces, tmpl::bind<::Tags::TimeStepperRef, tmpl::_1, tmpl::pin< StepperType > > >
 List of Tags::TimeStepperRef specializations needed when adding a Tags::ConcreteTimeStepper.
 

Functions

template<typename DbTags >
void change_slab_size (const gsl::not_null< db::DataBox< DbTags > * > box, const double new_slab_end)
 Change the slab size, updating all quantities in the DataBox depending on it. More...
 
TimeDelta choose_lts_step_size (const Time &time, const double desired_step)
 Convert an arbitrary desired step to a valid LTS step size.
 
double slab_rounding_error (const Time &time)
 Scale of the roundoff error incurred from inexact slab operations near the given time.
 
double largest_stepper_error (double values, double errors, const StepperErrorTolerances &tolerances)
 Calculate the pointwise worst error. More...
 
double largest_stepper_error (const std::complex< double > &values, const std::complex< double > &errors, const StepperErrorTolerances &tolerances)
 Calculate the pointwise worst error. More...
 
double largest_stepper_error (const DataVector &values, const DataVector &errors, const StepperErrorTolerances &tolerances)
 Calculate the pointwise worst error. More...
 
double largest_stepper_error (const ComplexDataVector &values, const ComplexDataVector &errors, const StepperErrorTolerances &tolerances)
 Calculate the pointwise worst error. More...
 

Detailed Description

Code related to the representation of time during simulations.

The time covered by a simulation is divided up into a sequence of adjacent, non-overlapping (except at endpoints) intervals referred to as "slabs". The boundaries between slabs can be placed at arbitrary times. Slabs, as represented in the code as the Slab class, provide comparison operators comparing slabs agreeing with the definition as a sequence of intervals. Slabs that do not jointly belong to any such sequence should not be compared.

The specific time is represented by the Time class, which encodes the slab containing the time and the fraction of the slab that has elapsed as an exact rational. Times are comparable according to their natural time ordering, except for times belonging to incomparable slabs.

Differences in time within a slab are represented as exact fractions of that slab by the TimeDelta class. TimeDeltas are only meaningful within a single slab, with the exception that the ratio of objects with different slabs may be taken, resulting in an inexact floating-point result. Longer intervals of time are represented using floating-point values.

Typedef Documentation

◆ evolution_greater

template<typename T = void>
using evolution_greater = evolution_comparator<T, std::greater>

Ordering functors that reverse their order when time runs backwards. See evolution_comparator and evolution_comparator<void,Comparator> for the provided interface.

See also
std::less

◆ evolution_greater_equal

template<typename T = void>
using evolution_greater_equal = evolution_comparator<T, std::greater_equal>

Ordering functors that reverse their order when time runs backwards. See evolution_comparator and evolution_comparator<void,Comparator> for the provided interface.

See also
std::less

◆ evolution_less

template<typename T = void>
using evolution_less = evolution_comparator<T, std::less>

Ordering functors that reverse their order when time runs backwards. See evolution_comparator and evolution_comparator<void,Comparator> for the provided interface.

See also
std::less

◆ evolution_less_equal

template<typename T = void>
using evolution_less_equal = evolution_comparator<T, std::less_equal>

Ordering functors that reverse their order when time runs backwards. See evolution_comparator and evolution_comparator<void,Comparator> for the provided interface.

See also
std::less

◆ self_start_procedure

template<typename StepActions , typename System >
using SelfStart::self_start_procedure = typedef tmpl::flatten<tmpl::list< SelfStart::Actions::Initialize<System>, ::Actions::Label<detail::PhaseStart>, SelfStart::Actions::CheckForCompletion<detail::PhaseEnd, System>, ::Actions::AdvanceTime, SelfStart::Actions::CheckForOrderIncrease, StepActions, ::Actions::Goto<detail::PhaseStart>, ::Actions::Label<detail::PhaseEnd>, SelfStart::Actions::Cleanup, ::Actions::AdvanceTime, Parallel::Actions::TerminatePhase> >

The list of actions required to self-start an integrator.

Template Parameters
StepActionsList of actions computing and recording the system derivative and updating the evolved variables (but not the time).
See also
SelfStart

Function Documentation

◆ change_slab_size()

template<typename DbTags >
void change_slab_size ( const gsl::not_null< db::DataBox< DbTags > * >  box,
const double  new_slab_end 
)

Change the slab size, updating all quantities in the DataBox depending on it.

The end of the slab (in the appropriate direction for the evolution's flow of time) will be set to new_slab_end. The time step is set to the same fraction of the new slab as it was of the old.

◆ largest_stepper_error() [1/4]

double largest_stepper_error ( const ComplexDataVector values,
const ComplexDataVector errors,
const StepperErrorTolerances tolerances 
)

Calculate the pointwise worst error.

Details

For a double, or std::complex<double>, calculates

\begin{equation} \frac{e}{a + r \max(|v|, |v + e|)} \end{equation}

where \(v\) is values, \(e\) is errors, and \(a\) and \(r\) are the tolerances from tolerances. For vector types, calculates the largest error over all the points.

◆ largest_stepper_error() [2/4]

double largest_stepper_error ( const DataVector values,
const DataVector errors,
const StepperErrorTolerances tolerances 
)

Calculate the pointwise worst error.

Details

For a double, or std::complex<double>, calculates

\begin{equation} \frac{e}{a + r \max(|v|, |v + e|)} \end{equation}

where \(v\) is values, \(e\) is errors, and \(a\) and \(r\) are the tolerances from tolerances. For vector types, calculates the largest error over all the points.

◆ largest_stepper_error() [3/4]

double largest_stepper_error ( const std::complex< double > &  values,
const std::complex< double > &  errors,
const StepperErrorTolerances tolerances 
)

Calculate the pointwise worst error.

Details

For a double, or std::complex<double>, calculates

\begin{equation} \frac{e}{a + r \max(|v|, |v + e|)} \end{equation}

where \(v\) is values, \(e\) is errors, and \(a\) and \(r\) are the tolerances from tolerances. For vector types, calculates the largest error over all the points.

◆ largest_stepper_error() [4/4]

double largest_stepper_error ( double  values,
double  errors,
const StepperErrorTolerances tolerances 
)

Calculate the pointwise worst error.

Details

For a double, or std::complex<double>, calculates

\begin{equation} \frac{e}{a + r \max(|v|, |v + e|)} \end{equation}

where \(v\) is values, \(e\) is errors, and \(a\) and \(r\) are the tolerances from tolerances. For vector types, calculates the largest error over all the points.