adding stopped wells list to DynamicListEconLimited

when well is closed due to rate economic limits, based on the auto
shut-in configuration, the well can be STOP or SHUT.

When well is closed due to all the connections are closed, it should be
SHUT.
This commit is contained in:
Kai Bao 2016-06-29 14:46:24 +02:00
parent eb163e648c
commit 28636aad5c
3 changed files with 30 additions and 22 deletions

View File

@ -33,23 +33,29 @@ namespace Opm
{
public:
bool anyWellEconLimited() const {
return !(m_shut_wells.empty());
};
bool wellEconLimited(const std::string& well_name) const {
return std::find(m_shut_wells.begin(), m_shut_wells.end(), well_name) != m_shut_wells.end();
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();
};
void addShuttedWell(const std::string& well_name) {
// the well should not be in the list
// TODO: not sure wheter a shutted well can
// still be running through some other mechanism.
assert( !wellEconLimited(well_name) );
assert( !wellShuttedEconLimited(well_name) );
assert( !wellStoppedEconLimited(well_name) );
m_shut_wells.push_back(well_name);
m_shutted_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( !wellShuttedEconLimited(well_name) );
assert( !wellStoppedEconLimited(well_name) );
m_stopped_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());
@ -65,7 +71,8 @@ namespace Opm
void addClosedConnectionsForWell(const std::string& well_name,
const int cell_closed_connection) {
if (connectionClosedForWell(well_name)) {
if (!connectionClosedForWell(well_name)) {
// first time adding a connection for the well
std::vector<int> vector_cells = {cell_closed_connection};
m_cells_closed_connections[well_name] = vector_cells;
} else {
@ -74,7 +81,8 @@ namespace Opm
}
private:
std::vector <std::string> m_shut_wells;
std::vector <std::string> m_shutted_wells;
std::vector <std::string> m_stopped_wells;
// using grid cell number to indicate the location of the connections
std::map<std::string, std::vector<int>> m_cells_closed_connections;
};

View File

@ -433,20 +433,21 @@ namespace Opm
const auto* well = (*wellIter);
if (well->getStatus(timeStep) == WellCommon::STOP) {
// STOPed wells are kept in the well list but marked as stopped.
well_controls_stop_well(w_->ctrls[well_index]);
}
if (well->getStatus(timeStep) == WellCommon::SHUT) {
//SHUT wells are not added to the well list
continue;
}
if (list_econ_limited.wellEconLimited(well->name())) {
if (list_econ_limited.wellShuttedEconLimited(well->name())) {
continue;
}
if (well->getStatus(timeStep) == WellCommon::STOP || list_econ_limited.wellStoppedEconLimited(well->name())) {
// Stopped wells are kept in the well list but marked as stopped.
well_controls_stop_well(w_->ctrls[well_index]);
}
if (well->isInjector(timeStep)) {
const WellInjectionProperties& injectionProperties = well->getInjectionProperties(timeStep);
int ok = 1;

View File

@ -145,8 +145,7 @@ void WellsManager::createWellsFromSpecs(std::vector<const Well*>& wells, size_t
continue;
}
if (list_econ_limited.wellEconLimited(well->name())) {
// std::cout << " the well " << well->name() << " was closed " << std::endl;
if (list_econ_limited.wellShuttedEconLimited(well->name())) {
continue;
}