My Project
Runspec.hpp
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 <opm/common/OpmLog/KeywordLocation.hpp>
23#include <opm/input/eclipse/EclipseState/Phase.hpp>
24#include <opm/input/eclipse/EclipseState/Tables/Tabdims.hpp>
25#include <opm/input/eclipse/EclipseState/Tables/Regdims.hpp>
26#include <opm/input/eclipse/EclipseState/EndpointScaling.hpp>
27#include <opm/input/eclipse/Schedule/UDQ/UDQParams.hpp>
28#include <opm/input/eclipse/Schedule/Action/Actdims.hpp>
29
30#include <optional>
31#include <string>
32
33namespace Opm {
34
35class Deck;
36
37class Phases {
38public:
39 Phases() noexcept = default;
40 Phases( bool oil, bool gas, bool wat, bool solvent = false, bool polymer = false, bool energy = false,
41 bool polymw = false, bool foam = false, bool brine = false, bool zfraction = false ) noexcept;
42
43 static Phases serializationTestObject();
44
45 bool active( Phase ) const noexcept;
46 size_t size() const noexcept;
47
48 bool operator==(const Phases& data) const;
49
50 template<class Serializer>
51 void serializeOp(Serializer& serializer)
52 {
53 serializer(bits);
54 }
55
56private:
57 std::bitset< NUM_PHASES_IN_ENUM > bits;
58};
59
60
61class Welldims {
62public:
63 Welldims() = default;
64 explicit Welldims(const Deck& deck);
65
66 static Welldims serializationTestObject();
67
68 int maxConnPerWell() const
69 {
70 return this->nCWMax;
71 }
72
73 int maxWellsPerGroup() const
74 {
75 return this->nWGMax;
76 }
77
78 int maxGroupsInField() const
79 {
80 return this->nGMax;
81 }
82
83 int maxWellsInField() const
84 {
85 return this->nWMax;
86 }
87
88 int maxWellListsPrWell() const
89 {
90 return this->nWlistPrWellMax;
91 }
92
93 int maxDynamicWellLists() const
94 {
95 return this->nDynWlistMax;
96 }
97
98 const std::optional<KeywordLocation>& location() const {
99 return this->m_location;
100 }
101
102 static bool rst_cmp(const Welldims& full_dims, const Welldims& rst_dims) {
103 return full_dims.maxConnPerWell() == rst_dims.maxConnPerWell() &&
104 full_dims.maxWellsPerGroup() == rst_dims.maxWellsPerGroup() &&
105 full_dims.maxGroupsInField() == rst_dims.maxGroupsInField() &&
106 full_dims.maxWellsInField() == rst_dims.maxWellsInField() &&
107 full_dims.maxWellListsPrWell() == rst_dims.maxWellListsPrWell() &&
108 full_dims.maxDynamicWellLists() == rst_dims.maxDynamicWellLists();
109 }
110
111 bool operator==(const Welldims& data) const {
112 return this->location() == data.location() &&
113 rst_cmp(*this, data);
114 }
115
116
117 template<class Serializer>
118 void serializeOp(Serializer& serializer)
119 {
120 serializer(nWMax);
121 serializer(nCWMax);
122 serializer(nWGMax);
123 serializer(nGMax);
124 serializer(nWlistPrWellMax);
125 serializer(nDynWlistMax);
126 serializer(m_location);
127 }
128
129private:
130 int nWMax { 0 };
131 int nCWMax { 0 };
132 int nWGMax { 0 };
133 int nGMax { 0 };
134 int nWlistPrWellMax { 1 };
135 int nDynWlistMax { 1 };
136 std::optional<KeywordLocation> m_location;
137};
138
140public:
142 explicit WellSegmentDims(const Deck& deck);
143
144 static WellSegmentDims serializationTestObject();
145
146
147 int maxSegmentedWells() const
148 {
149 return this->nSegWellMax;
150 }
151
152 int maxSegmentsPerWell() const
153 {
154 return this->nSegmentMax;
155 }
156
157 int maxLateralBranchesPerWell() const
158 {
159 return this->nLatBranchMax;
160 }
161
162 bool operator==(const WellSegmentDims& data) const;
163
164 template<class Serializer>
165 void serializeOp(Serializer& serializer)
166 {
167 serializer(nSegWellMax);
168 serializer(nSegmentMax);
169 serializer(nLatBranchMax);
170 }
171
172private:
173 int nSegWellMax;
174 int nSegmentMax;
175 int nLatBranchMax;
176};
177
179public:
180 NetworkDims();
181 explicit NetworkDims(const Deck& deck);
182
183 static NetworkDims serializationTestObject();
184
185 int maxNONodes() const
186 {
187 return this->nMaxNoNodes;
188 }
189
190 int maxNoBranches() const
191 {
192 return this->nMaxNoBranches;
193 }
194
195 int maxNoBranchesConToNode() const
196 {
197 return this->nMaxNoBranchesConToNode;
198 }
199
200 bool active() const;
201
202 bool operator==(const NetworkDims& data) const;
203
204 template<class Serializer>
205 void serializeOp(Serializer& serializer)
206 {
207 serializer(nMaxNoNodes);
208 serializer(nMaxNoBranches);
209 serializer(nMaxNoBranchesConToNode);
210 }
211
212private:
213 int nMaxNoNodes;
214 int nMaxNoBranches;
215 int nMaxNoBranchesConToNode;
216};
217
219public:
221 explicit AquiferDimensions(const Deck& deck);
222
223 static AquiferDimensions serializationTestObject();
224
225 int maxAnalyticAquifers() const
226 {
227 return this->maxNumAnalyticAquifers;
228 }
229
230 int maxAnalyticAquiferConnections() const
231 {
232 return this->maxNumAnalyticAquiferConn;
233 }
234
235 template <class Serializer>
236 void serializeOp(Serializer& serializer)
237 {
238 serializer(this->maxNumAnalyticAquifers);
239 serializer(this->maxNumAnalyticAquiferConn);
240 }
241
242private:
243 int maxNumAnalyticAquifers;
244 int maxNumAnalyticAquiferConn;
245};
246
247bool operator==(const AquiferDimensions& lhs, const AquiferDimensions& rhs);
248
250{
251public:
252 EclHysterConfig() = default;
253 explicit EclHysterConfig(const Deck& deck);
254
255 static EclHysterConfig serializationTestObject();
256
260 //void setActive(bool yesno);
261
265 bool active() const;
266
273 int pcHysteresisModel() const;
274
281 int krHysteresisModel() const;
282
288 double modParamTrapped() const;
289
295 double curvatureCapPrs() const;
296
297 bool operator==(const EclHysterConfig& data) const;
298
299 template<class Serializer>
300 void serializeOp(Serializer& serializer)
301 {
302 serializer(activeHyst);
303 serializer(pcHystMod);
304 serializer(krHystMod);
305 serializer(modParamTrappedValue);
306 serializer(curvatureCapPrsValue);
307 }
308
309private:
310 // enable hysteresis at all
311 bool activeHyst { false };
312
313 // the capillary pressure and the relperm hysteresis models to be used
314 int pcHystMod { -1 };
315 int krHystMod { -1 };
316 // regularisation parameter used for Killough model
317 double modParamTrappedValue { 0.1 };
318 // curvature parameter for capillary pressure
319 double curvatureCapPrsValue { 0.1 };
320};
321
323public:
324 enum class ThreePhaseOilKrModel {
325 Default,
326 Stone1,
327 Stone2
328 };
329
330 enum class KeywordFamily {
331 Family_I, // SGOF, SWOF, SLGOF
332 Family_II, // SGFN, SOF{2,3}, SWFN
333 Family_III, // GSF, WSF
334 Undefined,
335 };
336
338 explicit SatFuncControls(const Deck& deck);
339 explicit SatFuncControls(const double tolcritArg,
340 const ThreePhaseOilKrModel model,
341 const KeywordFamily family);
342
343 static SatFuncControls serializationTestObject();
344
345 double minimumRelpermMobilityThreshold() const
346 {
347 return this->tolcrit;
348 }
349
350 ThreePhaseOilKrModel krModel() const
351 {
352 return this->krmodel;
353 }
354
355 KeywordFamily family() const
356 {
357 return this->satfunc_family;
358 }
359
360 bool operator==(const SatFuncControls& rhs) const;
361
362 template<class Serializer>
363 void serializeOp(Serializer& serializer)
364 {
365 serializer(tolcrit);
366 serializer(krmodel);
367 serializer(satfunc_family);
368 }
369
370private:
371 double tolcrit;
372 ThreePhaseOilKrModel krmodel = ThreePhaseOilKrModel::Default;
373 KeywordFamily satfunc_family = KeywordFamily::Undefined;
374};
375
376
377class Nupcol {
378public:
379 Nupcol();
380 explicit Nupcol(int min_value);
381 void update(int value);
382 int value() const;
383
384 static Nupcol serializationTestObject();
385 bool operator==(const Nupcol& data) const;
386
387 template<class Serializer>
388 void serializeOp(Serializer& serializer) {
389 serializer(this->nupcol_value);
390 serializer(this->min_nupcol);
391 }
392
393private:
394 int min_nupcol;
395 int nupcol_value;
396};
397
398
399class Tracers {
400public:
401
402 Tracers() = default;
403
404 explicit Tracers(const Deck& );
405 int water_tracers() const;
406
407 template<class Serializer>
408 void serializeOp(Serializer& serializer) {
409 serializer(this->m_oil_tracers);
410 serializer(this->m_water_tracers);
411 serializer(this->m_gas_tracers);
412 serializer(this->m_env_tracers);
413 serializer(this->diffusion_control);
414 serializer(this->max_iter);
415 serializer(this->min_iter);
416 }
417
418 static Tracers serializationTestObject();
419 bool operator==(const Tracers& data) const;
420
421private:
422 int m_oil_tracers;
423 int m_water_tracers;
424 int m_gas_tracers;
425 int m_env_tracers;
426 bool diffusion_control;
427 int max_iter;
428 int min_iter;
429 // The TRACERS keyword has some additional options which seem quite arcane,
430 // for now not included here.
431};
432
433
434class Runspec {
435public:
436 Runspec() = default;
437 explicit Runspec( const Deck& );
438
439 static Runspec serializationTestObject();
440
441 std::time_t start_time() const noexcept;
442 const UDQParams& udqParams() const noexcept;
443 const Phases& phases() const noexcept;
444 const Tabdims& tabdims() const noexcept;
445 const Regdims& regdims() const noexcept;
446 const EndpointScaling& endpointScaling() const noexcept;
447 const Welldims& wellDimensions() const noexcept;
448 const WellSegmentDims& wellSegmentDimensions() const noexcept;
449 const NetworkDims& networkDimensions() const noexcept;
450 const AquiferDimensions& aquiferDimensions() const noexcept;
451 int eclPhaseMask( ) const noexcept;
452 const EclHysterConfig& hysterPar() const noexcept;
453 const Actdims& actdims() const noexcept;
454 const SatFuncControls& saturationFunctionControls() const noexcept;
455 const Nupcol& nupcol() const noexcept;
456 const Tracers& tracers() const;
457 bool co2Storage() const noexcept;
458 bool micp() const noexcept;
459
460 bool operator==(const Runspec& data) const;
461 static bool rst_cmp(const Runspec& full_state, const Runspec& rst_state);
462
463 template<class Serializer>
464 void serializeOp(Serializer& serializer)
465 {
466 serializer(this->m_start_time);
467 serializer(active_phases);
468 serializer(m_tabdims);
469 serializer(m_regdims);
470 serializer(endscale);
471 serializer(welldims);
472 serializer(wsegdims);
473 serializer(netwrkdims);
474 serializer(aquiferdims);
475 serializer(udq_params);
476 serializer(hystpar);
477 serializer(m_actdims);
478 serializer(m_sfuncctrl);
479 serializer(m_nupcol);
480 serializer(m_co2storage);
481 serializer(m_micp);
482 }
483
484private:
485 std::time_t m_start_time;
486 Phases active_phases;
487 Tabdims m_tabdims;
488 Regdims m_regdims;
489 EndpointScaling endscale;
490 Welldims welldims;
491 WellSegmentDims wsegdims;
492 NetworkDims netwrkdims;
493 AquiferDimensions aquiferdims;
494 UDQParams udq_params;
495 EclHysterConfig hystpar;
496 Actdims m_actdims;
497 SatFuncControls m_sfuncctrl;
498 Nupcol m_nupcol;
499 Tracers m_tracers;
500 bool m_co2storage;
501 bool m_micp;
502};
503
504
505}
506
507#endif // OPM_RUNSPEC_HPP
Definition: Actdims.hpp:30
Definition: Runspec.hpp:218
Definition: Deck.hpp:49
Definition: Runspec.hpp:250
int pcHysteresisModel() const
Return the type of the hysteresis model which is used for capillary pressure.
double modParamTrapped() const
Regularisation parameter used for Killough model.
double curvatureCapPrs() const
Curvature parameter used for capillary pressure hysteresis.
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.
Definition: EndpointScaling.hpp:28
Definition: Runspec.hpp:178
Definition: Runspec.hpp:377
Definition: Runspec.hpp:37
Definition: Regdims.hpp:36
Definition: Runspec.hpp:434
Definition: Runspec.hpp:322
Class for (de-)serializing.
Definition: Serializer.hpp:84
Definition: Tabdims.hpp:36
Definition: Runspec.hpp:399
Definition: UDQParams.hpp:31
Definition: Runspec.hpp:139
Definition: Runspec.hpp:61
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:30