Merge pull request #670 from totto82/shut_wells

Fix SHUT wells
This commit is contained in:
Atgeirr Flø Rasmussen 2014-10-24 11:30:06 +02:00
commit 12cd6d9f1e
4 changed files with 28 additions and 4 deletions

View File

@ -655,7 +655,7 @@ public:
"SM3/DAY" /* surf. cub. m. per day */) "SM3/DAY" /* surf. cub. m. per day */)
{ } { }
virtual double retrieveValue(const SimulatorTimer& /*timer*/, virtual double retrieveValue(const SimulatorTimer& timer,
const WellState& wellState, const WellState& wellState,
const std::map<std::string, int>& wellNameToIdxMap) const std::map<std::string, int>& wellNameToIdxMap)
{ {
@ -666,6 +666,11 @@ public:
return 0.0; return 0.0;
} }
if (well_->getStatus(timer.currentStepNum()) == WellCommon::SHUT) {
// well is shut in the current time step
return 0.0;
}
// TODO: Why only positive rates? // TODO: Why only positive rates?
using namespace Opm::unit; using namespace Opm::unit;
return convert::to(std::max(0., rate(wellState)), return convert::to(std::max(0., rate(wellState)),
@ -705,6 +710,11 @@ public:
return 0.0; return 0.0;
} }
if (well_->getStatus(timer.currentStepNum()) == WellCommon::SHUT) {
// well is shut in the current time step
return 0.0;
}
// find the index for the quantity in the wellState // find the index for the quantity in the wellState
this->updateTimeStepWellIndex_(wellNameToIdxMap); this->updateTimeStepWellIndex_(wellNameToIdxMap);
if (this->flatIdx_ < 0) { if (this->flatIdx_ < 0) {
@ -748,7 +758,7 @@ public:
"Pascal") "Pascal")
{ } { }
virtual double retrieveValue(const SimulatorTimer& /*timer*/, virtual double retrieveValue(const SimulatorTimer& timer,
const WellState& wellState, const WellState& wellState,
const std::map<std::string, int>& wellNameToIdxMap) const std::map<std::string, int>& wellNameToIdxMap)
{ {
@ -758,6 +768,10 @@ public:
// well not active in current time step // well not active in current time step
return 0.0; return 0.0;
} }
if (well_->getStatus(timer.currentStepNum()) == WellCommon::SHUT) {
// well is shut in the current time step
return 0.0;
}
return bhp(wellState); return bhp(wellState);
} }

View File

@ -412,7 +412,7 @@ namespace Opm
} }
if (well->getStatus(timeStep) == WellCommon::SHUT) { if (well->getStatus(timeStep) == WellCommon::SHUT) {
well_controls_shut_well( w_->ctrls[well_index] ); //well_controls_shut_well( w_->ctrls[well_index] );
well_index++; well_index++;
continue; continue;
} }

View File

@ -127,6 +127,11 @@ void WellsManager::createWellsFromSpecs(std::vector<WellConstPtr>& wells, size_t
int well_index = 0; int well_index = 0;
for (auto wellIter= wells.begin(); wellIter != wells.end(); ++wellIter) { for (auto wellIter= wells.begin(); wellIter != wells.end(); ++wellIter) {
WellConstPtr well = (*wellIter); WellConstPtr well = (*wellIter);
if (well->getStatus(timeStep) == WellCommon::SHUT) {
continue;
}
{ // WELSPECS handling { // WELSPECS handling
well_names_to_index[well->name()] = well_index; well_names_to_index[well->name()] = well_index;
well_names.push_back(well->name()); well_names.push_back(well->name());

View File

@ -275,7 +275,12 @@ BOOST_AUTO_TEST_CASE(WellShutOK) {
Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(deck)); Opm::EclipseStateConstPtr eclipseState(new Opm::EclipseState(deck));
Opm::GridManager gridManager(deck); Opm::GridManager gridManager(deck);
BOOST_CHECK_NO_THROW( Opm::WellsManager wellsManager2(eclipseState , 2 , *gridManager.c_grid(), NULL)); Opm::WellsManager wellsManager2(eclipseState , 2 , *gridManager.c_grid(), NULL);
// Shut wells are not added to the deck. i.e number of wells should be 2-1
BOOST_CHECK( wellsManager2.c_wells()->number_of_wells == 1);
//BOOST_CHECK_NO_THROW( Opm::WellsManager wellsManager2(eclipseState , 2 , *gridManager.c_grid(), NULL));
} }