21 #ifndef OPM_AUTODIFF_VFPHELPERS_HPP_ 22 #define OPM_AUTODIFF_VFPHELPERS_HPP_ 42 template<
class Scalar>
45 VFPEvaluation() : value(0.0), dthp(0.0), dwfr(0.0), dgfr(0.0), dalq(0.0), dflo(0.0) {};
54 template<
class Scalar>
56 template<
class Scalar>
58 template<
class Scalar>
64 template<
class Scalar>
67 InterpData() : ind_{0, 0}, inv_dist_(0.0), factor_(0.0) {}
79 T getFlo(
const VFPProdTable& table,
90 T getFlo(
const VFPInjTable& table,
100 T getWFR(
const VFPProdTable& table,
109 template <
typename T>
110 T getGFR(
const VFPProdTable& table,
118 template <
typename T>
119 const T& getTable(
const std::map<
int, std::reference_wrapper<const T>>& tables,
int table_id);
124 template <
typename T>
125 bool hasTable(
const std::map<
int, std::reference_wrapper<const T>>& tables,
int table_id) {
126 const auto entry = tables.find(table_id);
127 return (entry != tables.end() );
133 template <
typename TYPE,
typename TABLE>
134 TYPE getType(
const TABLE& table);
138 template<
class Scalar>
148 const std::vector<double>& values);
174 const Scalar explicit_wfr,
175 const Scalar explicit_gfr,
176 const bool use_vfpexplicit);
190 static Scalar
findTHP(
const std::vector<Scalar>& bhp_array,
191 const std::vector<double>& thp_array,
193 const bool find_largest =
true);
198 static std::pair<Scalar, Scalar>
209 static std::optional<std::pair<Scalar, Scalar>>
217 const std::function<Scalar(
const Scalar)>& adjust_bhp);
static detail::VFPEvaluation< Scalar > interpolate(const VFPProdTable &table, const detail::InterpData< Scalar > &flo_i, const detail::InterpData< Scalar > &thp_i, const detail::InterpData< Scalar > &wfr_i, const detail::InterpData< Scalar > &gfr_i, const detail::InterpData< Scalar > &alq_i)
Helper function which interpolates data using the indices etc.
Definition: VFPHelpers.cpp:146
An "ADB-like" structure with a single value and a set of derivatives.
Definition: VFPHelpers.hpp:43
static std::optional< std::pair< Scalar, Scalar > > intersectWithIPR(const VFPProdTable &table, const Scalar thp, const Scalar wfr, const Scalar gfr, const Scalar alq, const Scalar ipr_a, const Scalar ipr_b, const std::function< Scalar(const Scalar)> &adjust_bhp)
Get (flo, bhp) at largest occuring stable vfp/ipr-intersection if it exists.
Definition: VFPHelpers.cpp:551
static std::pair< Scalar, Scalar > getMinimumBHPCoordinate(const VFPProdTable &table, const Scalar thp, const Scalar wfr, const Scalar gfr, const Scalar alq)
Get (flo, bhp) at minimum bhp for given thp,wfr,gfr,alq.
Definition: VFPHelpers.cpp:518
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: blackoilbioeffectsmodules.hh:45
Helper struct for linear interpolation.
Definition: VFPHelpers.hpp:65
static Scalar findTHP(const std::vector< Scalar > &bhp_array, const std::vector< double > &thp_array, Scalar bhp, const bool find_largest=true)
This function finds the value of THP given a specific BHP.
Definition: VFPHelpers.cpp:365
Definition: VFPHelpers.hpp:139
static detail::InterpData< Scalar > findInterpData(const Scalar value_in, const std::vector< double > &values)
Helper function to find indices etc.
Definition: VFPHelpers.cpp:84