Use SingleWellState to manage well surface rates

This commit is contained in:
Joakim Hove
2021-08-24 11:49:03 +02:00
parent 8937c9cba9
commit 755de65eb4
16 changed files with 136 additions and 146 deletions

View File

@@ -279,14 +279,14 @@ namespace Opm
double total_rate = 0.0;
for (int phase = 0; phase < np; ++phase){
total_rate += well_state.wellRates(index_of_well_)[phase];
total_rate += ws.surface_rates[phase];
}
// for pressure controlled wells the well rates are the potentials
// if the rates are trivial we are most probably looking at the newly
// opened well and we therefore make the affort of computing the potentials anyway.
if (std::abs(total_rate) > 0) {
for (int phase = 0; phase < np; ++phase){
well_potentials[phase] = well_state.wellRates(index_of_well_)[phase];
well_potentials[phase] = ws.surface_rates[phase];
}
return;
}
@@ -367,7 +367,7 @@ namespace Opm
const int np = number_of_phases_;
const double sign = well_copy.well_ecl_.isInjector() ? 1.0 : -1.0;
for (int phase = 0; phase < np; ++phase){
well_state_copy.wellRates(well_copy.index_of_well_)[phase] = sign * ws.well_potentials[phase];
ws.surface_rates[phase] = sign * ws.well_potentials[phase];
}
well_copy.scaleSegmentRatesWithWellRates(well_state_copy);