From 09b445f69dc63eba7474831a0230b5b96f0d3075 Mon Sep 17 00:00:00 2001 From: Tor Harald Sandve Date: Fri, 30 Aug 2019 12:56:49 +0200 Subject: [PATCH] support nupcol --- .../EclipseState/Schedule/Schedule.hpp | 3 ++ .../EclipseState/Schedule/Schedule.cpp | 17 ++++++++- tests/parser/ScheduleTests.cpp | 37 +++++++++++++++++++ 3 files changed, 56 insertions(+), 1 deletion(-) diff --git a/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp b/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp index 9906e3156..3b95bd345 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp @@ -216,6 +216,7 @@ namespace Opm size_t size() const; void applyAction(size_t reportStep, const Action::ActionX& action, const Action::Result& result); + int getNupcol(size_t reportStep) const; private: TimeMap m_timeMap; OrderedMap< std::string, DynamicState>> wells_static; @@ -239,6 +240,7 @@ namespace Opm Action::Actions m_actions; std::map well_events; + DynamicState m_nupcol; GTNode groupTree(const std::string& root_node, std::size_t report_step, const GTNode * parent) const; void updateGroup(std::shared_ptr group, size_t reportStep); @@ -281,6 +283,7 @@ namespace Opm void handleGUIDERAT( const DeckKeyword& keyword, size_t currentStep); void handleWEFAC( const DeckKeyword& keyword, size_t currentStep, const ParseContext& parseContext, ErrorGuard& errors); void handleTUNING( const DeckKeyword& keyword, size_t currentStep); + void handleNUPCOL( const DeckKeyword& keyword, size_t currentStep); void handleGRUPTREE( const DeckKeyword& keyword, size_t currentStep, const UnitSystem& unit_system, const ParseContext& parseContext, ErrorGuard& errors); void handleGRUPNET( const DeckKeyword& keyword, size_t currentStep, const UnitSystem& unit_system); void handleWRFT( const DeckKeyword& keyword, size_t currentStep); diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp index 1a502f4d3..ce7cbdeb2 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp @@ -123,7 +123,8 @@ namespace { udq_active(this->m_timeMap, std::make_shared()), guide_rate_model(this->m_timeMap, std::make_shared()), global_whistctl_mode(this->m_timeMap, WellProducer::CMODE_UNDEFINED), - rft_config(this->m_timeMap) + rft_config(this->m_timeMap), + m_nupcol(this->m_timeMap, 3) { addGroup( "FIELD", 0, deck.getActiveUnitSystem()); @@ -385,6 +386,9 @@ namespace { else if (keyword.name() == "VFPPROD") handleVFPPROD(keyword, unit_system, currentStep); + else if (keyword.name() == "NUPCOL") + handleNUPCOL(keyword, currentStep); + else if (geoModifiers.find( keyword.name() ) != geoModifiers.end()) { bool supported = geoModifiers.at( keyword.name() ); if (supported) { @@ -515,6 +519,12 @@ namespace { } } + void Schedule::handleNUPCOL( const DeckKeyword& keyword, size_t currentStep) { + const int nupcol = keyword.getRecord(0).getItem("NUM_ITER").get(0); + this->m_nupcol.update(currentStep, nupcol); + } + + void Schedule::handleCOMPORD(const ParseContext& parseContext, ErrorGuard& errors, const DeckKeyword& compordKeyword, size_t /* currentStep */) { for (const auto& record : compordKeyword) { @@ -2565,5 +2575,10 @@ void Schedule::handleGRUPTREE( const DeckKeyword& keyword, size_t currentStep, c } + int Schedule::getNupcol(size_t reportStep) const { + return this->m_nupcol.get(reportStep); + } + + } diff --git a/tests/parser/ScheduleTests.cpp b/tests/parser/ScheduleTests.cpp index 08767a650..d865e3eae 100644 --- a/tests/parser/ScheduleTests.cpp +++ b/tests/parser/ScheduleTests.cpp @@ -3336,3 +3336,40 @@ BOOST_AUTO_TEST_CASE(RFT_CONFIG2) { const auto& rft_config = schedule.rftConfig(); BOOST_CHECK_EQUAL(1, rft_config.firstRFTOutput()); } + + +BOOST_AUTO_TEST_CASE(nupcol) { + Opm::Parser parser; + std::string input = + "START -- 0 \n" + "19 JUN 2007 / \n" + "SCHEDULE\n" + "DATES\n -- 1\n" + " 10 OKT 2008 / \n" + "/\n" + "NUPCOL\n" + " 4 /\n" + "DATES\n -- 1\n" + " 10 OKT 2009 / \n" + "/\n" + "NUPCOL\n" + " 10 /\n" + "DATES\n -- 1\n" + " 10 OKT 2010 / \n" + "/\n" + + ; + + auto deck = parser.parseString(input); + EclipseGrid grid(10,10,10); + TableManager table ( deck ); + Eclipse3DProperties eclipseProperties ( deck , table, grid); + Runspec runspec (deck); + Schedule schedule( deck, grid, eclipseProperties,runspec); + + { + BOOST_CHECK_EQUAL(schedule.getNupcol(0),3); + BOOST_CHECK_EQUAL(schedule.getNupcol(1),4); + BOOST_CHECK_EQUAL(schedule.getNupcol(2),10); + } +}