mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-11-30 13:03:49 -06:00
ecl problem: determine whether the simulation is finished in endEpisode()
it used to be in beginEpisode(), but this caused endEpisode() to be called twice at the end of the simulation.
This commit is contained in:
parent
15ad669d5d
commit
b0ffc1f573
@ -355,10 +355,6 @@ public:
|
||||
simulator.startNextEpisode(timeMap->getTimeStepLength(nextEpisodeIdx));
|
||||
simulator.setTimeStepSize(timeMap->getTimeStepLength(nextEpisodeIdx));
|
||||
}
|
||||
else {
|
||||
simulator.setFinished(true);
|
||||
return;
|
||||
}
|
||||
|
||||
// set up the wells
|
||||
wellManager_.beginEpisode(this->simulator().gridManager().eclState());
|
||||
@ -405,15 +401,22 @@ public:
|
||||
*/
|
||||
void endEpisode()
|
||||
{
|
||||
const auto& simulator = this->simulator();
|
||||
auto& simulator = this->simulator();
|
||||
const auto& eclState = simulator.gridManager().eclState();
|
||||
auto& linearizer = this->model().linearizer();
|
||||
int episodeIdx = simulator.episodeIndex();
|
||||
|
||||
std::cout << "Episode " << episodeIdx + 1 << " finished.\n";
|
||||
|
||||
bool wellsWillChange = wellManager_.wellsChanged(eclState, episodeIdx + 1);
|
||||
linearizer.setLinearizationReusable(!wellsWillChange);
|
||||
|
||||
std::cout << "Episode " << episodeIdx + 1 << " finished.\n";
|
||||
Opm::TimeMapConstPtr timeMap = eclState->getSchedule()->getTimeMap();
|
||||
int numReportSteps = timeMap->size() - 1;
|
||||
if (episodeIdx + 1 >= numReportSteps) {
|
||||
simulator.setFinished(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
|
Loading…
Reference in New Issue
Block a user