A time loop with a check point mechanism.
#include <dumux/common/timeloop.hh>
Public Types | |
using | Scalar = Scalar |
Public Member Functions | |
template<class... Args> | |
CheckPointTimeLoop (Args &&... args) | |
void | advanceTimeStep () override |
Advance time step. More... | |
Scalar | maxTimeStepSize () const override |
The current maximum time step size. More... | |
template<class ScalarOrDuration1 , class ScalarOrDuration2 = Scalar> | |
void | setPeriodicCheckPoint (ScalarOrDuration1 interval, ScalarOrDuration2 offset=0.0) |
Set a periodic check point. More... | |
void | disablePeriodicCheckPoints () |
disable periodic check points More... | |
void | removeAllCheckPoints () |
remove all check points More... | |
bool | isCheckPoint () const |
Whether now is a time checkpoint. More... | |
template<class ScalarOrDuration > | |
void | setCheckPoint (ScalarOrDuration t) |
add a checkpoint to the queue More... | |
template<class ScalarOrDuration > | |
void | setCheckPoint (const std::initializer_list< ScalarOrDuration > &checkPoints) |
add checkpoints to the queue from a list of time points More... | |
template<class ScalarOrDuration > | |
void | setCheckPoint (const std::vector< ScalarOrDuration > &checkPoints) |
template<class ForwardIterator > | |
void | setCheckPoint (ForwardIterator first, ForwardIterator last) |
add checkpoints to the queue from a container from the first iterator to the last iterator More... | |
void | setTimeStepSize (std::chrono::duration< Rep, Period > dt) |
Set the current time step size to a given value. More... | |
Simulated time and time step management | |
void | start () |
Tells the time loop to start tracking the time. More... | |
double | stop () |
Tells the time loop to stop tracking the time. More... | |
void | resetTimer () |
Reset the timer. More... | |
template<class Rep1 , class Period1 , class Rep2 , class Period2 , class Rep3 , class Period3 > | |
void | reset (std::chrono::duration< Rep1, Period1 > startTime, std::chrono::duration< Rep2, Period2 > dt, std::chrono::duration< Rep3, Period3 > tEnd, bool verbose=true) |
Reset the time loop. More... | |
void | reset (Scalar startTime, Scalar dt, Scalar tEnd, bool verbose=true) |
Reset the time loop. More... | |
template<class ScalarOrDuration > | |
void | setTime (ScalarOrDuration t) |
Set the current simulated time, don't change the current time step index. More... | |
template<class ScalarOrDuration > | |
void | setTime (ScalarOrDuration t, int stepIdx) |
Set the current simulated time and the time step index. More... | |
Scalar | time () const final |
Return the time \(\mathrm{[s]}\) before the time integration. To get the time after the time integration you have to add timeStepSize() to time(). More... | |
Scalar | endTime () const |
Returns the number of (simulated) seconds which the simulation runs. More... | |
void | setEndTime (Scalar t) |
Set the time of simulated seconds at which the simulation runs. More... | |
double | wallClockTime () const |
Returns the current wall clock time (cpu time) spend in this time loop. More... | |
void | setTimeStepSize (Scalar dt) final |
Set the current time step size to a given value. More... | |
template<class ScalarOrDuration > | |
void | setMaxTimeStepSize (ScalarOrDuration maxDt) |
Set the maximum time step size to a given value. More... | |
Scalar | timeStepSize () const final |
Returns the suggested time step length \(\mathrm{[s]}\) so that we don't miss the beginning of the next episode or cross the end of the simulation. More... | |
int | timeStepIndex () const |
Returns number of time steps which have been executed since the beginning of the simulation. More... | |
Scalar | previousTimeStepSize () const |
The previous time step size. More... | |
void | setFinished (bool finished=true) |
Specify whether the simulation is finished. More... | |
bool | finished () const override |
Returns true if the simulation is finished. More... | |
bool | willBeFinished () const |
Returns true if the simulation is finished after the time level is incremented by the current time step size. More... | |
void | reportTimeStep () const |
State info on cpu time. More... | |
template<class Communicator = Dune::Communication<typename Dune::MPIHelper::MPICommunicator>> | |
void | finalize (const Communicator &comm=Dune::MPIHelper::getCommunication()) |
Print final status and stops tracking the time. More... | |
bool | verbose () const |
If the time loop has verbose output. More... | |
void | setVerbose (bool verbose=true) |
Sets time loop verbosity. More... | |
static constexpr Scalar | baseEps_ = 1e-10 |
Dune::Timer | timer_ |
Scalar | time_ |
Scalar | endTime_ |
Scalar | startTime_ |
Scalar | timeStepSize_ |
Scalar | previousTimeStepSize_ |
Scalar | userSetMaxTimeStepSize_ |
Scalar | timeAfterLastTimeStep_ |
Scalar | timeStepWallClockTime_ |
int | timeStepIdx_ |
bool | finished_ |
bool | verbose_ |
|
inherited |
|
inline |
|
inlineoverridevirtual |
Check point management, TimeLoop::isCheckPoint() has to be called after this!
Reimplemented from Dumux::TimeLoop< Scalar >.
|
inline |
|
inlineinherited |
|
inlineinherited |
|
inlineoverridevirtualinherited |
This is the case if either setFinished(true) has been called or if the end time is reached.
Implements Dumux::TimeLoopBase< Scalar >.
|
inline |
|
inlineoverridevirtual |
Reimplemented from Dumux::TimeLoop< Scalar >.
|
inlineinherited |
|
inline |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inline |
checkPoints | the list of check points |
|
inline |
|
inline |
first | iterator to the first element to be inserted |
last | iterator to the one-after-last element to be inserted |
|
inline |
t | the check point (in seconds) |
|
inlineinherited |
t | The time \(\mathrm{[s]}\) at which the simulation is finished |
|
inlineinherited |
finished | If true the simulation is considered finished before the end time is reached, else it is only considered finished if the end time is reached. |
|
inlineinherited |
maxDt | The new value for the maximum time step size \(\mathrm{[s]}\) |
|
inline |
interval | Set a periodic checkout every [interval] seconds |
offset | time from which the periodic check points are supposed to start (simulation time) the first checkpoint will be at time = offset. |
|
inlineinherited |
t | The time \(\mathrm{[s]}\) which should be jumped to |
|
inlineinherited |
t | The time \(\mathrm{[s]}\) which should be jumped to |
stepIdx | The new time step index |
|
inlinefinalvirtualinherited |
If the step size would exceed the length of the current episode, the timeStep() method will take care that the step size won't exceed the episode or the end of the simulation, though.
dt | The new value for the time step size \(\mathrm{[s]}\) |
Implements Dumux::TimeLoopBase< Scalar >.
|
inlineinherited |
dt | The new value for the time step size \(\mathrm{[s]}\) |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlinefinalvirtualinherited |
Implements Dumux::TimeLoopBase< Scalar >.
|
inlineinherited |
|
inlinefinalvirtualinherited |
Implements Dumux::TimeLoopBase< Scalar >.
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
staticconstexprprotectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |