From fda1d654946414f60a187ff17bf976852a6fa2a1 Mon Sep 17 00:00:00 2001 From: Joakim Hove Date: Mon, 15 Feb 2021 19:56:55 +0100 Subject: [PATCH] Pass table argument to VFP getFLo() --- opm/simulators/wells/MultisegmentWell_impl.hpp | 10 ++++------ opm/simulators/wells/StandardWell_impl.hpp | 10 ++++------ opm/simulators/wells/VFPHelpers.hpp | 10 ++++++---- opm/simulators/wells/VFPInjProperties.cpp | 2 +- opm/simulators/wells/VFPInjProperties.hpp | 2 +- opm/simulators/wells/VFPProdProperties.cpp | 6 +++--- opm/simulators/wells/VFPProdProperties.hpp | 2 +- 7 files changed, 20 insertions(+), 22 deletions(-) diff --git a/opm/simulators/wells/MultisegmentWell_impl.hpp b/opm/simulators/wells/MultisegmentWell_impl.hpp index 9af1166db..4dbcfbb0d 100644 --- a/opm/simulators/wells/MultisegmentWell_impl.hpp +++ b/opm/simulators/wells/MultisegmentWell_impl.hpp @@ -3606,9 +3606,8 @@ namespace Opm }; // Make the flo() function. - auto flo_type = table.getFloType(); - auto flo = [flo_type](const std::vector& rates) { - return detail::getFlo(rates[Water], rates[Oil], rates[Gas], flo_type); + auto flo = [&table](const std::vector& 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& rates) { - return detail::getFlo(rates[Water], rates[Oil], rates[Gas], flo_type); + auto flo = [&table](const std::vector& rates) { + return detail::getFlo(table, rates[Water], rates[Oil], rates[Gas]); }; // Make the frates() function. diff --git a/opm/simulators/wells/StandardWell_impl.hpp b/opm/simulators/wells/StandardWell_impl.hpp index 026f69fd3..8d092924b 100644 --- a/opm/simulators/wells/StandardWell_impl.hpp +++ b/opm/simulators/wells/StandardWell_impl.hpp @@ -3726,9 +3726,8 @@ namespace Opm }; // Make the flo() function. - auto flo_type = table.getFloType(); - auto flo = [flo_type](const std::vector& rates) { - return detail::getFlo(rates[Water], rates[Oil], rates[Gas], flo_type); + auto flo = [&table](const std::vector& 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& rates) { - return detail::getFlo(rates[Water], rates[Oil], rates[Gas], flo_type); + auto flo = [&table](const std::vector& rates) { + return detail::getFlo(table, rates[Water], rates[Oil], rates[Gas]); }; // Make the frates() function. diff --git a/opm/simulators/wells/VFPHelpers.hpp b/opm/simulators/wells/VFPHelpers.hpp index 8beca98a8..e6041ac8b 100644 --- a/opm/simulators/wells/VFPHelpers.hpp +++ b/opm/simulators/wells/VFPHelpers.hpp @@ -74,7 +74,8 @@ inline EvalWell zeroIfNanInf(const EvalWell& value) { * @return Production rate of oil, gas or liquid. */ template -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 -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()); diff --git a/opm/simulators/wells/VFPInjProperties.cpp b/opm/simulators/wells/VFPInjProperties.cpp index 6a2863acb..0fe49f5d9 100644 --- a/opm/simulators/wells/VFPInjProperties.cpp +++ b/opm/simulators/wells/VFPInjProperties.cpp @@ -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 thp_array = table.getTHPAxis(); int nthp = thp_array.size(); diff --git a/opm/simulators/wells/VFPInjProperties.hpp b/opm/simulators/wells/VFPInjProperties.hpp index 8a14010fc..b2b719cec 100644 --- a/opm/simulators/wells/VFPInjProperties.hpp +++ b/opm/simulators/wells/VFPInjProperties.hpp @@ -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 diff --git a/opm/simulators/wells/VFPProdProperties.cpp b/opm/simulators/wells/VFPProdProperties.cpp index 41d369f06..d074cba28 100644 --- a/opm/simulators/wells/VFPProdProperties.cpp +++ b/opm/simulators/wells/VFPProdProperties.cpp @@ -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& 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()); diff --git a/opm/simulators/wells/VFPProdProperties.hpp b/opm/simulators/wells/VFPProdProperties.hpp index 153fd0d5f..a0ba75988 100644 --- a/opm/simulators/wells/VFPProdProperties.hpp +++ b/opm/simulators/wells/VFPProdProperties.hpp @@ -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());