From 509c8a71a07b6569f8e46304dd39252f09744f2a Mon Sep 17 00:00:00 2001 From: Joakim Hove Date: Wed, 3 Feb 2021 10:43:56 +0100 Subject: [PATCH 1/9] Remove runtime argument from Schedule::updateWellStatus() --- .../eclipse/EclipseState/Schedule/Schedule.hpp | 2 +- .../EclipseState/Schedule/KeywordHandlers.cpp | 16 ++++++++-------- .../eclipse/EclipseState/Schedule/Schedule.cpp | 12 ++++++------ 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp b/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp index 7eea4b63d..94ac1eb73 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp @@ -520,7 +520,7 @@ namespace Opm GTNode groupTree(const std::string& root_node, std::size_t report_step, std::size_t level, const std::optional& parent_name) const; bool checkGroups(const ParseContext& parseContext, ErrorGuard& errors); - bool updateWellStatus( const std::string& well, std::size_t reportStep, bool runtime, Well::Status status, std::optional = {}); + bool updateWellStatus( const std::string& well, std::size_t reportStep, Well::Status status, std::optional = {}); void addWellToGroup( const std::string& group_name, const std::string& well_name , std::size_t timeStep); void iterateScheduleSection(std::size_t load_start, std::size_t load_end, diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/KeywordHandlers.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/KeywordHandlers.cpp index c5731f547..a8223a887 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/KeywordHandlers.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/KeywordHandlers.cpp @@ -857,7 +857,7 @@ namespace { const Well::Status status = Well::StatusFromString(record.getItem("STATUS").getTrimmedString(0)); for (const auto& well_name : well_names) { - this->updateWellStatus( well_name , handlerContext.currentStep , false, status, handlerContext.keyword.location() ); + this->updateWellStatus( well_name , handlerContext.currentStep , status, handlerContext.keyword.location() ); std::optional alq_type; auto& dynamic_state = this->wells_static.at(well_name); @@ -909,7 +909,7 @@ namespace { "Well " + well2->name() + " is a history matched well with zero rate where crossflow is banned. " + "This well will be closed at " + std::to_string(m_timeMap.getTimePassedUntil(handlerContext.currentStep) / (60*60*24)) + " days"; OpmLog::note(msg); - this->updateWellStatus( well_name, handlerContext.currentStep, false, Well::Status::SHUT); + this->updateWellStatus( well_name, handlerContext.currentStep, Well::Status::SHUT); } } } @@ -926,7 +926,7 @@ namespace { const Well::Status status = Well::StatusFromString(record.getItem("STATUS").getTrimmedString(0)); for (const auto& well_name : well_names) { - bool update_well = this->updateWellStatus(well_name, handlerContext.currentStep, false, status, handlerContext.keyword.location()); + bool update_well = this->updateWellStatus(well_name, handlerContext.currentStep, status, handlerContext.keyword.location()); std::optional alq_type; auto& dynamic_state = this->wells_static.at(well_name); auto well2 = std::make_shared(*dynamic_state[handlerContext.currentStep]); @@ -981,7 +981,7 @@ namespace { const Well::Status status = Well::StatusFromString(record.getItem("STATUS").getTrimmedString(0)); for (const auto& well_name : well_names) { - this->updateWellStatus(well_name, handlerContext.currentStep, false, status, handlerContext.keyword.location()); + this->updateWellStatus(well_name, handlerContext.currentStep, status, handlerContext.keyword.location()); bool update_well = false; auto& dynamic_state = this->wells_static.at(well_name); @@ -1014,14 +1014,14 @@ namespace { if (injection->surfaceInjectionRate.is()) { if (injection->hasInjectionControl(Well::InjectorCMode::RATE) && injection->surfaceInjectionRate.zero()) { OpmLog::note(msg); - this->updateWellStatus( well_name, handlerContext.currentStep, false, Well::Status::SHUT); + this->updateWellStatus( well_name, handlerContext.currentStep, Well::Status::SHUT); } } if (injection->reservoirInjectionRate.is()) { if (injection->hasInjectionControl(Well::InjectorCMode::RESV) && injection->reservoirInjectionRate.zero()) { OpmLog::note(msg); - this->updateWellStatus( well_name, handlerContext.currentStep, false, Well::Status::SHUT); + this->updateWellStatus( well_name, handlerContext.currentStep, Well::Status::SHUT); } } } @@ -1043,7 +1043,7 @@ namespace { const Well::Status status = Well::StatusFromString( record.getItem("STATUS").getTrimmedString(0)); for (const auto& well_name : well_names) { - this->updateWellStatus(well_name, handlerContext.currentStep, false, status, handlerContext.keyword.location()); + this->updateWellStatus(well_name, handlerContext.currentStep, status, handlerContext.keyword.location()); bool update_well = false; auto& dynamic_state = this->wells_static.at(well_name); auto well2 = std::make_shared(*dynamic_state[handlerContext.currentStep]); @@ -1070,7 +1070,7 @@ namespace { "Well " + well_name + " is an injector with zero rate where crossflow is banned. " + "This well will be closed at " + std::to_string ( m_timeMap.getTimePassedUntil(handlerContext.currentStep) / (60*60*24) ) + " days"; OpmLog::note(msg); - this->updateWellStatus( well_name, handlerContext.currentStep, false, Well::Status::SHUT); + this->updateWellStatus( well_name, handlerContext.currentStep, Well::Status::SHUT); } } } diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp index 7e839992f..984db03d9 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp @@ -529,15 +529,15 @@ void Schedule::iterateScheduleSection(std::size_t load_start, std::size_t load_e } void Schedule::shut_well(const std::string& well_name, std::size_t report_step) { - this->updateWellStatus(well_name, report_step, true, Well::Status::SHUT); + this->updateWellStatus(well_name, report_step, Well::Status::SHUT); } void Schedule::open_well(const std::string& well_name, std::size_t report_step) { - this->updateWellStatus(well_name, report_step, true, Well::Status::OPEN); + this->updateWellStatus(well_name, report_step, Well::Status::OPEN); } void Schedule::stop_well(const std::string& well_name, std::size_t report_step) { - this->updateWellStatus(well_name, report_step, true, Well::Status::STOP); + this->updateWellStatus(well_name, report_step, Well::Status::STOP); } void Schedule::updateWell(std::shared_ptr well, std::size_t reportStep) { @@ -550,7 +550,7 @@ void Schedule::iterateScheduleSection(std::size_t load_start, std::size_t load_e Function is quite dangerous - because if this is called while holding a Well pointer that will go stale and needs to be refreshed. */ - bool Schedule::updateWellStatus( const std::string& well_name, std::size_t reportStep , bool runtime, Well::Status status, std::optional location) { + bool Schedule::updateWellStatus( const std::string& well_name, std::size_t reportStep, Well::Status status, std::optional location) { auto& dynamic_state = this->wells_static.at(well_name); auto well2 = std::make_shared(*dynamic_state[reportStep]); if (well2->getConnections().empty() && status == Well::Status::OPEN) { @@ -657,7 +657,7 @@ void Schedule::iterateScheduleSection(std::size_t load_start, std::size_t load_e + std::to_string( days ) + " days"; OpmLog::note(msg); } else { - this->updateWellStatus( wname, currentStep, runtime, well_status); + this->updateWellStatus( wname, currentStep, well_status); if (well_status == open) this->rft_config.addWellOpen(wname, currentStep); } @@ -1184,7 +1184,7 @@ void Schedule::iterateScheduleSection(std::size_t load_start, std::size_t load_e "All completions in well " + well.name() + " is shut at " + std::to_string ( m_timeMap.getTimePassedUntil(timeStep) / (60*60*24) ) + " days. \n" + "The well is therefore also shut."; OpmLog::note(msg); - this->updateWellStatus( well.name(), timeStep, false, Well::Status::SHUT); + this->updateWellStatus( well.name(), timeStep, Well::Status::SHUT); } } } From a47cdc1b6b65103014b0cbb75741235b0d525c7e Mon Sep 17 00:00:00 2001 From: Joakim Hove Date: Wed, 3 Feb 2021 11:16:58 +0100 Subject: [PATCH 2/9] Require Well::updateConnections() force argument --- .../eclipse/EclipseState/Schedule/Well/Well.hpp | 2 +- .../eclipse/EclipseState/Schedule/Well/Well.cpp | 14 +++++++------- tests/parser/ScheduleTests.cpp | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp b/opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp index f5fd86cb2..2cbe89cac 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp @@ -543,7 +543,7 @@ public: bool updateRefDepth(const std::optional& ref_dpeth); bool updateDrainageRadius(double drainage_radius); void updateSegments(std::shared_ptr segments_arg); - bool updateConnections(std::shared_ptr connections, std::size_t report_step, bool runtime, bool force = false); + bool updateConnections(std::shared_ptr connections, std::size_t, bool runtime, bool force); bool updateConnections(std::shared_ptr connections, std::size_t report_step, const EclipseGrid& grid, const std::vector& pvtnum); bool updateStatus(Status status); bool updateConnectionStatus(Status well_state, std::size_t report_step, bool runtime); diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp index 2a73f185e..56ae09158 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp @@ -645,7 +645,7 @@ bool Well::updateConnectionStatus(Status well_state, std::size_t report_step, bo c.setState(connection_state); new_connections->add(c); } - this->updateConnections(std::move(new_connections), report_step, runtime); + this->updateConnections(std::move(new_connections), report_step, runtime, false); return true; } @@ -689,7 +689,7 @@ bool Well::updateAutoShutin(bool auto_shutin) { } -bool Well::updateConnections(std::shared_ptr connections_arg, std::size_t report_step, bool runtime, bool force) { +bool Well::updateConnections(std::shared_ptr connections_arg, std::size_t, bool runtime, bool force) { connections_arg->order( ); if (force || *this->connections != *connections_arg) { this->connections = connections_arg; @@ -710,7 +710,7 @@ bool Well::updateConnections(std::shared_ptr connections_arg, s } bool Well::updateConnections(std::shared_ptr connections_arg, std::size_t report_step, const EclipseGrid& grid, const std::vector& pvtnum) { - bool update = this->updateConnections(connections_arg, report_step, false); + bool update = this->updateConnections(connections_arg, report_step, false, false); if (this->pvt_table == 0 && !this->connections->empty()) { const auto& lowest = this->connections->lowest(); auto active_index = grid.activeIndex(lowest.global_index()); @@ -738,7 +738,7 @@ bool Well::handleCOMPSEGS(const DeckKeyword& keyword, auto [new_connections, new_segments] = Compsegs::processCOMPSEGS(keyword, *this->connections, *this->segments , grid, parseContext, errors); - this->updateConnections( std::make_shared(std::move(new_connections)), report_step, false ); + this->updateConnections( std::make_shared(std::move(new_connections)), report_step, false, false ); this->updateSegments( std::make_shared( std::move(new_segments)) ); return true; } @@ -1058,7 +1058,7 @@ bool Well::handleWELOPENConnections(const DeckRecord& record, std::size_t report new_connections->add(c); } - return this->updateConnections(std::move(new_connections), report_step, runtime); + return this->updateConnections(std::move(new_connections), report_step, runtime, false); } @@ -1088,7 +1088,7 @@ bool Well::handleCOMPLUMP(const DeckRecord& record, std::size_t report_step) { new_connections->add(c); } - return this->updateConnections(std::move(new_connections), report_step, false); + return this->updateConnections(std::move(new_connections), report_step, false, false); } @@ -1115,7 +1115,7 @@ bool Well::handleWPIMULT(const DeckRecord& record, std::size_t report_step) { new_connections->add(c); } - return this->updateConnections(std::move(new_connections), report_step, false); + return this->updateConnections(std::move(new_connections), report_step, false, false); } diff --git a/tests/parser/ScheduleTests.cpp b/tests/parser/ScheduleTests.cpp index 9e3156abf..f9c7853b6 100644 --- a/tests/parser/ScheduleTests.cpp +++ b/tests/parser/ScheduleTests.cpp @@ -3259,8 +3259,8 @@ BOOST_AUTO_TEST_CASE(WELL_STATIC) { 10, 100); - BOOST_CHECK( ws.updateConnections(c2, 0, false) ); - BOOST_CHECK( !ws.updateConnections(c2, 0, false) ); + BOOST_CHECK( ws.updateConnections(c2, 0, false, false) ); + BOOST_CHECK( !ws.updateConnections(c2, 0, false, false) ); } From e7f72ddb8ac466191e4d77d1049da4d0dae8d393 Mon Sep 17 00:00:00 2001 From: Joakim Hove Date: Wed, 3 Feb 2021 11:27:10 +0100 Subject: [PATCH 3/9] Remove unsused argument report_step in Well::updateConnections() --- .../eclipse/EclipseState/Schedule/Well/Well.hpp | 2 +- .../EclipseState/Schedule/KeywordHandlers.cpp | 2 +- .../eclipse/EclipseState/Schedule/Well/Well.cpp | 14 +++++++------- tests/parser/ScheduleTests.cpp | 4 ++-- tests/parser/WellTests.cpp | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp b/opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp index 2cbe89cac..caf1eb53c 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp @@ -543,7 +543,7 @@ public: bool updateRefDepth(const std::optional& ref_dpeth); bool updateDrainageRadius(double drainage_radius); void updateSegments(std::shared_ptr segments_arg); - bool updateConnections(std::shared_ptr connections, std::size_t, bool runtime, bool force); + bool updateConnections(std::shared_ptr connections, bool runtime, bool force); bool updateConnections(std::shared_ptr connections, std::size_t report_step, const EclipseGrid& grid, const std::vector& pvtnum); bool updateStatus(Status status); bool updateConnectionStatus(Status well_state, std::size_t report_step, bool runtime); diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/KeywordHandlers.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/KeywordHandlers.cpp index a8223a887..d6899cb02 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/KeywordHandlers.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/KeywordHandlers.cpp @@ -1158,7 +1158,7 @@ namespace { // Well::updateWellProductivityIndex() implicitly mutates // internal state in the WellConnections class. auto connections = std::make_shared(well2->getConnections()); - well2->updateConnections(std::move(connections), event_step, false, true); + well2->updateConnections(std::move(connections), false, true); if (well2->updateWellProductivityIndex(rawProdIndex)) this->updateWell(std::move(well2), event_step); diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp index 56ae09158..e1745dbe2 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp @@ -645,7 +645,7 @@ bool Well::updateConnectionStatus(Status well_state, std::size_t report_step, bo c.setState(connection_state); new_connections->add(c); } - this->updateConnections(std::move(new_connections), report_step, runtime, false); + this->updateConnections(std::move(new_connections), runtime, false); return true; } @@ -689,7 +689,7 @@ bool Well::updateAutoShutin(bool auto_shutin) { } -bool Well::updateConnections(std::shared_ptr connections_arg, std::size_t, bool runtime, bool force) { +bool Well::updateConnections(std::shared_ptr connections_arg, bool runtime, bool force) { connections_arg->order( ); if (force || *this->connections != *connections_arg) { this->connections = connections_arg; @@ -710,7 +710,7 @@ bool Well::updateConnections(std::shared_ptr connections_arg, s } bool Well::updateConnections(std::shared_ptr connections_arg, std::size_t report_step, const EclipseGrid& grid, const std::vector& pvtnum) { - bool update = this->updateConnections(connections_arg, report_step, false, false); + bool update = this->updateConnections(connections_arg, false, false); if (this->pvt_table == 0 && !this->connections->empty()) { const auto& lowest = this->connections->lowest(); auto active_index = grid.activeIndex(lowest.global_index()); @@ -738,7 +738,7 @@ bool Well::handleCOMPSEGS(const DeckKeyword& keyword, auto [new_connections, new_segments] = Compsegs::processCOMPSEGS(keyword, *this->connections, *this->segments , grid, parseContext, errors); - this->updateConnections( std::make_shared(std::move(new_connections)), report_step, false, false ); + this->updateConnections( std::make_shared(std::move(new_connections)), false, false ); this->updateSegments( std::make_shared( std::move(new_segments)) ); return true; } @@ -1058,7 +1058,7 @@ bool Well::handleWELOPENConnections(const DeckRecord& record, std::size_t report new_connections->add(c); } - return this->updateConnections(std::move(new_connections), report_step, runtime, false); + return this->updateConnections(std::move(new_connections), runtime, false); } @@ -1088,7 +1088,7 @@ bool Well::handleCOMPLUMP(const DeckRecord& record, std::size_t report_step) { new_connections->add(c); } - return this->updateConnections(std::move(new_connections), report_step, false, false); + return this->updateConnections(std::move(new_connections), false, false); } @@ -1115,7 +1115,7 @@ bool Well::handleWPIMULT(const DeckRecord& record, std::size_t report_step) { new_connections->add(c); } - return this->updateConnections(std::move(new_connections), report_step, false, false); + return this->updateConnections(std::move(new_connections), false, false); } diff --git a/tests/parser/ScheduleTests.cpp b/tests/parser/ScheduleTests.cpp index f9c7853b6..ee83ae495 100644 --- a/tests/parser/ScheduleTests.cpp +++ b/tests/parser/ScheduleTests.cpp @@ -3259,8 +3259,8 @@ BOOST_AUTO_TEST_CASE(WELL_STATIC) { 10, 100); - BOOST_CHECK( ws.updateConnections(c2, 0, false, false) ); - BOOST_CHECK( !ws.updateConnections(c2, 0, false, false) ); + BOOST_CHECK( ws.updateConnections(c2, false, false) ); + BOOST_CHECK( !ws.updateConnections(c2, false, false) ); } diff --git a/tests/parser/WellTests.cpp b/tests/parser/WellTests.cpp index f9d9caba1..f9602ca47 100644 --- a/tests/parser/WellTests.cpp +++ b/tests/parser/WellTests.cpp @@ -1343,7 +1343,7 @@ END "P and Q must have the same internal connections pointers"); auto connQ = std::make_shared(wellP.getConnections()); - wellQ.updateConnections(std::move(connQ), 0, true, true); + wellQ.updateConnections(std::move(connQ), true, true); BOOST_CHECK_MESSAGE(! wellP.hasSameConnectionsPointers(wellQ), "P and Q must NOT have the same internal connections pointers " "after forcibly updating the connections structure"); From 4aa0d5ac56b1f43587efa534bccc6806f756fd87 Mon Sep 17 00:00:00 2001 From: Joakim Hove Date: Wed, 3 Feb 2021 11:31:52 +0100 Subject: [PATCH 4/9] Remove unused method Well::updateConnectionStatus() --- .../EclipseState/Schedule/Well/Well.hpp | 1 - .../EclipseState/Schedule/Well/Well.cpp | 31 ------------------- 2 files changed, 32 deletions(-) diff --git a/opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp b/opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp index caf1eb53c..e7af5a87a 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp @@ -546,7 +546,6 @@ public: bool updateConnections(std::shared_ptr connections, bool runtime, bool force); bool updateConnections(std::shared_ptr connections, std::size_t report_step, const EclipseGrid& grid, const std::vector& pvtnum); bool updateStatus(Status status); - bool updateConnectionStatus(Status well_state, std::size_t report_step, bool runtime); bool updateGroup(const std::string& group); bool updateWellGuideRate(bool available, double guide_rate, GuideRateTarget guide_phase, double scale_factor); bool updateWellGuideRate(double guide_rate); diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp index e1745dbe2..2af15d08e 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp @@ -618,37 +618,6 @@ bool Well::updateStatus(Status well_state) { -bool Well::updateConnectionStatus(Status well_state, std::size_t report_step, bool runtime) { - Connection::State connection_state; - if (runtime) - throw std::logic_error("runtime and update_connections can not be combined"); - - switch (well_state) { - case Status::OPEN: - connection_state = Connection::State::OPEN; - break; - case Status::SHUT: - connection_state = Connection::State::SHUT; - break; - case Status::AUTO: - connection_state = Connection::State::AUTO; - break; - case Status::STOP: - connection_state = Connection::State::SHUT; - break; - default: - throw std::logic_error("Bug - should not be here"); - } - - auto new_connections = std::make_shared(this->connections->ordering(), this->headI, this->headJ); - for (auto c : *this->connections) { - c.setState(connection_state); - new_connections->add(c); - } - this->updateConnections(std::move(new_connections), runtime, false); - return true; -} - bool Well::updateRefDepth(const std::optional& ref_depth_arg) { From 5580165fee5a42e6b131d8e42eed9f566d9eb7c0 Mon Sep 17 00:00:00 2001 From: Joakim Hove Date: Wed, 3 Feb 2021 11:40:38 +0100 Subject: [PATCH 5/9] Remove report_step argument in Well::updateConnections() --- opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp | 2 +- .../parser/eclipse/EclipseState/Schedule/KeywordHandlers.cpp | 2 +- src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp | 4 ++-- src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp b/opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp index e7af5a87a..a1078bcfa 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp @@ -544,7 +544,7 @@ public: bool updateDrainageRadius(double drainage_radius); void updateSegments(std::shared_ptr segments_arg); bool updateConnections(std::shared_ptr connections, bool runtime, bool force); - bool updateConnections(std::shared_ptr connections, std::size_t report_step, const EclipseGrid& grid, const std::vector& pvtnum); + bool updateConnections(std::shared_ptr connections, const EclipseGrid& grid, const std::vector& pvtnum); bool updateStatus(Status status); bool updateGroup(const std::string& group); bool updateWellGuideRate(bool available, double guide_rate, GuideRateTarget guide_phase, double scale_factor); diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/KeywordHandlers.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/KeywordHandlers.cpp index d6899cb02..12f10354b 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/KeywordHandlers.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/KeywordHandlers.cpp @@ -159,7 +159,7 @@ namespace { auto well2 = std::shared_ptr(new Well( this->getWell(name, handlerContext.currentStep))); auto connections = std::shared_ptr( new WellConnections( well2->getConnections())); connections->loadCOMPDAT(record, *handlerContext.grid_ptr, *handlerContext.fp_ptr, name, handlerContext.keyword.location()); - if (well2->updateConnections(connections, handlerContext.currentStep, *handlerContext.grid_ptr, handlerContext.fp_ptr->get_int("PVTNUM"))) { + if (well2->updateConnections(connections, *handlerContext.grid_ptr, handlerContext.fp_ptr->get_int("PVTNUM"))) { this->updateWell(std::move(well2), handlerContext.currentStep); wells.insert( name ); } diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp index 984db03d9..77f82947b 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp @@ -1452,7 +1452,7 @@ namespace { rst_well.ij[0], rst_well.ij[1], rst_connections); - well.updateConnections( std::make_shared( std::move(connections) ), report_step, grid, fp.get_int("PVTNUM")); + well.updateConnections( std::make_shared( std::move(connections) ), grid, fp.get_int("PVTNUM")); } else { std::unordered_map rst_segments; for (const auto& rst_segment : rst_well.segments) { @@ -1461,7 +1461,7 @@ namespace { } auto [connections, segments] = Compsegs::rstUpdate(rst_well, rst_connections, rst_segments); - well.updateConnections( std::make_shared(std::move(connections)), report_step, grid, fp.get_int("PVTNUM")); + well.updateConnections( std::make_shared(std::move(connections)), grid, fp.get_int("PVTNUM")); well.updateSegments( std::make_shared(std::move(segments) )); } diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp index 2af15d08e..9e5613018 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp @@ -678,7 +678,7 @@ bool Well::updateConnections(std::shared_ptr connections_arg, b return false; } -bool Well::updateConnections(std::shared_ptr connections_arg, std::size_t report_step, const EclipseGrid& grid, const std::vector& pvtnum) { +bool Well::updateConnections(std::shared_ptr connections_arg, const EclipseGrid& grid, const std::vector& pvtnum) { bool update = this->updateConnections(connections_arg, false, false); if (this->pvt_table == 0 && !this->connections->empty()) { const auto& lowest = this->connections->lowest(); From fa85bc64456e05bd0066b08ec325372329a2cf89 Mon Sep 17 00:00:00 2001 From: Joakim Hove Date: Wed, 3 Feb 2021 11:45:18 +0100 Subject: [PATCH 6/9] Remove report_step argument from Well::handleCOMPSEGS() --- opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp | 2 +- .../parser/eclipse/EclipseState/Schedule/KeywordHandlers.cpp | 2 +- src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp b/opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp index a1078bcfa..cb6aba1a3 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp @@ -566,7 +566,7 @@ public: void updateWPaveRefDepth(double ref_depth); bool handleWELSEGS(const DeckKeyword& keyword); - bool handleCOMPSEGS(const DeckKeyword& keyword, std::size_t report_step, const EclipseGrid& grid, const ParseContext& parseContext, ErrorGuard& errors); + bool handleCOMPSEGS(const DeckKeyword& keyword, const EclipseGrid& grid, const ParseContext& parseContext, ErrorGuard& errors); bool handleWELOPENConnections(const DeckRecord& record, std::size_t report_step, Connection::State status, bool action_mode); bool handleCOMPLUMP(const DeckRecord& record, std::size_t report_step); bool handleWPIMULT(const DeckRecord& record, std::size_t report_step); diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/KeywordHandlers.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/KeywordHandlers.cpp index 12f10354b..55389bd8a 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/KeywordHandlers.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/KeywordHandlers.cpp @@ -236,7 +236,7 @@ namespace { return; } - if (well_ptr->handleCOMPSEGS(handlerContext.keyword, handlerContext.currentStep, *handlerContext.grid_ptr, parseContext, errors)) + if (well_ptr->handleCOMPSEGS(handlerContext.keyword, *handlerContext.grid_ptr, parseContext, errors)) this->updateWell(std::move(well_ptr), handlerContext.currentStep); } diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp index 9e5613018..e81e8b253 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp @@ -700,7 +700,6 @@ bool Well::updateSolventFraction(double solvent_fraction_arg) { bool Well::handleCOMPSEGS(const DeckKeyword& keyword, - std::size_t report_step, const EclipseGrid& grid, const ParseContext& parseContext, ErrorGuard& errors) { From 29274ed3152fee1cda52a66050ddfb0b56e2145b Mon Sep 17 00:00:00 2001 From: Joakim Hove Date: Wed, 3 Feb 2021 11:46:48 +0100 Subject: [PATCH 7/9] Remove report_step argument from Well::handleCOMPLUMP() --- opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp | 2 +- .../parser/eclipse/EclipseState/Schedule/KeywordHandlers.cpp | 2 +- src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp b/opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp index cb6aba1a3..f7c7613aa 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp @@ -568,7 +568,7 @@ public: bool handleWELSEGS(const DeckKeyword& keyword); bool handleCOMPSEGS(const DeckKeyword& keyword, const EclipseGrid& grid, const ParseContext& parseContext, ErrorGuard& errors); bool handleWELOPENConnections(const DeckRecord& record, std::size_t report_step, Connection::State status, bool action_mode); - bool handleCOMPLUMP(const DeckRecord& record, std::size_t report_step); + bool handleCOMPLUMP(const DeckRecord& record); bool handleWPIMULT(const DeckRecord& record, std::size_t report_step); void filterConnections(const ActiveGridCells& grid); diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/KeywordHandlers.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/KeywordHandlers.cpp index 55389bd8a..4a1aa22df 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/KeywordHandlers.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/KeywordHandlers.cpp @@ -195,7 +195,7 @@ namespace { for (const auto& wname : well_names) { auto& dynamic_state = this->wells_static.at(wname); auto well_ptr = std::make_shared( *dynamic_state[handlerContext.currentStep] ); - if (well_ptr->handleCOMPLUMP(record, handlerContext.currentStep)) + if (well_ptr->handleCOMPLUMP(record)) this->updateWell(std::move(well_ptr), handlerContext.currentStep); } } diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp index e81e8b253..eaeaf385a 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp @@ -1033,7 +1033,7 @@ bool Well::handleWELOPENConnections(const DeckRecord& record, std::size_t report -bool Well::handleCOMPLUMP(const DeckRecord& record, std::size_t report_step) { +bool Well::handleCOMPLUMP(const DeckRecord& record) { auto match = [=]( const Connection &c) -> bool { if (!match_eq(c.getI(), record, "I" , -1)) return false; From d1178bdd38c8a9e768119667d6014cf27109ee69 Mon Sep 17 00:00:00 2001 From: Joakim Hove Date: Wed, 3 Feb 2021 11:47:39 +0100 Subject: [PATCH 8/9] Remocve report_step argument from Well::handleWPIMULT() --- opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp | 2 +- .../parser/eclipse/EclipseState/Schedule/KeywordHandlers.cpp | 2 +- src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp b/opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp index f7c7613aa..ffefd8506 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp @@ -569,7 +569,7 @@ public: bool handleCOMPSEGS(const DeckKeyword& keyword, const EclipseGrid& grid, const ParseContext& parseContext, ErrorGuard& errors); bool handleWELOPENConnections(const DeckRecord& record, std::size_t report_step, Connection::State status, bool action_mode); bool handleCOMPLUMP(const DeckRecord& record); - bool handleWPIMULT(const DeckRecord& record, std::size_t report_step); + bool handleWPIMULT(const DeckRecord& record); void filterConnections(const ActiveGridCells& grid); ProductionControls productionControls(const SummaryState& st) const; diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/KeywordHandlers.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/KeywordHandlers.cpp index 4a1aa22df..592bea40c 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/KeywordHandlers.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/KeywordHandlers.cpp @@ -1538,7 +1538,7 @@ namespace { for (const auto& wname : well_names) { auto& dynamic_state = this->wells_static.at(wname); auto well_ptr = std::make_shared( *dynamic_state[handlerContext.currentStep] ); - if (well_ptr->handleWPIMULT(record, handlerContext.currentStep)) + if (well_ptr->handleWPIMULT(record)) this->updateWell(std::move(well_ptr), handlerContext.currentStep); } } diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp index eaeaf385a..01d369880 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp @@ -1061,7 +1061,7 @@ bool Well::handleCOMPLUMP(const DeckRecord& record) { -bool Well::handleWPIMULT(const DeckRecord& record, std::size_t report_step) { +bool Well::handleWPIMULT(const DeckRecord& record) { auto match = [=]( const Connection &c) -> bool { if (!match_ge(c.complnum(), record, "FIRST")) return false; From 3936af4f9ecaa744434412c55dcebbd93c8213ed Mon Sep 17 00:00:00 2001 From: Joakim Hove Date: Wed, 3 Feb 2021 11:50:25 +0100 Subject: [PATCH 9/9] Remove report_step argument from Well::handleWELOPENConnections() --- opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp | 2 +- src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp | 2 +- src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp b/opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp index ffefd8506..ed9ef574b 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp @@ -567,7 +567,7 @@ public: bool handleWELSEGS(const DeckKeyword& keyword); bool handleCOMPSEGS(const DeckKeyword& keyword, const EclipseGrid& grid, const ParseContext& parseContext, ErrorGuard& errors); - bool handleWELOPENConnections(const DeckRecord& record, std::size_t report_step, Connection::State status, bool action_mode); + bool handleWELOPENConnections(const DeckRecord& record, Connection::State status, bool action_mode); bool handleCOMPLUMP(const DeckRecord& record); bool handleWPIMULT(const DeckRecord& record); diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp index 77f82947b..ad1508e79 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Schedule.cpp @@ -684,7 +684,7 @@ void Schedule::iterateScheduleSection(std::size_t load_start, std::size_t load_e { auto& dynamic_state = this->wells_static.at(wname); auto well_ptr = std::make_shared( *dynamic_state[currentStep] ); - if (well_ptr->handleWELOPENConnections(record, currentStep, connection_status, runtime)) + if (well_ptr->handleWELOPENConnections(record, connection_status, runtime)) dynamic_state.update(currentStep, std::move(well_ptr)); } diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp index 01d369880..2911ffc60 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp @@ -1006,7 +1006,7 @@ int Well::fip_region_number() const { */ -bool Well::handleWELOPENConnections(const DeckRecord& record, std::size_t report_step, Connection::State state_arg, bool runtime) { +bool Well::handleWELOPENConnections(const DeckRecord& record, Connection::State state_arg, bool runtime) { auto match = [=]( const Connection &c) -> bool { if (!match_eq(c.getI(), record, "I" , -1)) return false;