opm-common
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
153class WellSegmentDims {
154public:
155 WellSegmentDims();
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
198class NetworkDims {
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
255class AquiferDimensions {
256public:
257 AquiferDimensions();
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
286class EclHysterConfig
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
342 bool doPcScaling() const;
343
347 bool fixWettingPhaseKillough() const;
348
349 bool operator==(const EclHysterConfig& data) const;
350
351 template<class Serializer>
352 void serializeOp(Serializer& serializer)
353 {
354 serializer(activeHyst);
355 serializer(pcHystMod);
356 serializer(krHystMod);
357 serializer(modParamTrappedValue);
358 serializer(curvatureCapPrsValue);
359 serializer(activeWagHyst);
360 serializer(enablePcScaling);
361 serializer(enableKilloughWettingFix);
362 }
363
364private:
365 // enable hysteresis at all
366 bool activeHyst { false };
367
368 // the capillary pressure and the relperm hysteresis models to be used
369 int pcHystMod { -1 };
370 int krHystMod { -1 };
371 // regularisation parameter used for Killough model
372 double modParamTrappedValue { 0.1 };
373 // curvature parameter for capillary pressure
374 double curvatureCapPrsValue { 0.1 };
375
376 // enable WAG hysteresis
377 bool activeWagHyst { false };
378
379 // flag to enable Pc scaling
380 bool enablePcScaling { false };
381
382 // flag to enable Fix for wetting phase Killough
383 bool enableKilloughWettingFix { false };
384};
385
386class SatFuncControls {
387public:
388 enum class ThreePhaseOilKrModel {
389 Default,
390 Stone1,
391 Stone2
392 };
393
394 enum class KeywordFamily {
395 Family_I, // SGOF, SWOF, SLGOF
396 Family_II, // SGFN, SOF{2,3}, SWFN, SGWFN
397 Family_III, // GSF, WSF
398
399 Undefined,
400 };
401
402 SatFuncControls();
403 explicit SatFuncControls(const Deck& deck);
404 explicit SatFuncControls(const double tolcritArg,
405 const ThreePhaseOilKrModel model,
406 const KeywordFamily family);
407
408 static SatFuncControls serializationTestObject();
409
410 double minimumRelpermMobilityThreshold() const
411 {
412 return this->tolcrit;
413 }
414
415 ThreePhaseOilKrModel krModel() const
416 {
417 return this->krmodel;
418 }
419
420 KeywordFamily family() const
421 {
422 return this->satfunc_family;
423 }
424
425 bool operator==(const SatFuncControls& rhs) const;
426
427 template<class Serializer>
428 void serializeOp(Serializer& serializer)
429 {
430 serializer(tolcrit);
431 serializer(krmodel);
432 serializer(satfunc_family);
433 }
434
435private:
436 double tolcrit;
437 ThreePhaseOilKrModel krmodel = ThreePhaseOilKrModel::Default;
438 KeywordFamily satfunc_family = KeywordFamily::Undefined;
439};
440
441
442class Nupcol {
443public:
444 Nupcol();
445 explicit Nupcol(int min_value);
446 void update(int value);
447 int value() const;
448
449 static Nupcol serializationTestObject();
450 bool operator==(const Nupcol& data) const;
451
452 template<class Serializer>
453 void serializeOp(Serializer& serializer) {
454 serializer(this->nupcol_value);
455 serializer(this->min_nupcol);
456 }
457
458private:
459 int min_nupcol;
460 int nupcol_value;
461};
462
463
464class Tracers {
465public:
466 Tracers() = default;
467
468 explicit Tracers(const Deck& );
469 int water_tracers() const;
470 int gas_tracers() const;
471 int oil_tracers() const;
472
473 template<class Serializer>
474 void serializeOp(Serializer& serializer) {
475 serializer(this->m_oil_tracers);
476 serializer(this->m_water_tracers);
477 serializer(this->m_gas_tracers);
478 serializer(this->m_env_tracers);
479 serializer(this->diffusion_control);
480 serializer(this->max_iter);
481 serializer(this->min_iter);
482 }
483
484 static Tracers serializationTestObject();
485 bool operator==(const Tracers& data) const;
486
487private:
488 int m_oil_tracers{};
489 int m_water_tracers{};
490 int m_gas_tracers{};
491 int m_env_tracers{};
492 bool diffusion_control{false};
493 int max_iter{};
494 int min_iter{};
495 // The TRACERS keyword has some additional options which seem quite arcane,
496 // for now not included here.
497};
498
499
500class Geochem {
501public:
502 Geochem() = default;
503 Geochem(std::string file_name, double mbal_tol, double ph_tol, bool charge_balance,
504 bool activated, int splay_tree)
505 : m_file_name(file_name)
506 , m_mbal_tol(mbal_tol)
507 , m_ph_tol(ph_tol)
508 , m_charge_balance(charge_balance)
509 , m_activated(activated)
510 , m_splay_tree(splay_tree)
511 { };
512 explicit Geochem(const Deck&);
513
514 const std::string& geochem_file_name() const;
515 double mbal_tol() const;
516 double ph_tol() const;
517 int splay_tree_resolution() const;
518 bool charge_balance() const;
519 bool enabled() const;
520
521 template<class Serializer>
522 void serializeOp(Serializer& serializer) {
523 serializer(this->m_file_name);
524 serializer(this->m_mbal_tol);
525 serializer(this->m_ph_tol);
526 serializer(this->m_charge_balance);
527 serializer(this->m_activated);
528 serializer(this->m_splay_tree);
529 }
530 static Geochem serializationTestObject();
531
532 bool operator==(const Geochem& data) const;
533
534private:
535 std::string m_file_name;
536 double m_mbal_tol{};
537 double m_ph_tol{};
538 bool m_charge_balance{false};
539 bool m_activated{false};
540 int m_splay_tree{0};
541};
542
543
544class Runspec {
545public:
546 Runspec() = default;
547 explicit Runspec( const Deck& );
548
549 static Runspec serializationTestObject();
550
551 std::time_t start_time() const noexcept;
552 const UDQParams& udqParams() const noexcept;
553 const Phases& phases() const noexcept;
554 const Tabdims& tabdims() const noexcept;
555 const Regdims& regdims() const noexcept;
556 const EndpointScaling& endpointScaling() const noexcept;
557 const Welldims& wellDimensions() const noexcept;
558 const WellSegmentDims& wellSegmentDimensions() const noexcept;
559 const NetworkDims& networkDimensions() const noexcept;
560 const AquiferDimensions& aquiferDimensions() const noexcept;
561 int eclPhaseMask( ) const noexcept;
562 const EclHysterConfig& hysterPar() const noexcept;
563 const Actdims& actdims() const noexcept;
564 const SatFuncControls& saturationFunctionControls() const noexcept;
565 const Nupcol& nupcol() const noexcept;
566 const Tracers& tracers() const;
567 const Geochem& geochem() const;
568 bool compositionalMode() const;
569 size_t numComps() const;
570 bool co2Storage() const noexcept;
571 bool co2Sol() const noexcept;
572 bool h2Sol() const noexcept;
573 bool h2Storage() const noexcept;
574 bool micp() const noexcept;
575 bool mech() const noexcept;
576 bool frac() const noexcept;
577 bool temp() const noexcept;
578 bool compositional() const noexcept;
579 bool biof() const noexcept;
580
581 bool operator==(const Runspec& data) const;
582 static bool rst_cmp(const Runspec& full_state, const Runspec& rst_state);
583
584 template<class Serializer>
585 void serializeOp(Serializer& serializer)
586 {
587 serializer(this->m_start_time);
588 serializer(active_phases);
589 serializer(m_tabdims);
590 serializer(m_regdims);
591 serializer(endscale);
592 serializer(welldims);
593 serializer(wsegdims);
594 serializer(netwrkdims);
595 serializer(aquiferdims);
596 serializer(udq_params);
597 serializer(hystpar);
598 serializer(m_actdims);
599 serializer(m_sfuncctrl);
600 serializer(m_nupcol);
601 serializer(m_tracers);
602 serializer(m_comps);
603 serializer(m_co2storage);
604 serializer(m_co2sol);
605 serializer(m_h2sol);
606 serializer(m_h2storage);
607 serializer(m_micp);
608 serializer(m_mech);
609 serializer(m_frac);
610 serializer(m_temp);
611 serializer(m_biof);
612 serializer(m_geochem);
613 }
614
615private:
616 std::time_t m_start_time{};
617 Phases active_phases{};
618 Tabdims m_tabdims{};
619 Regdims m_regdims{};
620 EndpointScaling endscale{};
621 Welldims welldims{};
622 WellSegmentDims wsegdims{};
623 NetworkDims netwrkdims{};
624 AquiferDimensions aquiferdims{};
625 UDQParams udq_params{};
626 EclHysterConfig hystpar{};
627 Actdims m_actdims{};
628 SatFuncControls m_sfuncctrl{};
629 Nupcol m_nupcol{};
630 Tracers m_tracers{};
631 Geochem m_geochem{};
632 size_t m_comps = 0;
633 bool m_co2storage{false};
634 bool m_co2sol{false};
635 bool m_h2sol{false};
636 bool m_h2storage{false};
637 bool m_micp{false};
638 bool m_mech{false};
639 bool m_frac{false};
640 bool m_temp{false};
641 bool m_biof{false};
642};
643
644std::size_t declaredMaxRegionID(const Runspec& rspec);
645
646} // namespace Opm
647
648#endif // OPM_RUNSPEC_HPP
Definition Actdims.hpp:30
Definition Runspec.hpp:255
Definition Deck.hpp:46
Definition Runspec.hpp:287
int pcHysteresisModel() const
Return the type of the hysteresis model which is used for capillary pressure.
Definition Runspec.cpp:486
double modParamTrapped() const
Regularisation parameter used for Killough model.
Definition Runspec.cpp:492
bool fixWettingPhaseKillough() const
Activate fix for wetting phase killough.
Definition Runspec.cpp:504
double curvatureCapPrs() const
Curvature parameter used for capillary pressure hysteresis.
Definition Runspec.cpp:495
bool activeWag() const
Wag hysteresis.
Definition Runspec.cpp:498
bool doPcScaling() const
Do Pc scaling for scanning curves.
Definition Runspec.cpp:501
bool active() const
Specify whether hysteresis is enabled or not.
Definition Runspec.cpp:483
int krHysteresisModel() const
Return the type of the hysteresis model which is used for relative permeability.
Definition Runspec.cpp:489
Definition EndpointScaling.hpp:28
Definition Runspec.hpp:500
Definition Runspec.hpp:198
Definition Runspec.hpp:442
Definition Runspec.hpp:46
Definition Regdims.hpp:36
Definition Runspec.hpp:544
Definition Runspec.hpp:386
Class for (de-)serializing.
Definition Serializer.hpp:94
Definition Tabdims.hpp:36
Definition Runspec.hpp:464
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