Opm::AdaptiveSimulatorTimer Class Reference

Simulation timer for adaptive time stepping. More...

#include <AdaptiveSimulatorTimer.hpp>

Inheritance diagram for Opm::AdaptiveSimulatorTimer:
Inheritance graph

Public Member Functions

 AdaptiveSimulatorTimer (const SimulatorTimerInterface &timer, const double lastStepTaken, const double maxTimeStep=std::numeric_limits< double >::max())
 constructor taking a simulator timer to determine start and end time More...
 
AdaptiveSimulatorTimeroperator++ ()
 advance time by currentStepLength More...
 
void advance ()
 advance time by currentStepLength More...
 
void provideTimeStepEstimate (const double dt_estimate)
 provide and estimate for new time step size More...
 
bool initialStep () const
 Whether this is the first step. More...
 
int currentStepNum () const
 
int reportStepNum () const
 return current report step More...
 
double currentStepLength () const
 
void setCurrentStepLength (double dt)
 
double totalTime () const
 
double simulationTimeElapsed () const
 
bool done () const
 
double averageStepLength () const
 return average step length used so far More...
 
double maxStepLength () const
 return max step length used so far More...
 
double minStepLength () const
 return min step length used so far More...
 
double stepLengthTaken () const
 Previous step length. This is the length of the step that was taken to arrive at this time. More...
 
void report (std::ostream &os) const
 report start and end time as well as used steps so far More...
 
boost::posix_time::ptime startDateTime () const
 start date time of simulation More...
 
bool lastStepFailed () const
 Return true if last time step failed. More...
 
void setLastStepFailed (bool lastStepFailed)
 tell the timestepper whether timestep failed or not More...
 
virtual std::unique_ptr< SimulatorTimerInterfaceclone () const
 return copy of object More...
 
virtual double reportStepLengthTaken () const
 
virtual boost::posix_time::ptime currentDateTime () const
 Return the current time as a posix time object. More...
 
virtual time_t currentPosixTime () const
 

Protected Attributes

std::shared_ptr< boost::posix_time::ptime > start_date_time_
 
const double start_time_
 
const double total_time_
 
const int report_step_
 
const double max_time_step_
 
double current_time_
 
double dt_
 
int current_step_
 
std::vector< double > steps_
 
bool lastStepFailed_
 

Detailed Description

Simulation timer for adaptive time stepping.

Constructor & Destructor Documentation

◆ AdaptiveSimulatorTimer()

Opm::AdaptiveSimulatorTimer::AdaptiveSimulatorTimer ( const SimulatorTimerInterface timer,
const double  lastStepTaken,
const double  maxTimeStep = std::numeric_limits< double >::max() 
)

constructor taking a simulator timer to determine start and end time

Parameters
timerin case of sub stepping this is the outer timer
lastStepTakenlast suggested time step
maxTimeStepmaximum time step allowed

Member Function Documentation

◆ advance()

void Opm::AdaptiveSimulatorTimer::advance ( )
inlinevirtual

advance time by currentStepLength

Implements Opm::SimulatorTimerInterface.

References operator++().

◆ averageStepLength()

double Opm::AdaptiveSimulatorTimer::averageStepLength ( ) const

return average step length used so far

◆ clone()

virtual std::unique_ptr< SimulatorTimerInterface > Opm::AdaptiveSimulatorTimer::clone ( ) const
virtual

return copy of object

Implements Opm::SimulatorTimerInterface.

◆ currentDateTime()

virtual boost::posix_time::ptime Opm::SimulatorTimerInterface::currentDateTime ( ) const
virtualinherited

Return the current time as a posix time object.

Reimplemented in Opm::SimulatorTimer.

◆ currentPosixTime()

virtual time_t Opm::SimulatorTimerInterface::currentPosixTime ( ) const
virtualinherited

Time elapsed since the start of the POSIX epoch (Jan 1st, 1970) until the current time step begins [s].

Reimplemented in Opm::SimulatorTimer.

◆ currentStepLength()

double Opm::AdaptiveSimulatorTimer::currentStepLength ( ) const
virtual

◆ currentStepNum()

