Refactor some methods in GasLiftSingleWellGeneric.

Refactor getOilRateWithGroupLimit_(), getGasRateWithGroupLimit_(),
getWaterRateWithGroupLimit_(), and getLiquidRateWithGroupLimit_() into
a single generic method called getRateWithGroupLimit_().
This commit is contained in:
Håkon Hægland
2021-12-17 01:52:34 +01:00
parent f77d82a0e9
commit 837f33e679
4 changed files with 171 additions and 118 deletions

View File

@@ -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(