mirror of
https://github.com/OPM/opm-simulators.git
synced 2026-09-05 04:40:19 -05:00
Only sum rates for owned wells in WellGroupHelpers.
Well rates of distributed wells might be stored on multiple processes but should be summed only once. Hence only the owner does the summation with this commit.
This commit is contained in:
@@ -112,6 +112,15 @@ namespace WellGroupHelpers
|
|||||||
schedule.getGroup(group.parent(), reportStepIdx), schedule, reportStepIdx, factor);
|
schedule.getGroup(group.parent(), reportStepIdx), schedule, reportStepIdx, factor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool wellIsOwned(std::size_t well_index, [[maybe_unused]] const std::string& wellName,
|
||||||
|
const WellStateFullyImplicitBlackoil& wellState)
|
||||||
|
{
|
||||||
|
const auto& well_info = wellState.parallelWellInfo(well_index);
|
||||||
|
assert(well_info.name() == wellName);
|
||||||
|
|
||||||
|
return well_info.isOwner();
|
||||||
|
}
|
||||||
|
|
||||||
double sumWellPhaseRates(const std::vector<double>& rates,
|
double sumWellPhaseRates(const std::vector<double>& rates,
|
||||||
const Group& group,
|
const Group& group,
|
||||||
const Schedule& schedule,
|
const Schedule& schedule,
|
||||||
@@ -135,6 +144,11 @@ namespace WellGroupHelpers
|
|||||||
|
|
||||||
int well_index = it->second[0];
|
int well_index = it->second[0];
|
||||||
|
|
||||||
|
if (! wellIsOwned(well_index, wellName, wellState) ) // Only sum once
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
const auto& wellEcl = schedule.getWell(wellName, reportStepIdx);
|
const auto& wellEcl = schedule.getWell(wellName, reportStepIdx);
|
||||||
// only count producers or injectors
|
// only count producers or injectors
|
||||||
if ((wellEcl.isProducer() && injector) || (wellEcl.isInjector() && !injector))
|
if ((wellEcl.isProducer() && injector) || (wellEcl.isInjector() && !injector))
|
||||||
@@ -195,6 +209,11 @@ namespace WellGroupHelpers
|
|||||||
|
|
||||||
int well_index = it->second[0];
|
int well_index = it->second[0];
|
||||||
|
|
||||||
|
if (! wellIsOwned(well_index, wellName, wellState) ) // Only sum once
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
const auto& wellEcl = schedule.getWell(wellName, reportStepIdx);
|
const auto& wellEcl = schedule.getWell(wellName, reportStepIdx);
|
||||||
// only count producers or injectors
|
// only count producers or injectors
|
||||||
if ((wellEcl.isProducer() && injector) || (wellEcl.isInjector() && !injector))
|
if ((wellEcl.isProducer() && injector) || (wellEcl.isInjector() && !injector))
|
||||||
@@ -303,6 +322,12 @@ namespace WellGroupHelpers
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
int well_index = it->second[0];
|
int well_index = it->second[0];
|
||||||
|
|
||||||
|
if (! wellIsOwned(well_index, wellName, wellState) ) // Only sum once
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
const auto wellrate_index = well_index * wellState.numPhases();
|
const auto wellrate_index = well_index * wellState.numPhases();
|
||||||
const double efficiency = wellTmp.getEfficiencyFactor();
|
const double efficiency = wellTmp.getEfficiencyFactor();
|
||||||
// add contributino from wells not under group control
|
// add contributino from wells not under group control
|
||||||
@@ -385,6 +410,12 @@ namespace WellGroupHelpers
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
int well_index = it->second[0];
|
int well_index = it->second[0];
|
||||||
|
|
||||||
|
if (! wellIsOwned(well_index, wellName, wellState) ) // Only sum once
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
const auto wellrate_index = well_index * wellState.numPhases();
|
const auto wellrate_index = well_index * wellState.numPhases();
|
||||||
// add contribution from wells unconditionally
|
// add contribution from wells unconditionally
|
||||||
for (int phase = 0; phase < np; phase++) {
|
for (int phase = 0; phase < np; phase++) {
|
||||||
@@ -431,20 +462,26 @@ namespace WellGroupHelpers
|
|||||||
double waterpot = 0.0;
|
double waterpot = 0.0;
|
||||||
|
|
||||||
const auto& it = wellState.wellMap().find( well.name());
|
const auto& it = wellState.wellMap().find( well.name());
|
||||||
if (it != end) { // the well is found
|
if (it == end) // the well is not found
|
||||||
|
continue;
|
||||||
|
int well_index = it->second[0];
|
||||||
|
|
||||||
int well_index = it->second[0];
|
if (! wellIsOwned(well_index, wellName, wellState) ) // Only sum once
|
||||||
|
{
|
||||||
const auto wpot = wellState.wellPotentials().data() + well_index*wellState.numPhases();
|
continue;
|
||||||
if (pu.phase_used[BlackoilPhases::Liquid] > 0)
|
|
||||||
oilpot = wpot[pu.phase_pos[BlackoilPhases::Liquid]];
|
|
||||||
|
|
||||||
if (pu.phase_used[BlackoilPhases::Vapour] > 0)
|
|
||||||
gaspot = wpot[pu.phase_pos[BlackoilPhases::Vapour]];
|
|
||||||
|
|
||||||
if (pu.phase_used[BlackoilPhases::Aqua] > 0)
|
|
||||||
waterpot = wpot[pu.phase_pos[BlackoilPhases::Aqua]];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const auto wpot = wellState.wellPotentials().data() + well_index*wellState.numPhases();
|
||||||
|
if (pu.phase_used[BlackoilPhases::Liquid] > 0)
|
||||||
|
oilpot = wpot[pu.phase_pos[BlackoilPhases::Liquid]];
|
||||||
|
|
||||||
|
if (pu.phase_used[BlackoilPhases::Vapour] > 0)
|
||||||
|
gaspot = wpot[pu.phase_pos[BlackoilPhases::Vapour]];
|
||||||
|
|
||||||
|
if (pu.phase_used[BlackoilPhases::Aqua] > 0)
|
||||||
|
waterpot = wpot[pu.phase_pos[BlackoilPhases::Aqua]];
|
||||||
|
|
||||||
const double wefac = well.getEfficiencyFactor();
|
const double wefac = well.getEfficiencyFactor();
|
||||||
oilpot = comm.sum(oilpot) * wefac;
|
oilpot = comm.sum(oilpot) * wefac;
|
||||||
gaspot = comm.sum(gaspot) * wefac;
|
gaspot = comm.sum(gaspot) * wefac;
|
||||||
|
|||||||
@@ -195,6 +195,11 @@ namespace Opm
|
|||||||
const WellMapType& wellMap() const { return wellMap_; }
|
const WellMapType& wellMap() const { return wellMap_; }
|
||||||
WellMapType& wellMap() { return wellMap_; }
|
WellMapType& wellMap() { return wellMap_; }
|
||||||
|
|
||||||
|
const ParallelWellInfo& parallelWellInfo(std::size_t well_index) const
|
||||||
|
{
|
||||||
|
return *parallel_well_info_[well_index];
|
||||||
|
}
|
||||||
|
|
||||||
/// The number of wells present.
|
/// The number of wells present.
|
||||||
int numWells() const
|
int numWells() const
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user