opm-common
GSatProd.hpp
1 /*
2  Copyright 2024 Equinor 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
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 
20 #ifndef GSATPROD_H
21 #define GSATPROD_H
22 
23 #include <opm/input/eclipse/Deck/UDAValue.hpp>
24 #include <opm/input/eclipse/Units/UnitSystem.hpp>
25 
26 #include <array>
27 #include <cstddef>
28 #include <map>
29 #include <string>
30 
31 namespace Opm {
32 
33  class SummaryState;
34 
36  class GSatProd
37  {
38  public:
41  {
45  std::array<UDAValue, 5> rate{};
46 
48  double udq_undefined;
49 
57  bool operator==(const GSatProdGroup& data) const {
58  return rate == data.rate &&
60  }
61 
67  template<class Serializer>
68  void serializeOp(Serializer& serializer)
69  {
70  serializer(rate);
71  serializer(udq_undefined);
72  }
73  };
74 
77  enum Rate { Oil, Gas, Water, Resv, GLift, };
78 
82  std::array<double, 5> rate{};
83  };
84 
87 
111  void assign(const std::string& name,
112  const UDAValue& oil_rate,
113  const UDAValue& gas_rate,
114  const UDAValue& water_rate,
115  const UDAValue& resv_rate,
116  const UDAValue& glift_rate,
117  double udq_undefined);
118 
126  bool has(const std::string& name) const;
127 
139  const GSatProdGroup& get(const std::string& name) const;
140 
148  const GSatProdGroupProp get(const std::string& name,
149  const SummaryState& st) const;
150 
159  bool empty() const { return this->size() == 0; }
160 
163  std::size_t size() const;
164 
172  bool operator==(const GSatProd& data) const;
173 
179  template<class Serializer>
180  void serializeOp(Serializer& serializer)
181  {
182  serializer(groups_);
183  }
184 
185  private:
187  std::map<std::string, GSatProdGroup> groups_;
188  };
189 
190 } // namespace Opm
191 
192 #endif // GSATPROD_H
void serializeOp(Serializer &serializer)
Convert between byte array and object representation.
Definition: GSatProd.hpp:68
bool empty() const
Whether or not any groups have associate satellite production rates.
Definition: GSatProd.hpp:159
double udq_undefined
Default udq value.
Definition: GSatProd.hpp:48
Definition: GSatProd.hpp:75
std::array< double, 5 > rate
Satellite production rates.
Definition: GSatProd.hpp:82
Definition: UDAValue.hpp:31
std::array< UDAValue, 5 > rate
Satellite production rates.
Definition: GSatProd.hpp:45
static GSatProd serializationTestObject()
Create a serialisation test object.
Definition: GSatProd.cpp:29
Group level satellite production.
Definition: GSatProd.hpp:36
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:30
Satellite production rates for a single group.
Definition: GSatProd.hpp:40
bool operator==(const GSatProdGroup &data) const
Equality predicate.
Definition: GSatProd.hpp:57
std::size_t size() const
Number of groups for which satellite production rates have been defined.
Definition: GSatProd.cpp:90
void assign(const std::string &name, const UDAValue &oil_rate, const UDAValue &gas_rate, const UDAValue &water_rate, const UDAValue &resv_rate, const UDAValue &glift_rate, double udq_undefined)
Define satellite production rates for named group.
Definition: GSatProd.cpp:70
Definition: SummaryState.hpp:72
bool operator==(const GSatProd &data) const
Equality predicate.
Definition: GSatProd.cpp:95
bool has(const std::string &name) const
Whether or not satellite production rates have been defined for a named group.
Definition: GSatProd.cpp:38
Class for (de-)serializing.
Definition: Serializer.hpp:94
void serializeOp(Serializer &serializer)
Convert between byte array and object representation.
Definition: GSatProd.hpp:180
Rate
Satellite production rate items.
Definition: GSatProd.hpp:77