My Project
PvtxTable.hpp
1 /*
2  Copyright 2015 Statoil ASA.
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 #ifndef OPM_PARSER_PVTX_TABLE_HPP
20 #define OPM_PARSER_PVTX_TABLE_HPP
21 
22 #include <opm/input/eclipse/EclipseState/Tables/ColumnSchema.hpp>
23 #include <opm/input/eclipse/EclipseState/Tables/SimpleTable.hpp>
24 #include <opm/input/eclipse/EclipseState/Tables/TableColumn.hpp>
25 #include <opm/input/eclipse/EclipseState/Tables/TableSchema.hpp>
26 
27 #include <string>
28 #include <utility>
29 #include <vector>
30 
31 #include <stddef.h>
32 
33 /*
34  This class is a common base class for the PVTG and PVTO tables. The
35  PVTO and PVTG keywords have a quite complex structure. The structure
36  consists of alternating records of saturated data and corresponding
37  undersaturated tables, this structure is again repeated for the
38  different satnum regions.
39 
40 
41  PVTO
42 
43 -- RSO PRESSURE B-OIL VISCOSITY
44 -- (BAR) (CP)
45 
46  [ 20.59 { 50.00 1.10615 1.180 } ] \
47  { 75.00 1.10164 1.247 } |
48  { 100.00 1.09744 1.315 } |
49  { 125.00 1.09351 1.384 } |
50  { 150.00 1.08984 1.453 }/ |
51  |
52  [ 28.19 { 70.00 1.12522 1.066 } ] |
53  { 95.00 1.12047 1.124 } |
54  { 120.00 1.11604 1.182 } |-- Pvtnum region 1
55  { 145.00 1.11191 1.241 } |
56  { 170.00 1.10804 1.300 }/ |
57  |
58  [ 36.01 { 90.00 1.14458 0.964 } ] |
59  { 115.00 1.13959 1.014 } |
60  { 140.00 1.13494 1.064 } |
61  { 165.00 1.13060 1.115 } |
62  { 190.00 1.12653 1.166 }/ |
63 / /
64  404.60 594.29 1.97527 0.21564 \
65  619.29 1.96301 0.21981 |
66  644.29 1.95143 0.22393 |-- Pvtnum region 2
67  669.29 1.94046 0.22801 |
68  694.29 1.93005 0.23204 / |
69 / /
70  404.60 594.29 1.97527 0.21564 \
71  619.29 1.96301 0.21981 |
72  644.29 1.95143 0.22393 |
73  669.29 1.94046 0.22801 |
74  694.29 1.93005 0.23204 / |-- Pvtnum region 3
75  404.60 594.29 1.97527 0.21564 |
76  619.29 1.96301 0.21981 |
77  644.29 1.95143 0.22393 |
78  669.29 1.94046 0.22801 |
79  694.29 1.93005 0.23204 / /
80 /
81 
82 
83 In pvtnum region1 the saturated records are marked with [ ... ], and
84 the corresponding undersaturated tables are marked with { ... }. So
85 for pvtnum region1 the table of saturated properties looks like:
86 
87  RSO PRESSURE B-OIL VISCOSITY
88  20.59 50.00 1.10615 1.180
89  28.19 70.00 1.12522 1.066
90  36.01 90.00 1.14458 0.964
91 
92 In the PvtxTable class this table is available as the method
93 getSaturatedTable( ). For each RS value there is a table of
94 undersaturated properties; since the saturated table for region1 has
95 three rows there are three such tables, these tables are available as
96 getUnderSaturatedTable( index ). In this particular example the first
97 undersaturated table looks like:
98 
99  PRESSURE B-OIL VISCOSITY
100  50.00 1.10615 1.180
101  75.00 1.10164 1.247
102  100.00 1.09744 1.315
103  125.00 1.09351 1.384
104  150.00 1.08984 1.453
105 
106 The first row actually corresponds to saturated values.
107 */
108 
109  namespace Opm {
110 
111  class DeckKeyword;
112 
113  class PvtxTable {
114  public:
115  static size_t numTables( const DeckKeyword& keyword);
116  static std::vector<std::pair<size_t , size_t> > recordRanges( const DeckKeyword& keyword);
117 
118  PvtxTable() = default;
119  explicit PvtxTable(const std::string& columnName);
120 
121  static PvtxTable serializationTestObject();
122 
123  const SimpleTable& getUnderSaturatedTable(size_t tableNumber) const;
124  void init(const DeckKeyword& keyword, size_t tableIdx);
125  size_t size() const;
126  double evaluate(const std::string& column, double outerArg, double innerArg) const;
127  double getArgValue(size_t index) const;
128  const SimpleTable& getSaturatedTable() const;
129 
130  /*
131  Will iterate over the internal undersaturated tables; same
132  as getUnderSaturatedTable( ).
133  */
134  std::vector< SimpleTable >::const_iterator begin() const;
135  std::vector< SimpleTable >::const_iterator end() const;
136 
137  bool operator==(const PvtxTable& data) const;
138 
139  template <class Serializer>
140  void serializeOp(Serializer& serializer)
141  {
142  serializer(m_outerColumnSchema);
143  serializer(m_outerColumn);
144  serializer(m_underSaturatedSchema);
145  serializer(m_saturatedSchema);
146  serializer(m_underSaturatedTables);
147  serializer(m_saturatedTable);
148  }
149 
150  protected:
151  ColumnSchema m_outerColumnSchema;
152  TableColumn m_outerColumn;
153 
154  TableSchema m_underSaturatedSchema;
155  TableSchema m_saturatedSchema;
156  std::vector< SimpleTable > m_underSaturatedTables;
157  SimpleTable m_saturatedTable;
158  };
159 }
160 
161 #endif
Definition: ColumnSchema.hpp:31
Definition: DeckKeyword.hpp:36
Definition: PvtxTable.hpp:113
Class for (de-)serializing.
Definition: Serializer.hpp:75
Definition: SimpleTable.hpp:35
Definition: TableColumn.hpp:32
Definition: TableSchema.hpp:31
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:29