Fix treatment of WELOPEN keyword.

Now you can actually shut and open wells with WELOPEN. The following
caveats apply:
 - this may interact improperly with group controls,
 - dynamic usage of WCONINJE/WCONPROD should not be mixed with WELOPEN.
This commit is contained in:
Atgeirr Flø Rasmussen 2012-09-20 14:35:03 +02:00
parent 50a23c0f5d
commit e3388575d6

View File

@ -716,32 +716,31 @@ namespace Opm
#endif #endif
if (deck.hasField("WELOPEN")) { if (deck.hasField("WELOPEN")) {
const WELOPEN& welopen = deck.getWELOPEN(); const WELOPEN& welopen = deck.getWELOPEN();
for (size_t i = 0; i < welopen.welopen.size(); ++i) {
for (size_t i = 0; i < welopen.welopen.size(); ++i) { WelopenLine line = welopen.welopen[i];
WelopenLine line = welopen.welopen[i]; std::string wellname = line.well_;
std::string wellname = line.well_; std::map<std::string, int>::const_iterator it = well_names_to_index.find(wellname);
std::map<std::string, int>::const_iterator it = well_names_to_index.find(wellname); if (it == well_names_to_index.end()) {
if (it == well_names_to_index.end()) { THROW("Trying to open/shut well with name: \"" << wellname<<"\" but it's not registered under WELSPECS.");
THROW("Trying to open/shut well with name: \"" << wellname<<"\" but it's not registered under WELSPECS."); }
} const int index = it->second;
int index = it->second; if (line.openshutflag_ == "SHUT") {
if (line.openshutflag_ == "SHUT") { int& cur_ctrl = w_->ctrls[index]->current;
// We currently don't care if the well is open or not. if (cur_ctrl >= 0) {
/// \TODO Should this perhaps be allowed? I.e. should it be if(well_shut) { shutwell(); } else { /* do nothing*/ }? cur_ctrl = ~cur_ctrl;
//ASSERT(w_->ctrls[index]->current < 0); }
} else if (line.openshutflag_ == "OPEN") { ASSERT(w_->ctrls[index]->current < 0);
//ASSERT(w_->ctrls[index]->current >= 0); } else if (line.openshutflag_ == "OPEN") {
} else { int& cur_ctrl = w_->ctrls[index]->current;
THROW("Unknown Open/close keyword: \"" << line.openshutflag_<< "\". Allowed values: OPEN, SHUT."); if (cur_ctrl < 0) {
} cur_ctrl = ~cur_ctrl;
}
// We revert back to it's original control. ASSERT(w_->ctrls[index]->current >= 0);
// Note that this is OK as ~~ = id. } else {
w_->ctrls[index]->current = ~w_->ctrls[index]->current; THROW("Unknown Open/close keyword: \"" << line.openshutflag_<< "\". Allowed values: OPEN, SHUT.");
}
}
}
} }
// Build the well_collection_ well group hierarchy. // Build the well_collection_ well group hierarchy.