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