int Opm::AdaptiveSimulatorTimer::currentStepNum ( ) const
virtual

◆ done()

bool Opm::AdaptiveSimulatorTimer::done ( ) const
virtual

◆ initialStep()

bool Opm::AdaptiveSimulatorTimer::initialStep ( ) const
virtual

Whether this is the first step.

Implements Opm::SimulatorTimerInterface.

◆ lastStepFailed()

bool Opm::AdaptiveSimulatorTimer::lastStepFailed ( ) const
inlinevirtual

Return true if last time step failed.

Implements Opm::SimulatorTimerInterface.

References lastStepFailed_.

Referenced by setLastStepFailed().

◆ maxStepLength()

double Opm::AdaptiveSimulatorTimer::maxStepLength ( ) const

return max step length used so far

◆ minStepLength()

double Opm::AdaptiveSimulatorTimer::minStepLength ( ) const

return min step length used so far

◆ operator++()

AdaptiveSimulatorTimer & Opm::AdaptiveSimulatorTimer::operator++ ( )

advance time by currentStepLength

Referenced by advance().

◆ provideTimeStepEstimate()

void Opm::AdaptiveSimulatorTimer::provideTimeStepEstimate ( const double  dt_estimate)

provide and estimate for new time step size

◆ report()

void Opm::AdaptiveSimulatorTimer::report ( std::ostream &  os) const

report start and end time as well as used steps so far

◆ reportStepLengthTaken()

virtual double Opm::SimulatorTimerInterface::reportStepLengthTaken ( ) const
inlinevirtualinherited

Previous report step length. This is the length of the step that was taken to arrive at this report step time.

Note
if no increments have been done (i.e. the timer is still in its constructed state and reportStepNum() == 0), it is an error to call stepLengthTaken().

References Opm::SimulatorTimerInterface::stepLengthTaken().

◆ reportStepNum()

int Opm::AdaptiveSimulatorTimer::reportStepNum ( ) const
virtual

return current report step

Reimplemented from Opm::SimulatorTimerInterface.

◆ setCurrentStepLength()

void Opm::AdaptiveSimulatorTimer::setCurrentStepLength ( double  dt)

◆ setLastStepFailed()

void Opm::AdaptiveSimulatorTimer::setLastStepFailed ( bool  lastStepFailed)
inline

tell the timestepper whether timestep failed or not

References lastStepFailed(), and lastStepFailed_.

◆ simulationTimeElapsed()

double Opm::AdaptiveSimulatorTimer::simulationTimeElapsed ( ) const
virtual

◆ startDateTime()

boost::posix_time::ptime Opm::AdaptiveSimulatorTimer::startDateTime ( ) const
virtual

start date time of simulation

Implements Opm::SimulatorTimerInterface.

◆ stepLengthTaken()

double Opm::AdaptiveSimulatorTimer::stepLengthTaken ( ) const
virtual

Previous step length. This is the length of the step that was taken to arrive at this time.

Implements Opm::SimulatorTimerInterface.

◆ totalTime()

double Opm::AdaptiveSimulatorTimer::totalTime ( ) const

Member Data Documentation

◆ current_step_

int Opm::AdaptiveSimulatorTimer::current_step_
protected

◆ current_time_

double Opm::AdaptiveSimulatorTimer::current_time_
protected

◆ dt_

double Opm::AdaptiveSimulatorTimer::dt_
protected

◆ lastStepFailed_

bool Opm::AdaptiveSimulatorTimer::lastStepFailed_
protected

◆ max_time_step_

const double Opm::AdaptiveSimulatorTimer::max_time_step_
protected

◆ report_step_

const int Opm::AdaptiveSimulatorTimer::report_step_
protected

◆ start_date_time_

std::shared_ptr<boost::posix_time::ptime> Opm::AdaptiveSimulatorTimer::start_date_time_
protected

◆ start_time_

const double Opm::AdaptiveSimulatorTimer::start_time_
protected

◆ steps_

std::vector< double > Opm::AdaptiveSimulatorTimer::steps_
protected

◆ total_time_

const double Opm::AdaptiveSimulatorTimer::total_time_
protected

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