opm-common
WagHysteresisConfig.hpp
1 /*
2  Copyright 2023 Equinor.
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_WAGHYSTERSISCONFIG_HPP
20 #define OPM_PARSER_WAGHYSTERSISCONFIG_HPP
21 
22 #include <cstddef>
23 #include <vector>
24 
25 namespace Opm {
26 
27 class Deck;
28 class DeckRecord;
29 
31  public:
32 
34 
35  private:
36  // WAG hysteresis Lands parameter
37  double wagLandsParamValue { 1.0 };
38  // WAG hysteresis reduction factor
39  double wagSecondaryDrainageReductionValue { 0.0 };
40  // WAG gas model flag
41  bool wagGasFlagValue { true };
42  // WAG residual oil model flag
43  bool wagResidualOilFlagValue { false };
44  // WAG water model flag
45  bool wagWaterFlagValue { false };
46  // WAG hysteresis linear fraction
47  double wagImbCurveLinearFractionValue { 0.1 };
48  // WAG hysteresis 3-phase threshold
49  double wagWaterThresholdSaturationValue { 0.001 };
50 
51  public:
52  WagHysteresisConfigRecord() = default;
53 
54  explicit WagHysteresisConfigRecord(const DeckRecord& record);
55 
56  double wagLandsParam() const {
57  return wagLandsParamValue;
58  }
59 
60  double wagSecondaryDrainageReduction() const {
61  return wagSecondaryDrainageReductionValue;
62  }
63 
64  bool wagGasFlag() const {
65  return wagGasFlagValue;
66  }
67 
68  bool wagResidualOilFlag() const {
69  return wagResidualOilFlagValue;
70  }
71 
72  bool wagWaterFlag() const {
73  return wagWaterFlagValue;
74  }
75 
76  double wagImbCurveLinearFraction() const {
77  return wagImbCurveLinearFractionValue;
78  }
79 
80  double wagWaterThresholdSaturation() const {
81  return wagWaterThresholdSaturationValue;
82  }
83 
84  bool operator==(const WagHysteresisConfigRecord& data) const
85  {
86  return this->wagLandsParam() == data.wagLandsParam() &&
87  this->wagSecondaryDrainageReduction() == data.wagSecondaryDrainageReduction() &&
88  this->wagGasFlag() == data.wagGasFlag() &&
89  this->wagResidualOilFlag() == data.wagResidualOilFlag() &&
90  this->wagWaterFlag() == data.wagWaterFlag() &&
91  this->wagImbCurveLinearFraction() == data.wagImbCurveLinearFraction() &&
92  this->wagWaterThresholdSaturation() == data.wagWaterThresholdSaturation();
93  }
94 
95  template<class Serializer>
96  void serializeOp(Serializer& serializer)
97  {
98  serializer(wagLandsParamValue);
99  serializer(wagSecondaryDrainageReductionValue);
100  serializer(wagGasFlagValue);
101  serializer(wagResidualOilFlagValue);
102  serializer(wagWaterFlagValue);
103  serializer(wagImbCurveLinearFractionValue);
104  serializer(wagWaterThresholdSaturationValue);
105  }
106 
107  static WagHysteresisConfigRecord serializationTestObject()
108  {
110  result.wagLandsParamValue = 0;
111  result.wagSecondaryDrainageReductionValue = 1;
112  result.wagGasFlagValue = true;
113  result.wagResidualOilFlagValue = false;
114  result.wagWaterFlagValue = false;
115  result.wagImbCurveLinearFractionValue = 2;
116  result.wagWaterThresholdSaturationValue = 3;
117 
118  return result;
119  }
120  };
121 
123 
124  explicit WagHysteresisConfig(const Deck& deck);
125 
126  std::size_t size() const;
127  bool empty() const;
128 
129  const std::vector<WagHysteresisConfigRecord>::const_iterator begin() const;
130  const std::vector<WagHysteresisConfigRecord>::const_iterator end() const;
131 
132  template<class Serializer>
133  void serializeOp(Serializer& serializer)
134  {
135  serializer(wagrecords);
136  }
137  bool operator==(const WagHysteresisConfig& other) const;
138 
139  const WagHysteresisConfigRecord& operator[](std::size_t index) const;
140 
141  private:
142  std::vector<WagHysteresisConfigRecord> wagrecords;
143  };
144 }
145 
146 #endif // OPM_PARSER_WAGHYSTERSISCONFIG_HPP
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:30
Definition: WagHysteresisConfig.hpp:30
Definition: WagHysteresisConfig.hpp:33
Definition: Deck.hpp:46
Definition: DeckRecord.hpp:32
Class for (de-)serializing.
Definition: Serializer.hpp:94