opm-common
GroupEconProductionLimits.hpp
1 /*
2  Copyright 2023 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 GROUP_ECON_PRODUCTION_LIMITS_H
21 #define GROUP_ECON_PRODUCTION_LIMITS_H
22 
23 #include <opm/input/eclipse/Deck/UDAValue.hpp>
24 
25 #include <cstddef>
26 #include <map>
27 #include <optional>
28 #include <string>
29 
30 namespace Opm {
31 
32 class DeckRecord;
33 class Schedule;
34 class SummaryState;
35 
37 {
38 public:
39  enum class EconWorkover {
40  NONE = 0,
41  CON = 1, // CON
42  CONP = 2, // +CON
43  WELL = 3,
44  PLUG = 4,
45  ALL = 5
46  };
47 
48  class GEconGroup
49  {
50  public:
51  GEconGroup() = default;
52  GEconGroup(const DeckRecord &record, const int report_step);
53  bool endRun() const;
54  UDAValue minOilRate() const;
55  UDAValue minGasRate() const;
56  UDAValue maxWaterCut() const;
57  UDAValue maxGasOilRatio() const;
58  UDAValue maxWaterGasRatio() const;
59  int maxOpenWells() const;
60  bool operator==(const GEconGroup& other) const;
61  int reportStep() const;
62  template<class Serializer>
63  void serializeOp(Serializer& serializer)
64  {
65  serializer(m_min_oil_rate);
66  serializer(m_min_gas_rate);
67  serializer(m_max_water_cut);
68  serializer(m_max_gas_oil_ratio);
69  serializer(m_max_water_gas_ratio);
70  serializer(m_workover);
71  serializer(m_end_run);
72  serializer(m_max_open_wells);
73  }
74  static GEconGroup serializationTestObject();
75  EconWorkover workover() const;
76 
77  private:
78  UDAValue m_min_oil_rate{};
79  UDAValue m_min_gas_rate{};
80  UDAValue m_max_water_cut{};
81  UDAValue m_max_gas_oil_ratio{};
82  UDAValue m_max_water_gas_ratio{};
83  EconWorkover m_workover{EconWorkover::NONE};
84  bool m_end_run{false};
85  int m_max_open_wells{};
86  int m_report_step{}; // Used to get UDQ undefined value
87  };
88 
90  {
91  /* Same as GEconGroup but with UDA values realized at given report step*/
92  public:
93  GEconGroupProp(const double min_oil_rate,
94  const double min_gas_rate,
95  const double max_water_cut,
96  const double max_gas_oil_ratio,
97  const double max_water_gas_ratio,
98  EconWorkover workover,
99  bool end_run,
100  int max_open_wells);
101  bool endRun() const;
102  std::optional<double> minOilRate() const;
103  std::optional<double> minGasRate() const;
104  std::optional<double> maxWaterCut() const;
105  std::optional<double> maxGasOilRatio() const;
106  std::optional<double> maxWaterGasRatio() const;
107  int maxOpenWells() const;
108  EconWorkover workover() const;
109 
110  private:
111  std::optional<double> m_min_oil_rate{};
112  std::optional<double> m_min_gas_rate{};
113  std::optional<double> m_max_water_cut{};
114  std::optional<double> m_max_gas_oil_ratio{};
115  std::optional<double> m_max_water_gas_ratio{};
116  EconWorkover m_workover{EconWorkover::NONE};
117  bool m_end_run{false};
118  int m_max_open_wells{};
119  };
120 
121  GroupEconProductionLimits() = default;
122  //explicit GroupEconProductionLimits(const RestartIO::RstWell& rstWell);
123 
124  void add_group(const int report_step, const std::string &group_name, const DeckRecord &record);
125  static EconWorkover econWorkoverFromString(const std::string& string_value);
126  static std::string econWorkoverToString(EconWorkover workover);
127  const GEconGroup& get_group(const std::string& gname) const;
128  GEconGroupProp get_group_prop(
129  const Schedule &schedule, const SummaryState &st, const std::string& gname) const;
130  bool has_group(const std::string& gname) const;
131  bool operator==(const GroupEconProductionLimits& other) const;
132  bool operator!=(const GroupEconProductionLimits& other) const;
133  template<class Serializer>
134  void serializeOp(Serializer& serializer) const
135  {
136  serializer(m_groups);
137  }
138  static GroupEconProductionLimits serializationTestObject();
139  std::size_t size() const;
140 
141 private:
142  std::map<std::string, GEconGroup> m_groups;
143 };
144 
145 } // namespace Opm
146 
147 #endif
Definition: GroupEconProductionLimits.hpp:36
Definition: UDAValue.hpp:31
Definition: Schedule.hpp:102
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:30
Definition: SummaryState.hpp:72
Definition: GroupEconProductionLimits.hpp:89
Definition: DeckRecord.hpp:33
Class for (de-)serializing.
Definition: Serializer.hpp:95
Definition: GroupEconProductionLimits.hpp:48