Merge pull request #1636 from joakim-hove/add-python-arg

Add python arg
This commit is contained in:
Joakim Hove
2020-03-27 13:43:44 +01:00
committed by GitHub
45 changed files with 395 additions and 185 deletions

View File

@@ -23,6 +23,7 @@
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
#include <opm/parser/eclipse/Parser/ErrorGuard.hpp>
#include <opm/parser/eclipse/Python/Python.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
@@ -35,10 +36,11 @@ int main(int /* argc */, char** argv) {
Opm::Parser parser;
Opm::ParseContext parse_context;
Opm::ErrorGuard error_guard;
Opm::Python python;
Opm::Deck deck = parser.parseFile(deck_file, parse_context, error_guard);
Opm::EclipseState state(deck);
Opm::Schedule schedule(deck, state, parse_context, error_guard);
Opm::Schedule schedule(deck, state, parse_context, error_guard, python);
Opm::SummaryConfig summary_config(deck, schedule, state.getTableManager(), parse_context, error_guard);
if (error_guard) {

View File

@@ -29,6 +29,7 @@
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/parser/eclipse/Python/Python.hpp>
#include <opm/common/OpmLog/OpmLog.hpp>
#include <opm/common/OpmLog/StreamLog.hpp>
@@ -44,6 +45,7 @@ inline void loadDeck( const char * deck_file) {
Opm::ParseContext parseContext;
Opm::ErrorGuard errors;
Opm::Parser parser;
Opm::Python python;
std::cout << "Loading deck: " << deck_file << " ..... "; std::cout.flush();
@@ -62,7 +64,7 @@ inline void loadDeck( const char * deck_file) {
std::cout << "creating Schedule .... "; std::cout.flush();
start = std::chrono::system_clock::now();
Opm::Schedule schedule( deck, state);
Opm::Schedule schedule( deck, state, python);
auto schedule_time = std::chrono::system_clock::now() - start;
std::cout << "creating SummaryConfig .... "; std::cout.flush();

View File

@@ -98,6 +98,7 @@ namespace Opm
class EclipseGrid;
class EclipseState;
class FieldPropsManager;
class Python;
class Runspec;
class SCHEDULESection;
class SummaryState;
@@ -122,6 +123,7 @@ namespace Opm
const Runspec &runspec,
const ParseContext& parseContext,
ErrorGuard& errors,
const Python& python,
const RestartIO::RstState* rst = nullptr);
template<typename T>
@@ -131,18 +133,21 @@ namespace Opm
const Runspec &runspec,
const ParseContext& parseContext,
T&& errors,
const Python& python,
const RestartIO::RstState* rst = nullptr);
Schedule(const Deck& deck,
const EclipseGrid& grid,
const FieldPropsManager& fp,
const Runspec &runspec,
const Python& python,
const RestartIO::RstState* rst = nullptr);
Schedule(const Deck& deck,
const EclipseState& es,
const ParseContext& parseContext,
ErrorGuard& errors,
const Python& python,
const RestartIO::RstState* rst = nullptr);
template <typename T>
@@ -150,8 +155,15 @@ namespace Opm
const EclipseState& es,
const ParseContext& parseContext,
T&& errors,
const Python& python,
const RestartIO::RstState* rst = nullptr);
Schedule(const Deck& deck,
const EclipseState& es,
const Python& python,
const RestartIO::RstState* rst = nullptr);
// The constructor *without* the Python arg should really only be used from Python itself
Schedule(const Deck& deck,
const EclipseState& es,
const RestartIO::RstState* rst = nullptr);

View File

@@ -124,6 +124,7 @@ std::pair<std::time_t, std::size_t> restart_info(const RestartIO::RstState * rst
const Runspec &runspec,
const ParseContext& parseContext,
ErrorGuard& errors,
const Python& python,
const RestartIO::RstState * rst) :
m_timeMap( deck , restart_info( rst )),
m_oilvaporizationproperties( this->m_timeMap, OilVaporizationProperties(runspec.tabdims().getNumPVTTables()) ),
@@ -175,8 +176,9 @@ std::pair<std::time_t, std::size_t> restart_info(const RestartIO::RstState * rst
const Runspec &runspec,
const ParseContext& parseContext,
T&& errors,
const Python& python,
const RestartIO::RstState * rst) :
Schedule(deck, grid, fp, runspec, parseContext, errors, rst)
Schedule(deck, grid, fp, runspec, parseContext, errors, python, rst)
{}
@@ -184,40 +186,47 @@ std::pair<std::time_t, std::size_t> restart_info(const RestartIO::RstState * rst
const EclipseGrid& grid,
const FieldPropsManager& fp,
const Runspec &runspec,
const Python& python,
const RestartIO::RstState * rst) :
Schedule(deck, grid, fp, runspec, ParseContext(), ErrorGuard(), rst)
Schedule(deck, grid, fp, runspec, ParseContext(), ErrorGuard(), python, rst)
{}
Schedule::Schedule(const Deck& deck, const EclipseState& es, const ParseContext& parse_context, ErrorGuard& errors, const RestartIO::RstState * rst) :
Schedule::Schedule(const Deck& deck, const EclipseState& es, const ParseContext& parse_context, ErrorGuard& errors, const Python& python, const RestartIO::RstState * rst) :
Schedule(deck,
es.getInputGrid(),
es.fieldProps(),
es.runspec(),
parse_context,
errors,
python,
rst)
{}
template <typename T>
Schedule::Schedule(const Deck& deck, const EclipseState& es, const ParseContext& parse_context, T&& errors, const RestartIO::RstState * rst) :
Schedule::Schedule(const Deck& deck, const EclipseState& es, const ParseContext& parse_context, T&& errors, const Python& python, const RestartIO::RstState * rst) :
Schedule(deck,
es.getInputGrid(),
es.fieldProps(),
es.runspec(),
parse_context,
errors,
python,
rst)
{}
Schedule::Schedule(const Deck& deck, const EclipseState& es, const RestartIO::RstState * rst) :
Schedule(deck, es, ParseContext(), ErrorGuard(), rst)
Schedule::Schedule(const Deck& deck, const EclipseState& es, const Python& python, const RestartIO::RstState * rst) :
Schedule(deck, es, ParseContext(), ErrorGuard(), python, rst)
{}
Schedule::Schedule(const Deck& deck, const EclipseState& es, const RestartIO::RstState * rst) :
Schedule(deck, es, ParseContext(), ErrorGuard(), Python(), rst)
{}
Schedule Schedule::serializeObject()
{
Schedule result;

View File

@@ -27,6 +27,7 @@
#include <opm/common/utility/FileSystem.hpp>
#include <opm/parser/eclipse/Python/Python.hpp>
#include <opm/io/eclipse/ERst.hpp>
#include <opm/io/eclipse/ESmry.hpp>
@@ -69,9 +70,10 @@ bool is_file(const Opm::filesystem::path& name)
BOOST_AUTO_TEST_CASE(RUN) {
Parser parser;
Python python;
Deck deck = parser.parseFile("SPE1CASE1.DATA");
EclipseState state(deck);
Schedule schedule(deck, state);
Schedule schedule(deck, state, python);
SummaryConfig summary_config(deck, schedule, state.getTableManager());
msim msim(state);

View File

@@ -26,6 +26,7 @@
#include <stdexcept>
#include <iostream>
#include <opm/parser/eclipse/Python/Python.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/SummaryState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
@@ -53,11 +54,12 @@ struct test_data {
EclipseState state;
Schedule schedule;
SummaryConfig summary_config;
Python python;
test_data(const std::string& deck_string) :
deck( Parser().parseString(deck_string)),
state( this->deck ),
schedule( this->deck, this->state),
schedule( this->deck, this->state, python),
summary_config( this->deck, this->schedule, this->state.getTableManager())
{
auto& ioconfig = this->state.getIOConfig();

View File

@@ -27,6 +27,7 @@
#include <boost/date_time/posix_time/posix_time.hpp>
#include <opm/common/utility/TimeService.hpp>
#include <opm/parser/eclipse/Python/Python.hpp>
#include <opm/common/OpmLog/Location.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/FieldPropsManager.hpp>
@@ -43,6 +44,7 @@
#include <opm/parser/eclipse/Parser/Parser.hpp>
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
#include <opm/parser/eclipse/Parser/ErrorGuard.hpp>
#include <opm/parser/eclipse/Python/Python.hpp>
using namespace Opm;
@@ -122,6 +124,7 @@ ENDACTIO
TSTEP
10 /
)"};
Opm::Python python;
Opm::Parser parser;
auto deck1 = parser.parseString(MISSING_END);
auto deck2 = parser.parseString(WITH_WELSPECS);
@@ -132,16 +135,16 @@ TSTEP
Runspec runspec (deck1);
// The ACTIONX keyword has no matching 'ENDACTIO' -> exception
BOOST_CHECK_THROW(Schedule(deck1, grid1, fp, runspec ), std::invalid_argument);
BOOST_CHECK_THROW(Schedule(deck1, grid1, fp, runspec, python), std::invalid_argument);
Schedule sched(deck2, grid1, fp, runspec);
Schedule sched(deck2, grid1, fp, runspec, python);
BOOST_CHECK( !sched.hasWell("W1") );
BOOST_CHECK( sched.hasWell("W2"));
// The deck3 contains the 'GRID' keyword in the ACTIONX block - that is not a whitelisted keyword.
ParseContext parseContext( {{ParseContext::ACTIONX_ILLEGAL_KEYWORD, InputError::THROW_EXCEPTION}} );
ErrorGuard errors;
BOOST_CHECK_THROW(Schedule(deck3, grid1, fp, runspec, parseContext, errors), std::invalid_argument);
BOOST_CHECK_THROW(Schedule(deck3, grid1, fp, runspec, parseContext, errors, python), std::invalid_argument);
}
@@ -230,12 +233,13 @@ TSTEP
std::string deck_string = start + action_string + end;
Opm::Parser parser;
auto deck = parser.parseString(deck_string);
Python python;
EclipseGrid grid1(10,10,10);
TableManager table ( deck );
FieldPropsManager fp( deck, Phases{true, true, true}, grid1, table);
Runspec runspec(deck);
return Schedule(deck, grid1, fp, runspec);
return Schedule(deck, grid1, fp, runspec, python);
}
@@ -703,9 +707,10 @@ TSTEP
EclipseGrid grid1(10,10,10);
TableManager table ( deck );
FieldPropsManager fp( deck, Phases{true, true, true}, grid1, table);
Python python;
Runspec runspec (deck);
Schedule sched(deck, grid1, fp, runspec);
Schedule sched(deck, grid1, fp, runspec, python);
const auto& actions0 = sched.actions(0);
BOOST_CHECK_EQUAL(actions0.size(), 0);

View File

@@ -26,7 +26,7 @@
#include <boost/date_time/posix_time/posix_time.hpp>
#include <opm/parser/eclipse/Python/Python.hpp>
#include <opm/parser/eclipse/Parser/Parser.hpp>
#include <opm/parser/eclipse/Deck/DeckItem.hpp>
#include <opm/parser/eclipse/Deck/DeckRecord.hpp>
@@ -205,8 +205,9 @@ BOOST_AUTO_TEST_CASE(loadCOMPDATTESTSPE1) {
Opm::Parser parser;
const auto deck = parser.parseFile("SPE1CASE1.DATA");
Opm::Python python;
Opm::EclipseState state(deck);
Opm::Schedule sched(deck, state);
Opm::Schedule sched(deck, state, python);
const auto& units = deck.getActiveUnitSystem();
const auto& prod = sched.getWell("PROD", 0);
@@ -230,8 +231,9 @@ BOOST_AUTO_TEST_CASE(loadCOMPDATTESTSPE9) {
Opm::Parser parser;
const auto deck = parser.parseFile("SPE9_CP_PACKED.DATA");
Opm::Python python;
Opm::EclipseState state(deck);
Opm::Schedule sched(deck, state);
Opm::Schedule sched(deck, state, python);
const auto& units = deck.getActiveUnitSystem();
/*
The list of the expected values come from the PRT file in an ECLIPSE simulation.

View File

@@ -26,6 +26,7 @@ along with OPM. If not, see <http://www.gnu.org/licenses/>.
#include <boost/test/unit_test.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <opm/parser/eclipse/Python/Python.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/parser/eclipse/EclipseState/SimulationConfig/ThresholdPressure.hpp>
@@ -199,8 +200,9 @@ const char *deckData =
BOOST_AUTO_TEST_CASE(CreateSchedule) {
auto deck = createDeck();
Python python;
EclipseState state(deck);
Schedule schedule(deck, state);
Schedule schedule(deck, state, python);
BOOST_CHECK_EQUAL(schedule.getStartTime(), TimeMap::mkdate( 1998 , 3 , 8));
}

View File

@@ -110,11 +110,11 @@ BOOST_AUTO_TEST_CASE(PYINPUT_BASIC) {
BOOST_AUTO_TEST_CASE(PYACTION) {
Parser parser;
Python python;
auto deck = parser.parseFile("EMBEDDED_PYTHON.DATA");
auto ecl_state = EclipseState(deck);
auto schedule = Schedule(deck, ecl_state);
auto schedule = Schedule(deck, ecl_state, python);
Python python;
SummaryState st(std::chrono::system_clock::now());
const auto& pyaction_kw = deck.getKeyword<ParserKeywords::PYACTION>(0);
const std::string& fname = pyaction_kw.getRecord(1).getItem(0).get<std::string>(0);

View File

@@ -29,6 +29,7 @@
#include <opm/parser/eclipse/Parser/InputErrorAction.hpp>
#include <opm/parser/eclipse/Parser/ErrorGuard.hpp>
#include <opm/parser/eclipse/Python/Python.hpp>
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/Deck/DeckItem.hpp>
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
@@ -72,6 +73,7 @@ BOOST_AUTO_TEST_CASE( CheckUnsoppertedInSCHEDULE ) {
" 10 10/\n"
"\n";
Python python;
Parser parser(true);
ParseContext parseContext;
ErrorGuard errors;
@@ -83,7 +85,7 @@ BOOST_AUTO_TEST_CASE( CheckUnsoppertedInSCHEDULE ) {
parseContext.update( ParseContext::UNSUPPORTED_SCHEDULE_GEO_MODIFIER , InputError::IGNORE );
{
Runspec runspec ( deck );
Schedule schedule( deck, grid , fp, runspec , parseContext, errors);
Schedule schedule( deck, grid , fp, runspec , parseContext, errors, python);
auto events = schedule.getEvents( );
BOOST_CHECK_EQUAL( false , events.hasEvent( ScheduleEvents::GEO_MODIFIER , 1 ));
BOOST_CHECK_EQUAL( true , events.hasEvent( ScheduleEvents::GEO_MODIFIER , 2 ));

View File

@@ -24,6 +24,7 @@
#define BOOST_TEST_MODULE GroupTests
#include <boost/test/unit_test.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <opm/parser/eclipse/Python/Python.hpp>
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/Parser/Parser.hpp>
@@ -112,11 +113,12 @@ BOOST_AUTO_TEST_CASE(createDeckWithGEFAC) {
"/\n";
auto deck = parser.parseString(input);
Python python;
EclipseGrid grid(10,10,10);
TableManager table ( deck );
Runspec runspec (deck );
FieldPropsManager fp( deck, Phases{true, true, true}, grid, table);
Opm::Schedule schedule(deck, grid, fp, runspec);
Opm::Schedule schedule(deck, grid, fp, runspec, python);
auto group_names = schedule.groupNames("PRODUC");
BOOST_CHECK_EQUAL(group_names.size(), 1);
@@ -165,11 +167,12 @@ BOOST_AUTO_TEST_CASE(createDeckWithWGRUPCONandWCONPROD) {
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 );
Opm::Schedule schedule(deck, grid, fp, runspec);
Opm::Schedule schedule(deck, grid, fp, runspec, python);
const auto& currentWell = schedule.getWell("B-37T2", 0);
const Opm::Well::WellProductionProperties& wellProductionProperties = currentWell.getProductionProperties();
BOOST_CHECK(wellProductionProperties.controlMode == Opm::Well::ProducerCMode::GRUP);
@@ -209,11 +212,12 @@ BOOST_AUTO_TEST_CASE(createDeckWithGRUPNET) {
"/\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 );
Opm::Schedule schedule(deck, grid, fp, runspec);
Opm::Schedule schedule(deck, grid, fp, runspec, python);
const auto& group1 = schedule.getGroup("PROD", 0);
const auto& group2 = schedule.getGroup("MANI-E2", 0);
@@ -267,11 +271,12 @@ BOOST_AUTO_TEST_CASE(createDeckWithGCONPROD) {
/)";
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 );
Opm::Schedule schedule(deck, grid, fp, runspec);
Opm::Schedule schedule(deck, grid, fp, runspec, python);
SummaryState st(std::chrono::system_clock::now());
const auto& group1 = schedule.getGroup("G1", 0);
@@ -320,13 +325,14 @@ BOOST_AUTO_TEST_CASE(TESTGuideRateLINCOM) {
)";
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 );
/* The 'COMB' target mode is not supported */
BOOST_CHECK_THROW(Opm::Schedule schedule(deck, grid, fp, runspec), std::logic_error);
BOOST_CHECK_THROW(Opm::Schedule schedule(deck, grid, fp, runspec, python), std::logic_error);
}
BOOST_AUTO_TEST_CASE(TESTGuideRate) {
@@ -357,11 +363,12 @@ BOOST_AUTO_TEST_CASE(TESTGuideRate) {
)";
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);
GuideRate gr(schedule);
}
@@ -390,11 +397,12 @@ BOOST_AUTO_TEST_CASE(TESTGCONSALE) {
)";
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);
double metric_to_si = 1.0 / (24.0 * 3600.0); //cubic meters / day
@@ -459,11 +467,12 @@ BOOST_AUTO_TEST_CASE(GCONINJE_MULTIPLE_PHASES) {
)";
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);
SummaryState st(std::chrono::system_clock::now());
// Step 0
{

View File

@@ -24,6 +24,7 @@
#include <boost/test/unit_test.hpp>
#include <opm/parser/eclipse/Python/Python.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/FieldPropsManager.hpp>
#include <opm/parser/eclipse/EclipseState/Runspec.hpp>
@@ -76,11 +77,12 @@ BOOST_AUTO_TEST_CASE(MESSAGES) {
;
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 MessageLimits limits = schedule.getMessageLimits();
BOOST_CHECK_EQUAL( limits.getBugPrintLimit( 0 ) , 77 ); // The pre Schedule initialization

View File

@@ -24,6 +24,7 @@
#define BOOST_TEST_MODULE ParseContextTests
#include <boost/test/unit_test.hpp>
#include <opm/parser/eclipse/Python/Python.hpp>
#include <opm/parser/eclipse/Parser/ErrorGuard.hpp>
#include <opm/parser/eclipse/Parser/Parser.hpp>
#include <opm/parser/eclipse/Parser/ParserKeywords/D.hpp>
@@ -335,14 +336,15 @@ BOOST_AUTO_TEST_CASE( CheckUnsupportedInSCHEDULE ) {
TableManager table ( deckSupported );
FieldPropsManager fp(deckSupported, Phases{true, true, true}, grid, table);
Runspec runspec(deckSupported);
Python python;
parseContext.update( ParseContext::UNSUPPORTED_SCHEDULE_GEO_MODIFIER , InputError::IGNORE );
BOOST_CHECK_NO_THROW( Schedule( deckSupported , grid , fp, runspec, parseContext, errors ));
BOOST_CHECK_NO_THROW( Schedule( deckUnSupported, grid , fp, runspec, parseContext, errors ));
BOOST_CHECK_NO_THROW( Schedule( deckSupported , grid , fp, runspec, parseContext, errors, python ));
BOOST_CHECK_NO_THROW( Schedule( deckUnSupported, grid , fp, runspec, parseContext, errors, python ));
parseContext.update( ParseContext::UNSUPPORTED_SCHEDULE_GEO_MODIFIER , InputError::THROW_EXCEPTION );
BOOST_CHECK_THROW( Schedule( deckUnSupported , grid , fp, runspec , parseContext , errors), std::invalid_argument );
BOOST_CHECK_NO_THROW( Schedule( deckSupported , grid , fp, runspec , parseContext, errors));
BOOST_CHECK_THROW( Schedule( deckUnSupported , grid , fp, runspec , parseContext , errors, python), std::invalid_argument );
BOOST_CHECK_NO_THROW( Schedule( deckSupported , grid , fp, runspec , parseContext, errors, python));
}
@@ -413,12 +415,13 @@ BOOST_AUTO_TEST_CASE(TestCOMPORD) {
TableManager table ( deck );
FieldPropsManager fp( deck, Phases{true, true, true}, grid, table);
Runspec runspec(deck);
Python python;
parseContext.update( ParseContext::UNSUPPORTED_COMPORD_TYPE , InputError::IGNORE);
BOOST_CHECK_NO_THROW( Schedule( deck , grid , fp, runspec, parseContext, errors ));
BOOST_CHECK_NO_THROW( Schedule( deck , grid , fp, runspec, parseContext, errors, python ));
parseContext.update( ParseContext::UNSUPPORTED_COMPORD_TYPE , InputError::THROW_EXCEPTION);
BOOST_CHECK_THROW( Schedule( deck, grid , fp, runspec , parseContext, errors), std::invalid_argument );
BOOST_CHECK_THROW( Schedule( deck, grid , fp, runspec , parseContext, errors, python), std::invalid_argument );
}
@@ -753,18 +756,18 @@ BOOST_AUTO_TEST_CASE( test_invalid_wtemplate_config ) {
testSamples.push_back(testSample);
std::string deckinput;
for (std::string sample : testSamples) {
deckinput = defDeckString + sample;
auto deckUnSupported = parser.parseString( deckinput , parseContext, errors );
Python python;
EclipseGrid grid( deckUnSupported );
TableManager table ( deckUnSupported );
FieldPropsManager fp( deckUnSupported, Phases{true, true, true}, grid, table);
Runspec runspec( deckUnSupported);
BOOST_CHECK_THROW( Schedule( deckUnSupported , grid , fp, runspec , parseContext, errors), std::invalid_argument );
BOOST_CHECK_THROW( Schedule( deckUnSupported , grid , fp, runspec , parseContext, errors, python), std::invalid_argument );
}
}

View File

@@ -22,6 +22,7 @@
#include <boost/test/unit_test.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/RFTConfig.hpp>
#include <opm/parser/eclipse/Python/Python.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
@@ -39,13 +40,14 @@ namespace {
{
Setup(const ::Opm::Deck& deck);
::Opm::Python python;
::Opm::EclipseState es;
::Opm::Schedule sched;
};
Setup::Setup(const ::Opm::Deck& deck)
: es (deck)
, sched(deck, es)
, sched(deck, es, python)
{}
Setup parseDeckString(const std::string& input)

View File

@@ -22,6 +22,7 @@
#include <boost/test/unit_test.hpp>
#include <boost/date_time/posix_time/posix_time.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/Schedule/Schedule.hpp>
@@ -76,9 +77,9 @@ BOOST_AUTO_TEST_CASE(LoadRST) {
EclIO::ERst rst_file("SPE1CASE2.X0060");
auto rst_state = RestartIO::RstState::load(rst_file, 60);
BOOST_REQUIRE_THROW( rst_state.get_well("NO_SUCH_WELL"), std::out_of_range);
Python python;
EclipseState ecl_state(deck);
Schedule sched(deck, ecl_state);
Schedule sched(deck, ecl_state, python);
const auto& well_names = sched.wellNames(60);
BOOST_CHECK_EQUAL(well_names.size(), rst_state.wells.size());
@@ -90,16 +91,17 @@ BOOST_AUTO_TEST_CASE(LoadRST) {
}
BOOST_AUTO_TEST_CASE(LoadRestartSim) {
Python python;
Parser parser;
auto deck = parser.parseFile("SPE1CASE2.DATA");
EclipseState ecl_state(deck);
Schedule sched(deck, ecl_state);
Schedule sched(deck, ecl_state, python);
auto restart_deck = parser.parseFile("SPE1CASE2_RESTART.DATA");
EclIO::ERst rst_file("SPE1CASE2.X0060");
auto rst_state = RestartIO::RstState::load(rst_file, 60);
EclipseState ecl_state_restart(restart_deck);
Schedule restart_sched(restart_deck, ecl_state_restart, &rst_state);
Schedule restart_sched(restart_deck, ecl_state_restart, python, &rst_state);
// Verify that sched and restart_sched are identical from report_step 60 and onwords.
}

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);

View File

@@ -21,6 +21,7 @@
#include <boost/test/unit_test.hpp>
#include <opm/parser/eclipse/Python/Python.hpp>
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
@@ -148,8 +149,9 @@ static std::vector< std::string > sorted_key_names( const SummaryConfig& summary
static SummaryConfig createSummary( std::string input , const ParseContext& parseContext = ParseContext()) {
ErrorGuard errors;
auto deck = createDeck( input );
Python python;
EclipseState state( deck );
Schedule schedule(deck, state, parseContext, errors);
Schedule schedule(deck, state, parseContext, errors, python);
return SummaryConfig( deck, schedule, state.getTableManager( ), parseContext, errors );
}
@@ -167,20 +169,22 @@ BOOST_AUTO_TEST_CASE(wells_all) {
BOOST_AUTO_TEST_CASE(EMPTY) {
auto deck = createDeck_no_wells( "" );
Python python;
EclipseState state( deck );
Schedule schedule(deck, state);
Schedule schedule(deck, state, python);
SummaryConfig conf(deck, schedule, state.getTableManager());
BOOST_CHECK_EQUAL( conf.size(), 0 );
}
BOOST_AUTO_TEST_CASE(wells_missingI) {
Python python;
ParseContext parseContext;
ErrorGuard errors;
const auto input = "WWCT\n/\n";
auto deck = createDeck_no_wells( input );
parseContext.update(ParseContext::SUMMARY_UNKNOWN_WELL, InputError::THROW_EXCEPTION);
EclipseState state( deck );
Schedule schedule(deck, state, parseContext, errors );
Schedule schedule(deck, state, parseContext, errors, python );
BOOST_CHECK_NO_THROW( SummaryConfig( deck, schedule, state.getTableManager( ), parseContext, errors ));
}
@@ -715,11 +719,12 @@ BOOST_AUTO_TEST_CASE( SUMMARY_MISC) {
BOOST_AUTO_TEST_CASE(Summary_Segment)
{
Python python;
const auto input = std::string { "SOFR_TEST.DATA" };
const auto deck = Parser{}.parseFile(input);
const auto state = EclipseState { deck };
const auto schedule = Schedule { deck, state};
const auto schedule = Schedule { deck, state, python};
const auto summary = SummaryConfig {
deck, schedule, state.getTableManager()
};

View File

@@ -22,6 +22,7 @@
#include <boost/test/unit_test.hpp>
#include <opm/parser/eclipse/Python/Python.hpp>
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/Parser/Parser.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
@@ -70,11 +71,12 @@ static Deck createDeck(const std::string& input) {
BOOST_AUTO_TEST_CASE(TuningTest) {
auto deck = createDeck(deckStr);
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& tuning = schedule.getTuning();
auto event = schedule.getEvents();

View File

@@ -16,6 +16,7 @@ Copyright 2018 Statoil ASA.
#define BOOST_TEST_MODULE UDQTests
#include <boost/test/unit_test.hpp>
#include <opm/parser/eclipse/Python/Python.hpp>
#include <opm/parser/eclipse/Parser/ErrorGuard.hpp>
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
#include <opm/parser/eclipse/Deck/Deck.hpp>
@@ -139,17 +140,18 @@ BOOST_AUTO_TEST_CASE(TEST)
Schedule make_schedule(const std::string& input) {
Parser parser;
Python python;
auto deck = parser.parseString(input);
if (deck.hasKeyword("DIMENS")) {
EclipseState es(deck);
return Schedule(deck, es);
return Schedule(deck, es, python);
} else {
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);
return Schedule(deck, grid , fp, runspec, python);
}
}

View File

@@ -24,6 +24,7 @@
#include <boost/test/unit_test.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/Schedule/Schedule.hpp>
@@ -145,7 +146,8 @@ static Opm::Schedule createSchedule(const std::string& schedule) {
TableManager table ( deck );
FieldPropsManager fp( deck, Phases{true, true, true}, grid, table);
Runspec runspec (deck);
return Schedule(deck, grid , fp, runspec );
Python python;
return Schedule(deck, grid , fp, runspec, python );
}

View File

@@ -22,6 +22,7 @@
#include <boost/filesystem.hpp>
#include <boost/test/unit_test.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>
@@ -175,31 +176,34 @@ static Deck createDeckWithWaterInjector() {
}
BOOST_AUTO_TEST_CASE(TestNoSolvent) {
auto deck = createDeckWithOutSolvent();
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(!deck.hasKeyword("WSOLVENT"));
}
BOOST_AUTO_TEST_CASE(TestGasInjector) {
auto deck = createDeckWithGasInjector();
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(deck.hasKeyword("WSOLVENT"));
}
BOOST_AUTO_TEST_CASE(TestDynamicWSOLVENT) {
auto deck = createDeckWithDynamicWSOLVENT();
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(deck.hasKeyword("WSOLVENT"));
const auto& keyword = deck.getKeyword("WSOLVENT");
BOOST_CHECK_EQUAL(keyword.size(),1);
@@ -214,18 +218,20 @@ BOOST_AUTO_TEST_CASE(TestDynamicWSOLVENT) {
BOOST_AUTO_TEST_CASE(TestOilInjector) {
auto deck = createDeckWithOilInjector();
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(TestWaterInjector) {
auto deck = createDeckWithWaterInjector();
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);
}

View File

@@ -29,6 +29,7 @@
#include <opm/parser/eclipse/Deck/DeckItem.hpp>
#include <opm/parser/eclipse/Deck/DeckRecord.hpp>
#include <opm/parser/eclipse/Python/Python.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
#include <opm/parser/eclipse/EclipseState/Runspec.hpp>
@@ -86,11 +87,12 @@ BOOST_AUTO_TEST_CASE(WellCOMPDATtestTRACK) {
auto deck = parser.parseString(input);
Opm::Python python;
Opm::EclipseGrid grid(10,10,10);
TableManager table ( deck );
FieldPropsManager fp( deck, Phases{true, true, true}, grid, table);
Opm::Runspec runspec (deck);
Opm::Schedule schedule(deck, grid , fp, runspec);
Opm::Schedule schedule(deck, grid , fp, runspec, python);
const auto& op_1 = schedule.getWell("OP_1", 2);
const auto& completions = op_1.getConnections();
@@ -132,11 +134,12 @@ BOOST_AUTO_TEST_CASE(WellCOMPDATtestDefaultTRACK) {
auto deck = parser.parseString(input);
Opm::Python python;
Opm::EclipseGrid grid(10,10,10);
TableManager table ( deck );
FieldPropsManager fp( deck, Phases{true, true, true}, grid, table);
Opm::Runspec runspec (deck);
Opm::Schedule schedule(deck, grid , fp, runspec);
Opm::Schedule schedule(deck, grid , fp, runspec, python);
const auto& op_1 = schedule.getWell("OP_1", 2);
const auto& completions = op_1.getConnections();
@@ -179,7 +182,8 @@ BOOST_AUTO_TEST_CASE(WellCOMPDATtestINPUT) {
TableManager table ( deck );
FieldPropsManager fp( deck, Phases{true, true, true}, grid, table);
Opm::Runspec runspec (deck);
Opm::Schedule schedule(deck, grid , fp, runspec, Opm::ParseContext(), errors);
Opm::Python python;
Opm::Schedule schedule(deck, grid , fp, runspec, Opm::ParseContext(), errors, python);
const auto& op_1 = schedule.getWell("OP_1", 2);
const auto& completions = op_1.getConnections();
@@ -852,11 +856,12 @@ BOOST_AUTO_TEST_CASE(WELOPEN) {
auto deck = parser.parseString(input);
Python python;
Opm::EclipseGrid grid(10,10,10);
TableManager table ( deck );
FieldPropsManager fp(deck, Phases{true, true, true}, grid, table);
Opm::Runspec runspec (deck);
Opm::Schedule schedule(deck, grid , fp, runspec);
Opm::Schedule schedule(deck, grid , fp, runspec, python);
{
const auto& op_1 = schedule.getWell("OP_1", 1);
BOOST_CHECK(op_1.getStatus() == Well::Status::OPEN);

View File

@@ -22,6 +22,7 @@
#include <boost/filesystem.hpp>
#include <boost/test/unit_test.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>
@@ -135,19 +136,21 @@ BOOST_AUTO_TEST_CASE(TestNoTracer) {
EclipseGrid grid(10,10,10);
TableManager table ( deck );
FieldPropsManager fp(deck, Phases{true, true, true}, grid, table);
Python python;
Runspec runspec ( deck );
Schedule schedule(deck, grid , fp, runspec);
Schedule schedule(deck, grid , fp, runspec, python);
BOOST_CHECK(!deck.hasKeyword("WTRACER"));
}
BOOST_AUTO_TEST_CASE(TestDynamicWTRACER) {
auto deck = createDeckWithDynamicWTRACER();
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(deck.hasKeyword("WTRACER"));
const auto& keyword = deck.getKeyword("WTRACER");
BOOST_CHECK_EQUAL(keyword.size(),1);
@@ -165,10 +168,11 @@ BOOST_AUTO_TEST_CASE(TestDynamicWTRACER) {
BOOST_AUTO_TEST_CASE(TestTracerInProducerTHROW) {
auto deck = createDeckWithTracerInProducer();
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);
}

View File

@@ -25,6 +25,7 @@
#include <vector>
#include <boost/date_time.hpp>
#include <opm/parser/eclipse/Python/Python.hpp>
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
@@ -303,10 +304,11 @@ BOOST_AUTO_TEST_CASE( NorneRestartConfig ) {
rptConfig.push_back( std::make_tuple(240 , true , boost::gregorian::date( 2006,10,1)) );
rptConfig.push_back( std::make_tuple(241 , true , boost::gregorian::date( 2006,10,10)) );
Python python;
Parser parser;
auto deck = parser.parseFile( path_prefix() + "IOConfig/RPTRST_DECK.DATA");
EclipseState state(deck);
Schedule schedule(deck, state);
Schedule schedule(deck, state, python);
verifyRestartConfig(schedule.getTimeMap(), schedule.restart(), rptConfig);
}
@@ -349,10 +351,11 @@ BOOST_AUTO_TEST_CASE( RestartConfig2 ) {
}
Python python;
Parser parser;
auto deck = parser.parseFile(path_prefix() + "IOConfig/RPT_TEST2.DATA");
EclipseState state( deck);
Schedule schedule(deck, state);
Schedule schedule(deck, state, python);
const auto& rstConfig = schedule.restart();
verifyRestartConfig(schedule.getTimeMap(), rstConfig, rptConfig);

View File

@@ -20,6 +20,7 @@
#define BOOST_TEST_MODULE ParserKeywordsIntegrationTests
#include <boost/test/unit_test.hpp>
#include <opm/parser/eclipse/Python/Python.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/FieldPropsManager.hpp>
#include <opm/parser/eclipse/EclipseState/Runspec.hpp>
@@ -594,7 +595,8 @@ BOOST_AUTO_TEST_CASE( MULTISEGMENT_ABS ) {
const EclipseState state(deck);
const TableManager table ( deck );
Runspec runspec (deck);
const Schedule sched(deck, state);
Python python;
const Schedule sched(deck, state, python);
// checking the relation between segments and completions
// and also the depth of completions
@@ -1368,7 +1370,8 @@ BOOST_AUTO_TEST_CASE( WCONPROD ) {
TableManager table ( deck );
FieldPropsManager fp( deck, Phases{true, true, true}, grid, table);
Runspec runspec (deck);
Schedule sched(deck, grid, fp, runspec );
Python python;
Schedule sched(deck, grid, fp, runspec, python);
BOOST_CHECK_EQUAL(5U, sched.numWells());
BOOST_CHECK(sched.hasWell("INJE1"));
@@ -1410,11 +1413,12 @@ BOOST_AUTO_TEST_CASE( WCONINJE ) {
Parser parser;
std::string wconprodFile(pathprefix() + "WellWithWildcards/WCONINJE1");
auto deck = parser.parseFile(wconprodFile);
Python python;
EclipseGrid grid(30,30,30);
TableManager table ( deck );
FieldPropsManager fp(deck, Phases{true, true, true}, grid, table);
Runspec runspec (deck);
Schedule sched( deck, grid, fp, runspec);
Schedule sched( deck, grid, fp, runspec, python);
SummaryState st(std::chrono::system_clock::now());
BOOST_CHECK_EQUAL(5U, sched.numWells());

View File

@@ -33,6 +33,7 @@
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Events.hpp>
#include <opm/parser/eclipse/Units/Units.hpp>
#include <opm/parser/eclipse/Python/Python.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellProductionProperties.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellInjectionProperties.hpp>
@@ -46,6 +47,7 @@ inline std::string pathprefix() {
BOOST_AUTO_TEST_CASE(CreateSchedule) {
Parser parser;
Python python;
EclipseGrid grid(10,10,10);
std::string scheduleFile(pathprefix() + "SCHEDULE/SCHEDULE1");
auto deck1 = parser.parseFile(scheduleFile);
@@ -56,7 +58,7 @@ BOOST_AUTO_TEST_CASE(CreateSchedule) {
TableManager table ( deck );
FieldPropsManager fp(deck, Phases{true, true, true}, grid, table);
Runspec runspec (deck);
Schedule sched(deck, grid , fp, runspec);
Schedule sched(deck, grid , fp, runspec, python);
const auto& timeMap = sched.getTimeMap();
BOOST_CHECK_EQUAL(TimeMap::mkdate(2007 , 5 , 10), sched.getStartTime());
BOOST_CHECK_EQUAL(9U, timeMap.size());
@@ -73,7 +75,8 @@ BOOST_AUTO_TEST_CASE(CreateSchedule_Comments_After_Keywords) {
TableManager table ( deck );
FieldPropsManager fp(deck, Phases{true, true, true}, grid, table);
Runspec runspec (deck);
Schedule sched(deck, grid , fp, runspec);
Python python;
Schedule sched(deck, grid , fp, runspec, python);
const auto& timeMap = sched.getTimeMap();
BOOST_CHECK_EQUAL(TimeMap::mkdate(2007, 5 , 10) , sched.getStartTime());
BOOST_CHECK_EQUAL(9U, timeMap.size());
@@ -87,8 +90,9 @@ BOOST_AUTO_TEST_CASE(WCONPROD_MissingCmode) {
EclipseGrid grid(10,10,3);
TableManager table ( deck );
FieldPropsManager fp(deck, Phases{true, true, true}, grid, table);
Python python;
Runspec runspec (deck);
BOOST_CHECK_NO_THROW( Schedule(deck, grid , fp, runspec) );
BOOST_CHECK_NO_THROW( Schedule(deck, grid , fp, runspec, python) );
}
@@ -100,7 +104,8 @@ BOOST_AUTO_TEST_CASE(WCONPROD_Missing_DATA) {
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 );
Python python;
BOOST_CHECK_THROW( Schedule(deck, grid , fp, runspec, python) , std::invalid_argument );
}
@@ -112,7 +117,8 @@ BOOST_AUTO_TEST_CASE(WellTestRefDepth) {
TableManager table ( deck );
FieldPropsManager fp(deck, Phases{true, true, true}, grid, table);
Runspec runspec (deck);
Schedule sched(deck , grid , fp, runspec);
Python python;
Schedule sched(deck , grid , fp, runspec, python);
const auto& well1 = sched.getWellatEnd("W_1");
const auto& well2 = sched.getWellatEnd("W_2");
@@ -134,7 +140,8 @@ BOOST_AUTO_TEST_CASE(WellTesting) {
TableManager table ( deck );
FieldPropsManager fp(deck, Phases{true, true, true}, grid, table);
Runspec runspec (deck);
Schedule sched(deck, grid , fp, runspec);
Python python;
Schedule sched(deck, grid , fp, runspec, python);
BOOST_CHECK_EQUAL(4U, sched.numWells());
BOOST_CHECK(sched.hasWell("W_1"));
@@ -279,7 +286,8 @@ BOOST_AUTO_TEST_CASE(WellTestCOMPDAT_DEFAULTED_ITEMS) {
TableManager table ( deck );
FieldPropsManager fp(deck, Phases{true, true, true}, grid, table);
Runspec runspec (deck);
Schedule sched(deck, grid , fp, runspec);
Python python;
Schedule sched(deck, grid , fp, runspec, python);
}
@@ -291,7 +299,8 @@ BOOST_AUTO_TEST_CASE(WellTestCOMPDAT) {
TableManager table ( deck );
FieldPropsManager fp(deck, Phases{true, true, true}, grid, table);
Runspec runspec (deck);
Schedule sched(deck, grid , fp, runspec);
Python python;
Schedule sched(deck, grid , fp, runspec, python);
BOOST_CHECK_EQUAL(4U, sched.numWells());
BOOST_CHECK(sched.hasWell("W_1"));
@@ -326,7 +335,8 @@ BOOST_AUTO_TEST_CASE(GroupTreeTest_GRUPTREE_correct) {
TableManager table ( deck );
FieldPropsManager fp(deck, Phases{true, true, true}, grid, table);
Runspec runspec (deck);
Schedule schedule(deck, grid , fp, runspec);
Python python;
Schedule schedule(deck, grid , fp, runspec, python);
BOOST_CHECK( schedule.hasGroup( "FIELD" ));
BOOST_CHECK( schedule.hasGroup( "PROD" ));
@@ -348,7 +358,8 @@ BOOST_AUTO_TEST_CASE(GroupTreeTest_GRUPTREE_WITH_REPARENT_correct_tree) {
TableManager table ( deck );
FieldPropsManager fp(deck, Phases{true, true, true}, grid, table);
Runspec runspec (deck);
Schedule sched(deck, grid , fp, runspec);
Python python;
Schedule sched(deck, grid , fp, runspec, python);
const auto& field_group = sched.getGroup("FIELD", 1);
const auto& new_group = sched.getGroup("GROUP_NEW", 1);
@@ -371,7 +382,8 @@ BOOST_AUTO_TEST_CASE( WellTestGroups ) {
TableManager table ( deck );
FieldPropsManager fp(deck, Phases{true, true, true}, grid, table);
Runspec runspec (deck);
Schedule sched(deck, grid , fp, runspec);
Python python;
Schedule sched(deck, grid , fp, runspec, python);
SummaryState st(std::chrono::system_clock::now());
BOOST_CHECK_EQUAL( 3U , sched.numGroups() );
@@ -422,7 +434,8 @@ BOOST_AUTO_TEST_CASE( WellTestGroupAndWellRelation ) {
TableManager table ( deck );
FieldPropsManager fp(deck, Phases{true, true, true}, grid, table);
Runspec runspec (deck);
Schedule sched(deck, grid , fp, runspec);
Python python;
Schedule sched(deck, grid , fp, runspec, python);
{
auto& group1 = sched.getGroup("GROUP1", 0);
@@ -480,11 +493,12 @@ BOOST_AUTO_TEST_CASE(WellTestWGRUPCONWellPropertiesSet) {
Parser parser;
std::string scheduleFile(pathprefix() + "SCHEDULE/SCHEDULE_WGRUPCON");
auto deck = parser.parseFile(scheduleFile);
Python python;
EclipseGrid grid(10,10,10);
TableManager table ( deck );
FieldPropsManager fp(deck, Phases{true, true, true}, grid, table);
Runspec runspec (deck);
Schedule sched(deck, grid , fp, runspec);
Schedule sched(deck, grid , fp, runspec, python);
const auto& well1 = sched.getWell("W_1", 0);
BOOST_CHECK(well1.isAvailableForGroupControl( ));
@@ -528,11 +542,12 @@ COMPDAT \n\
'W1' 2* 1 1 'OPEN' 1* 32.948 0.311 3047.839 2* 'X' 22.100 /\n\
/\n";
auto deck = parser.parseString(deckString);
Python python;
EclipseGrid grid(30,30,10);
TableManager table ( deck );
FieldPropsManager fp(deck, Phases{true, true, true}, grid, table);
Runspec runspec (deck);
Schedule sched(deck, grid , fp, runspec);
Schedule sched(deck, grid , fp, runspec, python);
const auto& connections = sched.getWell("W1", 0).getConnections();
BOOST_CHECK_EQUAL( 10 , connections.get(0).getI() );
BOOST_CHECK_EQUAL( 20 , connections.get(0).getJ() );
@@ -547,24 +562,26 @@ BOOST_AUTO_TEST_CASE(OpmCode) {
Parser parser;
std::string scheduleFile(pathprefix() + "SCHEDULE/wells_group.data");
auto deck = parser.parseFile(scheduleFile);
Python python;
EclipseGrid grid(10,10,5);
TableManager table ( deck );
Runspec runspec (deck);
FieldPropsManager fp(deck, runspec.phases(), grid, table);
BOOST_CHECK_NO_THROW( Schedule(deck , grid , fp, runspec) );
BOOST_CHECK_NO_THROW( Schedule(deck , grid , fp, runspec, python) );
}
BOOST_AUTO_TEST_CASE(WELLS_SHUT) {
Parser parser;
Python python;
std::string scheduleFile(pathprefix() + "SCHEDULE/SCHEDULE_SHUT_WELL");
auto deck = parser.parseFile(scheduleFile);
EclipseGrid grid(20,40,1);
TableManager table ( deck );
FieldPropsManager fp(deck, Phases{true, true, true}, grid, table);
Runspec runspec (deck);
Schedule sched(deck, grid , fp, runspec);
Schedule sched(deck, grid , fp, runspec, python);
{
@@ -594,7 +611,8 @@ BOOST_AUTO_TEST_CASE(WellTestWPOLYMER) {
TableManager table ( deck );
FieldPropsManager fp(deck, Phases{true, true, true}, grid, table);
Runspec runspec (deck);
Schedule sched(deck, grid , fp, runspec);
Python python;
Schedule sched(deck, grid , fp, runspec, python);
BOOST_CHECK_EQUAL(4U, sched.numWells());
@@ -661,7 +679,8 @@ BOOST_AUTO_TEST_CASE(WellTestWFOAM) {
TableManager table ( deck );
FieldPropsManager fp(deck, Phases{true, true, true}, grid, table);
Runspec runspec (deck);
Schedule sched(deck, grid , fp, runspec);
Python python;
Schedule sched(deck, grid , fp, runspec, python);
BOOST_CHECK_EQUAL(4U, sched.numWells());
@@ -728,7 +747,8 @@ BOOST_AUTO_TEST_CASE(WellTestWECON) {
TableManager table ( deck );
FieldPropsManager fp(deck, Phases{true, true, true}, grid, table);
Runspec runspec (deck);
Schedule sched(deck, grid , fp, runspec);
Python python;
Schedule sched(deck, grid , fp, runspec, python);
BOOST_CHECK_EQUAL(3U, sched.numWells());
BOOST_CHECK(sched.hasWell("INJE01"));
@@ -838,7 +858,8 @@ BOOST_AUTO_TEST_CASE(TestEvents) {
TableManager table ( deck );
FieldPropsManager fp(deck, Phases{true, true, true}, grid, table);
Runspec runspec (deck);
Schedule sched(deck , grid , fp, runspec);
Python python;
Schedule sched(deck , grid , fp, runspec, python);
const Events& events = sched.getEvents();
BOOST_CHECK( events.hasEvent(ScheduleEvents::NEW_WELL , 0 ) );
@@ -872,7 +893,8 @@ BOOST_AUTO_TEST_CASE(TestWellEvents) {
TableManager table ( deck );
FieldPropsManager fp(deck, Phases{true, true, true}, grid, table);
Runspec runspec(deck);
Schedule sched(deck , grid , fp, runspec);
Python python;
Schedule sched(deck , grid , fp, runspec, python);
BOOST_CHECK( sched.hasWellGroupEvent( "W_1", ScheduleEvents::NEW_WELL , 0 ));
BOOST_CHECK( sched.hasWellGroupEvent( "W_2", ScheduleEvents::NEW_WELL , 2 ));

View File

@@ -24,6 +24,7 @@
#include <opm/parser/eclipse/Parser/Parser.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/parser/eclipse/Python/Python.hpp>
using namespace Opm;
@@ -33,12 +34,13 @@ inline std::string pathprefix() {
BOOST_AUTO_TEST_CASE(MULTFLT_IN_SCHEDULE) {
Parser parser;
Python python;
std::string scheduleFile(pathprefix() + "TRANS/Deck1");
ParseContext parseContext;
auto deck = parser.parseFile(scheduleFile);
EclipseState state(deck);
const auto& trans = state.getTransMult();
Schedule schedule(deck, state);
Schedule schedule(deck, state, python);
const Events& events = schedule.getEvents();
BOOST_CHECK_EQUAL( 0.10 , trans.getMultiplier( 3,2,0,FaceDir::XPlus ));

View File

@@ -25,13 +25,15 @@
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/parser/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
#include <opm/parser/eclipse/Python/Python.hpp>
inline void loadDeck( const char * deck_file) {
Opm::Parser parser;
Opm::Python python;
auto deck = parser.parseFile(deck_file);
Opm::EclipseState state( deck);
Opm::Schedule schedule( deck, state);
Opm::Schedule schedule( deck, state, python);
Opm::SummaryConfig summary( deck, schedule, state.getTableManager( ));
{
std::stringstream ss;

View File

@@ -17,16 +17,14 @@
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#include <iostream>
#include <vector>
#include <unordered_map>
#include <iostream>
#include <vector>
#include <opm/io/eclipse/rst/state.hpp>
#include <opm/io/eclipse/ERst.hpp>
#include <opm/parser/eclipse/Units/UnitSystem.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp>
#include <opm/parser/eclipse/Python/Python.hpp>
#include <opm/parser/eclipse/Parser/Parser.hpp>
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
@@ -68,7 +66,7 @@ void initLogging() {
*/
Opm::Schedule load_schedule(const std::string& fname, int& report_step) {
Opm::Schedule load_schedule(const Opm::Python& python, const std::string& fname, int& report_step) {
Opm::Parser parser;
auto deck = parser.parseFile(fname);
Opm::EclipseState state(deck);
@@ -80,26 +78,27 @@ Opm::Schedule load_schedule(const std::string& fname, int& report_step) {
Opm::EclIO::ERst rst_file(rst_filename);
const auto& rst = Opm::RestartIO::RstState::load(rst_file, report_step);
return Opm::Schedule(deck, state, &rst);
return Opm::Schedule(deck, state, python, &rst);
} else
return Opm::Schedule(deck, state);
return Opm::Schedule(deck, state, python);
}
Opm::Schedule load_schedule(const std::string& fname) {
Opm::Schedule load_schedule(const Opm::Python& python, const std::string& fname) {
int report_step;
return load_schedule(fname, report_step);
return load_schedule(python, fname, report_step);
}
int main(int argc, char ** argv) {
Opm::Python python;
initLogging();
if (argc == 2)
load_schedule(argv[1]);
load_schedule(python, argv[1]);
else {
int report_step;
const auto& sched = load_schedule(argv[1]);
const auto& rst_sched = load_schedule(argv[2], report_step);
const auto& sched = load_schedule(python, argv[1]);
const auto& rst_sched = load_schedule(python, argv[2], report_step);
if (Opm::Schedule::cmp(sched, rst_sched, report_step) ) {
std::cout << "Schedule objects were equal!" << std::endl;

View File

@@ -8,6 +8,7 @@
#include <opm/parser/eclipse/Parser/Parser.hpp>
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/Python/Python.hpp>
#include <opm/output/eclipse/AggregateUDQData.hpp>
#include <opm/output/eclipse/AggregateActionxData.hpp>
#include <opm/output/eclipse/WriteRestartHelpers.hpp>
@@ -79,10 +80,11 @@ struct SimulationCase
explicit SimulationCase(const Opm::Deck& deck)
: es { deck }
, grid { deck }
, sched{ deck, es }
, sched{ deck, es, python }
{}
// Order requirement: 'es' must be declared/initialised before 'sched'.
Opm::Python python;
Opm::EclipseState es;
Opm::EclipseGrid grid;
Opm::Schedule sched;

View File

@@ -24,6 +24,7 @@
#include <opm/output/eclipse/VectorItems/connection.hpp>
#include <opm/io/eclipse/rst/header.hpp>
#include <opm/io/eclipse/rst/connection.hpp>
#include <opm/parser/eclipse/Python/Python.hpp>
#include <boost/test/unit_test.hpp>
@@ -528,13 +529,15 @@ END
struct SimulationCase {
explicit SimulationCase(const Opm::Deck& deck)
: es(deck)
, python()
, grid(deck)
, sched(deck, es)
, sched(deck, es, python)
{
}
// Order requirement: 'es' must be declared/initialised before 'sched'.
Opm::EclipseState es;
Opm::Python python;
Opm::EclipseGrid grid;
Opm::Schedule sched;
};

View File

@@ -26,6 +26,7 @@
#include <opm/output/eclipse/VectorItems/intehead.hpp>
#include <opm/output/eclipse/VectorItems/well.hpp>
#include <opm/parser/eclipse/Python/Python.hpp>
#include <opm/output/data/Wells.hpp>
@@ -457,10 +458,11 @@ struct SimulationCase
{
explicit SimulationCase(const Opm::Deck& deck)
: es ( deck )
, sched (deck, es )
, sched (deck, es, python )
{}
// Order requirement: 'es' must be declared/initialised before 'sched'.
Opm::Python python;
Opm::EclipseState es;
Opm::Schedule sched;
};

View File

@@ -23,6 +23,7 @@
#include <boost/test/unit_test.hpp>
#include <opm/output/eclipse/AggregateWellData.hpp>
#include <opm/parser/eclipse/Python/Python.hpp>
#include <opm/output/eclipse/VectorItems/intehead.hpp>
#include <opm/output/eclipse/VectorItems/well.hpp>
@@ -586,12 +587,13 @@ struct SimulationCase
explicit SimulationCase(const Opm::Deck& deck)
: es ( deck )
, grid ( deck )
, sched( deck, es )
, sched( deck, es, python )
{}
// Order requirement: 'es' must be declared/initialised before 'sched'.
Opm::Python python;
Opm::EclipseState es;
Opm::EclipseGrid grid;
Opm::EclipseGrid grid;
Opm::Schedule sched;
};

View File

@@ -14,6 +14,7 @@
#include <opm/output/eclipse/InteHEAD.hpp>
#include <opm/output/eclipse/VectorItems/intehead.hpp>
#include <opm/output/eclipse/DoubHEAD.hpp>
#include <opm/parser/eclipse/Python/Python.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQInput.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/UDQ/UDQActive.hpp>
@@ -109,10 +110,11 @@ struct SimulationCase
explicit SimulationCase(const Opm::Deck& deck)
: es { deck }
, grid { deck }
, sched{ deck, es }
, sched{ deck, es, python }
{}
// Order requirement: 'es' must be declared/initialised before 'sched'.
Opm::Python python;
Opm::EclipseState es;
Opm::EclipseGrid grid;
Opm::Schedule sched;

View File

@@ -32,6 +32,7 @@
#include <opm/io/eclipse/rst/well.hpp>
#include <opm/io/eclipse/rst/header.hpp>
#include <opm/parser/eclipse/Python/Python.hpp>
#include <opm/output/data/Wells.hpp>
@@ -353,10 +354,11 @@ struct SimulationCase
explicit SimulationCase(const Opm::Deck& deck)
: es { deck }
, grid { deck }
, sched{ deck, es }
, sched{ deck, es, python }
{}
// Order requirement: 'es' must be declared/initialised before 'sched'.
Opm::Python python;
Opm::EclipseState es;
Opm::EclipseGrid grid;
Opm::Schedule sched;

View File

@@ -24,6 +24,7 @@
#include <opm/parser/eclipse/EclipseState/Schedule/ArrayDimChecker.hpp>
#include <opm/parser/eclipse/Python/Python.hpp>
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
@@ -344,6 +345,7 @@ struct CaseObjects
CaseObjects& operator=(const CaseObjects& rhs) = delete;
CaseObjects& operator=(CaseObjects&& rhs) = delete;
Opm::Python python;
Opm::ErrorGuard guard;
Opm::EclipseState es;
Opm::Schedule sched;
@@ -352,7 +354,7 @@ struct CaseObjects
CaseObjects::CaseObjects(const Opm::Deck& deck, const Opm::ParseContext& ctxt)
: guard{}
, es (deck)
, sched(deck, es, ctxt, guard)
, sched(deck, es, ctxt, guard, python)
{
}

View File

@@ -24,6 +24,7 @@
#include <opm/output/eclipse/EclipseIO.hpp>
#include <opm/output/data/Cells.hpp>
#include <opm/parser/eclipse/Python/Python.hpp>
#include <opm/parser/eclipse/Parser/Parser.hpp>
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
@@ -280,7 +281,8 @@ BOOST_AUTO_TEST_CASE(EclipseIOIntegration) {
auto deck = Parser().parseString( deckString);
auto es = EclipseState( deck );
auto& eclGrid = es.getInputGrid();
Schedule schedule(deck, es);
Python python;
Schedule schedule(deck, es, python);
SummaryConfig summary_config( deck, schedule, es.getTableManager( ));
SummaryState st(std::chrono::system_clock::now());
es.getIOConfig().setBaseName( "FOO" );

View File

@@ -24,6 +24,7 @@
#include <opm/io/eclipse/ERft.hpp>
#include <opm/io/eclipse/OutputStream.hpp>
#include <opm/parser/eclipse/Python/Python.hpp>
#include <opm/output/data/Solution.hpp>
#include <opm/output/data/Wells.hpp>
@@ -244,6 +245,7 @@ BOOST_AUTO_TEST_SUITE(Using_EclipseIO)
BOOST_AUTO_TEST_CASE(test_RFT)
{
Python python;
const auto rset = RSet{ "TESTRFT" };
const auto eclipse_data_filename = std::string{ "testrft.DATA" };
@@ -263,7 +265,7 @@ BOOST_AUTO_TEST_CASE(test_RFT)
const auto& grid = eclipseState.getInputGrid();
const auto numCells = grid.getCartesianSize( );
const Schedule schedule(deck, eclipseState);
const Schedule schedule(deck, eclipseState, python);
const SummaryConfig summary_config( deck, schedule, eclipseState.getTableManager( ));
EclipseIO eclipseWriter( eclipseState, grid, schedule, summary_config );
@@ -365,6 +367,7 @@ namespace {
BOOST_AUTO_TEST_CASE(test_RFT2)
{
Python python;
const auto rset = RSet{ "TESTRFT" };
const auto eclipse_data_filename = std::string{ "testrft.DATA" };
@@ -384,7 +387,7 @@ BOOST_AUTO_TEST_CASE(test_RFT2)
const auto& grid = eclipseState.getInputGrid();
const auto numCells = grid.getCartesianSize( );
Schedule schedule(deck, eclipseState);
Schedule schedule(deck, eclipseState, python);
SummaryConfig summary_config( deck, schedule, eclipseState.getTableManager( ));
SummaryState st(std::chrono::system_clock::now());
@@ -453,13 +456,15 @@ namespace {
{}
explicit Setup(const ::Opm::Deck& deck)
: es { deck }
, sched{ deck, es }
: es { deck }
, python{ }
, sched { deck, es , python }
{
}
::Opm::EclipseState es;
::Opm::Schedule sched;
::Opm::Python python;
};
std::vector<Opm::data::Connection>

View File

@@ -27,6 +27,7 @@
#include <opm/output/eclipse/RestartValue.hpp>
#include <opm/output/data/Cells.hpp>
#include <opm/output/data/Wells.hpp>
#include <opm/parser/eclipse/Python/Python.hpp>
#include <opm/parser/eclipse/EclipseState/Tables/Eqldims.hpp>
#include <opm/parser/eclipse/Deck/Deck.hpp>
@@ -338,12 +339,13 @@ struct Setup {
const EclipseGrid& grid;
Schedule schedule;
SummaryConfig summary_config;
Python python;
Setup( const char* path) :
deck( Parser().parseFile( path) ),
es( deck),
grid( es.getInputGrid( ) ),
schedule( deck, es ),
schedule( deck, es, python ),
summary_config( deck, schedule, es.getTableManager( ))
{
auto& io_config = es.getIOConfig();

View File

@@ -35,6 +35,7 @@
#include <opm/output/data/Groups.hpp>
#include <opm/output/eclipse/Summary.hpp>
#include <opm/parser/eclipse/Python/Python.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/SummaryState.hpp>
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/Units/UnitSystem.hpp>
@@ -368,6 +369,7 @@ double ecl_sum_get_well_completion_var( const EclIO::ESmry* smry,
}
struct setup {
Python python;
Deck deck;
EclipseState es;
const EclipseGrid& grid;
@@ -384,7 +386,7 @@ struct setup {
deck( Parser().parseFile( path) ),
es( deck ),
grid( es.getInputGrid() ),
schedule( deck, es),
schedule( deck, es, python),
config( deck, schedule, es.getTableManager()),
wells( result_wells() ),
groups( result_groups() ),

View File

@@ -35,6 +35,7 @@
#include <opm/output/data/Groups.hpp>
#include <opm/output/eclipse/Summary.hpp>
#include <opm/parser/eclipse/Python/Python.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/SummaryState.hpp>
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/Units/UnitSystem.hpp>
@@ -204,6 +205,7 @@ static data::Group result_groups() {
struct setup {
Python python;
Deck deck;
EclipseState es;
const EclipseGrid& grid;
@@ -220,7 +222,7 @@ struct setup {
deck( Parser().parseFile( path) ),
es( deck ),
grid( es.getInputGrid() ),
schedule( deck, es),
schedule( deck, es, python),
config( deck, schedule, es.getTableManager()),
wells( result_wells() ),
groups( result_groups() ),

View File

@@ -24,6 +24,7 @@
#include <stdexcept>
#include <opm/parser/eclipse/Python/Python.hpp>
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
@@ -39,11 +40,12 @@ const char* path = "summary_deck.DATA";
BOOST_AUTO_TEST_CASE(create) {
Python python;
Parser parser;
Deck deck( parser.parseFile( path ));
EclipseState es(deck);
const EclipseGrid& grid = es.getInputGrid();
Schedule schedule( deck, es);
Schedule schedule( deck, es, python);
out::RegionCache rc(es.fieldProps().get_int("FIPNUM"), grid, schedule);
{
const auto& empty = rc.connections( 4 );

View File

@@ -32,6 +32,7 @@
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.hpp>
#include <opm/parser/eclipse/Parser/ParseContext.hpp>
#include <opm/parser/eclipse/Parser/Parser.hpp>
#include <opm/parser/eclipse/Python/Python.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellProductionProperties.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellInjectionProperties.hpp>
@@ -194,11 +195,12 @@ BOOST_AUTO_TEST_CASE(EclipseWriteRestartWellInfo) {
std::string eclipse_data_filename = "testblackoilstate3.DATA";
Opm::Python python;
Opm::Parser parser;
Opm::Deck deck( parser.parseFile( eclipse_data_filename ));
Opm::EclipseState es(deck);
const Opm::EclipseGrid& grid = es.getInputGrid();
Opm::Schedule schedule( deck, es);
Opm::Schedule schedule( deck, es, python);
Opm::SummaryConfig summary_config( deck, schedule, es.getTableManager( ));
const auto num_cells = grid.getCartesianSize();
Opm::EclipseIO eclipseWriter( es, grid , schedule, summary_config);

View File

@@ -23,6 +23,7 @@
#include <vector>
#include <opm/parser/eclipse/Python/Python.hpp>
#include <opm/output/eclipse/WriteRestartHelpers.hpp>
#include <opm/output/eclipse/AggregateWellData.hpp>
#include <opm/output/eclipse/AggregateConnectionData.hpp>
@@ -190,12 +191,14 @@ TSTEP -- 8
struct SimulationCase
{
explicit SimulationCase(const Opm::Deck& deck)
: es { deck }
, grid { deck }
, sched{ deck, es }
: python{ }
, es { deck }
, grid { deck }
, sched { deck, es, python}
{}
// Order requirement: 'es' must be declared/initialised before 'sched'.
Opm::Python python;
Opm::EclipseState es;
Opm::EclipseGrid grid;
Opm::Schedule sched;