Store producer status, only call getALQ() for producers.

As it was, the getALQ() call would insert injectors into the ALQ maps,
leading to trouble.

Also, this gets rid of the slightly weird thing that the output data
structure's producer/injector status was only set after creation,
in BlackoilWellModel::wellData().
This commit is contained in:
Atgeirr Flø Rasmussen
2020-11-16 17:21:48 +01:00
parent 8a5203814b
commit 376aecfad5
2 changed files with 10 additions and 4 deletions

View File

@@ -212,9 +212,8 @@ namespace Opm {
continue; continue;
} }
xwPos->second.current_control.isProducer = well.isProducer(); auto& grval = xwPos->second.guide_rates;
grval.clear();
auto& grval = xwPos->second.guide_rates; grval.clear();
grval += this->getGuideRateValues(well); grval += this->getGuideRateValues(well);
} }

View File

@@ -150,6 +150,11 @@ namespace Opm
first_perf_index_[w+1] = connpos; first_perf_index_[w+1] = connpos;
} }
is_producer_.resize(nw, false);
for (int w = 0; w < nw; ++w) {
is_producer_[w] = wells_ecl[w].isProducer();
}
current_injection_controls_.resize(nw); current_injection_controls_.resize(nw);
current_production_controls_.resize(nw); current_production_controls_.resize(nw);
@@ -587,7 +592,7 @@ namespace Opm
well.rates.set( rt::brine, brineWellRate(w) ); well.rates.set( rt::brine, brineWellRate(w) );
} }
if ( well.current_control.isProducer ) { if ( is_producer_[w] ) {
well.rates.set( rt::alq, getALQ(/*wellName=*/wt.first) ); well.rates.set( rt::alq, getALQ(/*wellName=*/wt.first) );
} }
else { else {
@@ -600,6 +605,7 @@ namespace Opm
{ {
auto& curr = well.current_control; auto& curr = well.current_control;
curr.isProducer = this->is_producer_[w];
curr.prod = this->currentProductionControls()[w]; curr.prod = this->currentProductionControls()[w];
curr.inj = this->currentInjectionControls() [w]; curr.inj = this->currentInjectionControls() [w];
} }
@@ -1162,6 +1168,7 @@ namespace Opm
private: private:
std::vector<double> perfphaserates_; std::vector<double> perfphaserates_;
std::vector<bool> is_producer_; // Size equal to number of local wells.
// vector with size number of wells +1. // vector with size number of wells +1.
// iterate over all perforations of a given well // iterate over all perforations of a given well