Fixed applyGroupControls to handle zero guide rates

This commit is contained in:
Kjetil Olsen Lye 2012-05-02 16:54:49 +02:00
parent 8eb9b55759
commit 72afe774b0
2 changed files with 16 additions and 9 deletions

View File

@ -259,6 +259,10 @@ namespace Opm
if (forced || injSpec().control_mode_ == InjectionSpecification::FLD if (forced || injSpec().control_mode_ == InjectionSpecification::FLD
|| injSpec().control_mode_ == InjectionSpecification::NONE) { || injSpec().control_mode_ == InjectionSpecification::NONE) {
const double my_guide_rate = injectionGuideRate(!forced); const double my_guide_rate = injectionGuideRate(!forced);
if (my_guide_rate == 0.0) {
// Nothing to do here
return;
}
for (size_t i = 0; i < children_.size(); ++i) { for (size_t i = 0; i < children_.size(); ++i) {
const double child_target = target * children_[i]->injectionGuideRate(!forced) / my_guide_rate; const double child_target = target * children_[i]->injectionGuideRate(!forced) / my_guide_rate;
children_[i]->applyInjGroupControl(control_mode, child_target, true); children_[i]->applyInjGroupControl(control_mode, child_target, true);
@ -279,6 +283,10 @@ namespace Opm
if (forced || (prodSpec().control_mode_ == ProductionSpecification::FLD if (forced || (prodSpec().control_mode_ == ProductionSpecification::FLD
|| prodSpec().control_mode_ == ProductionSpecification::NONE)) { || prodSpec().control_mode_ == ProductionSpecification::NONE)) {
const double my_guide_rate = productionGuideRate(!forced); const double my_guide_rate = productionGuideRate(!forced);
if (my_guide_rate == 0.0) {
// Nothing to do here
return;
}
for (size_t i = 0; i < children_.size(); ++i) { for (size_t i = 0; i < children_.size(); ++i) {
const double child_target = target * children_[i]->productionGuideRate(!forced) / my_guide_rate; const double child_target = target * children_[i]->productionGuideRate(!forced) / my_guide_rate;
children_[i]->applyProdGroupControl(control_mode, child_target, true); children_[i]->applyProdGroupControl(control_mode, child_target, true);
@ -431,13 +439,14 @@ namespace Opm
case ProductionSpecification::RESV: case ProductionSpecification::RESV:
{ {
const double my_guide_rate = productionGuideRate(true); const double my_guide_rate = productionGuideRate(true);
ASSERT(my_guide_rate != 0.0);
for (size_t i = 0; i < children_.size(); ++i ) { for (size_t i = 0; i < children_.size(); ++i ) {
// Apply for all children. // Apply for all children.
// Note, we do _not_ want to call the applyProdGroupControl in this object, // Note, we do _not_ want to call the applyProdGroupControl in this object,
// as that would check if we're under group control, something we're not. // as that would check if we're under group control, something we're not.
const double children_guide_rate = productionGuideRate(true); const double children_guide_rate = children_[i]->productionGuideRate(true);
children_[i]->applyProdGroupControl(prod_mode, children_[i]->applyProdGroupControl(prod_mode,
(my_guide_rate / children_guide_rate) * getTarget(prod_mode), (children_guide_rate / my_guide_rate) * getTarget(prod_mode),
false); false);
} }
break; break;
@ -468,7 +477,7 @@ namespace Opm
// as that would check if we're under group control, something we're not. // as that would check if we're under group control, something we're not.
const double children_guide_rate = children_[i]->injectionGuideRate(true); const double children_guide_rate = children_[i]->injectionGuideRate(true);
children_[i]->applyInjGroupControl(inj_mode, children_[i]->applyInjGroupControl(inj_mode,
(my_guide_rate / children_guide_rate) * getTarget(inj_mode), (children_guide_rate / my_guide_rate) * getTarget(inj_mode),
false); false);
} }
break; break;
@ -915,7 +924,7 @@ namespace Opm
// For now, assume that if it isn't a well, it's a group // For now, assume that if it isn't a well, it's a group
if (isWell) { if (isWell) {
ProductionSpecification production_specification;
InjectionSpecification injection_specification; InjectionSpecification injection_specification;
if (deck.hasField("WCONINJE")) { if (deck.hasField("WCONINJE")) {
WCONINJE wconinje = deck.getWCONINJE(); WCONINJE wconinje = deck.getWCONINJE();
@ -927,13 +936,11 @@ namespace Opm
injection_specification.control_mode_ = toInjectionControlMode(line.control_mode_); injection_specification.control_mode_ = toInjectionControlMode(line.control_mode_);
injection_specification.surface_flow_max_rate_ = line.surface_flow_max_rate_; injection_specification.surface_flow_max_rate_ = line.surface_flow_max_rate_;
injection_specification.reservoir_flow_max_rate_ = line.reservoir_flow_max_rate_; injection_specification.reservoir_flow_max_rate_ = line.reservoir_flow_max_rate_;
production_specification.guide_rate_ = 0.0; // We know we're not a producer
} }
} }
} else {
injection_specification.guide_rate_ = 0.0;
} }
ProductionSpecification production_specification;
if (deck.hasField("WCONPROD")) { if (deck.hasField("WCONPROD")) {
WCONPROD wconprod = deck.getWCONPROD(); WCONPROD wconprod = deck.getWCONPROD();
std::cout << wconprod.wconprod.size() << std::endl; std::cout << wconprod.wconprod.size() << std::endl;
@ -945,10 +952,9 @@ namespace Opm
production_specification.oil_max_rate_ = line.oil_max_rate_; production_specification.oil_max_rate_ = line.oil_max_rate_;
production_specification.control_mode_ = toProductionControlMode(line.control_mode_); production_specification.control_mode_ = toProductionControlMode(line.control_mode_);
production_specification.water_max_rate_ = line.water_max_rate_; production_specification.water_max_rate_ = line.water_max_rate_;
injection_specification.guide_rate_ = 0.0; // we know we're not an injector
} }
} }
} else {
production_specification.guide_rate_ = 0.0;
} }
return_value.reset(new WellNode(name, production_specification, injection_specification, phase_usage)); return_value.reset(new WellNode(name, production_specification, injection_specification, phase_usage));
} else { } else {

View File

@ -353,6 +353,7 @@ namespace Opm
const std::map<std::string, int>::const_iterator it = well_names_to_index.find(lines[i].well_); const std::map<std::string, int>::const_iterator it = well_names_to_index.find(lines[i].well_);
if (it != well_names_to_index.end()) { if (it != well_names_to_index.end()) {
const int well_index = it->second; const int well_index = it->second;
well_data[well_index].type = PRODUCER;
} else { } else {
THROW("Unseen well name: " << lines[i].well_ << " first seen in WCONPROD"); THROW("Unseen well name: " << lines[i].well_ << " first seen in WCONPROD");
} }