opm-common
GroupSatelliteInjection.hpp
1 /*
2  Copyright 2025 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 OPM_GROUP_SATELLITE_INJECTION_HPP_INCLUDED
21 #define OPM_GROUP_SATELLITE_INJECTION_HPP_INCLUDED
22 
23 #include <opm/input/eclipse/EclipseState/Phase.hpp>
24 
25 #include <map>
26 #include <optional>
27 #include <vector>
28 
29 namespace Opm {
30 
33  {
34  public:
36  class Rate
37  {
38  public:
44  Rate& surface(const double q);
45 
51  Rate& reservoir(const double q);
52 
58  Rate& calorific(const double c);
59 
63  const std::optional<double>& surface() const
64  {
65  return this->surface_;
66  }
67 
71  const std::optional<double>& reservoir() const
72  {
73  return this->resv_;
74  }
75 
79  const std::optional<double>& calorific() const
80  {
81  return this->calorific_;
82  }
83 
86 
94  bool operator==(const Rate& that) const
95  {
96  return (this->surface_ == that.surface_)
97  && (this->resv_ == that.resv_)
98  && (this->calorific_ == that.calorific_)
99  ;
100  }
101 
107  template <class Serializer>
108  void serializeOp(Serializer& serializer)
109  {
110  serializer(this->surface_);
111  serializer(this->resv_);
112  serializer(this->calorific_);
113  }
114 
115  private:
120  std::optional<double> surface_{};
121 
126  std::optional<double> resv_{};
127 
132  std::optional<double> calorific_{};
133  };
134 
136  using RateIx = std::vector<Rate>::size_type;
137 
140 
145  GroupSatelliteInjection() = default;
146 
153  explicit GroupSatelliteInjection(const std::string& group);
154 
163  Rate& rate(const Phase phase);
164 
169  const std::string& name() const { return this->group_; }
170 
178  std::optional<RateIx> rateIndex(const Phase phase) const;
179 
186  const Rate& operator[](const RateIx i) const
187  {
188  return this->rates_[i];
189  }
190 
198  bool operator==(const GroupSatelliteInjection& that) const;
199 
205  template <class Serializer>
206  void serializeOp(Serializer& serializer)
207  {
208  serializer(this->group_);
209  serializer(this->i_);
210  serializer(this->rates_);
211  }
212 
213  private:
218  std::string group_{};
219 
221  std::map<Phase, RateIx> i_{};
222 
224  std::vector<Rate> rates_{};
225  };
226 
227 } // namespace Opm
228 
229 #endif // OPM_GROUP_SATELLITE_INJECTION_HPP_INCLUDED
const std::string & name() const
Group name.
Definition: GroupSatelliteInjection.hpp:169
void serializeOp(Serializer &serializer)
Convert between byte array and object representation.
Definition: GroupSatelliteInjection.hpp:108
static Rate serializationTestObject()
Create a serialisation test object.
Definition: GroupSatelliteInjection.cpp:31
const std::optional< double > & surface() const
Surface injection rate for this phase.
Definition: GroupSatelliteInjection.hpp:63
const std::optional< double > & reservoir() const
Reservoir injection rate for this phase.
Definition: GroupSatelliteInjection.hpp:71
const std::optional< double > & calorific() const
Mean calorific value of injected gas.
Definition: GroupSatelliteInjection.hpp:79
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:30
static GroupSatelliteInjection serializationTestObject()
Create a serialisation test object.
Definition: GroupSatelliteInjection.cpp:64
std::vector< Rate >::size_type RateIx
Index type for looking up phase rate objects.
Definition: GroupSatelliteInjection.hpp:136
Rate & rate(const Phase phase)
Read/write access to injection rate object for particular phase.
Definition: GroupSatelliteInjection.cpp:75
GroupSatelliteInjection()=default
Default constructor.
Group level satellite production.
Definition: GroupSatelliteInjection.hpp:32
bool operator==(const GroupSatelliteInjection &that) const
Equality predicate.
Definition: GroupSatelliteInjection.cpp:99
void serializeOp(Serializer &serializer)
Convert between byte array and object representation.
Definition: GroupSatelliteInjection.hpp:206
bool operator==(const Rate &that) const
Equality predicate.
Definition: GroupSatelliteInjection.hpp:94
const Rate & operator[](const RateIx i) const
Read only satellite injection rates.
Definition: GroupSatelliteInjection.hpp:186
Class for (de-)serializing.
Definition: Serializer.hpp:94
Satellite injection rates for a single phase.
Definition: GroupSatelliteInjection.hpp:36
std::optional< RateIx > rateIndex(const Phase phase) const
Compute lookup index for particular phase.
Definition: GroupSatelliteInjection.cpp:88