opm-common
ConnectionEconLimits.hpp
1 /*
2  Copyright 2026 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_CONNECTION_ECON_LIMITS_HPP
21 #define OPM_CONNECTION_ECON_LIMITS_HPP
22 
23 #include <optional>
24 #include <string>
25 
26 namespace Opm {
27 
28  class DeckRecord;
29 
32  {
34  enum class EconWorkover {
35  CON = 1, // CON
36  CONP = 2, // +CON
37  WELL = 3,
38  PLUG = 4,
39  };
40 
41  static EconWorkover EconWorkoverFromString(const std::string& stringValue);
42 
44  double max_water_cut{0.0};
45 
47  double max_gas_oil_ratio{0.0};
48 
50  double max_water_gas_ratio{0.0};
51 
53  EconWorkover workover{EconWorkover::CON};
54 
56  bool check_stopped_wells{false};
57 
59  std::optional<double> min_oil_rate{};
60 
62  std::optional<double> min_gas_rate{};
63 
65  std::string followon_well{};
66 
67  ConnectionEconLimits() = default;
68 
70  explicit ConnectionEconLimits(const DeckRecord& record);
71 
72  bool operator==(const ConnectionEconLimits& other) const;
73  bool operator!=(const ConnectionEconLimits& other) const
74  {
75  return !(*this == other);
76  }
77 
78  bool onAnyEffectiveLimit() const;
79  bool onMaxWaterCut() const { return this->max_water_cut > 0.0; }
80  bool onMaxGasOilRatio() const { return this->max_gas_oil_ratio > 0.0; }
81  bool onMaxWaterGasRatio() const{ return this->max_water_gas_ratio > 0.0; }
82  bool onMinOilRate() const { return this->min_oil_rate.has_value(); }
83  bool onMinGasRate() const { return this->min_gas_rate.has_value(); }
84 
85  static ConnectionEconLimits serializationTestObject();
86 
87  template <class Serializer>
88  void serializeOp(Serializer& serializer)
89  {
90  serializer(this->max_water_cut);
91  serializer(this->max_gas_oil_ratio);
92  serializer(this->max_water_gas_ratio);
93  serializer(this->workover);
94  serializer(this->check_stopped_wells);
95  serializer(this->min_oil_rate);
96  serializer(this->min_gas_rate);
97  serializer(this->followon_well);
98  }
99  };
100 
101 } // namespace Opm
102 
103 #endif // OPM_CONNECTION_ECON_LIMITS_HPP
EconWorkover
Workover procedure for CECON limits (no NONE option unlike WECON).
Definition: ConnectionEconLimits.hpp:34
std::optional< double > min_oil_rate
Minimum oil production rate (SI); empty means no limit.
Definition: ConnectionEconLimits.hpp:59
std::optional< double > min_gas_rate
Minimum gas production rate (SI); empty means no limit.
Definition: ConnectionEconLimits.hpp:62
std::string followon_well
Optional follow-on well.
Definition: ConnectionEconLimits.hpp:65
double max_water_cut
Maximum water cut (water/liquid ratio); 0.0 means off.
Definition: ConnectionEconLimits.hpp:44
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:30
EconWorkover workover
Workover applied when a ratio limit is violated.
Definition: ConnectionEconLimits.hpp:53
bool check_stopped_wells
Whether to check stopped wells.
Definition: ConnectionEconLimits.hpp:56
double max_water_gas_ratio
Maximum water/gas ratio; 0.0 means off.
Definition: ConnectionEconLimits.hpp:50
Per-connection economic limits (CECON keyword).
Definition: ConnectionEconLimits.hpp:31
double max_gas_oil_ratio
Maximum gas/oil ratio; 0.0 means off.
Definition: ConnectionEconLimits.hpp:47
Definition: DeckRecord.hpp:33