Added summation method to find total produced rates in a given group.

This commit is contained in:
Kjetil Olsen Lye
2012-05-09 12:35:26 +02:00
parent c72c4eed7c
commit 965b6d54d8
2 changed files with 61 additions and 0 deletions

View File

@@ -528,7 +528,21 @@ namespace Opm
return sum;
}
/// Gets the total production flow of the given phase.
/// \param[in] phase_flows A vector containing rates by phase for each well.
/// Is assumed to be ordered the same way as the related Wells-struct,
/// with all phase rates of a single well adjacent in the array.
/// \param[in] phase The phase for which to sum up.
double WellsGroup::getTotalProductionFlow(const std::vector<double>& phase_flows,
const BlackoilPhases::PhaseIndex phase)
{
double sum = 0.0;
for (size_t i = 0; i < children_.size(); ++i) {
sum += children_[i]->getTotalProductionFlow(phase_flows, phase);
}
return sum;
}
// ============== WellNode members ============
@@ -728,6 +742,25 @@ namespace Opm
}
/// Gets the total production flow of the given phase.
/// \param[in] phase_flows A vector containing rates by phase for each well.
/// Is assumed to be ordered the same way as the related Wells-struct,
/// with all phase rates of a single well adjacent in the array.
/// \param[in] phase The phase for which to sum up.
double WellNode::getTotalProductionFlow(const std::vector<double>& phase_flows,
const BlackoilPhases::PhaseIndex phase)
{
if (type() == INJECTOR) {
return 0.0;
}
return phase_flows[self_index_*phaseUsage().num_phases + phaseUsage().phase_pos[phase]];
}
WellType WellNode::type() const {
return wells_->type[self_index_];
}
void WellNode::applyProdGroupControl(const ProductionSpecification::ControlMode control_mode,
const double target,
const bool forced)