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