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 c2ce4d9bce
commit 3eeee29edb
2 changed files with 61 additions and 0 deletions

View File

@ -528,7 +528,21 @@ namespace Opm
return sum; 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 ============ // ============== 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, void WellNode::applyProdGroupControl(const ProductionSpecification::ControlMode control_mode,
const double target, const double target,
const bool forced) const bool forced)

View File

@ -179,6 +179,15 @@ namespace Opm
/// wells under group control /// wells under group control
virtual double injectionGuideRate(bool only_group) = 0; virtual double injectionGuideRate(bool only_group) = 0;
/// 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.
virtual double getTotalProductionFlow(const std::vector<double>& phase_flows,
const BlackoilPhases::PhaseIndex phase) = 0;
protected: protected:
/// Calculates the correct rate for the given ProductionSpecification::ControlMode /// Calculates the correct rate for the given ProductionSpecification::ControlMode
double rateByMode(const double* res_rates, double rateByMode(const double* res_rates,
@ -259,6 +268,14 @@ namespace Opm
/// wells under group control /// wells under group control
virtual double injectionGuideRate(bool only_group); virtual double injectionGuideRate(bool only_group);
/// 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.
virtual double getTotalProductionFlow(const std::vector<double>& phase_flows,
const BlackoilPhases::PhaseIndex phase);
private: private:
std::vector<std::tr1::shared_ptr<WellsGroupInterface> > children_; std::vector<std::tr1::shared_ptr<WellsGroupInterface> > children_;
}; };
@ -328,6 +345,17 @@ namespace Opm
/// wells under group control /// wells under group control
virtual double injectionGuideRate(bool only_group); virtual double injectionGuideRate(bool only_group);
/// 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.
virtual double getTotalProductionFlow(const std::vector<double>& phase_flows,
const BlackoilPhases::PhaseIndex phase);
/// Returns the type of the well.
WellType type() const;
private: private:
Wells* wells_; Wells* wells_;
int self_index_; int self_index_;