opm-common
SICD.hpp
1 /*
2  Copyright 2017 SINTEF Digital, Mathematics and Cybernetics.
3  Copyright 2019 Equinor ASA.
4 
5  This file is part of the Open Porous Media project (OPM).
6 
7  OPM is free software: you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation, either version 3 of the License, or
10  (at your option) any later version.
11 
12  OPM is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with OPM. If not, see <http://www.gnu.org/licenses/>.
19 */
20 
21 #ifndef SPIRALICD_HPP_HEADER_INCLUDED
22 #define SPIRALICD_HPP_HEADER_INCLUDED
23 
24 #include <opm/input/eclipse/Schedule/MSW/icd.hpp>
25 
26 #include <map>
27 #include <optional>
28 #include <string>
29 #include <utility>
30 #include <vector>
31 
32 namespace Opm {
33 
34  class DeckRecord;
35  class DeckKeyword;
36 
37 } // namespace Opm
38 
39 namespace Opm { namespace RestartIO {
40  struct RstSegment;
41 }} // namespace Opm::RestartIO
42 
43 namespace Opm {
44 
45  class SICD
46  {
47  public:
48  SICD() = default;
49  explicit SICD(const DeckRecord& record);
50  explicit SICD(const RestartIO::RstSegment& rstSegment);
51 
52  SICD(double strength,
53  double length,
54  double densityCalibration,
55  double viscosityCalibration,
56  double criticalValue,
57  double widthTransitionRegion,
58  double maxViscosityRatio,
59  int methodFlowScaling,
60  const std::optional<double>& maxAbsoluteRate,
61  ICDStatus status,
62  double scalingFactor);
63 
64  virtual ~SICD() = default;
65 
66  static SICD serializationTestObject();
67 
68  // the function will return a map
69  // [
70  // "WELL1" : [<seg1, sicd1>, <seg2, sicd2> ...]
71  // ....
72  static std::map<std::string, std::vector<std::pair<int, SICD>>>
73  fromWSEGSICD(const DeckKeyword& wsegsicd);
74 
75  const std::optional<double>& maxAbsoluteRate() const;
76  ICDStatus status() const;
77  double strength() const;
78  double length() const;
79  double densityCalibration() const;
80  double viscosityCalibration() const;
81  double criticalValue() const;
82  double widthTransitionRegion() const;
83  double maxViscosityRatio() const;
84  int methodFlowScaling() const;
85 
86  bool updateScalingFactor(const double segment_length, const double completion_length);
87  double scalingFactor() const;
88  int ecl_status() const;
89  bool operator==(const SICD& data) const;
90 
91  template<class Serializer>
92  void serializeOp(Serializer& serializer)
93  {
94  serializer(m_strength);
95  serializer(m_length);
96  serializer(m_density_calibration);
97  serializer(m_viscosity_calibration);
98  serializer(m_critical_value);
99  serializer(m_width_transition_region);
100  serializer(m_max_viscosity_ratio);
101  serializer(m_method_flow_scaling);
102  serializer(m_max_absolute_rate);
103  serializer(m_status);
104  serializer(m_scaling_factor);
105  }
106 
107  private:
108  double m_strength { 0.0 };
109  double m_length { 0.0 };
110  double m_density_calibration { 0.0 };
111  double m_viscosity_calibration { 0.0 };
112  double m_critical_value { 0.0 };
113  double m_width_transition_region { 0.0 };
114  double m_max_viscosity_ratio { 0.0 };
115  int m_method_flow_scaling { 0 };
116  std::optional<double> m_max_absolute_rate {};
117  ICDStatus m_status { ICDStatus::SHUT };
118 
119  // scaling factor is the only one can not be gotten from deck
120  // directly, needs to be updated afterwards
121  std::optional<double> m_scaling_factor { std::nullopt };
122  };
123 
124 } // namespace Opm
125 
126 #endif // SPIRALICD_HPP_HEADER_INCLUDED
Definition: SICD.hpp:45
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:30
Definition: segment.hpp:33
Definition: DeckRecord.hpp:32
Class for (de-)serializing.
Definition: Serializer.hpp:94
Definition: DeckKeyword.hpp:36