Merge pull request #481 from joakim-hove/open-wells

Added utility method Schedule::getOpenWells( )
This commit is contained in:
Joakim Hove
2015-05-29 09:05:51 +02:00
3 changed files with 59 additions and 0 deletions

View File

@@ -204,6 +204,7 @@ namespace Opm {
m_rootGroupTree->add(currentStep, newTree);
}
}
void Schedule::checkWELSPECSConsistency(WellConstPtr well, DeckKeywordConstPtr keyword, size_t recordIdx) const {
DeckRecordConstPtr record = keyword->getRecord(recordIdx);
@@ -970,6 +971,24 @@ namespace Opm {
return m_wells.get( wellName );
}
/*
Observe that this method only returns wells which have state ==
OPEN; it does not include wells in state AUTO which might have
been opened by the simulator.
*/
std::vector<WellPtr> Schedule::getOpenWells(size_t timeStep) const {
std::vector<WellPtr> wells;
for (auto well_iter = m_wells.begin(); well_iter != m_wells.end(); ++well_iter) {
auto well = *well_iter;
if (well->getStatus( timeStep ) == WellCommon::OPEN)
wells.push_back( well );
}
return wells;
}
std::vector<WellPtr> Schedule::getWells(const std::string& wellNamePattern) const {
std::vector<WellPtr> wells;
size_t wildcard_pos = wellNamePattern.find("*");

View File

@@ -52,6 +52,7 @@ namespace Opm
size_t getMaxNumCompletionsForWells(size_t timestep) const;
bool hasWell(const std::string& wellName) const;
WellPtr getWell(const std::string& wellName) const;
std::vector<WellPtr> getOpenWells(size_t timeStep) const;
std::vector<WellConstPtr> getWells() const;
std::vector<WellConstPtr> getWells(size_t timeStep) const;
std::vector<WellPtr> getWells(const std::string& wellNamePattern) const;

View File

@@ -104,6 +104,45 @@ BOOST_AUTO_TEST_CASE(WellTestRefDepth) {
}
BOOST_AUTO_TEST_CASE(WellTestOpen) {
BOOST_CHECK_EQUAL(2, 2);
ParserPtr parser(new Parser());
boost::filesystem::path scheduleFile("testdata/integration_tests/SCHEDULE/SCHEDULE_WELLS2");
DeckPtr deck = parser->parseFile(scheduleFile.string());
std::shared_ptr<const EclipseGrid> grid = std::make_shared<const EclipseGrid>(40,60,30);
IOConfigPtr ioConfig;
ScheduleConstPtr sched(new Schedule(grid , deck, ioConfig));
auto well1 = sched->getWell( "W_1" );
auto well2 = sched->getWell( "W_2" );
auto well3 = sched->getWell( "W_3" );
{
auto wells = sched->getOpenWells( 3 );
BOOST_CHECK_EQUAL( 1U , wells.size() );
BOOST_CHECK_EQUAL( well1 , wells[0] );
}
{
auto wells = sched->getOpenWells(6);
BOOST_CHECK_EQUAL( 3U , wells.size() );
BOOST_CHECK_EQUAL( well1 , wells[0] );
BOOST_CHECK_EQUAL( well2 , wells[1] );
BOOST_CHECK_EQUAL( well3 , wells[2] );
}
{
auto wells = sched->getOpenWells(12);
BOOST_CHECK_EQUAL( 2U , wells.size() );
BOOST_CHECK_EQUAL( well2 , wells[0] );
BOOST_CHECK_EQUAL( well3 , wells[1] );
}
}
BOOST_AUTO_TEST_CASE(WellTesting) {