00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef OPM_AUTODIFF_VFPINJPROPERTIES_HPP_
00021 #define OPM_AUTODIFF_VFPINJPROPERTIES_HPP_
00022
00023 #include <opm/parser/eclipse/EclipseState/Tables/VFPInjTable.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
00034 namespace Opm {
00035
00036 template <class Scalar>
00037 class AutoDiffBlock;
00038
00039 class VFPInjProperties {
00040 public:
00041 typedef AutoDiffBlock<double> ADB;
00042
00046 VFPInjProperties();
00047
00053 explicit VFPInjProperties(const VFPInjTable* inj_table);
00054
00060 explicit VFPInjProperties(const std::map<int, VFPInjTable>& inj_tables);
00061
00072 ADB bhp(const std::vector<int>& table_id,
00073 const Wells& wells,
00074 const ADB& qs,
00075 const ADB& thp) const;
00076
00092 ADB bhp(const std::vector<int>& table_id,
00093 const ADB& aqua,
00094 const ADB& liquid,
00095 const ADB& vapour,
00096 const ADB& thp) const;
00097
00114 template <class EvalWell>
00115 EvalWell bhp(const int table_id,
00116 const EvalWell& aqua,
00117 const EvalWell& liquid,
00118 const EvalWell& vapour,
00119 const double& thp) const {
00120
00121
00122 const VFPInjTable* table = detail::getTable(m_tables, table_id);
00123 EvalWell bhp = 0.0;
00124
00125
00126 EvalWell flo = detail::getFlo(aqua, liquid, vapour, table->getFloType());
00127
00128
00129 if (table != nullptr) {
00130
00131
00132 auto flo_i = detail::findInterpData(flo.value(), table->getFloAxis());
00133 auto thp_i = detail::findInterpData( thp, table->getTHPAxis());
00134
00135 detail::VFPEvaluation bhp_val = detail::interpolate(table->getTable(), flo_i, thp_i);
00136
00137 bhp = bhp_val.dflo * flo;
00138 bhp.setValue(bhp_val.value);
00139 }
00140 else {
00141 bhp.setValue(-1e100);
00142 }
00143 return bhp;
00144 }
00145
00157 double bhp(int table_id,
00158 const double& aqua,
00159 const double& liquid,
00160 const double& vapour,
00161 const double& thp) const;
00162
00163
00175 double thp(int table_id,
00176 const double& aqua,
00177 const double& liquid,
00178 const double& vapour,
00179 const double& bhp) const;
00180
00185 const VFPInjTable* getTable(const int table_id) const;
00186
00190 bool empty() const {
00191 return m_tables.empty();
00192 }
00193
00194 private:
00195
00196 std::map<int, const VFPInjTable*> m_tables;
00197 };
00198
00199
00200
00201 }
00202
00203
00204
00205 #endif