My Project
WellSegments.hpp
1 /*
2  Copyright 2015 SINTEF ICT, Applied Mathematics.
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 SEGMENTSET_HPP_HEADER_INCLUDED
21 #define SEGMENTSET_HPP_HEADER_INCLUDED
22 
23 #include <map>
24 #include <set>
25 #include <vector>
26 
27 #include <opm/input/eclipse/Schedule/MSW/Segment.hpp>
28 
29 namespace Opm {
30  class SICD;
31  class AutoICD;
32  class Valve;
33  class WellConnections;
34 }
35 
36 namespace Opm {
37 
38  class DeckKeyword;
39  class KeywordLocation;
40 
41  class WellSegments {
42  public:
43  enum class LengthDepth{
44  INC = 0,
45  ABS = 1
46  };
47  static const std::string LengthDepthToString(LengthDepth enumValue);
48  static LengthDepth LengthDepthFromString(const std::string& stringValue);
49 
50 
51  enum class CompPressureDrop {
52  HFA = 0,
53  HF_ = 1,
54  H__ = 2
55  };
56  static const std::string CompPressureDropToString(CompPressureDrop enumValue);
57  static CompPressureDrop CompPressureDropFromString(const std::string& stringValue);
58 
59 
60  enum class MultiPhaseModel {
61  HO = 0,
62  DF = 1
63  };
64  static const std::string MultiPhaseModelToString(MultiPhaseModel enumValue);
65  static MultiPhaseModel MultiPhaseModelFromString(const std::string& stringValue);
66 
67 
68  WellSegments() = default;
69  WellSegments(CompPressureDrop compDrop,
70  const std::vector<Segment>& segments);
71  explicit WellSegments(const DeckKeyword& keyword);
72  void loadWELSEGS( const DeckKeyword& welsegsKeyword);
73 
74  static WellSegments serializeObject();
75 
76  std::size_t size() const;
77  double depthTopSegment() const;
78  double lengthTopSegment() const;
79  double volumeTopSegment() const;
80 
81  CompPressureDrop compPressureDrop() const;
82 
83  // mapping the segment number to the index in the vector of segments
84  int segmentNumberToIndex(const int segment_number) const;
85 
86 
87 
88  const Segment& getFromSegmentNumber(const int segment_number) const;
89 
90  const Segment& operator[](size_t idx) const;
91  void orderSegments();
92  void updatePerfLength(const WellConnections& connections);
93 
94  bool operator==( const WellSegments& ) const;
95  bool operator!=( const WellSegments& ) const;
96 
97  double segmentLength(const int segment_number) const;
98  double segmentDepthChange(const int segment_number) const;
99  std::vector<Segment> branchSegments(int branch) const;
100  std::set<int> branches() const;
101 
102  // it returns true if there is no error encountered during the update
103  bool updateWSEGSICD(const std::vector<std::pair<int, SICD> >& sicd_pairs);
104 
105  bool updateWSEGVALV(const std::vector<std::pair<int, Valve> >& valve_pairs);
106  bool updateWSEGAICD(const std::vector<std::pair<int, AutoICD> >& aicd_pairs, const KeywordLocation& location);
107  const std::vector<Segment>::const_iterator begin() const;
108  const std::vector<Segment>::const_iterator end() const;
109 
110  template<class Serializer>
111  void serializeOp(Serializer& serializer)
112  {
113  serializer(m_comp_pressure_drop);
114  serializer.vector(m_segments);
115  serializer(segment_number_to_index);
116  }
117 
118  private:
119  void processABS();
120  void processINC(double depth_top, double length_top);
121  void process(LengthDepth length_depth, double depth_top, double length_top);
122  void addSegment(const Segment& new_segment);
123  void addSegment(int segment_number,
124  int branch,
125  int outlet_segment,
126  double length,
127  double depth,
128  double internal_diameter,
129  double roughness,
130  double cross_area,
131  double volume,
132  bool data_ready);
133  const Segment& topSegment() const;
134 
135  // components of the pressure drop to be included
136  CompPressureDrop m_comp_pressure_drop;
137  // There are X and Y cooridnate of the nodal point of the top segment
138  // Since they are not used for simulations and we are not supporting plotting,
139  // we are not handling them at the moment.
140  // There are other three properties for segment related to thermal conduction,
141  // while they are not supported by the keyword at the moment.
142 
143  std::vector< Segment > m_segments;
144  // the mapping from the segment number to the
145  // storage index in the vector
146  std::map<int, int> segment_number_to_index;
147  };
148 }
149 
150 #endif
Definition: DeckKeyword.hpp:36
Definition: KeywordLocation.hpp:27
Definition: Segment.hpp:63
Definition: Serializer.hpp:38
Definition: WellConnections.hpp:40
Definition: WellSegments.hpp:41
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:29