Added Schedule code to load Completions - with integrationTest

This commit is contained in:
Joakim Hove 2013-11-09 13:17:42 +01:00
parent 7d015772ee
commit 0f09746143
6 changed files with 97 additions and 56 deletions

View File

@ -73,6 +73,9 @@ namespace Opm {
handleWCONPROD(keyword, currentStep);
if (keyword->name() == "COMPDAT")
handleCOMPDAT( keyword , currentStep );
deckIndex++;
}
}
@ -118,6 +121,18 @@ namespace Opm {
handleWCON(keyword, currentStep, true);
}
void Schedule::handleCOMPDAT(DeckKeywordConstPtr keyword , size_t currentStep) {
std::map<std::string , std::vector< CompletionConstPtr> > completionMapList = Completion::completionsFromCOMPDATKeyword( keyword );
std::map<std::string , std::vector< CompletionConstPtr> >::iterator iter;
for( iter= completionMapList.begin(); iter != completionMapList.end(); iter++) {
const std::string wellName = iter->first;
WellPtr well = getWell( wellName );
well->addCompletions( currentStep , iter->second );
}
}
boost::gregorian::date Schedule::getStartDate() const {
return m_timeMap->getStartDate();
}

View File

@ -58,6 +58,7 @@ namespace Opm
void handleWCON(DeckKeywordConstPtr keyword, size_t currentStep, bool isPredictionMode);
void handleWCONHIST(DeckKeywordConstPtr keyword , size_t currentStep);
void handleWCONPROD(DeckKeywordConstPtr keyword, size_t currentStep);
void handleCOMPDAT(DeckKeywordConstPtr keyword , size_t currentStep);
void handleDATES(DeckKeywordConstPtr keyword);
void handleTSTEP(DeckKeywordConstPtr keyword);
};

View File

@ -32,6 +32,8 @@ namespace Opm {
return "AUTO";
case SHUT:
return "SHUT";
default:
throw std::invalid_argument("Unhandled enum value");
}
}

View File

