SPH
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ITimeStepping Class Referenceabstract

Base object providing integration in time for all quantities. More...

#include <TimeStepping.h>

Inheritance diagram for ITimeStepping:
Polymorphic BulirschStoer EulerExplicit LeapFrog ModifiedMidpointMethod PredictorCorrector RungeKutta

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< Storagestorage
 Main storage holding all the particles in the run. More...
 
Float timeStep
 Current time step. More...
 
Float maxTimeStep
 Maximal allowed time step. More...
 
AutoPtr< ITimeStepCriterioncriterion
 Criterion used to compute the time step. More...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ ITimeStepping() [1/2]

ITimeStepping::ITimeStepping ( const SharedPtr< Storage > &  storage,
const RunSettings settings 
)

Constructs the timestepping, using timestep criteria from parameters in settings.

Parameters
storageStorage used during the run
settingsSettings containing initial and maximal timestep and aslo timestep criteria

Definition at line 22 of file TimeStepping.cpp.

◆ ITimeStepping() [2/2]

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.

Note
Use MultiCriterion if more than one criterion is used.

Definition at line 13 of file TimeStepping.cpp.

◆ ~ITimeStepping()

ITimeStepping::~ITimeStepping ( )
overridedefault

Member Function Documentation

◆ getTimeStep()

INLINE Float ITimeStepping::getTimeStep ( ) const
inline

Definition at line 76 of file TimeStepping.h.

◆ step()

void ITimeStepping::step ( IScheduler scheduler,
ISolver solver,
Statistics stats 
)

Definition at line 27 of file TimeStepping.cpp.

◆ stepImpl()

virtual void ITimeStepping::stepImpl ( IScheduler scheduler,
ISolver solver,
Statistics stats 
)
protectedpure virtual

Member Data Documentation

◆ criterion

AutoPtr<ITimeStepCriterion> ITimeStepping::criterion
protected

Criterion used to compute the time step.

Definition at line 58 of file TimeStepping.h.

◆ maxTimeStep

Float ITimeStepping::maxTimeStep
protected

Maximal allowed time step.

Definition at line 55 of file TimeStepping.h.

◆ storage

SharedPtr<Storage> ITimeStepping::storage
protected

Main storage holding all the particles in the run.

Definition at line 49 of file TimeStepping.h.

◆ timeStep

Float ITimeStepping::timeStep
protected

Current time step.

Definition at line 52 of file TimeStepping.h.


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