Add Python arg to Schedule constructor

This commit is contained in:
Joakim Hove
2020-03-26 15:31:21 +01:00
parent 9d3ec9be61
commit 50fb51d56e
45 changed files with 395 additions and 185 deletions

View File

@@ -29,6 +29,7 @@
#include <opm/common/utility/TimeService.hpp>
#include <opm/parser/eclipse/Python/Python.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/FieldPropsManager.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
#include <opm/parser/eclipse/EclipseState/Runspec.hpp>
@@ -363,21 +364,23 @@ BOOST_AUTO_TEST_CASE(CreateScheduleDeckMissingReturnsDefaults) {
Deck deck;
Parser parser;
deck.addKeyword( DeckKeyword( parser.getKeyword("SCHEDULE" )));
Python 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 );
Schedule schedule(deck, grid , fp, runspec, python);
BOOST_CHECK_EQUAL( schedule.getStartTime() , TimeMap::mkdate(1983, 1 , 1));
}
BOOST_AUTO_TEST_CASE(CreateScheduleDeckWellsOrdered) {
auto deck = createDeckWithWellsOrdered();
Python 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);
Schedule schedule(deck, grid , fp, runspec, python);
auto well_names = schedule.wellNames();
BOOST_CHECK_EQUAL( "CW_1" , well_names[0]);
@@ -402,11 +405,12 @@ bool has_well( const std::vector<Well>& wells, const std::string& well_name) {
BOOST_AUTO_TEST_CASE(CreateScheduleDeckWellsOrderedGRUPTREE) {
auto deck = createDeckWithWellsOrderedGRUPTREE();
Python 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);
Schedule schedule(deck, grid , fp, runspec, python);
BOOST_CHECK_THROW( schedule.getChildWells2( "NO_SUCH_GROUP" , 1 ), std::invalid_argument);
{
@@ -453,11 +457,12 @@ BOOST_AUTO_TEST_CASE(CreateScheduleDeckWellsOrderedGRUPTREE) {
BOOST_AUTO_TEST_CASE(GroupTree2TEST) {
auto deck = createDeckWithWellsOrderedGRUPTREE();
Python 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);
Schedule schedule(deck, grid , fp, runspec, python);
BOOST_CHECK_THROW( schedule.groupTree("NO_SUCH_GROUP", 0), std::invalid_argument);
auto cg1 = schedule.getGroup("CG1", 0);
@@ -483,34 +488,37 @@ BOOST_AUTO_TEST_CASE(GroupTree2TEST) {
BOOST_AUTO_TEST_CASE(CreateScheduleDeckWithStart) {
auto deck = createDeck();
Python 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);
Schedule schedule(deck, grid , fp, runspec, python);
BOOST_CHECK_EQUAL( schedule.getStartTime() , TimeMap::mkdate(1998, 3 , 8 ));
}
BOOST_AUTO_TEST_CASE(CreateScheduleDeckWithSCHEDULENoThrow) {
Parser parser;
Deck deck;
Python 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));
BOOST_CHECK_NO_THROW( Schedule( deck, grid , fp, runspec, python));
}
BOOST_AUTO_TEST_CASE(EmptyScheduleHasNoWells) {
Python 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);
Schedule schedule(deck, grid , fp, runspec, python);
BOOST_CHECK_EQUAL( 0U , schedule.numWells() );
BOOST_CHECK_EQUAL( false , schedule.hasWell("WELL1") );
BOOST_CHECK_THROW( schedule.getWell("WELL2", 0) , std::invalid_argument );
@@ -519,12 +527,13 @@ BOOST_AUTO_TEST_CASE(EmptyScheduleHasNoWells) {
BOOST_AUTO_TEST_CASE(EmptyScheduleHasFIELDGroup) {
Python 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);
Schedule schedule(deck , grid , fp, runspec, python);
BOOST_CHECK_EQUAL( 1U , schedule.numGroups() );
BOOST_CHECK_EQUAL( true , schedule.hasGroup("FIELD") );
@@ -590,9 +599,10 @@ END
)"
};
::Opm::Python python;
const auto deck = ::Opm::Parser{}.parseString(input);
const auto es = ::Opm::EclipseState{deck};
const auto sched = ::Opm::Schedule{ deck, es };
const auto sched = ::Opm::Schedule{ deck, es, python };
BOOST_CHECK_MESSAGE(sched.hasGroup("P"), R"(Group "P" Must Exist)");
BOOST_CHECK_MESSAGE(sched.hasGroup("I"), R"(Group "I" Must Exist)");
@@ -614,12 +624,13 @@ END
}
BOOST_AUTO_TEST_CASE(WellsIterator_Empty_EmptyVectorReturned) {
Python 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);
Schedule schedule(deck , grid , fp, runspec, python);
const auto wells_alltimesteps = schedule.getWellsatEnd();
BOOST_CHECK_EQUAL(0U, wells_alltimesteps.size());
@@ -632,12 +643,13 @@ BOOST_AUTO_TEST_CASE(WellsIterator_Empty_EmptyVectorReturned) {
}
BOOST_AUTO_TEST_CASE(WellsIterator_HasWells_WellsReturned) {
Python 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);
Schedule schedule(deck , grid , fp, runspec, python);
size_t timeStep = 0;
const auto wells_alltimesteps = schedule.getWellsatEnd();
@@ -651,12 +663,13 @@ BOOST_AUTO_TEST_CASE(WellsIterator_HasWells_WellsReturned) {
BOOST_AUTO_TEST_CASE(ReturnNumWellsTimestep) {
Python 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);
Schedule schedule(deck, grid , fp, runspec, python);
BOOST_CHECK_EQUAL(schedule.numWells(0), 1);
BOOST_CHECK_EQUAL(schedule.numWells(1), 1);
@@ -665,12 +678,13 @@ BOOST_AUTO_TEST_CASE(ReturnNumWellsTimestep) {
}
BOOST_AUTO_TEST_CASE(TestCrossFlowHandling) {
Python 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);
Schedule schedule(deck, grid , fp, runspec, python);
BOOST_CHECK_EQUAL(schedule.getWell("BAN", 0).getAllowCrossFlow(), false);
BOOST_CHECK_EQUAL(schedule.getWell("ALLOW", 0).getAllowCrossFlow(), true);
@@ -738,12 +752,13 @@ static Deck createDeckWithWellsAndConnectionDataWithWELOPEN() {
}
BOOST_AUTO_TEST_CASE(CreateScheduleDeckWellsAndConnectionDataWithWELOPEN) {
Python python;
EclipseGrid grid(10,10,10);
auto deck = createDeckWithWellsAndConnectionDataWithWELOPEN();
auto deck = createDeckWithWellsAndConnectionDataWithWELOPEN();
TableManager table ( deck );
FieldPropsManager fp( deck, Phases{true, true, true}, grid, table);
Runspec runspec (deck);
Schedule schedule(deck ,grid , fp, runspec);
Schedule schedule(deck ,grid , fp, runspec, python);
{
constexpr auto well_shut = Well::Status::SHUT;
constexpr auto well_open = Well::Status::OPEN;
@@ -822,12 +837,13 @@ BOOST_AUTO_TEST_CASE(CreateScheduleDeckWithWELOPEN_TryToOpenWellWithShutCompleti
" 'OP_1' OPEN / \n "
"/\n";
Python 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);
Schedule schedule(deck , grid , fp, runspec, python);
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());
@@ -882,12 +898,13 @@ BOOST_AUTO_TEST_CASE(CreateScheduleDeckWithWELOPEN_CombineShutCompletionsAndAddN
" 12 NOV 2008 / \n"
"/\n";
Python 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);
Schedule schedule(deck, grid , fp, runspec, python);
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);
@@ -940,12 +957,13 @@ BOOST_AUTO_TEST_CASE(CreateScheduleDeckWithWRFT) {
"/\n";
Python 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);
Schedule schedule(deck, grid , fp, runspec, python);
const auto& rft_config = schedule.rftConfig();
BOOST_CHECK_EQUAL(2 , rft_config.firstRFTOutput());
@@ -998,12 +1016,13 @@ BOOST_AUTO_TEST_CASE(CreateScheduleDeckWithWRFTPLT) {
"DATES -- 5\n"
" 10 NOV 2008 / \n"
"/\n";
Python 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);
Schedule schedule(deck, grid , fp, runspec, python);
const auto& well = schedule.getWell("OP_1", 4);
BOOST_CHECK(Well::Status::OPEN == well.getStatus());
@@ -1049,11 +1068,12 @@ BOOST_AUTO_TEST_CASE(createDeckWithWeltArg) {
"/\n";
auto deck = parser.parseString(input);
Python 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);
Schedule schedule(deck, grid , fp, runspec, python);
Opm::UnitSystem unitSystem = deck.getActiveUnitSystem();
double siFactorL = unitSystem.parse("LiquidSurfaceVolume/Time").getSIScaling();
double siFactorG = unitSystem.parse("GasSurfaceVolume/Time").getSIScaling();
@@ -1097,12 +1117,13 @@ BOOST_AUTO_TEST_CASE(createDeckWithWeltArgException) {
"/\n";
auto deck = parser.parseString(input);
Python 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),
BOOST_CHECK_THROW(Schedule(deck, grid , fp, runspec, python),
std::invalid_argument);
}
@@ -1116,11 +1137,12 @@ BOOST_AUTO_TEST_CASE(createDeckWithWeltArgException2) {
"/\n";
auto deck = parser.parseString(input);
Python 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), std::invalid_argument);
BOOST_CHECK_THROW(Schedule(deck, grid , fp, runspec, python), std::invalid_argument);
}
BOOST_AUTO_TEST_CASE(createDeckWithWPIMULT) {
@@ -1162,11 +1184,12 @@ BOOST_AUTO_TEST_CASE(createDeckWithWPIMULT) {
"/\n";
auto deck = parser.parseString(input);
Python 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);
Schedule schedule(deck, grid , fp, runspec, python);
const auto& cs2 = schedule.getWell("OP_1", 2).getConnections();
const auto& cs3 = schedule.getWell("OP_1", 3).getConnections();
@@ -1233,6 +1256,7 @@ BOOST_AUTO_TEST_CASE(WELSPECS_WGNAME_SPACE) {
)";
auto deck = parser.parseString(input);
Python python;
EclipseGrid grid( deck );
TableManager table ( deck );
FieldPropsManager fp( deck, Phases{true, true, true}, grid, table);
@@ -1241,10 +1265,10 @@ BOOST_AUTO_TEST_CASE(WELSPECS_WGNAME_SPACE) {
ErrorGuard errors;
parseContext.update(ParseContext::PARSE_WGNAME_SPACE, InputError::THROW_EXCEPTION);
BOOST_CHECK_THROW( Opm::Schedule(deck, grid, fp, runspec, parseContext, errors), std::invalid_argument);
BOOST_CHECK_THROW( Opm::Schedule(deck, grid, fp, runspec, parseContext, errors, python), std::invalid_argument);
parseContext.update(ParseContext::PARSE_WGNAME_SPACE, InputError::IGNORE);
BOOST_CHECK_NO_THROW( Opm::Schedule(deck, grid, fp, runspec, parseContext, errors));
BOOST_CHECK_NO_THROW( Opm::Schedule(deck, grid, fp, runspec, parseContext, errors, python));
}
BOOST_AUTO_TEST_CASE(createDeckModifyMultipleGCONPROD) {
@@ -1285,11 +1309,12 @@ BOOST_AUTO_TEST_CASE(createDeckModifyMultipleGCONPROD) {
)";
auto deck = parser.parseString(input);
Python 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);
Opm::Schedule schedule(deck, grid, fp, runspec, python);
Opm::SummaryState st(std::chrono::system_clock::now());
Opm::UnitSystem unitSystem = deck.getActiveUnitSystem();
@@ -1334,11 +1359,12 @@ BOOST_AUTO_TEST_CASE(createDeckWithDRSDT) {
"/\n";
auto deck = parser.parseString(input);
Python 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);
Schedule schedule(deck, grid , fp, runspec, python);
size_t currentStep = 1;
BOOST_CHECK_EQUAL(schedule.hasOilVaporizationProperties(), true);
const auto& ovap = schedule.getOilVaporizationProperties(currentStep);
@@ -1368,11 +1394,12 @@ BOOST_AUTO_TEST_CASE(createDeckWithDRSDTR) {
"2 /\n";
auto deck = parser.parseString(input);
Python 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);
Schedule schedule(deck, grid , fp, runspec, python);
size_t currentStep = 1;
BOOST_CHECK_EQUAL(schedule.hasOilVaporizationProperties(), true);
const auto& ovap = schedule.getOilVaporizationProperties(currentStep);
@@ -1415,11 +1442,12 @@ BOOST_AUTO_TEST_CASE(createDeckWithDRSDTthenDRVDT) {
"/\n";
auto deck = parser.parseString(input);
Python 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);
Schedule schedule(deck, grid , fp, runspec, python);
BOOST_CHECK_EQUAL(schedule.hasOilVaporizationProperties(), true);
const OilVaporizationProperties& ovap1 = schedule.getOilVaporizationProperties(1);
@@ -1456,11 +1484,12 @@ BOOST_AUTO_TEST_CASE(createDeckWithVAPPARS) {
"/\n";
auto deck = parser.parseString(input);
Python 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);
Schedule schedule(deck, grid , fp, runspec, python);
size_t currentStep = 1;
BOOST_CHECK_EQUAL(schedule.hasOilVaporizationProperties(), true);
const OilVaporizationProperties& ovap = schedule.getOilVaporizationProperties(currentStep);
@@ -1487,11 +1516,12 @@ BOOST_AUTO_TEST_CASE(createDeckWithOutOilVaporizationProperties) {
auto deck = parser.parseString(input);
Python 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);
Schedule schedule(deck, grid , fp, runspec, python);
BOOST_CHECK_EQUAL(schedule.hasOilVaporizationProperties(), false);
@@ -1548,13 +1578,14 @@ BOOST_AUTO_TEST_CASE(changeBhpLimitInHistoryModeWithWeltarg) {
;
auto deck = parser.parseString(input);
Python 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);
Schedule sched(deck, grid , fp, runspec, python);
// The BHP limit should not be effected by WCONHIST
{
@@ -1645,11 +1676,12 @@ BOOST_AUTO_TEST_CASE(changeModeWithWHISTCTL) {
;
auto deck = parser.parseString(input);
Python 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);
Schedule schedule(deck, grid , fp, runspec, python);
//Start
BOOST_CHECK_THROW(schedule.getWell("P1", 0), std::invalid_argument);
@@ -1751,11 +1783,12 @@ BOOST_AUTO_TEST_CASE(fromWCONHISTtoWCONPROD) {
;
auto deck = parser.parseString(input);
Python 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);
Schedule schedule(deck, grid , fp, runspec, python);
//Start
BOOST_CHECK_THROW(schedule.getWell("P1", 0), std::invalid_argument);
@@ -1839,11 +1872,12 @@ BOOST_AUTO_TEST_CASE(WHISTCTL_NEW_WELL) {
;
auto deck = parser.parseString(input);
Python 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);
Schedule schedule(deck, grid , fp, runspec, python);
//10 OKT 2008
BOOST_CHECK(schedule.getWell("P1", 1).getProductionProperties().controlMode == Opm::Well::ProducerCMode::GRAT);
@@ -1915,11 +1949,12 @@ BOOST_AUTO_TEST_CASE(unsupportedOptionWHISTCTL) {
;
auto deck = parser.parseString(input);
Python 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), std::invalid_argument);
BOOST_CHECK_THROW(Schedule(deck, grid, fp, runspec, python), std::invalid_argument);
}
BOOST_AUTO_TEST_CASE(move_HEAD_I_location) {
@@ -1944,11 +1979,12 @@ BOOST_AUTO_TEST_CASE(move_HEAD_I_location) {
)";
auto deck = Parser().parseString(input);
Python 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);
Schedule schedule( deck, grid, fp, runspec, python);
BOOST_CHECK_EQUAL(2, schedule.getWell("W1", 1).getHeadI());
BOOST_CHECK_EQUAL(3, schedule.getWell("W1", 2).getHeadI());
}
@@ -1975,11 +2011,12 @@ BOOST_AUTO_TEST_CASE(change_ref_depth) {
)";
auto deck = Parser().parseString(input);
Python 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);
Schedule schedule( deck, grid, fp, runspec, python);
BOOST_CHECK_CLOSE(2873.94, schedule.getWell("W1", 1).getRefDepth(), 1e-5);
BOOST_CHECK_EQUAL(12.0, schedule.getWell("W1", 2).getRefDepth());
}
@@ -2014,11 +2051,12 @@ BOOST_AUTO_TEST_CASE(WTEMP_well_template) {
)";
auto deck = Parser().parseString(input);
Python 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);
Schedule schedule( deck, grid, fp, runspec, python);
BOOST_CHECK_CLOSE(288.71, schedule.getWell("W1", 1).getInjectionProperties().temperature, 1e-5);
BOOST_CHECK_CLOSE(288.71, schedule.getWell("W1", 2).getInjectionProperties().temperature, 1e-5);
@@ -2060,11 +2098,12 @@ BOOST_AUTO_TEST_CASE(WTEMPINJ_well_template) {
)";
auto deck = Parser().parseString(input);
Python 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);
Schedule schedule( deck, grid, fp, runspec, python);
// Producerwell - currently setting temperature only acts on injectors.
BOOST_CHECK_CLOSE(288.71, schedule.getWell("W1", 1).getInjectionProperties().temperature, 1e-5);
@@ -2112,11 +2151,12 @@ BOOST_AUTO_TEST_CASE( COMPDAT_sets_automatic_complnum ) {
)";
auto deck = Parser().parseString(input);
Python 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);
Schedule schedule( deck, grid, fp, runspec, python);
const auto& cs1 = schedule.getWell( "W1", 1 ).getConnections( );
BOOST_CHECK_EQUAL( 1, cs1.get( 0 ).complnum() );
BOOST_CHECK_EQUAL( 2, cs1.get( 1 ).complnum() );
@@ -2162,11 +2202,12 @@ BOOST_AUTO_TEST_CASE( COMPDAT_multiple_wells ) {
)";
auto deck = Parser().parseString( input);
Python 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);
Schedule schedule( deck, grid, fp, runspec, python);
{
const auto& w1cs = schedule.getWell( "W1", 1 ).getConnections();
@@ -2231,11 +2272,12 @@ BOOST_AUTO_TEST_CASE( COMPDAT_multiple_records_same_completion ) {
)";
auto deck = Parser().parseString(input);
Python 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);
Schedule schedule( deck, grid, fp, runspec, python);
const auto& cs = schedule.getWell( "W1", 1 ).getConnections();
BOOST_CHECK_EQUAL( 3U, cs.size() );
BOOST_CHECK_EQUAL( 1, cs.get( 0 ).complnum() );
@@ -2271,11 +2313,12 @@ BOOST_AUTO_TEST_CASE( complump_less_than_1 ) {
)";
auto deck = Parser().parseString( input);
Python 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), std::invalid_argument );
BOOST_CHECK_THROW( Schedule( deck , grid, fp, runspec, python), std::invalid_argument );
}
BOOST_AUTO_TEST_CASE( complump ) {
@@ -2323,11 +2366,12 @@ BOOST_AUTO_TEST_CASE( complump ) {
constexpr auto shut = Connection::State::SHUT;
auto deck = Parser().parseString(input);
Python 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);
Schedule schedule( deck, grid, fp, runspec, python);
const auto& sc0 = schedule.getWell("W1", 0).getConnections();
/* complnum should be modified by COMPLNUM */
@@ -2413,11 +2457,12 @@ BOOST_AUTO_TEST_CASE( COMPLUMP_specific_coordinates ) {
constexpr auto shut = Connection::State::SHUT;
auto deck = Parser().parseString( input);
Python 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);
Schedule schedule( deck, grid, fp, runspec, python);
const auto& cs1 = schedule.getWell("W1", 1).getConnections();
const auto& cs2 = schedule.getWell("W1", 2).getConnections();
@@ -2883,11 +2928,12 @@ BOOST_AUTO_TEST_CASE(handleWEFAC) {
;
auto deck = parser.parseString(input);
Python 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);
Schedule schedule(deck, grid , fp, runspec, python);
//1
BOOST_CHECK_EQUAL(schedule.getWell("P", 1).getEfficiencyFactor(), 0.5);
@@ -2928,11 +2974,12 @@ BOOST_AUTO_TEST_CASE(historic_BHP_and_THP) {
;
auto deck = parser.parseString(input);
Python 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);
Schedule schedule( deck, grid, fp, runspec, python);
{
const auto& prod = schedule.getWell("P", 1).getProductionProperties();
@@ -2962,10 +3009,11 @@ BOOST_AUTO_TEST_CASE(FilterCompletions2) {
EclipseGrid grid1(10,10,10);
std::vector<int> actnum(1000,1);
auto deck = createDeckWithWellsAndCompletionData();
Python python;
TableManager table ( deck );
FieldPropsManager fp( deck, Phases{true, true, true}, grid1, table);
Runspec runspec (deck);
Schedule schedule(deck, grid1 , fp, runspec);
Schedule schedule(deck, grid1 , fp, runspec, python);
{
const auto& c1_1 = schedule.getWell("OP_1", 1).getConnections();
const auto& c1_3 = schedule.getWell("OP_1", 3).getConnections();
@@ -3051,11 +3099,12 @@ VFPINJ \n \
Opm::Parser parser;
auto deck = parser.parseString(deckData);
Python 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);
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));
@@ -3177,11 +3226,12 @@ BOOST_AUTO_TEST_CASE(POLYINJ_TEST) {
Opm::Parser parser;
auto deck = parser.parseString(deckData);
Python 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);
Schedule schedule(deck, grid1 , fp, runspec, python);
const auto& poly0 = schedule.getWell("INJE01", 0).getPolymerProperties();
const auto& poly1 = schedule.getWell("INJE01", 1).getPolymerProperties();
@@ -3237,11 +3287,12 @@ BOOST_AUTO_TEST_CASE(WFOAM_TEST) {
Opm::Parser parser;
auto deck = parser.parseString(deckData);
Python 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);
Schedule schedule(deck, grid1 , fp, runspec, python);
const auto& f0 = schedule.getWell("INJE01", 0).getFoamProperties();
const auto& f1 = schedule.getWell("INJE01", 1).getFoamProperties();
@@ -3255,11 +3306,12 @@ BOOST_AUTO_TEST_CASE(WFOAM_TEST) {
BOOST_AUTO_TEST_CASE(WTEST_CONFIG) {
auto deck = createDeckWTEST();
Python 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);
Schedule schedule(deck, grid1 , fp, runspec, python);
const auto& wtest_config1 = schedule.wtestConfig(0);
BOOST_CHECK_EQUAL(wtest_config1.size(), 2);
@@ -3284,11 +3336,12 @@ bool has(const std::vector<std::string>& l, const std::string& s) {
BOOST_AUTO_TEST_CASE(WELL_STATIC) {
auto deck = createDeckWithWells();
Python 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);
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);
@@ -3333,11 +3386,12 @@ BOOST_AUTO_TEST_CASE(WELL_STATIC) {
BOOST_AUTO_TEST_CASE(WellNames) {
auto deck = createDeckWTEST();
Python 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);
Schedule schedule(deck, grid1 , fp, runspec, python);
auto names = schedule.wellNames("NO_SUCH_WELL", 0);
BOOST_CHECK_EQUAL(names.size(), 0);
@@ -3450,11 +3504,12 @@ BOOST_AUTO_TEST_CASE(RFT_CONFIG) {
BOOST_AUTO_TEST_CASE(RFT_CONFIG2) {
auto deck = createDeckRFTConfig();
Python 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);
Schedule schedule(deck, grid1 , fp, runspec, python);
const auto& rft_config = schedule.rftConfig();
BOOST_CHECK_EQUAL(2, rft_config.firstRFTOutput());
@@ -3484,11 +3539,12 @@ BOOST_AUTO_TEST_CASE(nupcol) {
;
auto deck = parser.parseString(input);
Python 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);
Schedule schedule( deck, grid, fp, runspec, python);
{
// Flow uses 12 as default
@@ -3576,11 +3632,12 @@ DATES -- 4
)";
auto deck = parser.parseString(input);
Python 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);
Schedule schedule( deck, grid, fp, runspec, python);
{
const auto& grc = schedule.guideRateConfig(0);
@@ -3674,9 +3731,10 @@ TSTEP
END
)");
::Opm::Python python;
const auto st = ::Opm::SummaryState{ std::chrono::system_clock::now() };
const auto es = ::Opm::EclipseState{ deck };
const auto sched = ::Opm::Schedule{ deck, es };
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);
@@ -3747,9 +3805,10 @@ TSTEP
END
)");
::Opm::Python python;
const auto st = ::Opm::SummaryState{ std::chrono::system_clock::now() };
const auto es = ::Opm::EclipseState{ deck };
const auto sched = ::Opm::Schedule{ deck, es };
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);