Merge pull request #1343 from GitPaean/single_phase_resv

making the single phase RESV injection work.
This commit is contained in:
Atgeirr Flø Rasmussen 2017-12-05 14:06:44 +01:00 committed by GitHub
commit 03a0baf447
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1155,7 +1155,6 @@ namespace Opm {
std::vector<double> distr (np);
std::vector<double> hrates(np);
std::vector<double> prates(np);
for (std::vector<int>::const_iterator
rp = resv_wells.begin(), e = resv_wells.end();
@ -1173,21 +1172,20 @@ namespace Opm {
if (0 <= rctrl) {
const std::vector<double>::size_type off = (*rp) * np;
if (is_producer) {
// Convert to positive rates to avoid issues
// in coefficient calculations.
std::transform(well_state_.wellRates().begin() + (off + 0*np),
well_state_.wellRates().begin() + (off + 1*np),
prates.begin(), std::negate<double>());
} else {
std::copy(well_state_.wellRates().begin() + (off + 0*np),
well_state_.wellRates().begin() + (off + 1*np),
prates.begin());
}
const int fipreg = 0; // Hack. Ignore FIP regions.
rateConverter_->calcCoeff(fipreg, pvtreg, distr);
if (!is_producer) { // injectors
well_controls_assert_number_of_phases(ctrl, np);
// original distr contains 0 and 1 to indicate phases under control
const double* old_distr = well_controls_get_current_distr(ctrl);
for (int p = 0; p < np; ++p) {
distr[p] *= old_distr[p];
}
}
well_controls_iset_distr(ctrl, rctrl, & distr[0]);
}
}