diff --git a/CMakeLists_files.cmake b/CMakeLists_files.cmake index c83fc49b..2f06010a 100644 --- a/CMakeLists_files.cmake +++ b/CMakeLists_files.cmake @@ -417,6 +417,6 @@ list (APPEND PUBLIC_HEADER_FILES opm/core/wells/WellCollection.hpp opm/core/wells/WellsGroup.hpp opm/core/wells/WellsManager.hpp - opm/core/wells/DynamicListEconLimited.hpp + opm/core/wells/DynamicListEconLimited.hpp opm/core/wells/WellsManager_impl.hpp ) diff --git a/opm/core/wells/DynamicListEconLimited.hpp b/opm/core/wells/DynamicListEconLimited.hpp index 9cde3c6c..cd8a2673 100644 --- a/opm/core/wells/DynamicListEconLimited.hpp +++ b/opm/core/wells/DynamicListEconLimited.hpp @@ -17,7 +17,7 @@ along with OPM. If not, see . */ #ifndef OPM_DYNAMICLISTECONLIMITED_HPP -#define OPM_DYNAMICLISTECONLIMITED_HPP +#define OPM_DYNAMICLISTECONLIMITED_HPP #include #include @@ -28,20 +28,20 @@ namespace Opm { - /// to handle the wells and connections voilating economic limits. + /// to handle the wells and connections violating economic limits. class DynamicListEconLimited { public: - bool wellShuttedEconLimited(const std::string& well_name) const { - return std::find(m_shutted_wells.begin(), m_shutted_wells.end(), well_name) != m_shutted_wells.end(); + bool wellShutEconLimited(const std::string& well_name) const { + return std::find(m_shut_wells.begin(), m_shut_wells.end(), well_name) != m_shut_wells.end(); }; - void addShuttedWell(const std::string& well_name) { - assert( !wellShuttedEconLimited(well_name) ); + void addShutWell(const std::string& well_name) { + assert( !wellShutEconLimited(well_name) ); assert( !wellStoppedEconLimited(well_name) ); - m_shutted_wells.push_back(well_name); + m_shut_wells.push_back(well_name); }; bool wellStoppedEconLimited(const std::string& well_name) const { @@ -49,7 +49,7 @@ namespace Opm }; void addStoppedWell(const std::string& well_name) { - assert( !wellShuttedEconLimited(well_name) ); + assert( !wellShutEconLimited(well_name) ); assert( !wellStoppedEconLimited(well_name) ); m_stopped_wells.push_back(well_name); @@ -57,7 +57,7 @@ namespace Opm // TODO: maybe completion better here - bool connectionClosedForWell(const std::string& well_name) const { + bool anyConnectionClosedForWell(const std::string& well_name) const { return (m_cells_closed_connections.find(well_name) != m_cells_closed_connections.end()); } @@ -65,28 +65,25 @@ namespace Opm return (m_cells_closed_connections.find(well_name)->second); } - std::vector& closedConnectionsForWell(const std::string& well_name) { - return (m_cells_closed_connections.find(well_name)->second); - } - void addClosedConnectionsForWell(const std::string& well_name, const int cell_closed_connection) { - if (!connectionClosedForWell(well_name)) { + if (!anyConnectionClosedForWell(well_name)) { // first time adding a connection for the well std::vector vector_cells = {cell_closed_connection}; m_cells_closed_connections[well_name] = vector_cells; } else { - closedConnectionsForWell(well_name).push_back(cell_closed_connection); + std::vector& closed_connections = m_cells_closed_connections.find(well_name)->second; + closed_connections.push_back(cell_closed_connection); } } private: - std::vector m_shutted_wells; + std::vector m_shut_wells; std::vector m_stopped_wells; // using grid cell number to indicate the location of the connections std::map> m_cells_closed_connections; }; } // namespace Opm -#endif /* OPM_DYNAMICLISTECONLIMITED_HPP */ +#endif /* OPM_DYNAMICLISTECONLIMITED_HPP */ diff --git a/opm/core/wells/WellsManager.cpp b/opm/core/wells/WellsManager.cpp index 072113b1..5a86c113 100644 --- a/opm/core/wells/WellsManager.cpp +++ b/opm/core/wells/WellsManager.cpp @@ -332,7 +332,7 @@ namespace Opm const double* permeability) : w_(0), is_parallel_run_(false) { - std::vector dummy_well_potentials;; + std::vector dummy_well_potentials; // TODO: not sure about the usage of this WellsManager constructor // TODO: not sure whether this is the correct thing to do here. DynamicListEconLimited dummy_list_econ_limited; @@ -438,7 +438,7 @@ namespace Opm continue; } - if (list_econ_limited.wellShuttedEconLimited(well->name())) { + if (list_econ_limited.wellShutEconLimited(well->name())) { continue; } diff --git a/opm/core/wells/WellsManager_impl.hpp b/opm/core/wells/WellsManager_impl.hpp index 08d10f79..c637eeff 100644 --- a/opm/core/wells/WellsManager_impl.hpp +++ b/opm/core/wells/WellsManager_impl.hpp @@ -145,12 +145,12 @@ void WellsManager::createWellsFromSpecs(std::vector& wells, size_t continue; } - if (list_econ_limited.wellShuttedEconLimited(well->name())) { + if (list_econ_limited.wellShutEconLimited(well->name())) { continue; } std::vector cells_connection_closed; - if (list_econ_limited.connectionClosedForWell(well->name())) { + if (list_econ_limited.anyConnectionClosedForWell(well->name())) { cells_connection_closed = list_econ_limited.getClosedConnectionsForWell(well->name()); } @@ -187,7 +187,8 @@ void WellsManager::createWellsFromSpecs(std::vector& wells, size_t int cell = cgit->second; // check if the connection is closed due to economic limits if (!cells_connection_closed.empty()) { - const bool connection_found = std::find(cells_connection_closed.begin(), cells_connection_closed.end(), cell) + const bool connection_found = std::find(cells_connection_closed.begin(), + cells_connection_closed.end(), cell) != cells_connection_closed.end(); if (connection_found) { continue;