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