diff --git a/CMakeLists_files.cmake b/CMakeLists_files.cmake index dae6f704d..2629fbd42 100644 --- a/CMakeLists_files.cmake +++ b/CMakeLists_files.cmake @@ -159,7 +159,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/WellsManager_impl.hpp opm/simulators/ParallelFileMerger.hpp opm/simulators/WellSwitchingLogger.hpp diff --git a/opm/autodiff/BlackoilWellModel.hpp b/opm/autodiff/BlackoilWellModel.hpp index 70e23753c..230651493 100644 --- a/opm/autodiff/BlackoilWellModel.hpp +++ b/opm/autodiff/BlackoilWellModel.hpp @@ -37,7 +37,6 @@ #include #include -#include #include #include #include diff --git a/opm/autodiff/BlackoilWellModel_impl.hpp b/opm/autodiff/BlackoilWellModel_impl.hpp index 4898067f8..f340ab83f 100644 --- a/opm/autodiff/BlackoilWellModel_impl.hpp +++ b/opm/autodiff/BlackoilWellModel_impl.hpp @@ -180,10 +180,6 @@ namespace Opm { wells_ecl_ = schedule().getWells(timeStepIdx); // Create wells and well state. - // Pass empty dynamicListEconLimited class - // The closing of wells due to limites is - // handled by the wellTestState class - DynamicListEconLimited dynamic_list_econ_limited; wells_manager_.reset( new WellsManager (eclState, schedule(), timeStepIdx, @@ -193,7 +189,6 @@ namespace Opm { Opm::UgGridHelpers::dimensions(grid), Opm::UgGridHelpers::cell2Faces(grid), Opm::UgGridHelpers::beginFaceCentroids(grid), - dynamic_list_econ_limited, grid.comm().size() > 1, defunct_well_names) ); @@ -432,8 +427,6 @@ namespace Opm { BlackoilWellModel:: initFromRestartFile(const RestartValue& restartValues) { - // gives a dummy dynamic_list_econ_limited - DynamicListEconLimited dummyListEconLimited; const auto& defunctWellNames = ebosSimulator_.vanguard().defunctWellNames(); WellsManager wellsmanager(eclState(), schedule(), @@ -448,7 +441,6 @@ namespace Opm { Opm::UgGridHelpers::dimensions(grid()), Opm::UgGridHelpers::cell2Faces(grid()), Opm::UgGridHelpers::beginFaceCentroids(grid()), - dummyListEconLimited, grid().comm().size() > 1, defunctWellNames); diff --git a/opm/autodiff/SimFIBODetails.hpp b/opm/autodiff/SimFIBODetails.hpp index 8d5841921..08f495fb9 100644 --- a/opm/autodiff/SimFIBODetails.hpp +++ b/opm/autodiff/SimFIBODetails.hpp @@ -26,7 +26,6 @@ #include #include #include -#include namespace Opm { diff --git a/opm/core/wells/DynamicListEconLimited.hpp b/opm/core/wells/DynamicListEconLimited.hpp deleted file mode 100644 index 22bf2355d..000000000 --- a/opm/core/wells/DynamicListEconLimited.hpp +++ /dev/null @@ -1,92 +0,0 @@ -/* - Copyright 2016 SINTEF ICT, Applied Mathematics. - - This file is part of the Open Porous Media project (OPM). - - OPM is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OPM is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with OPM. If not, see . -*/ -#ifndef OPM_DYNAMICLISTECONLIMITED_HPP -#define OPM_DYNAMICLISTECONLIMITED_HPP - -#include -#include -#include - -#include - -namespace Opm -{ - - /// to handle the wells and connections violating economic limits. - class DynamicListEconLimited - { - public: - - DynamicListEconLimited() { - } - - 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 addShutWell(const std::string& well_name) { - assert( !wellShutEconLimited(well_name) ); - assert( !wellStoppedEconLimited(well_name) ); - - m_shut_wells.push_back(well_name); - } - - bool wellStoppedEconLimited(const std::string& well_name) const { - return std::find(m_stopped_wells.begin(), m_stopped_wells.end(), well_name) != m_stopped_wells.end(); - } - - void addStoppedWell(const std::string& well_name) { - assert( !wellShutEconLimited(well_name) ); - assert( !wellStoppedEconLimited(well_name) ); - - m_stopped_wells.push_back(well_name); - } - - - // TODO: maybe completion better here - bool anyConnectionClosedForWell(const std::string& well_name) const { - return (m_cells_closed_connections.find(well_name) != m_cells_closed_connections.end()); - } - - const std::vector& getClosedConnectionsForWell(const std::string& well_name) const { - return (m_cells_closed_connections.find(well_name)->second); - } - - void addClosedConnectionsForWell(const std::string& well_name, - const int cell_closed_connection) { - 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 { - std::vector& closed_connections = m_cells_closed_connections.find(well_name)->second; - closed_connections.push_back(cell_closed_connection); - } - } - - private: - 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 */ - diff --git a/opm/core/wells/WellsManager.cpp b/opm/core/wells/WellsManager.cpp index 247fd06d6..3f7a16657 100644 --- a/opm/core/wells/WellsManager.cpp +++ b/opm/core/wells/WellsManager.cpp @@ -204,14 +204,10 @@ namespace Opm const UnstructuredGrid& grid) : w_(create_wells(0,0,0)), is_parallel_run_(false) { - // 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; init(eclipseState, schedule, timeStep, UgGridHelpers::numCells(grid), - UgGridHelpers::globalCell(grid), UgGridHelpers::cartDims(grid), + UgGridHelpers::globalCell(grid), UgGridHelpers::cartDims(grid), UgGridHelpers::dimensions(grid), UgGridHelpers::cell2Faces(grid), UgGridHelpers::beginFaceCentroids(grid), - dummy_list_econ_limited, std::unordered_set()); } @@ -297,8 +293,7 @@ namespace Opm void WellsManager::setupWellControls(std::vector< const Well* >& wells, size_t timeStep, std::vector& well_names, const PhaseUsage& phaseUsage, - const std::vector& wells_on_proc, - const DynamicListEconLimited& list_econ_limited) { + const std::vector& wells_on_proc) { int well_index = 0; auto well_on_proc = wells_on_proc.begin(); @@ -316,11 +311,7 @@ namespace Opm continue; } - if (list_econ_limited.wellShutEconLimited(well->name())) { - continue; - } - - if (well->getStatus(timeStep) == WellCommon::STOP || list_econ_limited.wellStoppedEconLimited(well->name())) { + if (well->getStatus(timeStep) == WellCommon::STOP) { // Stopped wells are kept in the well list but marked as stopped. well_controls_stop_well(w_->ctrls[well_index]); } diff --git a/opm/core/wells/WellsManager.hpp b/opm/core/wells/WellsManager.hpp index 12e1512f2..4ebd58c6c 100644 --- a/opm/core/wells/WellsManager.hpp +++ b/opm/core/wells/WellsManager.hpp @@ -26,7 +26,6 @@ #include #include -#include #include #include @@ -93,7 +92,6 @@ namespace Opm int dimensions, const F2C& f2c, FC begin_face_centroids, - const DynamicListEconLimited& list_econ_limited, bool is_parallel_run=false, const std::unordered_set& deactivated_wells = std::unordered_set ()); @@ -164,7 +162,6 @@ namespace Opm int dimensions, const C2F& cell_to_faces, FC begin_face_centroids, - const DynamicListEconLimited& list_econ_limited, const std::unordered_set& deactivated_wells); // Disable copying and assignment. WellsManager(const WellsManager& other); @@ -172,8 +169,7 @@ namespace Opm static void setupCompressedToCartesian(const int* global_cell, int number_of_cells, std::map& cartesian_to_compressed ); void setupWellControls(std::vector& wells, size_t timeStep, std::vector& well_names, const PhaseUsage& phaseUsage, - const std::vector& wells_on_proc, - const DynamicListEconLimited& list_econ_limited); + const std::vector& wells_on_proc); template void createWellsFromSpecs( std::vector& wells, size_t timeStep, @@ -190,8 +186,7 @@ namespace Opm const double* permeability, const NTG& ntg, std::vector& wells_on_proc, - const std::unordered_set& deactivated_wells, - const DynamicListEconLimited& list_econ_limited); + const std::unordered_set& deactivated_wells); void setupGuideRates(std::vector& wells, const size_t timeStep, std::vector& well_data, std::map& well_names_to_index); diff --git a/opm/core/wells/WellsManager_impl.hpp b/opm/core/wells/WellsManager_impl.hpp index b6b1af27c..fa8c1f13f 100644 --- a/opm/core/wells/WellsManager_impl.hpp +++ b/opm/core/wells/WellsManager_impl.hpp @@ -116,8 +116,7 @@ void WellsManager::createWellsFromSpecs(std::vector& wells, size_t const double* permeability, const NTG& ntg, std::vector& wells_on_proc, - const std::unordered_set& ignored_wells, - const DynamicListEconLimited& list_econ_limited) + const std::unordered_set& ignored_wells) { if (dimensions != 3) { OPM_THROW(std::domain_error, @@ -146,15 +145,6 @@ void WellsManager::createWellsFromSpecs(std::vector& wells, size_t continue; } - if (list_econ_limited.wellShutEconLimited(well->name())) { - continue; - } - - std::vector cells_connection_closed; - if (list_econ_limited.anyConnectionClosedForWell(well->name())) { - cells_connection_closed = list_econ_limited.getClosedConnectionsForWell(well->name()); - } - { // COMPDAT handling // shut completions and open ones stored in this process will have 1 others 0. @@ -175,15 +165,6 @@ void WellsManager::createWellsFromSpecs(std::vector& wells, size_t else { 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) - != cells_connection_closed.end(); - if (connection_found) { - continue; - } - } PerfData pd; pd.cell = cell; @@ -286,14 +267,13 @@ WellsManager(const Opm::EclipseState& eclipseState, int dimensions, const C2F& cell_to_faces, FC begin_face_centroids, - const DynamicListEconLimited& list_econ_limited, bool is_parallel_run, const std::unordered_set& deactivated_wells) : w_(create_wells(0,0,0)), is_parallel_run_(is_parallel_run) { init(eclipseState, schedule, timeStep, number_of_cells, global_cell, cart_dims, dimensions, - cell_to_faces, begin_face_centroids, list_econ_limited, deactivated_wells); + cell_to_faces, begin_face_centroids, deactivated_wells); } /// Construct wells from deck. @@ -308,7 +288,6 @@ WellsManager::init(const Opm::EclipseState& eclipseState, int dimensions, const C2F& cell_to_faces, FC begin_face_centroids, - const DynamicListEconLimited& list_econ_limited, const std::unordered_set& deactivated_wells) { if (dimensions != 3) { @@ -379,9 +358,9 @@ WellsManager::init(const Opm::EclipseState& eclipseState, dz, well_names, well_data, well_names_to_index, pu, cartesian_to_compressed, interleavedPerm.data(), ntg, - wells_on_proc, deactivated_wells, list_econ_limited); + wells_on_proc, deactivated_wells); - setupWellControls(wells, timeStep, well_names, pu, wells_on_proc, list_econ_limited); + setupWellControls(wells, timeStep, well_names, pu, wells_on_proc); { const auto& fieldGroup = schedule.getGroup( "FIELD" ); diff --git a/tests/test_wellmodel.cpp b/tests/test_wellmodel.cpp index c48761b6b..8d9a4b985 100644 --- a/tests/test_wellmodel.cpp +++ b/tests/test_wellmodel.cpp @@ -38,7 +38,6 @@ #include #include #include -#include #include #include @@ -89,9 +88,6 @@ struct SetupTest { std::vector compressed_to_cartesianIdx; Opm::createGlobalCellArray(grid, compressed_to_cartesianIdx); - // dummy_dynamic_list_econ_lmited - const Opm::DynamicListEconLimited dummy_dynamic_list; - current_timestep = 0; // Create wells. @@ -104,7 +100,6 @@ struct SetupTest { Opm::UgGridHelpers::dimensions(grid), Opm::UgGridHelpers::cell2Faces(grid), Opm::UgGridHelpers::beginFaceCentroids(grid), - dummy_dynamic_list, false, std::unordered_set() ) );