Refactor ScheduleTests to use fixture function

This commit is contained in:
Joakim Hove
2020-04-30 08:53:30 +02:00
parent 4fa0c93ff7
commit ef77be1508

View File

@@ -58,8 +58,19 @@
using namespace Opm;
static Deck createDeck() {
Opm::Parser parser;
Schedule make_schedule(const std::string& deck_string) {
const auto& deck = Parser{}.parseString(deck_string);
auto python = std::make_shared<Python>();
EclipseGrid grid(10,10,10);
TableManager table ( deck );
FieldPropsManager fp( deck, Phases{true, true, true}, grid, table);
Runspec runspec (deck);
return Schedule(deck, grid , fp, runspec, python);
}
static std::string createDeck() {
std::string input =
"START\n"
"8 MAR 1998 /\n"
@@ -67,11 +78,10 @@ static Deck createDeck() {
"SCHEDULE\n"
"\n";
return parser.parseString(input);
return input;
}
static Deck createDeckWithWells() {
Opm::Parser parser;
static std::string createDeckWithWells() {
std::string input =
"START -- 0 \n"
"10 MAI 2007 / \n"
@@ -91,11 +101,10 @@ static Deck createDeckWithWells() {
" \'W_3\' \'OP\' 20 51 3.92 \'OIL\' 7* / \n"
"/\n";
return parser.parseString(input);
return input;
}
static Deck createDeckWTEST() {
Opm::Parser parser;
static std::string createDeckWTEST() {
std::string input =
"START -- 0 \n"
"10 MAI 2007 / \n"
@@ -178,12 +187,10 @@ static Deck createDeckWTEST() {
" 'BAN' 'WATER' 1* 1.0 / \n"
"/\n";
return parser.parseString(input);
return input;
}
static Deck createDeckForTestingCrossFlow() {
Opm::Parser parser;
static std::string createDeckForTestingCrossFlow() {
std::string input =
"START -- 0 \n"
"10 MAI 2007 / \n"
@@ -243,27 +250,24 @@ static Deck createDeckForTestingCrossFlow() {
" 'BAN' 'WATER' 1* 1.0 / \n"
"/\n";
return parser.parseString(input);
return input;
}
static Deck createDeckWithWellsOrdered() {
Opm::Parser parser;
static std::string createDeckWithWellsOrdered() {
std::string input =
"START -- 0 \n"
"10 MAI 2007 / \n"
"SCHEDULE\n"
"WELSPECS\n"
" \'CW_1\' \'CG\' 30 37 3.33 \'OIL\' 7* / \n"
" \'BW_2\' \'BG\' 30 37 3.33 \'OIL\' 7* / \n"
" \'AW_3\' \'AG\' 20 51 3.92 \'OIL\' 7* / \n"
" \'CW_1\' \'CG\' 3 3 3.33 \'OIL\' 7* / \n"
" \'BW_2\' \'BG\' 3 3 3.33 \'OIL\' 7* / \n"
" \'AW_3\' \'AG\' 2 5 3.92 \'OIL\' 7* / \n"
"/\n";
return parser.parseString(input);
return input;
}
static Deck createDeckWithWellsOrderedGRUPTREE() {
Opm::Parser parser;
static std::string createDeckWithWellsOrderedGRUPTREE() {
std::string input =
"START -- 0 \n"
"10 MAI 2007 / \n"
@@ -275,17 +279,16 @@ static Deck createDeckWithWellsOrderedGRUPTREE() {
" CG2 PG2 /\n"
"/\n"
"WELSPECS\n"
" \'DW_0\' \'CG1\' 30 37 3.33 \'OIL\' 7* / \n"
" \'CW_1\' \'CG1\' 30 37 3.33 \'OIL\' 7* / \n"
" \'BW_2\' \'CG2\' 30 37 3.33 \'OIL\' 7* / \n"
" \'AW_3\' \'CG2\' 20 51 3.92 \'OIL\' 7* / \n"
" \'DW_0\' \'CG1\' 3 3 3.33 \'OIL\' 7* / \n"
" \'CW_1\' \'CG1\' 3 3 3.33 \'OIL\' 7* / \n"
" \'BW_2\' \'CG2\' 3 3 3.33 \'OIL\' 7* / \n"
" \'AW_3\' \'CG2\' 2 5 3.92 \'OIL\' 7* / \n"
"/\n";
return parser.parseString(input);
return input;
}
static Deck createDeckWithWellsAndCompletionData() {
Opm::Parser parser;
static std::string createDeckWithWellsAndCompletionData() {
std::string input =
"START -- 0 \n"
"1 NOV 1979 / \n"
@@ -315,11 +318,11 @@ static Deck createDeckWithWellsAndCompletionData() {
" 'OP_1' 0 * 3 9 'OPEN' 1* 32.948 0.311 3047.839 1* 1* 'X' 22.100 / \n"
"/\n";
return parser.parseString(input);
return input;
}
static Deck createDeckRFTConfig() {
return ::Opm::Parser{}.parseString(R"(RUNSPEC
static std::string createDeckRFTConfig() {
return R"(RUNSPEC
START -- 0
1 NOV 1979 /
SCHEDULE
@@ -357,9 +360,10 @@ COMPDAT
'OP_1' 0 * 3 9 'OPEN' 1* 32.948 0.311 3047.839 1* 1* 'X' 22.100 /
/
END
)");
)";
}
BOOST_AUTO_TEST_CASE(CreateScheduleDeckMissingReturnsDefaults) {
Deck deck;
Parser parser;
@@ -374,13 +378,7 @@ BOOST_AUTO_TEST_CASE(CreateScheduleDeckMissingReturnsDefaults) {
}
BOOST_AUTO_TEST_CASE(CreateScheduleDeckWellsOrdered) {
auto deck = createDeckWithWellsOrdered();
auto python = std::make_shared<Python>();
EclipseGrid grid(100,100,100);
TableManager table ( deck );
FieldPropsManager fp( deck, Phases{true, true, true}, grid, table);
Runspec runspec (deck);
Schedule schedule(deck, grid , fp, runspec, python);
const auto& schedule = make_schedule( createDeckWithWellsOrdered() );
auto well_names = schedule.wellNames();
BOOST_CHECK_EQUAL( "CW_1" , well_names[0]);
@@ -404,13 +402,7 @@ bool has_well( const std::vector<Well>& wells, const std::string& well_name) {
BOOST_AUTO_TEST_CASE(CreateScheduleDeckWellsOrderedGRUPTREE) {
auto deck = createDeckWithWellsOrderedGRUPTREE();
auto python = std::make_shared<Python>();
EclipseGrid grid(100,100,100);
TableManager table ( deck );
FieldPropsManager fp( deck, Phases{true, true, true}, grid, table);
Runspec runspec (deck);
Schedule schedule(deck, grid , fp, runspec, python);
const auto& schedule = make_schedule( createDeckWithWellsOrderedGRUPTREE() );
BOOST_CHECK_THROW( schedule.getChildWells2( "NO_SUCH_GROUP" , 1 ), std::invalid_argument);
{
@@ -456,13 +448,7 @@ BOOST_AUTO_TEST_CASE(CreateScheduleDeckWellsOrderedGRUPTREE) {
BOOST_AUTO_TEST_CASE(GroupTree2TEST) {
auto deck = createDeckWithWellsOrderedGRUPTREE();
auto python = std::make_shared<Python>();
EclipseGrid grid(100,100,100);
TableManager table ( deck );
FieldPropsManager fp( deck, Phases{true, true, true}, grid, table);
Runspec runspec (deck);
Schedule schedule(deck, grid , fp, runspec, python);
const auto& schedule = make_schedule( createDeckWithWellsOrderedGRUPTREE() );
BOOST_CHECK_THROW( schedule.groupTree("NO_SUCH_GROUP", 0), std::invalid_argument);
auto cg1 = schedule.getGroup("CG1", 0);
@@ -487,38 +473,16 @@ BOOST_AUTO_TEST_CASE(GroupTree2TEST) {
BOOST_AUTO_TEST_CASE(CreateScheduleDeckWithStart) {
auto deck = createDeck();
auto python = std::make_shared<Python>();
EclipseGrid grid(10,10,10);
TableManager table ( deck );
FieldPropsManager fp( deck, Phases{true, true, true}, grid, table);
Runspec runspec (deck);
Schedule schedule(deck, grid , fp, runspec, python);
const auto& schedule = make_schedule( createDeck() );
BOOST_CHECK_EQUAL( schedule.getStartTime() , TimeMap::mkdate(1998, 3 , 8 ));
}
BOOST_AUTO_TEST_CASE(CreateScheduleDeckWithSCHEDULENoThrow) {
Parser parser;
Deck deck;
auto python = std::make_shared<Python>();
EclipseGrid grid(10,10,10);
TableManager table ( deck );
FieldPropsManager fp( deck, Phases{true, true, true}, grid, table);
deck.addKeyword( DeckKeyword( parser.getKeyword("SCHEDULE" )));
Runspec runspec (deck);
BOOST_CHECK_NO_THROW( Schedule( deck, grid , fp, runspec, python));
BOOST_CHECK_NO_THROW( make_schedule( "SCHEDULE" ));
}
BOOST_AUTO_TEST_CASE(EmptyScheduleHasNoWells) {
auto python = std::make_shared<Python>();
EclipseGrid grid(10,10,10);
auto deck = createDeck();
TableManager table ( deck );
FieldPropsManager fp( deck, Phases{true, true, true}, grid, table);
Runspec runspec (deck);;
Schedule schedule(deck, grid , fp, runspec, python);
const auto& schedule = make_schedule( createDeck() );
BOOST_CHECK_EQUAL( 0U , schedule.numWells() );
BOOST_CHECK_EQUAL( false , schedule.hasWell("WELL1") );
BOOST_CHECK_THROW( schedule.getWell("WELL2", 0) , std::invalid_argument );
@@ -527,13 +491,7 @@ BOOST_AUTO_TEST_CASE(EmptyScheduleHasNoWells) {
BOOST_AUTO_TEST_CASE(EmptyScheduleHasFIELDGroup) {
auto python = std::make_shared<Python>();
EclipseGrid grid(10,10,10);
auto deck = createDeck();
TableManager table ( deck );
FieldPropsManager fp( deck, Phases{true, true, true}, grid, table);
Runspec runspec (deck);
Schedule schedule(deck , grid , fp, runspec, python);
const auto& schedule = make_schedule( createDeck() );
BOOST_CHECK_EQUAL( 1U , schedule.numGroups() );
BOOST_CHECK_EQUAL( true , schedule.hasGroup("FIELD") );
@@ -543,39 +501,6 @@ BOOST_AUTO_TEST_CASE(EmptyScheduleHasFIELDGroup) {
BOOST_AUTO_TEST_CASE(HasGroup_At_Time) {
const auto input = std::string { R"(
RUNSPEC
DIMENS
5 5 5 /
OIL
WATER
TABDIMS
/
WELLDIMS
2 10 3 2 /
GRID
DXV
5*100 /
DYV
5*100 /
DZV
5*5 /
TOPS
25*2500 /
PORO
125*0.15 /
PERMX
125*500 /
COPY
'PERMX' 'PERMY' /
'PERMX' 'PERMZ' /
/
MULTIPLY
'PERMZ' 0.1 /
/
PROPS
SWOF
0 0 1 0
1 1 0 0 /
SCHEDULE
WELSPECS
-- Group 'P' exists from the first report step
@@ -599,10 +524,7 @@ END
)"
};
auto python = std::make_shared<::Opm::Python>();
const auto deck = ::Opm::Parser{}.parseString(input);
const auto es = ::Opm::EclipseState{deck};
const auto sched = ::Opm::Schedule{ deck, es, python };
const auto sched = make_schedule(input);
BOOST_CHECK_MESSAGE(sched.hasGroup("P"), R"(Group "P" Must Exist)");
BOOST_CHECK_MESSAGE(sched.hasGroup("I"), R"(Group "I" Must Exist)");
@@ -624,13 +546,7 @@ END
}
BOOST_AUTO_TEST_CASE(WellsIterator_Empty_EmptyVectorReturned) {
auto python = std::make_shared<Python>();
EclipseGrid grid(10,10,10);
auto deck = createDeck();
TableManager table ( deck );
FieldPropsManager fp( deck, Phases{true, true, true}, grid, table);
Runspec runspec (deck);
Schedule schedule(deck , grid , fp, runspec, python);
const auto& schedule = make_schedule( createDeck() );
const auto wells_alltimesteps = schedule.getWellsatEnd();
BOOST_CHECK_EQUAL(0U, wells_alltimesteps.size());
@@ -643,13 +559,7 @@ BOOST_AUTO_TEST_CASE(WellsIterator_Empty_EmptyVectorReturned) {
}
BOOST_AUTO_TEST_CASE(WellsIterator_HasWells_WellsReturned) {
auto python = std::make_shared<Python>();
EclipseGrid grid(10,10,10);
auto deck = createDeckWithWells();
TableManager table ( deck );
FieldPropsManager fp( deck, Phases{true, true, true}, grid, table);
Runspec runspec (deck);
Schedule schedule(deck , grid , fp, runspec, python);
const auto& schedule = make_schedule( createDeckWithWells() );
size_t timeStep = 0;
const auto wells_alltimesteps = schedule.getWellsatEnd();
@@ -663,13 +573,7 @@ BOOST_AUTO_TEST_CASE(WellsIterator_HasWells_WellsReturned) {
BOOST_AUTO_TEST_CASE(ReturnNumWellsTimestep) {
auto python = std::make_shared<Python>();
EclipseGrid grid(10,10,10);
auto deck = createDeckWithWells();
TableManager table ( deck );
FieldPropsManager fp( deck, Phases{true, true, true}, grid, table);
Runspec runspec (deck);
Schedule schedule(deck, grid , fp, runspec, python);
const auto& schedule = make_schedule( createDeckWithWells() );
BOOST_CHECK_EQUAL(schedule.numWells(0), 1);
BOOST_CHECK_EQUAL(schedule.numWells(1), 1);
@@ -678,13 +582,7 @@ BOOST_AUTO_TEST_CASE(ReturnNumWellsTimestep) {
}
BOOST_AUTO_TEST_CASE(TestCrossFlowHandling) {
auto python = std::make_shared<Python>();
EclipseGrid grid(10,10,10);
auto deck = createDeckForTestingCrossFlow();
TableManager table ( deck );
FieldPropsManager fp( deck, Phases{true, true, true}, grid, table);
Runspec runspec (deck);
Schedule schedule(deck, grid , fp, runspec, python);
const auto& schedule = make_schedule( createDeckForTestingCrossFlow() );
BOOST_CHECK_EQUAL(schedule.getWell("BAN", 0).getAllowCrossFlow(), false);
BOOST_CHECK_EQUAL(schedule.getWell("ALLOW", 0).getAllowCrossFlow(), true);
@@ -697,8 +595,7 @@ BOOST_AUTO_TEST_CASE(TestCrossFlowHandling) {
BOOST_CHECK(Well::Status::OPEN == schedule.getWell("BAN", 5).getStatus());
}
static Deck createDeckWithWellsAndConnectionDataWithWELOPEN() {
Opm::Parser parser;
static std::string createDeckWithWellsAndConnectionDataWithWELOPEN() {
std::string input =
"START -- 0 \n"
"1 NOV 1979 / \n"
@@ -748,17 +645,11 @@ static Deck createDeckWithWellsAndConnectionDataWithWELOPEN() {
" 'OP_1' SHUT 0 0 0 0 0 / \n "
"/\n";
return parser.parseString(input);
return input;
}
BOOST_AUTO_TEST_CASE(CreateScheduleDeckWellsAndConnectionDataWithWELOPEN) {
auto python = std::make_shared<Python>();
EclipseGrid grid(10,10,10);
auto deck = createDeckWithWellsAndConnectionDataWithWELOPEN();
TableManager table ( deck );
FieldPropsManager fp( deck, Phases{true, true, true}, grid, table);
Runspec runspec (deck);
Schedule schedule(deck ,grid , fp, runspec, python);
const auto& schedule = make_schedule(createDeckWithWellsAndConnectionDataWithWELOPEN());
{
constexpr auto well_shut = Well::Status::SHUT;
constexpr auto well_open = Well::Status::OPEN;
@@ -837,13 +728,7 @@ BOOST_AUTO_TEST_CASE(CreateScheduleDeckWithWELOPEN_TryToOpenWellWithShutCompleti
" 'OP_1' OPEN / \n "
"/\n";
auto python = std::make_shared<Python>();
EclipseGrid grid(10,10,10);
auto deck = parser.parseString(input);
TableManager table ( deck );
FieldPropsManager fp( deck, Phases{true, true, true}, grid, table);
Runspec runspec (deck);
Schedule schedule(deck , grid , fp, runspec, python);
const auto& schedule = make_schedule(input);
const auto& well2_3 = schedule.getWell("OP_1",3);
const auto& well2_4 = schedule.getWell("OP_1",4);
BOOST_CHECK(Well::Status::SHUT == well2_3.getStatus());
@@ -898,13 +783,7 @@ BOOST_AUTO_TEST_CASE(CreateScheduleDeckWithWELOPEN_CombineShutCompletionsAndAddN
" 12 NOV 2008 / \n"
"/\n";
auto python = std::make_shared<Python>();
EclipseGrid grid(10,10,10);
auto deck = parser.parseString(input);
TableManager table ( deck );
FieldPropsManager fp( deck, Phases{true, true, true}, grid, table);
Runspec runspec (deck);
Schedule schedule(deck, grid , fp, runspec, python);
const auto& schedule = make_schedule(input);
const auto& well_3 = schedule.getWell("OP_1", 3);
const auto& well_4 = schedule.getWell("OP_1", 4);
const auto& well_5 = schedule.getWell("OP_1", 5);
@@ -957,13 +836,7 @@ BOOST_AUTO_TEST_CASE(CreateScheduleDeckWithWRFT) {
"/\n";
auto python = std::make_shared<Python>();
EclipseGrid grid(10,10,10);
auto deck = parser.parseString(input);
TableManager table ( deck );
FieldPropsManager fp( deck, Phases{true, true, true}, grid, table);
Runspec runspec (deck);
Schedule schedule(deck, grid , fp, runspec, python);
const auto& schedule = make_schedule(input);
const auto& rft_config = schedule.rftConfig();
BOOST_CHECK_EQUAL(2 , rft_config.firstRFTOutput());
@@ -1016,13 +889,8 @@ BOOST_AUTO_TEST_CASE(CreateScheduleDeckWithWRFTPLT) {
"DATES -- 5\n"
" 10 NOV 2008 / \n"
"/\n";
auto python = std::make_shared<Python>();
EclipseGrid grid(10,10,10);
auto deck = parser.parseString(input);
TableManager table ( deck );
FieldPropsManager fp( deck, Phases{true, true, true}, grid, table);
Runspec runspec (deck);
Schedule schedule(deck, grid , fp, runspec, python);
const auto& schedule = make_schedule(input);
const auto& well = schedule.getWell("OP_1", 4);
BOOST_CHECK(Well::Status::OPEN == well.getStatus());
@@ -1033,7 +901,6 @@ BOOST_AUTO_TEST_CASE(CreateScheduleDeckWithWRFTPLT) {
}
BOOST_AUTO_TEST_CASE(createDeckWithWeltArg) {
Opm::Parser parser;
std::string input =
"START -- 0 \n"
"19 JUN 2007 / \n"
@@ -1067,14 +934,8 @@ BOOST_AUTO_TEST_CASE(createDeckWithWeltArg) {
" OP_1 GUID 2300.14 /\n"
"/\n";
auto deck = parser.parseString(input);
auto python = std::make_shared<Python>();
EclipseGrid grid(10,10,10);
TableManager table ( deck );
FieldPropsManager fp( deck, Phases{true, true, true}, grid, table);
Runspec runspec (deck);
Schedule schedule(deck, grid , fp, runspec, python);
Opm::UnitSystem unitSystem = deck.getActiveUnitSystem();
const auto& schedule = make_schedule(input);
Opm::UnitSystem unitSystem = UnitSystem( UnitSystem::UnitType::UNIT_TYPE_METRIC );
double siFactorL = unitSystem.parse("LiquidSurfaceVolume/Time").getSIScaling();
double siFactorG = unitSystem.parse("GasSurfaceVolume/Time").getSIScaling();
double siFactorP = unitSystem.parse("Pressure").getSIScaling();
@@ -1107,7 +968,6 @@ BOOST_AUTO_TEST_CASE(createDeckWithWeltArg) {
}
BOOST_AUTO_TEST_CASE(createDeckWithWeltArgException) {
Opm::Parser parser;
std::string input =
"SCHEDULE\n"
"WELTARG\n"
@@ -1116,37 +976,21 @@ BOOST_AUTO_TEST_CASE(createDeckWithWeltArgException) {
" OP_1 RESV 1801.05 /\n"
"/\n";
auto deck = parser.parseString(input);
auto python = std::make_shared<Python>();
EclipseGrid grid(10,10,10);
TableManager table ( deck );
FieldPropsManager fp( deck, Phases{true, true, true}, grid, table);
Runspec runspec (deck);
BOOST_CHECK_THROW(Schedule(deck, grid , fp, runspec, python),
std::invalid_argument);
BOOST_CHECK_THROW(make_schedule(input), std::invalid_argument);
}
BOOST_AUTO_TEST_CASE(createDeckWithWeltArgException2) {
Opm::Parser parser;
std::string input =
"SCHEDULE\n"
"WELTARG\n"
" OP_1 LRAT /\n"
" OP_1 RESV 1801.05 /\n"
"/\n";
auto deck = parser.parseString(input);
auto python = std::make_shared<Python>();
EclipseGrid grid(10,10,10);
TableManager table ( deck );
FieldPropsManager fp( deck, Phases{true, true, true}, grid, table);
Runspec runspec (deck);
BOOST_CHECK_THROW(Schedule(deck, grid , fp, runspec, python), std::invalid_argument);
BOOST_CHECK_THROW(make_schedule(input), std::invalid_argument);
}
BOOST_AUTO_TEST_CASE(createDeckWithWPIMULT) {
Opm::Parser parser;
std::string input =
"START -- 0 \n"
"19 JUN 2007 / \n"
@@ -1183,14 +1027,7 @@ BOOST_AUTO_TEST_CASE(createDeckWithWPIMULT) {
" 'OP_1' 9 9 3 9 'OPEN' 1* 32.948 0.311 3047.839 1* 1* 'X' 22.100 / \n"
"/\n";
auto deck = parser.parseString(input);
auto python = std::make_shared<Python>();
EclipseGrid grid(10,10,10);
TableManager table ( deck );
FieldPropsManager fp( deck, Phases{true, true, true}, grid, table);
Runspec runspec (deck);
Schedule schedule(deck, grid , fp, runspec, python);
const auto& schedule = make_schedule(input);
const auto& cs1 = schedule.getWell("OP_1", 1).getConnections();
const auto& cs2 = schedule.getWell("OP_1", 2).getConnections();
const auto& cs3 = schedule.getWell("OP_1", 3).getConnections();
@@ -1270,7 +1107,6 @@ BOOST_AUTO_TEST_CASE(WELSPECS_WGNAME_SPACE) {
}
BOOST_AUTO_TEST_CASE(createDeckModifyMultipleGCONPROD) {
Opm::Parser parser;
const std::string input = R"(
START -- 0
10 'JAN' 2000 /
@@ -1306,16 +1142,10 @@ BOOST_AUTO_TEST_CASE(createDeckModifyMultipleGCONPROD) {
/
)";
auto deck = parser.parseString(input);
auto python = std::make_shared<Python>();
EclipseGrid grid( deck );
TableManager table ( deck );
FieldPropsManager fp( deck, Phases{true, true, true}, grid, table);
Runspec runspec (deck);
Opm::Schedule schedule(deck, grid, fp, runspec, python);
const auto& schedule = make_schedule(input);
Opm::SummaryState st(std::chrono::system_clock::now());
Opm::UnitSystem unitSystem = deck.getActiveUnitSystem();
Opm::UnitSystem unitSystem = UnitSystem(UnitSystem::UnitType::UNIT_TYPE_METRIC);
double siFactorL = unitSystem.parse("LiquidSurfaceVolume/Time").getSIScaling();
{
@@ -1344,7 +1174,6 @@ BOOST_AUTO_TEST_CASE(createDeckModifyMultipleGCONPROD) {
}
BOOST_AUTO_TEST_CASE(createDeckWithDRSDT) {
Opm::Parser parser;
std::string input =
"START -- 0 \n"
"19 JUN 2007 / \n"
@@ -1356,13 +1185,7 @@ BOOST_AUTO_TEST_CASE(createDeckWithDRSDT) {
"0.0003\n"
"/\n";
auto deck = parser.parseString(input);
auto python = std::make_shared<Python>();
EclipseGrid grid(10,10,10);
TableManager table ( deck );
FieldPropsManager fp( deck, Phases{true, true, true}, grid, table);
Runspec runspec (deck);
Schedule schedule(deck, grid , fp, runspec, python);
const auto& schedule = make_schedule(input);
size_t currentStep = 1;
BOOST_CHECK_EQUAL(schedule.hasOilVaporizationProperties(), true);
const auto& ovap = schedule.getOilVaporizationProperties(currentStep);
@@ -1375,7 +1198,6 @@ BOOST_AUTO_TEST_CASE(createDeckWithDRSDT) {
}
BOOST_AUTO_TEST_CASE(createDeckWithDRSDTR) {
Opm::Parser parser;
std::string input =
"START -- 0 \n"
"19 JUN 2007 / \n"
@@ -1391,13 +1213,7 @@ BOOST_AUTO_TEST_CASE(createDeckWithDRSDTR) {
"1 /\n"
"2 /\n";
auto deck = parser.parseString(input);
auto python = std::make_shared<Python>();
EclipseGrid grid(10,10,10);
TableManager table ( deck );
FieldPropsManager fp(deck, Phases{true, true, true}, grid, table);
Runspec runspec (deck);
Schedule schedule(deck, grid , fp, runspec, python);
const auto& schedule = make_schedule(input);
size_t currentStep = 1;
BOOST_CHECK_EQUAL(schedule.hasOilVaporizationProperties(), true);
const auto& ovap = schedule.getOilVaporizationProperties(currentStep);
@@ -1415,7 +1231,6 @@ BOOST_AUTO_TEST_CASE(createDeckWithDRSDTR) {
BOOST_AUTO_TEST_CASE(createDeckWithDRSDTthenDRVDT) {
Opm::Parser parser;
std::string input =
"START -- 0 \n"
"19 JUN 2007 / \n"
@@ -1439,13 +1254,7 @@ BOOST_AUTO_TEST_CASE(createDeckWithDRSDTthenDRVDT) {
"2 0.100\n"
"/\n";
auto deck = parser.parseString(input);
auto python = std::make_shared<Python>();
EclipseGrid grid(10,10,10);
TableManager table ( deck );
FieldPropsManager fp( deck, Phases{true, true, true}, grid, table);
Runspec runspec (deck);
Schedule schedule(deck, grid , fp, runspec, python);
const auto& schedule = make_schedule(input);
BOOST_CHECK_EQUAL(schedule.hasOilVaporizationProperties(), true);
const OilVaporizationProperties& ovap1 = schedule.getOilVaporizationProperties(1);
@@ -1469,7 +1278,6 @@ BOOST_AUTO_TEST_CASE(createDeckWithDRSDTthenDRVDT) {
}
BOOST_AUTO_TEST_CASE(createDeckWithVAPPARS) {
Opm::Parser parser;
std::string input =
"START -- 0 \n"
"19 JUN 2007 / \n"
@@ -1481,13 +1289,7 @@ BOOST_AUTO_TEST_CASE(createDeckWithVAPPARS) {
"2 0.100\n"
"/\n";
auto deck = parser.parseString(input);
auto python = std::make_shared<Python>();
EclipseGrid grid(10,10,10);
TableManager table ( deck );
FieldPropsManager fp( deck, Phases{true, true, true}, grid, table);
Runspec runspec (deck);
Schedule schedule(deck, grid , fp, runspec, python);
const auto& schedule = make_schedule(input);
size_t currentStep = 1;
BOOST_CHECK_EQUAL(schedule.hasOilVaporizationProperties(), true);
const OilVaporizationProperties& ovap = schedule.getOilVaporizationProperties(currentStep);
@@ -1503,7 +1305,6 @@ BOOST_AUTO_TEST_CASE(createDeckWithVAPPARS) {
BOOST_AUTO_TEST_CASE(createDeckWithOutOilVaporizationProperties) {
Opm::Parser parser;
std::string input =
"START -- 0 \n"
"19 JUN 2007 / \n"
@@ -1513,21 +1314,12 @@ BOOST_AUTO_TEST_CASE(createDeckWithOutOilVaporizationProperties) {
"/\n";
auto deck = parser.parseString(input);
auto python = std::make_shared<Python>();
EclipseGrid grid(10,10,10);
TableManager table ( deck );
FieldPropsManager fp( deck, Phases{true, true, true}, grid, table);
Runspec runspec (deck);
Schedule schedule(deck, grid , fp, runspec, python);
const auto& schedule = make_schedule(input);
BOOST_CHECK_EQUAL(schedule.hasOilVaporizationProperties(), false);
}
BOOST_AUTO_TEST_CASE(changeBhpLimitInHistoryModeWithWeltarg) {
Opm::Parser parser;
std::string input =
"START -- 0 \n"
"19 JUN 2007 / \n"
@@ -1575,15 +1367,9 @@ BOOST_AUTO_TEST_CASE(changeBhpLimitInHistoryModeWithWeltarg) {
"/\n"
;
auto deck = parser.parseString(input);
auto python = std::make_shared<Python>();
EclipseGrid grid(10,10,10);
TableManager table ( deck );
FieldPropsManager fp( deck, Phases{true, true, true}, grid, table);
Runspec runspec (deck);
SummaryState st(std::chrono::system_clock::now());
const auto& unit_system = deck.getActiveUnitSystem();
Schedule sched(deck, grid , fp, runspec, python);
const auto& sched = make_schedule(input);
const auto st = ::Opm::SummaryState{ std::chrono::system_clock::now() };
UnitSystem unit_system(UnitSystem::UnitType::UNIT_TYPE_METRIC);
// The BHP limit should not be effected by WCONHIST
{
@@ -1613,7 +1399,6 @@ BOOST_AUTO_TEST_CASE(changeBhpLimitInHistoryModeWithWeltarg) {
}
BOOST_AUTO_TEST_CASE(changeModeWithWHISTCTL) {
Opm::Parser parser;
std::string input =
"START -- 0 \n"
"19 JUN 2007 / \n"
@@ -1673,13 +1458,7 @@ BOOST_AUTO_TEST_CASE(changeModeWithWHISTCTL) {
"/\n"
;
auto deck = parser.parseString(input);
auto python = std::make_shared<Python>();
EclipseGrid grid(10,10,10);
TableManager table ( deck );
FieldPropsManager fp( deck, Phases{true, true, true}, grid, table);
Runspec runspec (deck);
Schedule schedule(deck, grid , fp, runspec, python);
const auto& schedule = make_schedule(input);
//Start
BOOST_CHECK_THROW(schedule.getWell("P1", 0), std::invalid_argument);
@@ -1744,7 +1523,6 @@ BOOST_AUTO_TEST_CASE(changeModeWithWHISTCTL) {
}
BOOST_AUTO_TEST_CASE(fromWCONHISTtoWCONPROD) {
Opm::Parser parser;
std::string input =
"START -- 0 \n"
"19 JUN 2007 / \n"
@@ -1780,14 +1558,7 @@ BOOST_AUTO_TEST_CASE(fromWCONHISTtoWCONPROD) {
"/\n"
;
auto deck = parser.parseString(input);
auto python = std::make_shared<Python>();
EclipseGrid grid(10,10,10);
TableManager table ( deck );
FieldPropsManager fp( deck, Phases{true, true, true}, grid, table);
Runspec runspec (deck);
Schedule schedule(deck, grid , fp, runspec, python);
const auto& schedule = make_schedule(input);
//Start
BOOST_CHECK_THROW(schedule.getWell("P1", 0), std::invalid_argument);
BOOST_CHECK_THROW(schedule.getWell("P2", 0), std::invalid_argument);
@@ -3004,14 +2775,15 @@ BOOST_AUTO_TEST_CASE(historic_BHP_and_THP) {
}
BOOST_AUTO_TEST_CASE(FilterCompletions2) {
EclipseGrid grid1(10,10,10);
std::vector<int> actnum(1000,1);
auto deck = createDeckWithWellsAndCompletionData();
const auto& deck = Parser{}.parseString(createDeckWithWellsAndCompletionData());
auto python = std::make_shared<Python>();
EclipseGrid grid1(10,10,10);
TableManager table ( deck );
FieldPropsManager fp( deck, Phases{true, true, true}, grid1, table);
Runspec runspec (deck);
Schedule schedule(deck, grid1 , fp, runspec, python);
Schedule schedule(deck, grid1, fp, runspec, python);
std::vector<int> actnum = grid1.getACTNUM();
{
const auto& c1_1 = schedule.getWell("OP_1", 1).getConnections();
const auto& c1_3 = schedule.getWell("OP_1", 3).getConnections();
@@ -3043,7 +2815,7 @@ BOOST_AUTO_TEST_CASE(FilterCompletions2) {
BOOST_AUTO_TEST_CASE(VFPINJ_TEST) {
const char *deckData = "\
const char *input = "\
START\n \
8 MAR 1998 /\n \
\n \
@@ -3094,15 +2866,8 @@ VFPINJ \n \
1 1.5 2.5 3.5 / \n\
2 4.5 5.5 6.5 / \n";
const auto& schedule = make_schedule(input);
Opm::Parser parser;
auto deck = parser.parseString(deckData);
auto python = std::make_shared<Python>();
EclipseGrid grid1(10,10,10);
TableManager table ( deck );
FieldPropsManager fp( deck, Phases{true, true, true}, grid1, table);
Runspec runspec (deck);
Schedule schedule(deck, grid1 , fp, runspec, python);
BOOST_CHECK( schedule.getEvents().hasEvent(ScheduleEvents::VFPINJ_UPDATE, 0));
BOOST_CHECK( !schedule.getEvents().hasEvent(ScheduleEvents::VFPINJ_UPDATE, 1));
@@ -3250,7 +3015,7 @@ BOOST_AUTO_TEST_CASE(POLYINJ_TEST) {
// Test for WFOAM
BOOST_AUTO_TEST_CASE(WFOAM_TEST) {
const char *deckData =
const char *input =
"START\n"
" 8 MAR 2018/\n"
"GRID\n"
@@ -3283,14 +3048,7 @@ BOOST_AUTO_TEST_CASE(WFOAM_TEST) {
"TSTEP\n"
" 1 /\n";
Opm::Parser parser;
auto deck = parser.parseString(deckData);
auto python = std::make_shared<Python>();
EclipseGrid grid1(10,10,10);
TableManager table ( deck );
FieldPropsManager fp( deck, Phases{true, true, true}, grid1, table);
Runspec runspec (deck);
Schedule schedule(deck, grid1 , fp, runspec, python);
const auto& schedule = make_schedule(input);
const auto& f0 = schedule.getWell("INJE01", 0).getFoamProperties();
const auto& f1 = schedule.getWell("INJE01", 1).getFoamProperties();
@@ -3303,13 +3061,7 @@ BOOST_AUTO_TEST_CASE(WFOAM_TEST) {
BOOST_AUTO_TEST_CASE(WTEST_CONFIG) {
auto deck = createDeckWTEST();
auto python = std::make_shared<Python>();
EclipseGrid grid1(10,10,10);
TableManager table ( deck );
FieldPropsManager fp( deck, Phases{true, true, true}, grid1, table);
Runspec runspec (deck);
Schedule schedule(deck, grid1 , fp, runspec, python);
const auto& schedule = make_schedule(createDeckWTEST());
const auto& wtest_config1 = schedule.wtestConfig(0);
BOOST_CHECK_EQUAL(wtest_config1.size(), 2);
@@ -3333,13 +3085,14 @@ bool has(const std::vector<std::string>& l, const std::string& s) {
BOOST_AUTO_TEST_CASE(WELL_STATIC) {
auto deck = createDeckWithWells();
const auto& deck = Parser{}.parseString(createDeckWithWells());
auto python = std::make_shared<Python>();
EclipseGrid grid1(10,10,10);
TableManager table ( deck );
FieldPropsManager fp( deck, Phases{true, true, true}, grid1, table);
Runspec runspec (deck);
Schedule schedule(deck, grid1 , fp, runspec, python);
Schedule schedule(deck, grid1, fp, runspec, python);
BOOST_CHECK_THROW( schedule.getWell("NO_SUCH_WELL", 0), std::invalid_argument);
BOOST_CHECK_THROW( schedule.getWell("W_3", 0), std::invalid_argument);
@@ -3383,14 +3136,7 @@ BOOST_AUTO_TEST_CASE(WELL_STATIC) {
BOOST_AUTO_TEST_CASE(WellNames) {
auto deck = createDeckWTEST();
auto python = std::make_shared<Python>();
EclipseGrid grid1(10,10,10);
TableManager table ( deck );
FieldPropsManager fp( deck, Phases{true, true, true}, grid1, table);
Runspec runspec (deck);
Schedule schedule(deck, grid1 , fp, runspec, python);
const auto& schedule = make_schedule(createDeckWTEST());
auto names = schedule.wellNames("NO_SUCH_WELL", 0);
BOOST_CHECK_EQUAL(names.size(), 0);
@@ -3501,13 +3247,7 @@ BOOST_AUTO_TEST_CASE(RFT_CONFIG) {
BOOST_AUTO_TEST_CASE(RFT_CONFIG2) {
auto deck = createDeckRFTConfig();
auto python = std::make_shared<Python>();
EclipseGrid grid1(10,10,10);
TableManager table ( deck );
FieldPropsManager fp( deck, Phases{true, true, true}, grid1, table);
Runspec runspec (deck);
Schedule schedule(deck, grid1 , fp, runspec, python);
const auto& schedule = make_schedule(createDeckRFTConfig());
const auto& rft_config = schedule.rftConfig();
BOOST_CHECK_EQUAL(2, rft_config.firstRFTOutput());
@@ -3515,7 +3255,6 @@ BOOST_AUTO_TEST_CASE(RFT_CONFIG2) {
BOOST_AUTO_TEST_CASE(nupcol) {
Opm::Parser parser;
std::string input =
"START -- 0 \n"
"19 JUN 2007 / \n"
@@ -3536,14 +3275,7 @@ BOOST_AUTO_TEST_CASE(nupcol) {
;
auto deck = parser.parseString(input);
auto python = std::make_shared<Python>();
EclipseGrid grid(10,10,10);
TableManager table ( deck );
FieldPropsManager fp( deck, Phases{true, true, true}, grid, table);
Runspec runspec (deck);
Schedule schedule( deck, grid, fp, runspec, python);
const auto& schedule = make_schedule(input);
{
// Flow uses 12 as default
BOOST_CHECK_EQUAL(schedule.getNupcol(0),12);
@@ -3553,7 +3285,6 @@ BOOST_AUTO_TEST_CASE(nupcol) {
}
BOOST_AUTO_TEST_CASE(TESTGuideRateConfig) {
Opm::Parser parser;
std::string input = R"(
START -- 0
10 MAI 2007 /
@@ -3641,14 +3372,7 @@ COMPDAT
)";
auto deck = parser.parseString(input);
auto python = std::make_shared<Python>();
EclipseGrid grid(10,10,10);
TableManager table ( deck );
FieldPropsManager fp( deck, Phases{true, true, true}, grid, table);
Runspec runspec (deck);
Schedule schedule( deck, grid, fp, runspec, python);
const auto& schedule = make_schedule(input);
{
const auto& grc = schedule.guideRateConfig(0);
const auto& w1_node = grc.well("W1");
@@ -3711,35 +3435,7 @@ COMPDAT
}
BOOST_AUTO_TEST_CASE(Injection_Control_Mode_From_Well) {
const auto deck = ::Opm::Parser{}.parseString(R"(RUNSPEC
DIMENS
10 10 10
/
START -- 0
20 MAR 2020 /
GRID
DXV
10*100 /
DYV
10*100 /
DZV
10*1 /
TOPS
100*2000 /
PERMX
1000*300 /
PERMY
1000*300 /
PERMZ
1000*3 /
PORO
1000*0.25 /
const auto input = R"(RUNSPEC
SCHEDULE
WELSPECS
@@ -3766,12 +3462,10 @@ TSTEP
30*30 /
END
)");
)";
auto python = std::make_shared<::Opm::Python>();
const auto sched = make_schedule(input);
const auto st = ::Opm::SummaryState{ std::chrono::system_clock::now() };
const auto es = ::Opm::EclipseState{ deck };
const auto sched = ::Opm::Schedule{ deck, es, python };
BOOST_CHECK_EQUAL(eclipseControlMode(sched.getWell("W1", 10), st), -1);
BOOST_CHECK_EQUAL(eclipseControlMode(sched.getWell("W2", 10), st), 3);
@@ -3783,35 +3477,7 @@ END
}
BOOST_AUTO_TEST_CASE(Production_Control_Mode_From_Well) {
const auto deck = ::Opm::Parser{}.parseString(R"(RUNSPEC
DIMENS
10 10 10
/
START -- 0
20 MAR 2020 /
GRID
DXV
10*100 /
DYV
10*100 /
DZV
10*1 /
TOPS
100*2000 /
PERMX
1000*300 /
PERMY
1000*300 /
PERMZ
1000*3 /
PORO
1000*0.25 /
const auto input = R"(RUNSPEC
SCHEDULE
WELSPECS
@@ -3840,12 +3506,10 @@ TSTEP
30*30 /
END
)");
)";
auto python = std::make_shared<::Opm::Python>();
const auto sched = make_schedule(input);
const auto st = ::Opm::SummaryState{ std::chrono::system_clock::now() };
const auto es = ::Opm::EclipseState{ deck };
const auto sched = ::Opm::Schedule{ deck, es, python };
BOOST_CHECK_EQUAL(eclipseControlMode(sched.getWell("W1", 10), st), -1);
BOOST_CHECK_EQUAL(eclipseControlMode(sched.getWell("W2", 10), st), 1);