20 #ifndef OPM_AUTODIFF_VFPPRODPROPERTIES_HPP_
21 #define OPM_AUTODIFF_VFPPRODPROPERTIES_HPP_
23 #include <opm/parser/eclipse/EclipseState/Tables/VFPProdTable.hpp>
24 #include <opm/core/wells.h>
25 #include <opm/material/densead/Math.hpp>
26 #include <opm/material/densead/Evaluation.hpp>
27 #include <opm/autodiff/VFPHelpers.hpp>
35 template <
class Scalar>
77 ADB bhp(
const std::vector<int>& table_id,
81 const ADB& alq)
const;
99 ADB bhp(
const std::vector<int>& table_id,
104 const ADB& alq)
const;
124 template <
class EvalWell>
125 EvalWell
bhp(
const int table_id,
126 const EvalWell& aqua,
127 const EvalWell& liquid,
128 const EvalWell& vapour,
130 const double& alq)
const {
133 const VFPProdTable* table = detail::getTable(m_tables, table_id);
137 EvalWell flo = detail::getFlo(aqua, liquid, vapour, table->getFloType());
138 EvalWell wfr = detail::getWFR(aqua, liquid, vapour, table->getWFRType());
139 EvalWell gfr = detail::getGFR(aqua, liquid, vapour, table->getGFRType());
142 if (table !=
nullptr) {
145 auto flo_i = detail::findInterpData(-flo.value(), table->getFloAxis());
146 auto thp_i = detail::findInterpData( thp, table->getTHPAxis());
147 auto wfr_i = detail::findInterpData( wfr.value(), table->getWFRAxis());
148 auto gfr_i = detail::findInterpData( gfr.value(), table->getGFRAxis());
149 auto alq_i = detail::findInterpData( alq, table->getALQAxis());
151 detail::VFPEvaluation bhp_val = detail::interpolate(table->getTable(), flo_i, thp_i, wfr_i, gfr_i, alq_i);
153 bhp = (bhp_val.dwfr * wfr) + (bhp_val.dgfr * gfr) - (bhp_val.dflo * flo);
154 bhp.setValue(bhp_val.value);
157 bhp.setValue(-1e100);
174 double bhp(
int table_id,
176 const double& liquid,
177 const double& vapour,
179 const double& alq)
const;
193 double thp(
int table_id,
195 const double& liquid,
196 const double& vapour,
198 const double& alq)
const;
204 const VFPProdTable*
getTable(
const int table_id)
const;
210 return m_tables.empty();
215 std::map<int, const VFPProdTable*> m_tables;
An "ADB-like" structure with a single value and a set of derivatives.
Definition: VFPHelpers.hpp:272
Class which linearly interpolates BHP as a function of rate, tubing head pressure, water fraction, gas fraction, and artificial lift for production VFP tables, and similarly the BHP as a function of the rate and tubing head pressure.
Definition: VFPProdProperties.hpp:43
double thp(int table_id, const double &aqua, const double &liquid, const double &vapour, const double &bhp, const double &alq) const
Linear interpolation of thp as a function of the input parameters.
Definition: VFPProdProperties.cpp:192
bool empty() const
Returns true if no vfp tables are in the current map.
Definition: VFPProdProperties.hpp:209
const VFPProdTable * getTable(const int table_id) const
Returns the table associated with the ID, or throws an exception if the table does not exist...
Definition: VFPProdProperties.cpp:234
VFPProdProperties()
Empty constructor.
Definition: VFPProdProperties.cpp:39
ADB bhp(const std::vector< int > &table_id, const Wells &wells, const ADB &qs, const ADB &thp, const ADB &alq) const
Linear interpolation of bhp as function of the input parameters.
Definition: VFPProdProperties.cpp:58
EvalWell bhp(const int table_id, const EvalWell &aqua, const EvalWell &liquid, const EvalWell &vapour, const double &thp, const double &alq) const
Linear interpolation of bhp as a function of the input parameters given as Evalutions Each entry corr...
Definition: VFPProdProperties.hpp:125