handling connection closing in DynamicListEconLimited

due to econ limits.
This commit is contained in:
Kai Bao 2016-06-28 15:12:24 +02:00
parent c64d33fbd3
commit eb163e648c
2 changed files with 41 additions and 0 deletions

View File

@ -21,6 +21,7 @@
#include <vector> #include <vector>
#include <string> #include <string>
#include <map>
#include <cassert> #include <cassert>
@ -31,6 +32,7 @@ namespace Opm
class DynamicListEconLimited class DynamicListEconLimited
{ {
public: public:
bool anyWellEconLimited() const { bool anyWellEconLimited() const {
return !(m_shut_wells.empty()); return !(m_shut_wells.empty());
}; };
@ -48,8 +50,33 @@ namespace Opm
m_shut_wells.push_back(well_name); m_shut_wells.push_back(well_name);
}; };
// TODO: maybe completion better here
bool connectionClosedForWell(const std::string& well_name) const {
return (m_cells_closed_connections.find(well_name) != m_cells_closed_connections.end());
}
const std::vector<int>& getClosedConnectionsForWell(const std::string& well_name) const {
return (m_cells_closed_connections.find(well_name)->second);
}
std::vector<int>& 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)) {
std::vector<int> vector_cells = {cell_closed_connection};
m_cells_closed_connections[well_name] = vector_cells;
} else {
closedConnectionsForWell(well_name).push_back(cell_closed_connection);
}
}
private: private:
std::vector <std::string> m_shut_wells; std::vector <std::string> m_shut_wells;
// using grid cell number to indicate the location of the connections
std::map<std::string, std::vector<int>> m_cells_closed_connections;
}; };
} // namespace Opm } // namespace Opm

View File

@ -150,6 +150,11 @@ void WellsManager::createWellsFromSpecs(std::vector<const Well*>& wells, size_t
continue; continue;
} }
std::vector<int> cells_connection_closed;
if (list_econ_limited.connectionClosedForWell(well->name())) {
cells_connection_closed = list_econ_limited.getClosedConnectionsForWell(well->name());
}
{ // COMPDAT handling { // COMPDAT handling
auto completionSet = well->getCompletions(timeStep); auto completionSet = well->getCompletions(timeStep);
// shut completions and open ones stored in this process will have 1 others 0. // shut completions and open ones stored in this process will have 1 others 0.
@ -181,6 +186,15 @@ void WellsManager::createWellsFromSpecs(std::vector<const Well*>& wells, size_t
else else
{ {
int cell = cgit->second; 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; PerfData pd;
pd.cell = cell; pd.cell = cell;
{ {