@ -1,36 +0,0 @@
/*
Copyright 2013 Statoil ASA.
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdexcept>
#include <iostream>
#include <boost/filesystem.hpp>
#define BOOST_TEST_MODULE WellTest
#include <boost/test/unit_test.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well.hpp>
BOOST_AUTO_TEST_CASE(CreateWellCorrentName) {
Opm::Well well("WELL1");
BOOST_CHECK_EQUAL( "WELL1" , well.name() );
}

View File

@ -27,6 +27,7 @@
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/Parser/Parser.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/CompletionSet.hpp>
using namespace Opm;
@ -48,14 +49,14 @@ BOOST_AUTO_TEST_CASE(WellTesting) {
boost::filesystem::path scheduleFile("testdata/integration_tests/SCHEDULE/SCHEDULE_WELLS2");
DeckPtr deck = parser->parse(scheduleFile.string());
ScheduleConstPtr sched(new Schedule(deck));
BOOST_CHECK_EQUAL(3U, sched->numWells());
BOOST_CHECK(sched->hasWell("OP_1"));
BOOST_CHECK(sched->hasWell("OP_2"));
BOOST_CHECK(sched->hasWell("OP_3"));
BOOST_CHECK(sched->hasWell("W_1"));
BOOST_CHECK(sched->hasWell("W_2"));
BOOST_CHECK(sched->hasWell("W_3"));
{
WellPtr well1 = sched->getWell("OP_1");
WellPtr well1 = sched->getWell("W_1");
BOOST_CHECK(well1->isInPredictionMode(0));
BOOST_CHECK_EQUAL(0, well1->getOilRate(0));
@ -78,5 +79,42 @@ BOOST_AUTO_TEST_CASE(WellTesting) {
BOOST_CHECK_EQUAL(13000, well1->getOilRate(8));
BOOST_CHECK_EQUAL(13000, well1->getOilRate(9));
BOOST_CHECK_EQUAL(13000, well1->getOilRate(10));
BOOST_CHECK_EQUAL( 3U , sched->numWells());
BOOST_CHECK( sched->hasWell("W_1"));
BOOST_CHECK( sched->hasWell("W_2"));
BOOST_CHECK( sched->hasWell("W_3"));
{
WellPtr well1 = sched->getWell("W_1");
BOOST_CHECK_EQUAL( 13000 , well1->getOilRate( 8 ));
}
}
}
BOOST_AUTO_TEST_CASE( WellTestCOMPDAT ) {
ParserPtr parser(new Parser());
boost::filesystem::path scheduleFile("testdata/integration_tests/SCHEDULE/SCHEDULE_WELLS2");
DeckPtr deck = parser->parse(scheduleFile.string());
ScheduleConstPtr sched( new Schedule(deck));
BOOST_CHECK_EQUAL( 3U , sched->numWells());
BOOST_CHECK( sched->hasWell("W_1"));
BOOST_CHECK( sched->hasWell("W_2"));
BOOST_CHECK( sched->hasWell("W_3"));
{
WellPtr well1 = sched->getWell("W_1");
BOOST_CHECK_EQUAL( 13000 , well1->getOilRate( 8 ));
CompletionSetConstPtr completions = well1->getCompletions( 0 );
BOOST_CHECK_EQUAL( 0U , completions->size() );
completions = well1->getCompletions( 3 );
BOOST_CHECK_EQUAL( 4U , completions->size() );
BOOST_CHECK_EQUAL( OPEN , completions->get(3)->getState() );
completions = well1->getCompletions( 7 );
BOOST_CHECK_EQUAL( 4U , completions->size() );
BOOST_CHECK_EQUAL( SHUT , completions->get(3)->getState() );
}
}

View File

@ -15,16 +15,30 @@ DATES -- 2,3
/
WELSPECS
'OP_1' 'OP' 30 37 1* 'OIL' 7* / Crap1
'OP_2' 'OP' 20 51 1* 'OIL' 7* / Crap2 Crap3
'OP_3' 'OP' 31 18 1* 'OIL' 7* /
'W_1' 'OP' 30 37 1* 'OIL' 7* / Crap1
'W_2' 'OP' 20 51 1* 'OIL' 7* / Crap2 Crap3
'W_3' 'OP' 31 18 1* 'OIL' 7* /
/
COMPDAT
-- WELL I J K1 K2 Sat. CF DIAM KH SKIN ND DIR Ro
'W_1' 30 37 1 3 'OPEN' 1* 32.948 0.311 3047.839 2* 'X' 22.100 /
'W_1' 31 37 14 14 'OPEN' 1* 19.731 0.311 1831.202 2* 'X' 22.463 /
--
'W_2' 20 51 1 1 'OPEN' 1* 1.168 0.311 107.872 2* 'Y' 21.925 /
'W_2' 20 51 5 5 'OPEN' 1* 7.359 0.311 679.489 2* 'Y' 21.903 /
--
'W_3' 31 18 1 1 'OPEN' 1* 27.412 0.311 2445.337 2* 'Y' 18.521 /
'W_3' 31 18 2 2 'OPEN' 1* 55.195 0.311 4923.842 2* 'Y' 18.524 /
/
WCONHIST
'OP_1' 'OPEN' 'ORAT' 4000.000 4.000 1.46402E+006 5* /
'OP_2' 'OPEN' 'ORAT' 7998.000 2.000 1461075.000 5* /
'OP_3' 'OPEN' 'ORAT' 7999.000 1.000 1471824.000 5* /
'W_1' 'OPEN' 'ORAT' 4000.000 4.000 1.46402E+006 5* /
'W_2' 'OPEN' 'ORAT' 7998.000 2.000 1461075.000 5* /
'W_3' 'OPEN' 'ORAT' 7999.000 1.000 1471824.000 5* /
/
@ -33,27 +47,34 @@ TSTEP -- 4,5,6
WCONHIST
'OP_1' 'OPEN' 'ORAT' 14000.000 4.000 1.46402E+006 5* /
'OP_2' 'OPEN' 'ORAT' 17998.000 2.000 1461075.000 5* /
'OP_3' 'OPEN' 'ORAT' 17999.000 1.000 1471824.000 5* /
'W_1' 'OPEN' 'ORAT' 14000.000 4.000 1.46402E+006 5* /
'W_2' 'OPEN' 'ORAT' 17998.000 2.000 1461075.000 5* /
'W_3' 'OPEN' 'ORAT' 17999.000 1.000 1471824.000 5* /
/
TSTEP - 7
3 /
COMPDAT
'W_1' 31 37 14 14 'SHUT' 1* 19.731 0.311 1831.202 2* 'X' 22.463 /
/
WCONPROD
'OP_1' 'OPEN' 'ORAT' 11000.000 4.000 1.46402E+006 5* /
'OP_2' 'OPEN' 'ORAT' 17998.000 2.000 1461075.000 5* /
'OP_3' 'OPEN' 'ORAT' 17999.000 1.000 1471824.000 5* /
'W_1' 'OPEN' 'ORAT' 11000.000 4.000 1.46402E+006 5* /
'W_2' 'OPEN' 'ORAT' 17998.000 2.000 1461075.000 5* /
'W_3' 'OPEN' 'ORAT' 17999.000 1.000 1471824.000 5* /
/
TSTEP -- 8
4 /
WCONHIST
'OP_1' 'OPEN' 'ORAT' 13000.000 4.000 1.46402E+006 5* /
'OP_2' 'OPEN' 'ORAT' 17998.000 2.000 1461075.000 5* /
'OP_3' 'OPEN' 'ORAT' 17999.000 1.000 1471824.000 5* /
'W_1' 'OPEN' 'ORAT' 13000.000 4.000 1.46402E+006 5* /
'W_2' 'OPEN' 'ORAT' 17998.000 2.000 1461075.000 5* /
'W_3' 'OPEN' 'ORAT' 17999.000 1.000 1471824.000 5* /
/
DATES -- 9, 10