My Project
Loading...
Searching...
No Matches
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
24#include <opm/input/eclipse/EclipseState/EndpointScaling.hpp>
25#include <opm/input/eclipse/EclipseState/Phase.hpp>
26#include <opm/input/eclipse/EclipseState/Tables/Regdims.hpp>
27#include <opm/input/eclipse/EclipseState/Tables/Tabdims.hpp>
28
29#include <opm/input/eclipse/Schedule/Action/Actdims.hpp>
30#include <opm/input/eclipse/Schedule/UDQ/UDQParams.hpp>
31
32#include <bitset>
33#include <cstddef>
34#include <ctime>
35#include <optional>
36
37namespace Opm {
38
39 class Deck;
40
41} // namespace Opm
42
43namespace Opm {
44
45class Phases
46{
47public:
48 Phases() noexcept = default;
49 Phases(bool oil, bool gas, bool wat,
50 bool solvent = false,
51 bool polymer = false,
52 bool energy = false,
53 bool polymw = false,
54 bool foam = false,
55 bool brine = false,
56 bool zfraction = false) noexcept;
57
58 static Phases serializationTestObject();
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 serializer(bits);
69 }
70
71private:
72 std::bitset<NUM_PHASES_IN_ENUM> bits;
73};
74
75class Welldims {
76public:
77 Welldims() = default;
78 explicit Welldims(const Deck& deck);
79
80 static Welldims serializationTestObject();
81
82 int maxConnPerWell() const
83 {
84 return this->nCWMax;
85 }
86
87 int maxWellsPerGroup() const
88 {
89 return this->nWGMax;
90 }
91
92 int maxGroupsInField() const
93 {
94 return this->nGMax;
95 }
96
97 int maxWellsInField() const
98 {
99 return this->nWMax;
100 }
101
102 int maxWellListsPrWell() const
103 {
104 return this->nWlistPrWellMax;
105 }
106
107 int maxDynamicWellLists() const
108 {
109 return this->nDynWlistMax;
110 }
111
112 const std::optional<KeywordLocation>& location() const
113 {
114 return this->m_location;
115 }
116
117 static bool rst_cmp(const Welldims& full_dims, const Welldims& rst_dims) {
118 return full_dims.maxConnPerWell() == rst_dims.maxConnPerWell() &&
119 full_dims.maxWellsPerGroup() == rst_dims.maxWellsPerGroup() &&
120 full_dims.maxGroupsInField() == rst_dims.maxGroupsInField() &&
121 full_dims.maxWellsInField() == rst_dims.maxWellsInField() &&
122 full_dims.maxWellListsPrWell() == rst_dims.maxWellListsPrWell() &&
123 full_dims.maxDynamicWellLists() == rst_dims.maxDynamicWellLists();
124 }
125
126 bool operator==(const Welldims& data) const {
127 return this->location() == data.location() &&
128 rst_cmp(*this, data);
129 }
130
131 template<class Serializer>
132 void serializeOp(Serializer& serializer)
133 {
134 serializer(nWMax);
135 serializer(nCWMax);
136 serializer(nWGMax);
137 serializer(nGMax);
138 serializer(nWlistPrWellMax);
139 serializer(nDynWlistMax);
140 serializer(m_location);
141 }
142
143private:
144 int nWMax { 0 };
145 int nCWMax { 0 };
146 int nWGMax { 0 };
147 int nGMax { 0 };
148 int nWlistPrWellMax { 1 };
149 int nDynWlistMax { 1 };
150 std::optional<KeywordLocation> m_location;
151};
152
154public:
156 explicit WellSegmentDims(const Deck& deck);
157
158 static WellSegmentDims serializationTestObject();
159
160 int maxSegmentedWells() const
161 {
162 return this->nSegWellMax;
163 }
164
165 int maxSegmentsPerWell() const
166 {
167 return this->nSegmentMax;
168 }
169
170 int maxLateralBranchesPerWell() const
171 {
172 return this->nLatBranchMax;
173 }
174
175 const std::optional<KeywordLocation>& location() const
176 {
177 return this->location_;
178 }
179
180 bool operator==(const WellSegmentDims& data) const;
181
182 template<class Serializer>
183 void serializeOp(Serializer& serializer)
184 {
185 serializer(nSegWellMax);
186 serializer(nSegmentMax);
187 serializer(nLatBranchMax);
188 serializer(location_);
189 }
190
191private:
192 int nSegWellMax;
193 int nSegmentMax;
194 int nLatBranchMax;
195 std::optional<KeywordLocation> location_;
196};
197
199public:
200 NetworkDims();
201 explicit NetworkDims(const Deck& deck);
202
203 static NetworkDims serializationTestObject();
204
205 int maxNONodes() const
206 {
207 return this->nMaxNoNodes;
208 }
209
210 int maxNoBranches() const
211 {
212 return this->nMaxNoBranches;
213 }
214
215 int maxNoBranchesConToNode() const
216 {
217 return this->nMaxNoBranchesConToNode;
218 }
219
220 bool extendedNetwork() const
221 {
222 return this->type_ == Type::Extended;
223 }
224
225 bool standardNetwork() const
226 {
227 return this->type_ == Type::Standard;
228 }
229
230 bool active() const
231 {
232 return this->extendedNetwork()
233 || this->standardNetwork();
234 }
235
236 bool operator==(const NetworkDims& data) const;
237
238 template<class Serializer>
239 void serializeOp(Serializer& serializer)
240 {
241 serializer(nMaxNoNodes);
242 serializer(nMaxNoBranches);
243 serializer(nMaxNoBranchesConToNode);
244 }
245
246private:
247 enum class Type { None, Extended, Standard, };
248
249 int nMaxNoNodes;
250 int nMaxNoBranches;
251 int nMaxNoBranchesConToNode;
252 Type type_{ Type::None };
253};
254
256public:
258 explicit AquiferDimensions(const Deck& deck);
259
260 static AquiferDimensions serializationTestObject();
261
262 int maxAnalyticAquifers() const
263 {
264 return this->maxNumAnalyticAquifers;
265 }
266
267 int maxAnalyticAquiferConnections() const
268 {
269 return this->maxNumAnalyticAquiferConn;
270 }
271
272 template <class Serializer>
273 void serializeOp(Serializer& serializer)
274 {
275 serializer(this->maxNumAnalyticAquifers);
276 serializer(this->maxNumAnalyticAquiferConn);
277 }
278
279private:
280 int maxNumAnalyticAquifers;
281 int maxNumAnalyticAquiferConn;
282};
283
284bool operator==(const AquiferDimensions& lhs, const AquiferDimensions& rhs);
285
287{
288public:
289 EclHysterConfig() = default;
290 explicit EclHysterConfig(const Deck& deck);
291
292 static EclHysterConfig serializationTestObject();
293
297 //void setActive(bool yesno);
298
302 bool active() const;
303
310 int pcHysteresisModel() const;
311
318 int krHysteresisModel() const;
319
325 double modParamTrapped() const;
326
332 double curvatureCapPrs() const;
333
337 bool activeWag() const;
338
339 bool operator==(const EclHysterConfig& data) const;
340
341 template<class Serializer>
342 void serializeOp(Serializer& serializer)
343 {
344 serializer(activeHyst);
345 serializer(pcHystMod);
346 serializer(krHystMod);
347 serializer(modParamTrappedValue);
348 serializer(curvatureCapPrsValue);
349 serializer(activeWagHyst);
350 }
351
352private:
353 // enable hysteresis at all
354 bool activeHyst { false };
355
356 // the capillary pressure and the relperm hysteresis models to be used
357 int pcHystMod { -1 };
358 int krHystMod { -1 };
359 // regularisation parameter used for Killough model
360 double modParamTrappedValue { 0.1 };
361 // curvature parameter for capillary pressure
362 double curvatureCapPrsValue { 0.1 };
363
364 // enable WAG hysteresis
365 bool activeWagHyst { false };
366};
367
369public:
370 enum class ThreePhaseOilKrModel {
371 Default,
372 Stone1,
373 Stone2
374 };
375
376 enum class KeywordFamily {
377 Family_I, // SGOF, SWOF, SLGOF
378 Family_II, // SGFN, SOF{2,3}, SWFN, SGWFN
379 Family_III, // GSF, WSF
380
381 Undefined,
382 };
383
385 explicit SatFuncControls(const Deck& deck);
386 explicit SatFuncControls(const double tolcritArg,
387 const ThreePhaseOilKrModel model,
388 const KeywordFamily family);
389
390 static SatFuncControls serializationTestObject();
391
392 double minimumRelpermMobilityThreshold() const
393 {
394 return this->tolcrit;
395 }
396
397 ThreePhaseOilKrModel krModel() const
398 {
399 return this->krmodel;
400 }
401
402 KeywordFamily family() const
403 {
404 return this->satfunc_family;
405 }
406
407 bool operator==(const SatFuncControls& rhs) const;
408
409 template<class Serializer>
410 void serializeOp(Serializer& serializer)
411 {
412 serializer(tolcrit);
413 serializer(krmodel);
414 serializer(satfunc_family);
415 }
416
417private:
418 double tolcrit;
419 ThreePhaseOilKrModel krmodel = ThreePhaseOilKrModel::Default;
420 KeywordFamily satfunc_family = KeywordFamily::Undefined;
421};
422
423
424class Nupcol {
425public:
426 Nupcol();
427 explicit Nupcol(int min_value);
428 void update(int value);
429 int value() const;
430
431 static Nupcol serializationTestObject();
432 bool operator==(const Nupcol& data) const;
433
434 template<class Serializer>
435 void serializeOp(Serializer& serializer) {
436 serializer(this->nupcol_value);
437 serializer(this->min_nupcol);
438 }
439
440private:
441 int min_nupcol;
442 int nupcol_value;
443};
444
445
446class Tracers {
447public:
448
449 Tracers() = default;
450
451 explicit Tracers(const Deck& );
452 int water_tracers() const;
453
454 template<class Serializer>
455 void serializeOp(Serializer& serializer) {
456 serializer(this->m_oil_tracers);
457 serializer(this->m_water_tracers);
458 serializer(this->m_gas_tracers);
459 serializer(this->m_env_tracers);
460 serializer(this->diffusion_control);
461 serializer(this->max_iter);
462 serializer(this->min_iter);
463 }
464
465 static Tracers serializationTestObject();
466 bool operator==(const Tracers& data) const;
467
468private:
469 int m_oil_tracers;
470 int m_water_tracers;
471 int m_gas_tracers;
472 int m_env_tracers;
473 bool diffusion_control;
474 int max_iter;
475 int min_iter;
476 // The TRACERS keyword has some additional options which seem quite arcane,
477 // for now not included here.
478};
479
480
481class Runspec {
482public:
483 Runspec() = default;
484 explicit Runspec( const Deck& );
485
486 static Runspec serializationTestObject();
487
488 std::time_t start_time() const noexcept;
489 const UDQParams& udqParams() const noexcept;
490 const Phases& phases() const noexcept;
491 const Tabdims& tabdims() const noexcept;
492 const Regdims& regdims() const noexcept;
493 const EndpointScaling& endpointScaling() const noexcept;
494 const Welldims& wellDimensions() const noexcept;
495 const WellSegmentDims& wellSegmentDimensions() const noexcept;
496 const NetworkDims& networkDimensions() const noexcept;
497 const AquiferDimensions& aquiferDimensions() const noexcept;
498 int eclPhaseMask( ) const noexcept;
499 const EclHysterConfig& hysterPar() const noexcept;
500 const Actdims& actdims() const noexcept;
501 const SatFuncControls& saturationFunctionControls() const noexcept;
502 const Nupcol& nupcol() const noexcept;
503 const Tracers& tracers() const;
504 bool compositionalMode() const;
505 size_t numComps() const;
506 bool co2Storage() const noexcept;
507 bool co2Sol() const noexcept;
508 bool h2Sol() const noexcept;
509 bool h2Storage() const noexcept;
510 bool micp() const noexcept;
511 bool mech() const noexcept;
512
513 bool operator==(const Runspec& data) const;
514 static bool rst_cmp(const Runspec& full_state, const Runspec& rst_state);
515
516 template<class Serializer>
517 void serializeOp(Serializer& serializer)
518 {
519 serializer(this->m_start_time);
520 serializer(active_phases);
521 serializer(m_tabdims);
522 serializer(m_regdims);
523 serializer(endscale);
524 serializer(welldims);
525 serializer(wsegdims);
526 serializer(netwrkdims);
527 serializer(aquiferdims);
528 serializer(udq_params);
529 serializer(hystpar);
530 serializer(m_actdims);
531 serializer(m_sfuncctrl);
532 serializer(m_nupcol);
533 serializer(m_comps);
534 serializer(m_co2storage);
535 serializer(m_co2sol);
536 serializer(m_h2sol);
537 serializer(m_h2storage);
538 serializer(m_micp);
539 serializer(m_mech);
540 }
541
542private:
543 std::time_t m_start_time;
544 Phases active_phases;
545 Tabdims m_tabdims;
546 Regdims m_regdims;
547 EndpointScaling endscale;
548 Welldims welldims;
549 WellSegmentDims wsegdims;
550 NetworkDims netwrkdims;
551 AquiferDimensions aquiferdims;
552 UDQParams udq_params;
553 EclHysterConfig hystpar;
554 Actdims m_actdims;
555 SatFuncControls m_sfuncctrl;
556 Nupcol m_nupcol;
557 Tracers m_tracers;
558 size_t m_comps = 0;
559 bool m_co2storage;
560 bool m_co2sol;
561 bool m_h2sol;
562 bool m_h2storage;
563 bool m_micp;
564 bool m_mech;
565};
566
567std::size_t declaredMaxRegionID(const Runspec& rspec);
568
569} // namespace Opm
570
571#endif // OPM_RUNSPEC_HPP
Definition Actdims.hpp:30
Definition Runspec.hpp:255
Definition Deck.hpp:49
Definition Runspec.hpp:287
int pcHysteresisModel() const
Return the type of the hysteresis model which is used for capillary pressure.
Definition Runspec.cpp:467
double modParamTrapped() const
Regularisation parameter used for Killough model.
Definition Runspec.cpp:473
double curvatureCapPrs() const
Curvature parameter used for capillary pressure hysteresis.
Definition Runspec.cpp:476
bool activeWag() const
Wag hysteresis.
Definition Runspec.cpp:479
bool active() const
Specify whether hysteresis is enabled or not.
Definition Runspec.cpp:464
int krHysteresisModel() const
Return the type of the hysteresis model which is used for relative permeability.
Definition Runspec.cpp:470
Definition EndpointScaling.hpp:28
Definition Runspec.hpp:198
Definition Runspec.hpp:424
Definition Runspec.hpp:46
Definition Regdims.hpp:36
Definition Runspec.hpp:481
Definition Runspec.hpp:368
Class for (de-)serializing.
Definition Serializer.hpp:84
Definition Tabdims.hpp:36
Definition Runspec.hpp:446
Definition UDQParams.hpp:31
Definition Runspec.hpp:153
Definition Runspec.hpp:75
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30