opm-common
Toggle main menu visibility
Loading...
Searching...
No Matches
Segment.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 SEGMENT_HPP_HEADER_INCLUDED
21
#define SEGMENT_HPP_HEADER_INCLUDED
22
23
#include <opm/input/eclipse/Schedule/MSW/AICD.hpp>
24
#include <opm/input/eclipse/Schedule/MSW/SICD.hpp>
25
#include <opm/input/eclipse/Schedule/MSW/Valve.hpp>
26
27
#include <optional>
28
#include <variant>
29
#include <vector>
30
31
#include <cmath>
32
33
namespace
Opm
{
namespace
RestartIO {
34
struct
RstSegment
;
35
}}
// namespace Opm::RestartIO
36
37
namespace
Opm
{
38
39
class
Segment {
40
public
:
41
// Maximum relative roughness to guarantee non-singularity for Re>=4000 in Haaland friction
42
// factor calculations (see MSWellHelpers in opm-simulators).
43
// cannot be constexpr due to clang not having constexpr std::pow
44
static
const
double
MAX_REL_ROUGHNESS;
// = 3.7 * std::pow((1.0 - 1.0e-3) - 6.9/4000.0, 9. / 10.);
45
46
47
enum class
SegmentType {
48
REGULAR,
49
SICD
,
50
AICD,
// Not really supported - just included to complete the enum
51
VALVE,
52
};
53
54
Segment();
55
56
Segment(
const
Segment& src,
double
new_depth,
double
new_length,
double
new_volume,
double
new_x,
double
new_y);
57
Segment(
const
Segment& src,
double
new_depth,
double
new_length,
double
new_x,
double
new_y);
58
Segment(
const
Segment& src,
double
new_depth,
double
new_length,
double
new_volume);
59
Segment(
const
Segment& src,
double
new_depth,
double
new_length);
60
Segment(
const
Segment& src,
double
new_volume);
61
Segment(
const
int
segment_number_in,
62
const
int
branch_in,
63
const
int
outlet_segment_in,
64
const
double
depth_in,
65
const
double
length_in,
66
const
double
internal_diameter_in,
67
const
double
roughness_in,
68
const
double
cross_area_in,
69
const
double
volume_in,
70
const
bool
data_ready_in,
71
const
double
x_in,
72
const
double
y_in);
73
74
explicit
Segment(
const
RestartIO::RstSegment
& rst_segment,
const
std::string& wname);
75
76
static
Segment serializationTestObject();
77
78
int
segmentNumber()
const
;
79
int
branchNumber()
const
;
80
int
outletSegment()
const
;
81
double
totalLength()
const
;
82
double
node_X()
const
;
83
double
node_Y()
const
;
84
double
depth()
const
;
85
double
internalDiameter()
const
;
86
double
roughness()
const
;
87
double
crossArea()
const
;
88
double
volume()
const
;
89
bool
dataReady()
const
;
90
91
SegmentType segmentType()
const
;
92
int
ecl_type_id()
const
;
93
94
const
std::vector<int>& inletSegments()
const
;
95
96
static
double
invalidValue();
97
98
bool
operator==(
const
Segment& )
const
;
99
bool
operator!=(
const
Segment& )
const
;
100
101
const
SICD
& spiralICD()
const
;
102
const
AutoICD
& autoICD()
const
;
103
const
Valve
& valve()
const
;
104
105
void
updateSpiralICD(
const
SICD
& spiral_icd);
106
void
updateAutoICD(
const
AutoICD
& aicd);
107
void
updateValve(
const
Valve
& valve,
const
double
segment_length);
108
void
updateValve(
const
Valve
& valve);
109
void
addInletSegment(
const
int
segment_number);
110
111
bool
isRegular()
const
112
{
113
return
std::holds_alternative<RegularSegment>(this->m_icd);
114
}
115
116
inline
bool
isSpiralICD()
const
117
{
118
return
std::holds_alternative<SICD>(this->m_icd);
119
}
120
121
inline
bool
isAICD()
const
122
{
123
return
std::holds_alternative<AutoICD>(this->m_icd);
124
}
125
126
inline
bool
isValve()
const
127
{
128
return
std::holds_alternative<Valve>(this->m_icd);
129
}
130
131
template
<
class
Serializer>
132
void
serializeOp(
Serializer
& serializer)
133
{
134
serializer(m_segment_number);
135
serializer(m_branch);
136
serializer(m_outlet_segment);
137
serializer(m_inlet_segments);
138
serializer(m_depth);
139
serializer(m_total_length);
140
serializer(m_internal_diameter);
141
serializer(m_roughness);
142
serializer(m_cross_area);
143
serializer(m_volume);
144
serializer(m_data_ready);
145
serializer(m_x);
146
serializer(m_y);
147
serializer(m_icd);
148
}
149
150
private
:
151
// The current serialization of std::variant<> requires that all the
152
// types in the variant have a serializeOp() method. We introduce
153
// this RegularSegment to meet this requirement. Ideally, the ICD
154
// variant<> would use std::monostate to represent non-ICD segments.
155
struct
RegularSegment
156
{
157
template
<
class
Serializer>
158
void
serializeOp(
Serializer
&) {}
159
160
static
RegularSegment serializationTestObject() {
return
{}; }
161
162
bool
operator==(
const
RegularSegment&)
const
{
return
true
; }
163
};
164
165
// segment number
166
// it should work as a ID.
167
int
m_segment_number;
168
169
// branch number
170
// for top segment, it should always be 1
171
int
m_branch;
172
173
// the outlet junction segment
174
// for top segment, it should be -1
175
int
m_outlet_segment;
176
177
// the segments whose outlet segments are the current segment
178
std::vector<int> m_inlet_segments;
179
180
// depth of the nodes to the bhp reference point
181
// when reading in from deck, with 'INC',
182
// it will be the incremental depth before processing.
183
// in the class Well, it always stores the 'ABS' value.
184
// TODO: to check if it is good to use 'ABS' always.
185
double
m_depth;
186
187
// length of the segment node to the bhp reference point.
188
// when reading in from deck, with 'INC',
189
// it will be incremental length before processing.
190
// After processing and in the class Well, it always stores the 'ABS' value.
191
// which means the total_length
192
double
m_total_length;
193
194
// tubing internal diameter
195
// or the equivalent diameter for annular cross-sections
196
// for top segment, it is UNDEFINED
197
// we use invalid_value for the top segment
198
double
m_internal_diameter;
199
200
// effective roughness of the tubing
201
// used to calculate the Fanning friction factor
202
// for top segment, it is UNDEFINED
203
// we use invalid_value for the top segment
204
double
m_roughness;
205
206
// cross-sectional area for fluid flow
207
// not defined for the top segment,
208
// we use invalid_value for the top segment.
209
double
m_cross_area;
210
211
// valume of the segment;
212
// it is defined for top segment.
213
// TODO: to check if the definition is the same with other segments.
214
double
m_volume;
215
216
// indicate if the data related to 'INC' or 'ABS' is ready
217
// the volume will be updated at a final step.
218
bool
m_data_ready;
219
220
// Length of segment projected onto the X axis. Not used in
221
// simulations, but needed for the SEG option in WRFTPLT.
222
double
m_x{};
223
224
// Length of segment projected onto the Y axis. Not used in
225
// simulations, but needed for the SEG option in WRFTPLT.
226
double
m_y{};
227
228
std::variant<RegularSegment, SICD, AutoICD, Valve> m_icd;
229
230
// There are three other properties for the segment pertaining to
231
// thermal conduction. These are not currently supported.
232
233
void
updateValve__(
Valve
& valve,
const
double
segment_length);
234
};
235
236
}
237
238
#endif
Opm::AutoICD
Definition
AICD.hpp:44
Opm::SICD
Definition
SICD.hpp:46
Opm::Serializer
Class for (de-)serializing.
Definition
Serializer.hpp:94
Opm::Valve
Definition
Valve.hpp:63
Opm
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition
Exceptions.hpp:30
Opm::RestartIO::RstSegment
Definition
segment.hpp:34
opm
input
eclipse
Schedule
MSW
Segment.hpp
Generated by
1.17.0