only using Wells for determination of the RESV well

One of them is redundant, we do not need both of them.
This commit is contained in:
Kai Bao 2019-01-07 09:50:40 +01:00
parent 98450b5aa8
commit 60e5a95972
2 changed files with 6 additions and 35 deletions

View File

@ -1489,11 +1489,8 @@ namespace Opm {
BlackoilWellModel<TypeTag>::
computeRESV(const std::size_t step)
{
typedef SimFIBODetails::WellMap WellMap;
const WellMap& wmap = SimFIBODetails::mapWells(wells_ecl_);
const std::vector<int>& resv_wells = SimFIBODetails::resvWells(wells(), step, wmap);
const std::vector<int>& resv_wells = SimFIBODetails::resvWells(wells());
int global_number_resv_wells = resv_wells.size();
global_number_resv_wells = ebosSimulator_.gridView().comm().sum(global_number_resv_wells);
@ -1503,6 +1500,8 @@ namespace Opm {
}
if (! resv_wells.empty()) {
typedef SimFIBODetails::WellMap WellMap;
const WellMap& wmap = SimFIBODetails::mapWells(wells_ecl_);
for (std::vector<int>::const_iterator
rp = resv_wells.begin(), e = resv_wells.end();
@ -1529,7 +1528,7 @@ namespace Opm {
// original distr contains 0 and 1 to indicate phases under control
const double* old_distr = well_controls_get_current_distr(ctrl);
for (size_t p = 0; p < np; ++p) {
for (int p = 0; p < np; ++p) {
distr[p] *= old_distr[p];
}
}

View File

@ -70,42 +70,14 @@ namespace Opm
return (0 <= resv_control(wells.ctrls[w]));
}
inline bool
is_resv(const WellMap& wmap,
const std::string& name,
const std::size_t step)
{
bool match = false;
WellMap::const_iterator i = wmap.find(name);
if (i != wmap.end()) {
const Well* wp = i->second;
match = (wp->isProducer(step) &&
wp->getProductionProperties(step)
.hasProductionControl(WellProducer::RESV))
|| (wp->isInjector(step) &&
wp->getInjectionProperties(step)
.hasInjectionControl(WellInjector::RESV));
}
return match;
}
inline std::vector<int>
resvWells(const Wells* wells,
const std::size_t step,
const WellMap& wmap)
resvWells(const Wells* wells)
{
std::vector<int> resv_wells;
if( wells )
{
for (int w = 0, nw = wells->number_of_wells; w < nw; ++w) {
if (is_resv(*wells, w) ||
((wells->name[w] != 0) &&
is_resv(wmap, wells->name[w], step)))
{
if ( is_resv(*wells, w) ) {
resv_wells.push_back(w);
}
}