My Project
VFPProdTable.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_PARSER_ECLIPSE_ECLIPSESTATE_TABLES_VFPPRODTABLE_HPP_
21 #define OPM_PARSER_ECLIPSE_ECLIPSESTATE_TABLES_VFPPRODTABLE_HPP_
22 
23 
24 #include <array>
25 #include <vector>
26 #include <opm/parser/eclipse/Units/Dimension.hpp>
27 #include <opm/common/OpmLog/KeywordLocation.hpp>
28 
29 namespace Opm {
30 
31  class DeckItem;
32  class DeckKeyword;
33  class UnitSystem;
34 
38 class VFPProdTable {
39 public:
40 
41  enum class FLO_TYPE {
42  FLO_OIL=1,
43  FLO_LIQ,
44  FLO_GAS
45  };
46 
47  enum class WFR_TYPE {
48  WFR_WOR=11,
49  WFR_WCT,
50  WFR_WGR
51  };
52 
53  enum class GFR_TYPE {
54  GFR_GOR=21,
55  GFR_GLR,
56  GFR_OGR
57  };
58 
59  enum class ALQ_TYPE {
60  ALQ_GRAT=31,
61  ALQ_IGLR,
62  ALQ_TGLR,
63  ALQ_PUMP,
64  ALQ_COMP,
65  ALQ_BEAN,
66  ALQ_UNDEF
67  };
68 
69  VFPProdTable();
70  VFPProdTable( const DeckKeyword& table, const UnitSystem& deck_unit_system);
71  VFPProdTable(int table_num,
72  double datum_depth,
73  FLO_TYPE flo_type,
74  WFR_TYPE wfr_type,
75  GFR_TYPE gfr_type,
76  ALQ_TYPE alq_type,
77  const std::vector<double>& flo_data,
78  const std::vector<double>& thp_data,
79  const std::vector<double>& wfr_data,
80  const std::vector<double>& gfr_data,
81  const std::vector<double>& alq_data,
82  const std::vector<double>& data);
83  static Dimension ALQDimension(const ALQ_TYPE& alq_type, const UnitSystem& unit_system);
84 
85  static VFPProdTable serializeObject();
86 
87  inline int getTableNum() const {
88  return m_table_num;
89  }
90 
91  inline const KeywordLocation& location() const {
92  return this->m_location;
93  }
94 
95  // The name() method is added to simplify serialization.
96  inline int name() const {
97  return m_table_num;
98  }
99 
100  inline double getDatumDepth() const {
101  return m_datum_depth;
102  }
103 
104  inline FLO_TYPE getFloType() const {
105  return m_flo_type;
106  }
107 
108  inline WFR_TYPE getWFRType() const {
109  return m_wfr_type;
110  }
111 
112  inline GFR_TYPE getGFRType() const {
113  return m_gfr_type;
114  }
115 
116  inline ALQ_TYPE getALQType() const {
117  return m_alq_type;
118  }
119 
120  inline const std::vector<double>& getFloAxis() const {
121  return m_flo_data;
122  }
123 
124  inline const std::vector<double>& getTHPAxis() const {
125  return m_thp_data;
126  }
127 
128  inline const std::vector<double>& getWFRAxis() const {
129  return m_wfr_data;
130  }
131 
132  inline const std::vector<double>& getGFRAxis() const {
133  return m_gfr_data;
134  }
135 
136  inline const std::vector<double>& getALQAxis() const {
137  return m_alq_data;
138  }
139 
154  inline const std::vector<double>& getTable() const {
155  return m_data;
156  }
157 
158  bool operator==(const VFPProdTable& data) const;
159 
160  std::array<size_t,5> shape() const;
161 
162  double operator()(size_t thp_idx, size_t wfr_idx, size_t gfr_idx, size_t alq_idx, size_t flo_idx) const;
163 
164  template<class Serializer>
165  void serializeOp(Serializer& serializer)
166  {
167  serializer(m_table_num);
168  serializer(m_datum_depth);
169  serializer(m_flo_type);
170  serializer(m_wfr_type);
171  serializer(m_gfr_type);
172  serializer(m_alq_type);
173  serializer(m_flo_data);
174  serializer(m_thp_data);
175  serializer(m_wfr_data);
176  serializer(m_gfr_data);
177  serializer(m_alq_data);
178  serializer(m_data);
179  m_location.serializeOp(serializer);
180  }
181 
182 private:
183  int m_table_num;
184  double m_datum_depth;
185  FLO_TYPE m_flo_type;
186  WFR_TYPE m_wfr_type;
187  GFR_TYPE m_gfr_type;
188  ALQ_TYPE m_alq_type;
189 
190  std::vector<double> m_flo_data;
191  std::vector<double> m_thp_data;
192  std::vector<double> m_wfr_data;
193  std::vector<double> m_gfr_data;
194  std::vector<double> m_alq_data;
195 
196  std::vector<double> m_data;
197  KeywordLocation m_location;
198 
199  void check();
200 
201  double& operator()(size_t thp_idx, size_t wfr_idx, size_t gfr_idx, size_t alq_idx, size_t flo_idx);
202 
203  static void scaleValues(std::vector<double>& values,
204  const double& scaling_factor);
205 
206  static void convertFloToSI(const FLO_TYPE& type,
207  std::vector<double>& values,
208  const UnitSystem& unit_system);
209  static void convertTHPToSI(std::vector<double>& values,
210  const UnitSystem& unit_system);
211  static void convertWFRToSI(const WFR_TYPE& type,
212  std::vector<double>& values,
213  const UnitSystem& unit_system);
214  static void convertGFRToSI(const GFR_TYPE& type,
215  std::vector<double>& values,
216  const UnitSystem& unit_system);
217  static void convertAlqToSI(const ALQ_TYPE& type,
218  std::vector<double>& values,
219  const UnitSystem& unit_system);
220 };
221 
222 
223 
224 }
225 
226 
227 #endif
Definition: DeckKeyword.hpp:36
Definition: Dimension.hpp:27
Definition: KeywordLocation.hpp:27
Definition: Serializer.hpp:38
Definition: UnitSystem.hpp:34
Class for reading data from a VFPPROD (vertical flow performance production) table.
Definition: VFPProdTable.hpp:38
const std::vector< double > & getTable() const
Returns the data of the table itself.
Definition: VFPProdTable.hpp:154
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:29