mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
SimulatorTimer: rename currentTime() to simulationTimeElapsed()
because the name "currentTime()" can be mistaken for the point in real-life time at which the simulation is run (e.g. March 11, 2014, 15:07:45.123), the _point_ in time which the simulator timer currently represents (e.g. Jun 5, 1985, 02:33:12.345) instead of the simulator time in seconds which elapsed since the START date (e.g. 52633.345 s). this rename may lead to some fallout in other modules. I'll fix them after this PR has been merged...
This commit is contained in:
@@ -113,8 +113,8 @@ namespace Opm
|
|||||||
return timesteps_[current_step_ - 1];
|
return timesteps_[current_step_ - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Current time.
|
/// time elapsed since the start of the simulation [s].
|
||||||
double SimulatorTimer::currentTime() const
|
double SimulatorTimer::simulationTimeElapsed() const
|
||||||
{
|
{
|
||||||
if (timeMap_)
|
if (timeMap_)
|
||||||
return timeMap_->getTimePassedUntil(current_step_);
|
return timeMap_->getTimePassedUntil(current_step_);
|
||||||
@@ -122,6 +122,12 @@ namespace Opm
|
|||||||
return current_time_;
|
return current_time_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// time elapsed since the start of the POSIX epoch (Jan 1st, 1970) [s].
|
||||||
|
time_t SimulatorTimer::currentPosixTime() const
|
||||||
|
{
|
||||||
|
tm t = boost::posix_time::to_tm(currentDateTime());
|
||||||
|
return std::mktime(&t);
|
||||||
|
}
|
||||||
|
|
||||||
boost::posix_time::ptime SimulatorTimer::currentDateTime() const
|
boost::posix_time::ptime SimulatorTimer::currentDateTime() const
|
||||||
{
|
{
|
||||||
@@ -161,7 +167,7 @@ namespace Opm
|
|||||||
void SimulatorTimer::report(std::ostream& os) const
|
void SimulatorTimer::report(std::ostream& os) const
|
||||||
{
|
{
|
||||||
os << "\n\n--------------- Simulation step number " << currentStepNum() << " ---------------"
|
os << "\n\n--------------- Simulation step number " << currentStepNum() << " ---------------"
|
||||||
<< "\n Current time (days) " << Opm::unit::convert::to(currentTime(), Opm::unit::day)
|
<< "\n Current time (days) " << Opm::unit::convert::to(simulationTimeElapsed(), Opm::unit::day)
|
||||||
<< "\n Current stepsize (days) " << Opm::unit::convert::to(currentStepLength(), Opm::unit::day)
|
<< "\n Current stepsize (days) " << Opm::unit::convert::to(currentStepLength(), Opm::unit::day)
|
||||||
<< "\n Total time (days) " << Opm::unit::convert::to(totalTime(), Opm::unit::day)
|
<< "\n Total time (days) " << Opm::unit::convert::to(totalTime(), Opm::unit::day)
|
||||||
<< "\n" << std::endl;
|
<< "\n" << std::endl;
|
||||||
|
|||||||
@@ -79,8 +79,13 @@ namespace Opm
|
|||||||
/// it is an error to call stepLengthTaken().
|
/// it is an error to call stepLengthTaken().
|
||||||
double stepLengthTaken () const;
|
double stepLengthTaken () const;
|
||||||
|
|
||||||
/// Current time.
|
/// Time elapsed since the start of the POSIX epoch (Jan 1st,
|
||||||
double currentTime() const;
|
/// 1970) until the current time step begins [s].
|
||||||
|
time_t currentPosixTime() const;
|
||||||
|
|
||||||
|
/// Time elapsed since the start of the simulation until the
|
||||||
|
/// beginning of the current time step [s].
|
||||||
|
double simulationTimeElapsed() const;
|
||||||
|
|
||||||
/// Return the current time as a posix time object.
|
/// Return the current time as a posix time object.
|
||||||
boost::posix_time::ptime currentDateTime() const;
|
boost::posix_time::ptime currentDateTime() const;
|
||||||
|
|||||||
Reference in New Issue
Block a user