mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Refactor some methods in GasLiftSingleWellGeneric.
Refactor getOilRateWithGroupLimit_(), getGasRateWithGroupLimit_(), getWaterRateWithGroupLimit_(), and getLiquidRateWithGroupLimit_() into a single generic method called getRateWithGroupLimit_().
This commit is contained in:
@@ -84,6 +84,26 @@ gasTarget(const std::string& group_name)
|
||||
return group_rate.gasTarget();
|
||||
}
|
||||
|
||||
double
|
||||
GasLiftGroupInfo::
|
||||
getRate(Rate rate_type, const std::string& group_name)
|
||||
{
|
||||
switch (rate_type) {
|
||||
case Rate::oil:
|
||||
return oilRate(group_name);
|
||||
case Rate::gas:
|
||||
return gasRate(group_name);
|
||||
case Rate::water:
|
||||
return waterRate(group_name);
|
||||
case Rate::liquid:
|
||||
return oilRate(group_name) + waterRate(group_name);
|
||||
default:
|
||||
// Need this to avoid compiler warning : control reaches end of non-void function
|
||||
throw std::runtime_error("This should not happen");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::tuple<double, double, double, double>
|
||||
GasLiftGroupInfo::
|
||||
getRates(int group_idx)
|
||||
@@ -93,6 +113,25 @@ getRates(int group_idx)
|
||||
return std::make_tuple(rates.oilRate(), rates.gasRate(), rates.waterRate(), rates.alq());
|
||||
}
|
||||
|
||||
std::optional<double>
|
||||
GasLiftGroupInfo::
|
||||
getTarget(Rate rate_type, const std::string& group_name)
|
||||
{
|
||||
switch (rate_type) {
|
||||
case Rate::oil:
|
||||
return oilTarget(group_name);
|
||||
case Rate::gas:
|
||||
return gasTarget(group_name);
|
||||
case Rate::water:
|
||||
return waterTarget(group_name);
|
||||
case Rate::liquid:
|
||||
return liquidTarget(group_name);
|
||||
default:
|
||||
// Need this to avoid compiler warning : control reaches end of non-void function
|
||||
throw std::runtime_error("This should not happen");
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::pair<std::string,double>>&
|
||||
GasLiftGroupInfo::
|
||||
getWellGroups(const std::string& well_name)
|
||||
@@ -189,6 +228,23 @@ liquidTarget(const std::string &group_name)
|
||||
return group_rate.liquidTarget();
|
||||
}
|
||||
|
||||
const std::string
|
||||
GasLiftGroupInfo::
|
||||
rateToString(Rate rate) {
|
||||
switch (rate) {
|
||||
case Rate::oil:
|
||||
return "oil";
|
||||
case Rate::gas:
|
||||
return "gas";
|
||||
case Rate::water:
|
||||
return "water";
|
||||
case Rate::liquid:
|
||||
return "liquid";
|
||||
default:
|
||||
throw std::runtime_error("This should not happen");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
GasLiftGroupInfo::
|
||||
update(
|
||||
|
||||
Reference in New Issue
Block a user