Schedule: explicitly instantiated

This commit is contained in:
Joakim Hove
2017-10-27 09:07:23 +02:00
parent 6598df59cc
commit 029de3542e
4 changed files with 64 additions and 23 deletions

View File

@@ -95,9 +95,9 @@ public:
*
* I.e., well positions, names etc...
*/
void init(const Opm::EclipseState& eclState)
void init(const Opm::EclipseState& eclState,
const Opm::Schedule& deckSchedule)
{
const auto& deckSchedule = eclState.getSchedule();
// create the wells which intersect with the current process' grid
for (size_t deckWellIdx = 0; deckWellIdx < deckSchedule.numWells(); ++deckWellIdx)
@@ -121,15 +121,14 @@ public:
* \brief This should be called the problem before each simulation
* episode to adapt the well controls.
*/
void beginEpisode(const Opm::EclipseState& eclState, bool wasRestarted=false)
void beginEpisode(const Opm::EclipseState& eclState, const Opm::Schedule& deckSchedule, bool wasRestarted=false)
{
unsigned episodeIdx = simulator_.episodeIndex();
const auto& deckSchedule = eclState.getSchedule();
WellCompletionsMap wellCompMap;
computeWellCompletionsMap_(episodeIdx, wellCompMap);
if (wasRestarted || wellTopologyChanged_(eclState, episodeIdx))
if (wasRestarted || wellTopologyChanged_(eclState, deckSchedule, episodeIdx))
updateWellTopology_(episodeIdx, wellCompMap, gridDofIsPenetrated_);
// set those parameters of the wells which do not change the topology of the
@@ -557,7 +556,7 @@ public:
void deserialize(Restarter& res OPM_UNUSED)
{
// initialize the wells for the current episode
beginEpisode(simulator_.gridManager().eclState(), /*wasRestarted=*/true);
beginEpisode(simulator_.gridManager().eclState(), simulator_.gridManager().schedule(), /*wasRestarted=*/true);
}
/*!
@@ -567,12 +566,13 @@ public:
* "Something" can either be the well topology (i.e., which grid blocks are contained
* in which well) or it can be a well parameter like the bottom hole pressure...
*/
bool wellsChanged(const Opm::EclipseState& eclState, unsigned reportStepIdx) const
bool wellsChanged(const Opm::EclipseState& eclState,
const Opm::Schedule& schedule,
unsigned reportStepIdx) const
{
if (wellTopologyChanged_(eclState, reportStepIdx))
return true;
const auto& schedule = eclState.getSchedule();
if (schedule.getTimeMap().numTimesteps() <= (unsigned) reportStepIdx)
// for the "until the universe dies" episode, the wells don't change
return false;
@@ -585,7 +585,9 @@ public:
}
protected:
bool wellTopologyChanged_(const Opm::EclipseState& eclState, unsigned reportStepIdx) const
bool wellTopologyChanged_(const Opm::EclipseState& eclState,
const Opm::Schedule& schedule,
unsigned reportStepIdx) const
{
if (reportStepIdx == 0) {
// the well topology has always been changed relative to before the
@@ -593,7 +595,6 @@ protected:
return true;
}
const auto& schedule = eclState.getSchedule();
if (schedule.getTimeMap().numTimesteps() <= (unsigned) reportStepIdx)
// for the "until the universe dies" episode, the wells don't change
return false;
@@ -666,10 +667,10 @@ protected:
void computeWellCompletionsMap_(unsigned reportStepIdx OPM_UNUSED, WellCompletionsMap& cartesianIdxToCompletionMap)
{
const auto& eclState = simulator_.gridManager().eclState();
const auto& deckSchedule = eclState.getSchedule();
const auto& deckSchedule = simulator_.gridManager().schedule();
#ifndef NDEBUG
const auto& eclState = simulator_.gridManager().eclState();
const auto& eclGrid = eclState.getInputGrid();
assert( int(eclGrid.getNX()) == simulator_.gridManager().cartesianDimensions()[ 0 ] );
assert( int(eclGrid.getNY()) == simulator_.gridManager().cartesianDimensions()[ 1 ] );
@@ -718,8 +719,7 @@ protected:
void updateWellParameters_(unsigned reportStepIdx, const WellCompletionsMap& wellCompletions)
{
const auto& eclState = simulator_.gridManager().eclState();
const auto& deckSchedule = eclState.getSchedule();
const auto& deckSchedule = simulator_.gridManager().schedule();
const std::vector<const Opm::Well*>& deckWells = deckSchedule.getWells(reportStepIdx);
// set the reference depth for all wells