mirror of
https://github.com/OPM/opm-simulators.git
synced 2026-09-05 04:40:19 -05:00
Fix and move changes to commented code to code to WellGroupHlper.hpp
This commit is contained in:
@@ -112,15 +112,6 @@ 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,
|
||||||
@@ -144,7 +135,7 @@ namespace WellGroupHelpers
|
|||||||
|
|
||||||
int well_index = it->second[0];
|
int well_index = it->second[0];
|
||||||
|
|
||||||
if (! wellIsOwned(well_index, wellName, wellState) ) // Only sum once
|
if (! wellState.wellIsOwned(well_index, wellName) ) // Only sum once
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -209,7 +200,7 @@ namespace WellGroupHelpers
|
|||||||
|
|
||||||
int well_index = it->second[0];
|
int well_index = it->second[0];
|
||||||
|
|
||||||
if (! wellIsOwned(well_index, wellName, wellState) ) // Only sum once
|
if (! wellState.wellIsOwned(well_index, wellName) ) // Only sum once
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -323,7 +314,7 @@ namespace WellGroupHelpers
|
|||||||
|
|
||||||
int well_index = it->second[0];
|
int well_index = it->second[0];
|
||||||
|
|
||||||
if (! wellIsOwned(well_index, wellName, wellState) ) // Only sum once
|
if (! wellState.wellIsOwned(well_index, wellName) ) // Only sum once
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -462,27 +453,22 @@ 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 not found
|
if (it != end && wellState.wellIsOwned(it->second[0], well.name()))
|
||||||
continue;
|
|
||||||
int well_index = it->second[0];
|
|
||||||
|
|
||||||
if (! wellIsOwned(well_index, wellName, wellState) ) // Only sum once
|
|
||||||
{
|
{
|
||||||
continue;
|
// the well is found and owned
|
||||||
|
|
||||||
|
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 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();
|
|
||||||
oilpot = comm.sum(oilpot) * wefac;
|
oilpot = comm.sum(oilpot) * wefac;
|
||||||
gaspot = comm.sum(gaspot) * wefac;
|
gaspot = comm.sum(gaspot) * wefac;
|
||||||
waterpot = comm.sum(waterpot) * wefac;
|
waterpot = comm.sum(waterpot) * wefac;
|
||||||
|
|||||||
@@ -160,6 +160,12 @@ namespace WellGroupHelpers
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
int well_index = it->second[0];
|
int well_index = it->second[0];
|
||||||
|
|
||||||
|
if (! wellState.wellIsOwned(well_index, wellName) ) // 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++) {
|
||||||
@@ -207,8 +213,9 @@ 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 && wellState.wellIsOwned(it->second[0], well.name()))
|
||||||
|
{
|
||||||
|
// the well is found and owned
|
||||||
int well_index = it->second[0];
|
int well_index = it->second[0];
|
||||||
|
|
||||||
const auto wpot = wellState.wellPotentials().data() + well_index * wellState.numPhases();
|
const auto wpot = wellState.wellPotentials().data() + well_index * wellState.numPhases();
|
||||||
|
|||||||
@@ -200,6 +200,13 @@ namespace Opm
|
|||||||
return *parallel_well_info_[well_index];
|
return *parallel_well_info_[well_index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool wellIsOwned(std::size_t well_index, [[maybe_unused]] const std::string& wellName) const
|
||||||
|
{
|
||||||
|
const auto& well_info = parallelWellInfo(well_index);
|
||||||
|
assert(well_info.name() == wellName);
|
||||||
|
|
||||||
|
return well_info.isOwner();
|
||||||
|
}
|
||||||
/// The number of wells present.
|
/// The number of wells present.
|
||||||
int numWells() const
|
int numWells() const
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user