Pass table argument to VFP getFLo()

This commit is contained in:
Joakim Hove 2021-02-15 19:56:55 +01:00
parent 6383f3c1ac
commit fda1d65494
7 changed files with 20 additions and 22 deletions

View File

@ -3606,9 +3606,8 @@ namespace Opm
};
// Make the flo() function.
auto flo_type = table.getFloType();
auto flo = [flo_type](const std::vector<double>& rates) {
return detail::getFlo(rates[Water], rates[Oil], rates[Gas], flo_type);
auto flo = [&table](const std::vector<double>& rates) {
return detail::getFlo(table, rates[Water], rates[Oil], rates[Gas]);
};
// Make the frates() function.
@ -3830,9 +3829,8 @@ namespace Opm
};
// Make the flo() function.
auto flo_type = table.getFloType();
auto flo = [flo_type](const std::vector<double>& rates) {
return detail::getFlo(rates[Water], rates[Oil], rates[Gas], flo_type);
auto flo = [&table](const std::vector<double>& rates) {
return detail::getFlo(table, rates[Water], rates[Oil], rates[Gas]);
};
// Make the frates() function.

View File

@ -3726,9 +3726,8 @@ namespace Opm
};
// Make the flo() function.
auto flo_type = table.getFloType();
auto flo = [flo_type](const std::vector<double>& rates) {
return detail::getFlo(rates[Water], rates[Oil], rates[Gas], flo_type);
auto flo = [&table](const std::vector<double>& rates) {
return detail::getFlo(table, rates[Water], rates[Oil], rates[Gas]);
};
// Make the frates() function.
@ -3932,9 +3931,8 @@ namespace Opm
};
// Make the flo() function.
auto flo_type = table.getFloType();
auto flo = [flo_type](const std::vector<double>& rates) {
return detail::getFlo(rates[Water], rates[Oil], rates[Gas], flo_type);
auto flo = [&table](const std::vector<double>& rates) {
return detail::getFlo(table, rates[Water], rates[Oil], rates[Gas]);
};
// Make the frates() function.

View File

@ -74,7 +74,8 @@ inline EvalWell zeroIfNanInf(const EvalWell& value) {
* @return Production rate of oil, gas or liquid.
*/
template <typename T>
static T getFlo(const T& aqua, const T& liquid, const T& vapour, VFPProdTable::FLO_TYPE type) {
static T getFlo(const VFPProdTable& table, const T& aqua, const T& liquid, const T& vapour) {
auto type = table.getFloType();
switch (type) {
case VFPProdTable::FLO_TYPE::FLO_OIL:
//Oil = liquid phase
@ -98,7 +99,8 @@ static T getFlo(const T& aqua, const T& liquid, const T& vapour, VFPProdTable::F
* @return Production rate of oil, gas or liquid.
*/
template <typename T>
static T getFlo(const T& aqua, const T& liquid, const T& vapour, VFPInjTable::FLO_TYPE type) {
static T getFlo(const VFPInjTable& table, const T& aqua, const T& liquid, const T& vapour) {
auto type = table.getFloType();
switch (type) {
case VFPInjTable::FLO_TYPE::FLO_OIL:
//Oil = liquid phase
@ -503,7 +505,7 @@ inline VFPEvaluation bhp(const VFPProdTable& table,
const double& thp,
const double& alq) {
//Find interpolation variables
double flo = detail::getFlo(aqua, liquid, vapour, table.getFloType());
double flo = detail::getFlo(table, aqua, liquid, vapour);
double wfr = detail::getWFR(aqua, liquid, vapour, table.getWFRType());
double gfr = detail::getGFR(aqua, liquid, vapour, table.getGFRType());
@ -530,7 +532,7 @@ inline VFPEvaluation bhp(const VFPInjTable& table,
const double& vapour,
const double& thp) {
//Find interpolation variables
double flo = detail::getFlo(aqua, liquid, vapour, table.getFloType());
double flo = detail::getFlo(table, aqua, liquid, vapour);
//First, find the values to interpolate between
auto flo_i = detail::findInterpData(flo, table.getFloAxis());

View File

@ -54,7 +54,7 @@ double VFPInjProperties::thp(int table_id,
const VFPInjTable& table = detail::getTable(m_tables, table_id);
//Find interpolation variables
double flo = detail::getFlo(aqua, liquid, vapour, table.getFloType());
double flo = detail::getFlo(table, aqua, liquid, vapour);
const std::vector<double> thp_array = table.getTHPAxis();
int nthp = thp_array.size();

View File

@ -68,7 +68,7 @@ public:
EvalWell bhp = 0.0 * aqua;
//Find interpolation variables
EvalWell flo = detail::getFlo(aqua, liquid, vapour, table.getFloType());
EvalWell flo = detail::getFlo(table, aqua, liquid, vapour);
//First, find the values to interpolate between
//Value of FLO is negative in OPM for producers, but positive in VFP table

View File

@ -53,7 +53,7 @@ double VFPProdProperties::thp(int table_id,
} else {
// The usual case.
// Recall that production rate is negative in Opm, so switch the sign.
flo = -detail::getFlo(aqua, liquid, vapour, table.getFloType());
flo = -detail::getFlo(table, aqua, liquid, vapour);
wfr = detail::getWFR(aqua, liquid, vapour, table.getWFRType());
gfr = detail::getGFR(aqua, liquid, vapour, table.getGFRType());
}
@ -181,12 +181,12 @@ calculateBhpWithTHPTarget(const std::vector<double>& ipr_a,
const double aqua_bhp_limit = rates_bhp_limit[Water];
const double liquid_bhp_limit = rates_bhp_limit[Oil];
const double vapour_bhp_limit = rates_bhp_limit[Gas];
const double flo_bhp_limit = detail::getFlo(aqua_bhp_limit, liquid_bhp_limit, vapour_bhp_limit, table.getFloType() );
const double flo_bhp_limit = detail::getFlo(table, aqua_bhp_limit, liquid_bhp_limit, vapour_bhp_limit );
const double aqua_bhp_middle = rates_bhp_middle[Water];
const double liquid_bhp_middle = rates_bhp_middle[Oil];
const double vapour_bhp_middle = rates_bhp_middle[Gas];
const double flo_bhp_middle = detail::getFlo(aqua_bhp_middle, liquid_bhp_middle, vapour_bhp_middle, table.getFloType() );
const double flo_bhp_middle = detail::getFlo(table, aqua_bhp_middle, liquid_bhp_middle, vapour_bhp_middle );
// we use the ratios based on the middle value of bhp_limit and bhp_safe_limit
const double wfr = detail::getWFR(aqua_bhp_middle, liquid_bhp_middle, vapour_bhp_middle, table.getWFRType());

View File

@ -74,7 +74,7 @@ public:
EvalWell bhp = 0.0 * aqua;
//Find interpolation variables
EvalWell flo = detail::getFlo(aqua, liquid, vapour, table.getFloType());
EvalWell flo = detail::getFlo(table, aqua, liquid, vapour);
EvalWell wfr = detail::getWFR(aqua, liquid, vapour, table.getWFRType());
EvalWell gfr = detail::getGFR(aqua, liquid, vapour, table.getGFRType());