opm-simulators
VFPProdProperties.hpp
1 /*
2  Copyright 2015 SINTEF ICT, Applied Mathematics.
3 
4  This file is part of the Open Porous Media project (OPM).
5 
6  OPM is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  OPM is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with OPM. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #ifndef OPM_AUTODIFF_VFPPRODPROPERTIES_HPP_
21 #define OPM_AUTODIFF_VFPPRODPROPERTIES_HPP_
22 
23 #include <functional>
24 #include <map>
25 #include <vector>
26 
27 
28 namespace Opm {
29 
30 class VFPProdTable;
31 
37 template<class Scalar>
38 class VFPProdProperties {
39 public:
43  void addTable(const VFPProdTable& new_table);
44 
65  template <class EvalWell>
66  EvalWell bhp(const int table_id,
67  const EvalWell& aqua,
68  const EvalWell& liquid,
69  const EvalWell& vapour,
70  const Scalar thp,
71  const Scalar alq,
72  const Scalar explicit_wfr,
73  const Scalar explicit_gfr,
74  const bool use_expvfp) const;
75 
91  Scalar bhp(const int table_id,
92  const Scalar aqua,
93  const Scalar liquid,
94  const Scalar vapour,
95  const Scalar thp,
96  const Scalar alq,
97  const Scalar explicit_wfr,
98  const Scalar explicit_gfr,
99  const bool use_expvfp) const;
100 
116  Scalar thp(const int table_id,
117  const Scalar aqua,
118  const Scalar liquid,
119  const Scalar vapour,
120  const Scalar bhp,
121  const Scalar alq,
122  const Scalar explicit_wfr,
123  const Scalar explicit_gfr,
124  const bool use_expvfp) const;
125 
130  const VFPProdTable& getTable(const int table_id) const;
131 
135  bool hasTable(const int table_id) const;
136 
140  bool empty() const
141  {
142  return m_tables.empty();
143  }
144 
148  Scalar minimumBHP(const int table_id, const Scalar thp,
149  const Scalar wfr, const Scalar gfr, const Scalar alq) const;
150 
151 protected:
152  // calculate a group bhp values with a group of flo rate values
153  std::vector<Scalar> bhpwithflo(const std::vector<Scalar>& flos,
154  const int table_id,
155  const Scalar wfr,
156  const Scalar gfr,
157  const Scalar thp,
158  const Scalar alq,
159  const Scalar dp) const;
160 
161  // Map which connects the table number with the table itself
162  std::map<int, std::reference_wrapper<const VFPProdTable>> m_tables;
163 };
164 
165 } // namespace Opm
166 
167 #endif /* OPM_AUTODIFF_VFPPRODPROPERTIES_HPP_ */
EvalWell bhp(const int table_id, const EvalWell &aqua, const EvalWell &liquid, const EvalWell &vapour, const Scalar thp, const Scalar alq, const Scalar explicit_wfr, const Scalar explicit_gfr, const bool use_expvfp) const
Linear interpolation of bhp as a function of the input parameters given as Evalutions Each entry corr...
Definition: VFPProdProperties.cpp:165
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: blackoilbioeffectsmodules.hh:45
bool empty() const
Returns true if no vfp tables are in the current map.
Definition: VFPProdProperties.hpp:140
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:99
Scalar thp(const int table_id, const Scalar aqua, const Scalar liquid, const Scalar vapour, const Scalar bhp, const Scalar alq, const Scalar explicit_wfr, const Scalar explicit_gfr, const bool use_expvfp) const
Linear interpolation of thp as a function of the input parameters.
Definition: VFPProdProperties.cpp:36
Scalar minimumBHP(const int table_id, const Scalar thp, const Scalar wfr, const Scalar gfr, const Scalar alq) const
Returns minimum bhp for given thp, wfr, gfr and alq.
Definition: VFPProdProperties.cpp:143
void addTable(const VFPProdTable &new_table)
Takes no ownership of data.
Definition: VFPProdProperties.cpp:157
bool hasTable(const int table_id) const
Check whether there is table associated with ID.
Definition: VFPProdProperties.cpp:105