Merge pull request #1243 from blattms/write-initial-oip

Write the initial OIP values if requested.
This commit is contained in:
Atgeirr Flø Rasmussen 2017-08-01 16:15:46 +02:00 committed by GitHub
commit babf06eade
5 changed files with 19 additions and 3 deletions

View File

@ -196,7 +196,7 @@ namespace Opm
const data::Solution& simProps, const data::Solution& simProps,
const std::map<std::string, double>& miscSummaryData, const std::map<std::string, double>& miscSummaryData,
const std::map<std::string, std::vector<double>>& extraRestartData, const std::map<std::string, std::vector<double>>& extraRestartData,
bool substep ) bool substep)
: writer_( writer ), : writer_( writer ),
timer_( timer.clone() ), timer_( timer.clone() ),
state_( state ), state_( state ),
@ -338,6 +338,11 @@ namespace Opm
if (initConfig.restartRequested() && ((initConfig.getRestartStep()) == (timer.currentStepNum()))) { if (initConfig.restartRequested() && ((initConfig.getRestartStep()) == (timer.currentStepNum()))) {
std::cout << "Skipping restart write in start of step " << timer.currentStepNum() << std::endl; std::cout << "Skipping restart write in start of step " << timer.currentStepNum() << std::endl;
} else { } else {
if ( timer.initialStep() )
{
// Set the initial OIP
eclIO_->overwriteInitialOIP(simProps);
}
// ... insert "extra" data (KR, VISC, ...) // ... insert "extra" data (KR, VISC, ...)
eclIO_->writeTimeStep(timer.reportStepNum(), eclIO_->writeTimeStep(timer.reportStepNum(),
substep, substep,

View File

@ -272,7 +272,7 @@ namespace Opm
const data::Solution& simProps, const data::Solution& simProps,
const std::map<std::string, double>& miscSummaryData, const std::map<std::string, double>& miscSummaryData,
const std::map<std::string, std::vector<double>>& extraRestartData, const std::map<std::string, std::vector<double>>& extraRestartData,
bool substep); bool substep );
/** \brief return output directory */ /** \brief return output directory */
const std::string& outputDirectory() const { return outputDir_; } const std::string& outputDirectory() const { return outputDir_; }

View File

@ -51,7 +51,12 @@ namespace Opm
provideTimeStepEstimate( lastStepTaken ); provideTimeStepEstimate( lastStepTaken );
} }
AdaptiveSimulatorTimer& AdaptiveSimulatorTimer::operator++ () bool AdaptiveSimulatorTimer::initialStep () const
{
return ( report_step_ == 0 ) && ( current_step_ == 0 );
}
AdaptiveSimulatorTimer& AdaptiveSimulatorTimer::operator++ ()
{ {
++current_step_; ++current_step_;
current_time_ += dt_; current_time_ += dt_;

View File

@ -56,6 +56,9 @@ namespace Opm
/// \brief provide and estimate for new time step size /// \brief provide and estimate for new time step size
void provideTimeStepEstimate( const double dt_estimate ); void provideTimeStepEstimate( const double dt_estimate );
/// \brief Whether this is the first step
bool initialStep () const;
/// \brief \copydoc SimulationTimer::currentStepNum /// \brief \copydoc SimulationTimer::currentStepNum
int currentStepNum () const; int currentStepNum () const;

View File

@ -83,6 +83,9 @@ namespace Opm
/// Return true if timer indicates that simulation of timer interval is finished /// Return true if timer indicates that simulation of timer interval is finished
virtual bool done() const = 0; virtual bool done() const = 0;
/// Whether the current step is the first step.
virtual bool initialStep() const = 0;
/// Return start date of simulation /// Return start date of simulation
virtual boost::posix_time::ptime startDateTime() const = 0; virtual boost::posix_time::ptime startDateTime() const = 0;