fixing the way in handling the RESV rates for WCONHIST

This commit is contained in:
Kai Bao committed 2019-01-04 15:10:18 +01:00
1 parent bfc915849a
commit 98450b5aa8
1 file changed
+8 -4
+8 -4
View File
@@ -1536,27 +1536,31 @@ namespace Opm {
well_controls_iset_distr(ctrl, rctrl, & distr[0]); well_controls_iset_distr(ctrl, rctrl, & distr[0]);
// for the WCONHIST wells, we need to calculate the rates // for the WCONHIST wells, we need to calculate the RESV rates since it can not be specified directly
if (is_producer) {
const WellMap::const_iterator i = wmap.find(wells()->name[*rp]); const WellMap::const_iterator i = wmap.find(wells()->name[*rp]);
if (i == wmap.end()) { if (i == wmap.end()) {
OPM_THROW(std::runtime_error, "Failed to find the well " << wells()->name[*rp] << " in wmap."); OPM_THROW(std::runtime_error, "Failed to find the well " << wells()->name[*rp] << " in wmap.");
} }
// not handling injector for now
const auto* wp = i->second; const auto* wp = i->second;
const WellProductionProperties& production_properties = wp->getProductionProperties(step); const WellProductionProperties& production_properties = wp->getProductionProperties(step);
// historical phase rates // historical phase rates
std::vector<double> hrates(np); std::vector<double> hrates(np);
SimFIBODetails::historyRates(phase_usage_, production_properties, hrates); SimFIBODetails::historyRates(phase_usage_, production_properties, hrates);
const double target = - std::inner_product(distr.begin(), distr.end(), std::vector<double> hrates_resv(np);
hrates.begin(), 0.0); rateConverter_->calcReservoirVoidageRates(fipreg, pvtreg, hrates, hrates_resv);
const double target = -std::accumulate(hrates_resv.begin(), hrates_resv.end(), 0.0);
well_controls_iset_target(ctrl, rctrl, target); well_controls_iset_target(ctrl, rctrl, target);
} }
} }
} }
} }
} }
}
// convert well data from opm-common to well state from opm-core // convert well data from opm-common to well state from opm-core