VFPProdTable.hpp
Go to the documentation of this file.
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_PARSER_ECLIPSE_ECLIPSESTATE_TABLES_VFPPRODTABLE_HPP_
21 #define OPM_PARSER_ECLIPSE_ECLIPSESTATE_TABLES_VFPPRODTABLE_HPP_
22 
24 
25 #include <opm/common/utility/platform_dependent/disable_warnings.h>
26 
27 #include <boost/multi_array.hpp>
28 
29 #include <opm/common/utility/platform_dependent/reenable_warnings.h>
30 
31 
32 namespace Opm {
33 
37 class VFPProdTable {
38 public:
39  typedef boost::multi_array<double, 5> array_type;
40  typedef boost::array<array_type::index, 5> extents;
41 
43  enum FLO_TYPE {
44  FLO_OIL=1, //< Oil rate
45  FLO_LIQ, //< Liquid rate
46  FLO_GAS, //< Gas rate
48  };
49 
51  enum WFR_TYPE {
52  WFR_WOR=11, //< Water-oil ratio
53  WFR_WCT, //< Water cut
54  WFR_WGR, //< Water-gas ratio
56  };
57 
59  enum GFR_TYPE {
60  GFR_GOR=21, //< Gas-oil ratio
61  GFR_GLR, //< Gas-liquid ratio
62  GFR_OGR, //< Oil-gas ratio
64  };
65 
67  enum ALQ_TYPE {
68  ALQ_GRAT=31, //< Lift as injection rate
69  ALQ_IGLR, //< Injection gas-liquid ratio
70  ALQ_TGLR, //< Total gas-liquid ratio
71  ALQ_PUMP, //< Pump rating
72  ALQ_COMP, //< Compressor power
73  ALQ_BEAN, //< Choke diameter
74  ALQ_UNDEF, //< Undefined
76  };
77 
81  inline VFPProdTable() : m_table_num(-1),
82  m_datum_depth(-1),
83  m_flo_type(FLO_INVALID),
84  m_wfr_type(WFR_INVALID),
85  m_gfr_type(GFR_INVALID),
86  m_alq_type(ALQ_INVALID) {
87 
88  }
89 
106  void init(int table_num,
107  double datum_depth,
108  FLO_TYPE flo_type,
109  WFR_TYPE wfr_type,
110  GFR_TYPE gfr_type,
111  ALQ_TYPE alq_type,
112  const std::vector<double>& flo_data,
113  const std::vector<double>& thp_data,
114  const std::vector<double>& wfr_data,
115  const std::vector<double>& gfr_data,
116  const std::vector<double>& alq_data,
117  const array_type& data);
118 
123  void init(DeckKeywordConstPtr table, std::shared_ptr<Opm::UnitSystem> deck_unit_system);
124 
129  inline int getTableNum() const {
130  return m_table_num;
131  }
132 
137  inline double getDatumDepth() const {
138  return m_datum_depth;
139  }
140 
145  inline FLO_TYPE getFloType() const {
146  return m_flo_type;
147  }
148 
153  inline WFR_TYPE getWFRType() const {
154  return m_wfr_type;
155  }
156 
161  inline GFR_TYPE getGFRType() const {
162  return m_gfr_type;
163  }
164 
169  inline ALQ_TYPE getALQType() const {
170  return m_alq_type;
171  }
172 
177  inline const std::vector<double>& getFloAxis() const {
178  return m_flo_data;
179  }
180 
185  inline const std::vector<double>& getTHPAxis() const {
186  return m_thp_data;
187  }
188 
193  inline const std::vector<double>& getWFRAxis() const {
194  return m_wfr_data;
195  }
196 
201  inline const std::vector<double>& getGFRAxis() const {
202  return m_gfr_data;
203  }
204 
209  inline const std::vector<double>& getALQAxis() const {
210  return m_alq_data;
211  }
212 
229  inline const array_type& getTable() const {
230  return m_data;
231  }
232 
233 private:
234 
235  //"Header" variables
236  int m_table_num;
237  double m_datum_depth;
238  FLO_TYPE m_flo_type;
239  WFR_TYPE m_wfr_type;
240  GFR_TYPE m_gfr_type;
241  ALQ_TYPE m_alq_type;
242 
243  //The actual table axes
244  std::vector<double> m_flo_data;
245  std::vector<double> m_thp_data;
246  std::vector<double> m_wfr_data;
247  std::vector<double> m_gfr_data;
248  std::vector<double> m_alq_data;
249 
250  //The data itself, using the data ordering m_data[thp][wfr][gfr][alq][flo]
251  array_type m_data;
252 
257  void check();
258 
259  static FLO_TYPE getFloType(std::shared_ptr<const DeckItem> item);
260  static WFR_TYPE getWFRType(std::shared_ptr<const DeckItem> item);
261  static GFR_TYPE getGFRType(std::shared_ptr<const DeckItem> item);
262  static ALQ_TYPE getALQType(std::shared_ptr<const DeckItem> item);
263 
264  static void scaleValues(std::vector<double>& values,
265  const double& scaling_factor);
266 
267  static void convertFloToSI(const FLO_TYPE& type,
268  std::vector<double>& values,
269  std::shared_ptr<Opm::UnitSystem> unit_system);
270  static void convertTHPToSI(std::vector<double>& values,
271  std::shared_ptr<Opm::UnitSystem> unit_system);
272  static void convertWFRToSI(const WFR_TYPE& type,
273  std::vector<double>& values,
274  std::shared_ptr<Opm::UnitSystem> unit_system);
275  static void convertGFRToSI(const GFR_TYPE& type,
276  std::vector<double>& values,
277  std::shared_ptr<Opm::UnitSystem> unit_system);
278  static void convertALQToSI(const ALQ_TYPE& type,
279  std::vector<double>& values,
280  std::shared_ptr<Opm::UnitSystem> unit_system);
281 };
282 
283 
284 
285 } //Namespace opm
286 
287 
288 #endif /* OPM_PARSER_ECLIPSE_ECLIPSESTATE_TABLES_VFPPRODTABLE_HPP_ */
const array_type & getTable() const
Definition: VFPProdTable.hpp:229
VFPProdTable()
Definition: VFPProdTable.hpp:81
boost::array< array_type::index, 5 > extents
Definition: VFPProdTable.hpp:40
Definition: VFPProdTable.hpp:53
Definition: Deck.hpp:29
FLO_TYPE
Rate type.
Definition: VFPProdTable.hpp:43
Definition: VFPProdTable.hpp:46
Definition: VFPProdTable.hpp:68
std::shared_ptr< const DeckKeyword > DeckKeywordConstPtr
Definition: DeckKeyword.hpp:71
boost::multi_array< double, 5 > array_type
Definition: VFPProdTable.hpp:39
Definition: VFPProdTable.hpp:37
GFR_TYPE getGFRType() const
Definition: VFPProdTable.hpp:161
double getDatumDepth() const
Definition: VFPProdTable.hpp:137
Definition: VFPProdTable.hpp:44
Definition: VFPProdTable.hpp:60
Definition: VFPProdTable.hpp:73
Definition: VFPProdTable.hpp:61
ALQ_TYPE
Artificial lift quantity.
Definition: VFPProdTable.hpp:67
const std::vector< double > & getWFRAxis() const
Definition: VFPProdTable.hpp:193
Definition: VFPProdTable.hpp:69
Definition: VFPProdTable.hpp:52
Definition: VFPProdTable.hpp:62
Definition: VFPProdTable.hpp:55
Definition: VFPProdTable.hpp:75
void init(int table_num, double datum_depth, FLO_TYPE flo_type, WFR_TYPE wfr_type, GFR_TYPE gfr_type, ALQ_TYPE alq_type, const std::vector< double > &flo_data, const std::vector< double > &thp_data, const std::vector< double > &wfr_data, const std::vector< double > &gfr_data, const std::vector< double > &alq_data, const array_type &data)
WFR_TYPE getWFRType() const
Definition: VFPProdTable.hpp:153
ALQ_TYPE getALQType() const
Definition: VFPProdTable.hpp:169
WFR_TYPE
Water fraction variable.
Definition: VFPProdTable.hpp:51
Definition: VFPProdTable.hpp:63
const std::vector< double > & getGFRAxis() const
Definition: VFPProdTable.hpp:201
Definition: VFPProdTable.hpp:54
GFR_TYPE
Gas fraction variable.
Definition: VFPProdTable.hpp:59
const std::vector< double > & getTHPAxis() const
Definition: VFPProdTable.hpp:185
const std::vector< double > & getALQAxis() const
Definition: VFPProdTable.hpp:209
Definition: VFPProdTable.hpp:72
Definition: VFPProdTable.hpp:45
Definition: VFPProdTable.hpp:74
Definition: VFPProdTable.hpp:70
int getTableNum() const
Definition: VFPProdTable.hpp:129
Definition: VFPProdTable.hpp:47
const std::vector< double > & getFloAxis() const
Definition: VFPProdTable.hpp:177
Definition: VFPProdTable.hpp:71
FLO_TYPE getFloType() const
Definition: VFPProdTable.hpp:145