Runspec.hpp
Go to the documentation of this file.
1/*
2 Copyright 2016 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 it under the terms
7 of the GNU General Public License as published by the Free Software
8 Foundation, either version 3 of the License, or (at your option) any later
9 version.
10
11 OPM is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
13 A PARTICULAR PURPOSE. See the GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License along with
16 OPM. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19#ifndef OPM_RUNSPEC_HPP
20#define OPM_RUNSPEC_HPP
21
22#include <iosfwd>
23#include <string>
24
29
30namespace Opm {
31class Deck;
32
33
34enum class Phase {
35 OIL = 0,
36 GAS = 1,
37 WATER = 2,
38 SOLVENT = 3,
39 POLYMER = 4,
40 ENERGY = 5,
41 POLYMW = 6,
42 FOAM = 7,
43 BRINE = 8
44 // If you add more entries to this enum, remember to update NUM_PHASES_IN_ENUM below.
45};
46
47constexpr int NUM_PHASES_IN_ENUM = static_cast<int>(Phase::BRINE) + 1; // Used to get correct size of the bitset in class Phases.
48
50std::ostream& operator<<( std::ostream&, const Phase& );
51
52class Phases {
53 public:
54 Phases() noexcept = default;
55 Phases( bool oil, bool gas, bool wat, bool solvent = false, bool polymer = false, bool energy = false,
56 bool polymw = false, bool foam = false, bool brine = false ) noexcept;
57
59
60 bool active( Phase ) const noexcept;
61 size_t size() const noexcept;
62
63 bool operator==(const Phases& data) const;
64
65 template<class Serializer>
66 void serializeOp(Serializer& serializer)
67 {
68 if (serializer.isSerializing())
69 serializer(bits.to_ulong());
70 else {
71 unsigned long Bits = 0;
72 serializer(Bits);
73 bits = std::bitset<NUM_PHASES_IN_ENUM>(Bits);
74 }
75 }
76
77 private:
78 std::bitset< NUM_PHASES_IN_ENUM > bits;
79};
80
81
82class Welldims {
83public:
84 Welldims() = default;
85 explicit Welldims(const Deck& deck);
86
88
89 int maxConnPerWell() const
90 {
91 return this->nCWMax;
92 }
93
94 int maxWellsPerGroup() const
95 {
96 return this->nWGMax;
97 }
98
99 int maxGroupsInField() const
100 {
101 return this->nGMax;
102 }
103
104 int maxWellsInField() const
105 {
106 return this->nWMax;
107 }
108
109 bool operator==(const Welldims& data) const {
110 return this->maxConnPerWell() == data.maxConnPerWell() &&
111 this->maxWellsPerGroup() == data.maxWellsPerGroup() &&
112 this->maxGroupsInField() == data.maxGroupsInField() &&
113 this->maxWellsInField() == data.maxWellsInField();
114 }
115
116 template<class Serializer>
117 void serializeOp(Serializer& serializer)
118 {
119 serializer(nWMax);
120 serializer(nCWMax);
121 serializer(nWGMax);
122 serializer(nGMax);
123 }
124
125private:
126 int nWMax { 0 };
127 int nCWMax { 0 };
128 int nWGMax { 0 };
129 int nGMax { 0 };
130};
131
133public:
135 explicit WellSegmentDims(const Deck& deck);
136
138
139
141 {
142 return this->nSegWellMax;
143 }
144
146 {
147 return this->nSegmentMax;
148 }
149
151 {
152 return this->nLatBranchMax;
153 }
154
155 bool operator==(const WellSegmentDims& data) const;
156
157 template<class Serializer>
158 void serializeOp(Serializer& serializer)
159 {
160 serializer(nSegWellMax);
161 serializer(nSegmentMax);
162 serializer(nLatBranchMax);
163 }
164
165private:
166 int nSegWellMax;
167 int nSegmentMax;
168 int nLatBranchMax;
169};
170
172{
173public:
174 EclHysterConfig() = default;
175 explicit EclHysterConfig(const Deck& deck);
176
178
182 //void setActive(bool yesno);
183
187 bool active() const;
188
195 int pcHysteresisModel() const;
196
203 int krHysteresisModel() const;
204
205 bool operator==(const EclHysterConfig& data) const;
206
207 template<class Serializer>
208 void serializeOp(Serializer& serializer)
209 {
210 serializer(activeHyst);
211 serializer(pcHystMod);
212 serializer(krHystMod);
213 }
214
215private:
216 // enable hysteresis at all
217 bool activeHyst { false };
218
219 // the capillary pressure and the relperm hysteresis models to be used
220 int pcHystMod { 0 };
221 int krHystMod { 0 };
222};
223
225public:
227 Default,
228 Stone1,
229 Stone2
230 };
231
233 explicit SatFuncControls(const Deck& deck);
234 SatFuncControls(const double tolcritArg,
236
237
239
241 {
242 return this->tolcrit;
243 }
244
246 {
247 return this->krmodel;
248 }
249
250 bool operator==(const SatFuncControls& rhs) const;
251
252 template<class Serializer>
253 void serializeOp(Serializer& serializer)
254 {
255 serializer(tolcrit);
256 serializer(krmodel);
257 }
258
259private:
260 double tolcrit;
262};
263
264class Runspec {
265public:
266 Runspec() = default;
267 explicit Runspec( const Deck& );
268
270
271 const UDQParams& udqParams() const noexcept;
272 const Phases& phases() const noexcept;
273 const Tabdims& tabdims() const noexcept;
274 const EndpointScaling& endpointScaling() const noexcept;
275 const Welldims& wellDimensions() const noexcept;
276 const WellSegmentDims& wellSegmentDimensions() const noexcept;
277 int eclPhaseMask( ) const noexcept;
278 const EclHysterConfig& hysterPar() const noexcept;
279 const Actdims& actdims() const noexcept;
281
282 bool operator==(const Runspec& data) const;
283
284 template<class Serializer>
285 void serializeOp(Serializer& serializer)
286 {
287 active_phases.serializeOp(serializer);
288 m_tabdims.serializeOp(serializer);
289 endscale.serializeOp(serializer);
290 welldims.serializeOp(serializer);
291 wsegdims.serializeOp(serializer);
292 udq_params.serializeOp(serializer);
293 hystpar.serializeOp(serializer);
294 m_actdims.serializeOp(serializer);
295 m_sfuncctrl.serializeOp(serializer);
296 }
297
298private:
299 Phases active_phases;
300 Tabdims m_tabdims;
301 EndpointScaling endscale;
302 Welldims welldims;
303 WellSegmentDims wsegdims;
304 UDQParams udq_params;
305 EclHysterConfig hystpar;
306 Actdims m_actdims;
307 SatFuncControls m_sfuncctrl;
308};
309
310
311}
312
313#endif // OPM_RUNSPEC_HPP
const char *const string
Definition: cJSON.h:170
Definition: Actdims.hpp:27
void serializeOp(Serializer &serializer)
Definition: Actdims.hpp:42
Definition: Deck.hpp:115
Definition: Runspec.hpp:172
EclHysterConfig(const Deck &deck)
int pcHysteresisModel() const
Return the type of the hysteresis model which is used for capillary pressure.
bool operator==(const EclHysterConfig &data) const
static EclHysterConfig serializeObject()
bool active() const
Specify whether hysteresis is enabled or not.
int krHysteresisModel() const
Return the type of the hysteresis model which is used for relative permeability.
EclHysterConfig()=default
void serializeOp(Serializer &serializer)
Definition: Runspec.hpp:208
Definition: EndpointScaling.hpp:28
void serializeOp(Serializer &serializer)
Definition: EndpointScaling.hpp:48
Definition: Runspec.hpp:52
static Phases serializeObject()
bool active(Phase) const noexcept
size_t size() const noexcept
Phases() noexcept=default
void serializeOp(Serializer &serializer)
Definition: Runspec.hpp:66
Definition: Runspec.hpp:264
const Actdims & actdims() const noexcept
Runspec(const Deck &)
const Welldims & wellDimensions() const noexcept
Runspec()=default
static Runspec serializeObject()
const EclHysterConfig & hysterPar() const noexcept
const EndpointScaling & endpointScaling() const noexcept
const WellSegmentDims & wellSegmentDimensions() const noexcept
int eclPhaseMask() const noexcept
const Phases & phases() const noexcept
const SatFuncControls & saturationFunctionControls() const noexcept
const UDQParams & udqParams() const noexcept
const Tabdims & tabdims() const noexcept
void serializeOp(Serializer &serializer)
Definition: Runspec.hpp:285
Definition: Runspec.hpp:224
bool operator==(const SatFuncControls &rhs) const
double minimumRelpermMobilityThreshold() const
Definition: Runspec.hpp:240
ThreePhaseOilKrModel
Definition: Runspec.hpp:226
void serializeOp(Serializer &serializer)
Definition: Runspec.hpp:253
static SatFuncControls serializeObject()
ThreePhaseOilKrModel krModel() const
Definition: Runspec.hpp:245
SatFuncControls(const Deck &deck)
SatFuncControls(const double tolcritArg, ThreePhaseOilKrModel model)
Definition: Serializer.hpp:38
Definition: parser/eclipse/EclipseState/Tables/tabdims.hpp:34
void serializeOp(Serializer &serializer)
Definition: parser/eclipse/EclipseState/Tables/tabdims.hpp:113
Definition: UDQParams.hpp:31
void serializeOp(Serializer &serializer)
Definition: UDQParams.hpp:51
Definition: Runspec.hpp:132
static WellSegmentDims serializeObject()
void serializeOp(Serializer &serializer)
Definition: Runspec.hpp:158
int maxSegmentedWells() const
Definition: Runspec.hpp:140
bool operator==(const WellSegmentDims &data) const
WellSegmentDims(const Deck &deck)
int maxSegmentsPerWell() const
Definition: Runspec.hpp:145
int maxLateralBranchesPerWell() const
Definition: Runspec.hpp:150
Definition: Runspec.hpp:82
int maxConnPerWell() const
Definition: Runspec.hpp:89
int maxWellsInField() const
Definition: Runspec.hpp:104
Welldims()=default
Welldims(const Deck &deck)
void serializeOp(Serializer &serializer)
Definition: Runspec.hpp:117
bool operator==(const Welldims &data) const
Definition: Runspec.hpp:109
int maxWellsPerGroup() const
Definition: Runspec.hpp:94
int maxGroupsInField() const
Definition: Runspec.hpp:99
static Welldims serializeObject()
#define false
Definition: msvc_stdbool.h:19
Definition: A.hpp:4
std::ostream & operator<<(std::ostream &os, const UniformTableLinear< T > &t)
Definition: UniformTableLinear.hpp:249
Phase
Definition: Runspec.hpp:34
Phase get_phase(const std::string &)
constexpr int NUM_PHASES_IN_ENUM
Definition: Runspec.hpp:47
static std::string data()
Definition: exprtk.hpp:40022