00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef OPM_AUTODIFF_VFPPRODPROPERTIES_HPP_
00021 #define OPM_AUTODIFF_VFPPRODPROPERTIES_HPP_
00022
00023 #include <opm/parser/eclipse/EclipseState/Tables/VFPProdTable.hpp>
00024 #include <opm/core/wells.h>
00025 #include <opm/material/densead/Math.hpp>
00026 #include <opm/material/densead/Evaluation.hpp>
00027 #include <opm/autodiff/VFPHelpers.hpp>
00028
00029 #include <vector>
00030 #include <map>
00031
00032
00033 namespace Opm {
00034
00035 template <class Scalar>
00036 class AutoDiffBlock;
00037
00043 class VFPProdProperties {
00044 public:
00045 typedef AutoDiffBlock<double> ADB;
00046
00050 VFPProdProperties();
00051
00057 explicit VFPProdProperties(const VFPProdTable* prod_table);
00058
00064 explicit VFPProdProperties(const std::map<int, VFPProdTable>& prod_tables);
00065
00077 ADB bhp(const std::vector<int>& table_id,
00078 const Wells& wells,
00079 const ADB& qs,
00080 const ADB& thp,
00081 const ADB& alq) const;
00082
00099 ADB bhp(const std::vector<int>& table_id,
00100 const ADB& aqua,
00101 const ADB& liquid,
00102 const ADB& vapour,
00103 const ADB& thp,
00104 const ADB& alq) const;
00105
00106
00124 template <class EvalWell>
00125 EvalWell bhp(const int table_id,
00126 const EvalWell& aqua,
00127 const EvalWell& liquid,
00128 const EvalWell& vapour,
00129 const double& thp,
00130 const double& alq) const {
00131
00132
00133 const VFPProdTable* table = detail::getTable(m_tables, table_id);
00134 EvalWell bhp = 0.0;
00135
00136
00137 EvalWell flo = detail::getFlo(aqua, liquid, vapour, table->getFloType());
00138 EvalWell wfr = detail::getWFR(aqua, liquid, vapour, table->getWFRType());
00139 EvalWell gfr = detail::getGFR(aqua, liquid, vapour, table->getGFRType());
00140
00141
00142 if (table != nullptr) {
00143
00144
00145 auto flo_i = detail::findInterpData(-flo.value(), table->getFloAxis());
00146 auto thp_i = detail::findInterpData( thp, table->getTHPAxis());
00147 auto wfr_i = detail::findInterpData( wfr.value(), table->getWFRAxis());
00148 auto gfr_i = detail::findInterpData( gfr.value(), table->getGFRAxis());
00149 auto alq_i = detail::findInterpData( alq, table->getALQAxis());
00150
00151 detail::VFPEvaluation bhp_val = detail::interpolate(table->getTable(), flo_i, thp_i, wfr_i, gfr_i, alq_i);
00152
00153 bhp = (bhp_val.dwfr * wfr) + (bhp_val.dgfr * gfr) - (bhp_val.dflo * flo);
00154 bhp.setValue(bhp_val.value);
00155 }
00156 else {
00157 bhp.setValue(-1e100);
00158 }
00159 return bhp;
00160 }
00161
00174 double bhp(int table_id,
00175 const double& aqua,
00176 const double& liquid,
00177 const double& vapour,
00178 const double& thp,
00179 const double& alq) const;
00180
00193 double thp(int table_id,
00194 const double& aqua,
00195 const double& liquid,
00196 const double& vapour,
00197 const double& bhp,
00198 const double& alq) const;
00199
00204 const VFPProdTable* getTable(const int table_id) const;
00205
00209 bool empty() const {
00210 return m_tables.empty();
00211 }
00212
00213 private:
00214
00215 std::map<int, const VFPProdTable*> m_tables;
00216 };
00217
00218
00219
00220
00221 }
00222
00223
00224 #endif