-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathpipe.h
More file actions
223 lines (148 loc) · 4.82 KB
/
pipe.h
File metadata and controls
223 lines (148 loc) · 4.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
/*
* This file is part of the ResOpt project.
*
* Copyright (C) 2011-2012 Aleksander O. Juell <aleksander.juell@ntnu.no>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef PIPE_H
#define PIPE_H
#include <QString>
#include <QStringList>
#include <QVector>
#include "component.h"
namespace ResOpt
{
class ProductionWell;
class PressureDropCalculator;
class Stream;
/**
* @brief Abstract base class for pipe segments
* @details A Pipe is fed by either Wells or other Pipes. Pressure drop calculations are performed based on the input streames
* going through the pipe and the outlet pressure of the pipe.
*
*/
class Pipe : public Component
{
private:
int m_number; // the identifier for the pipe
QString m_file_name; // the file containing the pressure drop table
PressureDropCalculator *p_calculator; // the pressure drop calculator
QVector<Pipe*> m_feed_pipes; // pointers to pipes entering this pipe
QVector<ProductionWell*> m_feed_wells; // pointers to wells entering this pipe directly
QVector<double> m_schedule; // a copy of the master schedule set in the model
/**
* @brief
*
* @param line
* @return QStringList
*/
QStringList processLine(const QString& line);
/**
* @brief
*
* @param list
* @return bool
*/
bool isEmpty(const QStringList &list);
public:
Pipe();
Pipe(const Pipe &p);
virtual ~Pipe();
// virtual functions
virtual Pipe* clone() = 0;
/**
* @brief Calculates the inlet pressure of the pipe based on the outlet pressure and the incoming streams
*
*/
virtual void calculateInletPressure() = 0;
/**
* @brief Resests the rates and pressures in all the streams to zero
*
*/
virtual void emptyStreams();
virtual void initialize(const QVector<double> &schedule);
virtual QString description() const = 0;
// misc functions
/**
* @brief A recursive function that calculates the inlet pressures for all the feed pipes.
* @details The inlet pressures are calculated recursively downwards in the branch. First for all the feed pipes connected to this
* pipe directly, then for all the feed pipes connected to the feed pipes of this pipe, and so on.
*
*/
void calculateBranchInletPressures();
/**
* @brief Removes all the current feed Wells and Pipes
*
*/
void cleanFeedConnections();
/**
* @brief Reads the input file containing the pressure drop tables for this pipe segment
*
*/
void readInputFile();
// add functions
/**
* @brief Adds s to Stream i
*
* @param i
* @param s
* @return bool
*/
bool addToStream(int i, const Stream &s);
/**
* @brief Adds a Pipe as a feed stream to this Pipe.
*
* @param p
*/
void addFeedPipe(Pipe *p) {m_feed_pipes.push_back(p);}
/**
* @brief Adds a Well as a direct feed to this Pipe
* @details Only Wells that feed directly into this Pipe should be added here. If the Well feeds indirectly from another Pipe,
* the connection should be taken care of through addFeedPipe(Pipe*).
*
* @param w
*/
void addFeedWell(ProductionWell *w) {m_feed_wells.push_back(w);}
// set functions
/**
* @brief Sets the identifying number of the pipe
*
* @param n
*/
void setNumber(int n) {m_number = n;}
/**
* @brief Sets the file name of the file containing pressure drop tables for the pipe.
*
* @param s
*/
void setFileName(const QString &s) {m_file_name = s;}
// get functions
/**
* @brief Returns the identifying number of the pipe
*
* @return int
*/
int number() const {return m_number;}
const QString& fileName() const {return m_file_name;}
/**
* @brief Returns the pressure drop calculator for this Pipe
*
* @return PressureDropCalculator
*/
PressureDropCalculator* calculator() {return p_calculator;}
};
} // namespace ResOpt
#endif // PIPE_H