From d00027b55a1df0a9029d386bc801e55d520c7d6f Mon Sep 17 00:00:00 2001 From: Andreas Lauser Date: Fri, 30 May 2014 12:42:48 +0200 Subject: [PATCH] ECL problem: fix the episode handling now the episodes seem to match the report steps... --- examples/problems/eclproblem.hh | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/examples/problems/eclproblem.hh b/examples/problems/eclproblem.hh index e6fafec56..18df6b197 100644 --- a/examples/problems/eclproblem.hh +++ b/examples/problems/eclproblem.hh @@ -232,10 +232,11 @@ public: simulator.setEpisodeIndex(0); // the user-specified initial time step can be shorter than - // the one given in the deck, but it can't be longer. + // the initial report step size given in the deck, but it + // can't be longer. Scalar dt = simulator.timeStepSize(); if (dt > simulator.episodeLength()) - simulator.setTimeStepSize(dt); + simulator.setTimeStepSize(simulator.episodeLength()); } /*! @@ -245,8 +246,18 @@ public: { Simulator &simulator = this->simulator(); Opm::TimeMapConstPtr timeMap = simulator.gridManager().schedule()->getTimeMap(); + + // TimeMap deals with points in time, so the number of time + // intervalls (i.e., report steps) is one less! + int numReportSteps = timeMap->size() - 1; + + // start the next episode if there are additional report + // steps, else finish the simulation int episodeIdx = simulator.episodeIndex(); - simulator.startNextEpisode(timeMap->getTimeStepLength(episodeIdx + 1)); + if (episodeIdx < numReportSteps) + simulator.startNextEpisode(timeMap->getTimeStepLength(episodeIdx + 1)); + else + simulator.setFinished(true); } /*! @@ -545,16 +556,14 @@ private: initialFluidStates_.resize(numDof); if (!deck->hasKeyword("SWAT") || - !deck->hasKeyword("SGAS")) { + !deck->hasKeyword("SGAS")) OPM_THROW(std::runtime_error, "So far, the Eclipse input file requires the presence of the SWAT " "and SGAS keywords"); - } - if (!deck->hasKeyword("PRESSURE")) { + if (!deck->hasKeyword("PRESSURE")) OPM_THROW(std::runtime_error, "So far, the Eclipse input file requires the presence of the PRESSURE " "keyword"); - } const std::vector &waterSaturationData = deck->getKeyword("SWAT")->getSIDoubleData();