SPH
|
Base object providing integration in time for all quantities. More...
#include <TimeStepping.h>
Public Member Functions | |
ITimeStepping (const SharedPtr< Storage > &storage, const RunSettings &settings) | |
Constructs the timestepping, using timestep criteria from parameters in settings. More... | |
ITimeStepping (const SharedPtr< Storage > &storage, const RunSettings &settings, AutoPtr< ITimeStepCriterion > &&criterion) | |
Constructs the timestepping, explicitly specifying the timestep criterion used in the run. More... | |
~ITimeStepping () override | |
INLINE Float | getTimeStep () const |
void | step (IScheduler &scheduler, ISolver &solver, Statistics &stats) |
Public Member Functions inherited from Polymorphic | |
virtual | ~Polymorphic () |
Protected Member Functions | |
virtual void | stepImpl (IScheduler &scheduler, ISolver &solver, Statistics &stats)=0 |
Protected Attributes | |
SharedPtr< Storage > | storage |
Main storage holding all the particles in the run. More... | |
Float | timeStep |
Current time step. More... | |
Float | maxTimeStep |
Maximal allowed time step. More... | |
AutoPtr< ITimeStepCriterion > | criterion |
Criterion used to compute the time step. More... | |
Base object providing integration in time for all quantities.
The integration is done by iterating with discrete time step, using step method. All derived objects must implement stepImpl function, which shall iterate over all independant quantities and advance their values using temporal derivatives computed by ISolver object passed in argument of the method. The step function then calls the user-defined stepImpl while also doing more legwork, such as saving statistics and computing new value of time step. Function stepImpl can also save statistics specific to the implementation, using provided Statistics object, but it shall not compute the time step value. To control time step, see TimeStepCriterion and derived classes.
The time-stepping object must take care of clearing derivatives, as there can be values from previous timestep, or some garbage memory when the method is called for the first time. It is also necessary to clamp all quantities by their minimal/maximal allowed values. These values can be different for different materials; the range of quantity for given IMaterial object can be obtained by IMaterial::range() const function.
Temporal derivatives are computed by calling ISolver::integrate function. The solver assumes the storage already has zeroed highest-order derivatives of all quantities. The implementation of ITimeStepping inteface must also assume that ISolver::integrate changes the number of particles in the storage. If the timestepping uses derivatives from different times, stored in separate Storage objects, the variable number of particles can be handled automatically by the Storage object, using the concept of dependenet storages - if you create an auxiliary storage, for example to store the prediction derivatives in predictor-corrector algorithm, simply add this storage as a dependent storage to the main one, and it will be updated every time the number of particles in the main storage changes.
Timestepping is bound to a single Storage object, passed in constructor, and this object cannot be changed during the lifetime of the timestepping object. Timestepping implementation can create any number of auxiliary storages and link then to the main one, this hierarchy established in the constructor will not change during the run.
Definition at line 46 of file TimeStepping.h.
ITimeStepping::ITimeStepping | ( | const SharedPtr< Storage > & | storage, |
const RunSettings & | settings | ||
) |
Constructs the timestepping, using timestep criteria from parameters in settings.
storage | Storage used during the run |
settings | Settings containing initial and maximal timestep and aslo timestep criteria |
Definition at line 22 of file TimeStepping.cpp.
NAMESPACE_SPH_BEGIN ITimeStepping::ITimeStepping | ( | const SharedPtr< Storage > & | storage, |
const RunSettings & | settings, | ||
AutoPtr< ITimeStepCriterion > && | criterion | ||
) |
Constructs the timestepping, explicitly specifying the timestep criterion used in the run.
Definition at line 13 of file TimeStepping.cpp.
|
overridedefault |
Definition at line 76 of file TimeStepping.h.
void ITimeStepping::step | ( | IScheduler & | scheduler, |
ISolver & | solver, | ||
Statistics & | stats | ||
) |
Definition at line 27 of file TimeStepping.cpp.
|
protectedpure virtual |
Implemented in BulirschStoer, ModifiedMidpointMethod, RungeKutta, LeapFrog, PredictorCorrector, and EulerExplicit.
|
protected |
Criterion used to compute the time step.
Definition at line 58 of file TimeStepping.h.
|
protected |
Maximal allowed time step.
Definition at line 55 of file TimeStepping.h.
Main storage holding all the particles in the run.
Definition at line 49 of file TimeStepping.h.
|
protected |
Current time step.
Definition at line 52 of file TimeStepping.h.