mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
cleanup: reportStepIdx --> writeStepIdx.
startDate --> startDateTime
removal of debug output.
This commit is contained in:
@@ -31,7 +31,7 @@ namespace Opm
|
||||
{
|
||||
AdaptiveSimulatorTimer::
|
||||
AdaptiveSimulatorTimer( const SimulatorTimerInterface& timer, const double lastStepTaken )
|
||||
: start_date_( timer.startDate() )
|
||||
: start_date_time_( timer.startDateTime() )
|
||||
, start_time_( timer.simulationTimeElapsed() )
|
||||
, total_time_( start_time_ + timer.currentStepLength() )
|
||||
, report_step_( timer.reportStepNum() )
|
||||
@@ -156,9 +156,9 @@ namespace Opm
|
||||
std::cout << "sub steps end time = " << unit::convert::to( simulationTimeElapsed(), unit::day ) << " (days)" << std::endl;
|
||||
}
|
||||
|
||||
boost::gregorian::date AdaptiveSimulatorTimer::startDate() const
|
||||
boost::posix_time::ptime AdaptiveSimulatorTimer::startDateTime() const
|
||||
{
|
||||
return start_date_;
|
||||
return start_date_time_;
|
||||
}
|
||||
|
||||
double AdaptiveSimulatorTimer::
|
||||
|
||||
@@ -89,11 +89,11 @@ namespace Opm
|
||||
/// \brief report start and end time as well as used steps so far
|
||||
void report(std::ostream& os) const;
|
||||
|
||||
/// \brief start date of simulation
|
||||
boost::gregorian::date startDate() const;
|
||||
/// \brief start date time of simulation
|
||||
boost::posix_time::ptime startDateTime() const;
|
||||
|
||||
protected:
|
||||
const boost::gregorian::date start_date_;
|
||||
const boost::posix_time::ptime start_date_time_;
|
||||
const double start_time_;
|
||||
const double total_time_;
|
||||
const int report_step_;
|
||||
|
||||
@@ -151,7 +151,12 @@ namespace Opm {
|
||||
std::cout << std::endl
|
||||
<<"Substep( " << substepTimer.currentStepNum()
|
||||
<< " ): Current time (days) " << unit::convert::to(substepTimer.simulationTimeElapsed(),unit::day) << std::endl
|
||||
<< " Current stepsize est (days) " << unit::convert::to(dtEstimate, unit::day) << std::endl;
|
||||
<< " Current stepsize est (days) " << unit::convert::to(dtEstimate, unit::day) << std::endl;
|
||||
}
|
||||
|
||||
// write data if outputWriter was provided
|
||||
if( outputWriter ) {
|
||||
outputWriter->writeTimeStep( substepTimer, state, well_state );
|
||||
}
|
||||
|
||||
// set new time step length
|
||||
@@ -161,10 +166,6 @@ namespace Opm {
|
||||
last_state = state ;
|
||||
last_well_state = well_state;
|
||||
|
||||
// write data if outputWriter was provided
|
||||
if( outputWriter ) {
|
||||
outputWriter->writeTimeStep( substepTimer, state, well_state );
|
||||
}
|
||||
}
|
||||
else // in case of no convergence (linearIterations < 0)
|
||||
{
|
||||
|
||||
@@ -100,9 +100,9 @@ namespace Opm
|
||||
return current_time_;
|
||||
}
|
||||
|
||||
boost::gregorian::date SimulatorTimer::startDate() const
|
||||
boost::posix_time::ptime SimulatorTimer::startDateTime() const
|
||||
{
|
||||
return start_date_;
|
||||
return boost::posix_time::ptime(start_date_);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace Opm
|
||||
double totalTime() const;
|
||||
|
||||
/// Return start date of simulation
|
||||
boost::gregorian::date startDate() const;
|
||||
boost::posix_time::ptime startDateTime() const;
|
||||
|
||||
/// Set total time.
|
||||
/// This is primarily intended for multi-epoch schedules,
|
||||
|
||||
@@ -37,6 +37,9 @@ namespace Opm
|
||||
SimulatorTimerInterface() {}
|
||||
|
||||
public:
|
||||
/// destructor
|
||||
virtual ~SimulatorTimerInterface() {}
|
||||
|
||||
/// Current step number. This is the number of timesteps that
|
||||
/// has been completed from the start of the run. The time
|
||||
/// after initialization but before the simulation has started
|
||||
@@ -60,6 +63,14 @@ namespace Opm
|
||||
/// it is an error to call stepLengthTaken().
|
||||
virtual double stepLengthTaken () const = 0;
|
||||
|
||||
/// 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().
|
||||
virtual double reportStepLengthTaken () const { return stepLengthTaken(); }
|
||||
|
||||
/// Time elapsed since the start of the simulation until the
|
||||
/// beginning of the current time step [s].
|
||||
virtual double simulationTimeElapsed() const = 0;
|
||||
@@ -68,12 +79,13 @@ namespace Opm
|
||||
virtual bool done() const = 0;
|
||||
|
||||
/// Return start date of simulation
|
||||
virtual boost::gregorian::date startDate() const = 0;
|
||||
virtual boost::posix_time::ptime startDateTime() const = 0;
|
||||
|
||||
/// Return the current time as a posix time object.
|
||||
virtual boost::posix_time::ptime currentDateTime() const
|
||||
{
|
||||
return boost::posix_time::ptime(startDate()) + boost::posix_time::seconds( (int) simulationTimeElapsed());
|
||||
return startDateTime() + boost::posix_time::seconds( (int) simulationTimeElapsed());
|
||||
//boost::posix_time::ptime(startDate()) + boost::posix_time::seconds( (int) simulationTimeElapsed());
|
||||
}
|
||||
|
||||
/// Time elapsed since the start of the POSIX epoch (Jan 1st,
|
||||
@@ -83,10 +95,6 @@ namespace Opm
|
||||
tm t = boost::posix_time::to_tm(currentDateTime());
|
||||
return std::mktime(&t);
|
||||
}
|
||||
|
||||
/// Print a report with current and total time etc.
|
||||
/// Note: if done(), it is an error to call report().
|
||||
//virtual void report(std::ostream& os) const = 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user