My Project
Loading...
Searching...
No Matches
GasLiftOpt.hpp
1/*
2 Copyright 2020 Equinor ASA.
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 GAS_LIFT_OPT_HPP
21#define GAS_LIFT_OPT_HPP
22
23#include <opm/io/eclipse/rst/group.hpp>
24#include <opm/io/eclipse/rst/well.hpp>
25
26#include <cstddef>
27#include <map>
28#include <optional>
29#include <string>
30
31namespace Opm {
32
35{
36public:
41 GasLiftGroup() = default;
42
47 explicit GasLiftGroup(const std::string& name)
48 : m_name(name)
49 {}
50
55 explicit GasLiftGroup(const RestartIO::RstGroup& rst_group);
56
64 static bool active(const RestartIO::RstGroup& rst_group);
65
69 const std::optional<double>& max_lift_gas() const
70 {
71 return this->m_max_lift_gas;
72 }
73
77 void max_lift_gas(const double value)
78 {
79 if (! (value < 0.0)) {
80 this->m_max_lift_gas = value;
81 }
82 }
83
89 const std::optional<double>& max_total_gas() const
90 {
91 return this->m_max_total_gas;
92 }
93
98 void max_total_gas(const double value)
99 {
100 if (! (value < 0.0)) {
101 this->m_max_total_gas = value;
102 }
103 }
104
108 const std::string& name() const
109 {
110 return this->m_name;
111 }
112
118 template<class Serializer>
119 void serializeOp(Serializer& serializer)
120 {
121 serializer(m_name);
122 serializer(m_max_lift_gas);
123 serializer(m_max_total_gas);
124 }
125
128
136 bool operator==(const GasLiftGroup& other) const;
137
138private:
140 std::string m_name{};
141
143 std::optional<double> m_max_lift_gas{};
144
147 std::optional<double> m_max_total_gas{};
148};
149
150// ---------------------------------------------------------------------------
151
154{
155public:
160 GasLiftWell() = default;
161
169 GasLiftWell(const std::string& name, const bool use_glo)
170 : m_name { name }
171 , m_use_glo { use_glo }
172 {}
173
178 explicit GasLiftWell(const RestartIO::RstWell& rst_well);
179
187 static bool active(const RestartIO::RstWell& rst_well);
188
192 const std::string& name() const
193 {
194 return this->m_name;
195 }
196
198 bool use_glo() const
199 {
200 return this->m_use_glo;
201 }
202
206 void max_rate(const double value)
207 {
208 this->m_max_rate = value;
209 }
210
224 const std::optional<double>& max_rate() const
225 {
226 return this->m_max_rate;
227 }
228
232 void weight_factor(const double value)
233 {
234 if (this->m_use_glo) {
235 this->m_weight = value;
236 }
237 }
238
240 double weight_factor() const
241 {
242 return this->m_weight;
243 }
244
248 void inc_weight_factor(const double value)
249 {
250 if (this->m_use_glo) {
251 this->m_inc_weight = value;
252 }
253 }
254
256 double inc_weight_factor() const
257 {
258 return this->m_inc_weight;
259 }
260
266 void min_rate(const double value)
267 {
268 if (this->m_use_glo) {
269 this->m_min_rate = value;
270 }
271 }
272
274 double min_rate() const
275 {
276 return this->m_min_rate;
277 }
278
283 void alloc_extra_gas(const bool value)
284 {
285 if (this->m_use_glo) {
286 this->m_alloc_extra_gas = value;
287 }
288 }
289
292 bool alloc_extra_gas() const
293 {
294 return this->m_alloc_extra_gas;
295 }
296
302 template<class Serializer>
303 void serializeOp(Serializer& serializer)
304 {
305 serializer(m_name);
306 serializer(m_use_glo);
307 serializer(m_max_rate);
308 serializer(m_min_rate);
309 serializer(m_weight);
310 serializer(m_inc_weight);
311 serializer(m_alloc_extra_gas);
312 }
313
316
324 bool operator==(const GasLiftWell& other) const;
325
326private:
328 std::string m_name{};
329
333 std::optional<double> m_max_rate{};
334
336 double m_min_rate { 0.0 };
337
339 bool m_use_glo { false };
340
342 double m_weight { 1.0 };
343
345 double m_inc_weight { 0.0 };
346
349 bool m_alloc_extra_gas { false };
350};
351
352// ---------------------------------------------------------------------------
353
356{
357public:
366 const GasLiftGroup& group(const std::string& gname) const;
367
378 const GasLiftWell& well(const std::string& wname) const;
379
381 double gaslift_increment() const;
382
387
390 double min_eco_gradient() const;
391
395
397 double min_wait() const;
398
403 void min_wait(double min_wait);
404
410 bool all_newton() const;
411
414 void all_newton(bool all_newton);
415
421 void add_group(const GasLiftGroup& group);
422
428 void add_well(const GasLiftWell& well);
429
431 bool active() const;
432
439 bool has_well(const std::string& well) const;
440
448 bool has_group(const std::string& group) const;
449
451 std::size_t num_wells() const
452 {
453 return this->m_wells.size();
454 }
455
458
466 bool operator==(const GasLiftOpt& other) const;
467
473 template<class Serializer>
474 void serializeOp(Serializer& serializer)
475 {
476 serializer(m_increment);
477 serializer(m_min_eco_gradient);
478 serializer(m_min_wait);
479 serializer(m_all_newton);
480 serializer(m_groups);
481 serializer(m_wells);
482 }
483
484private:
486 double m_increment { 0.0 };
487
490 double m_min_eco_gradient { 0.0 };
491
493 double m_min_wait { 0.0 };
494
500 bool m_all_newton { true };
501
504 std::map<std::string, GasLiftGroup> m_groups{};
505
508 std::map<std::string, GasLiftWell> m_wells{};
509};
510
511} // namespace Opm
512
513#endif // GAS_LIFT_OPT_HPP
Gas lift optimisation parameters at the group level.
Definition GasLiftOpt.hpp:35
void max_lift_gas(const double value)
Assign maximum lift gas limit for this group.
Definition GasLiftOpt.hpp:77
static GasLiftGroup serializationTestObject()
Create a serialisation test object.
Definition GasLiftOpt.cpp:49
static bool active(const RestartIO::RstGroup &rst_group)
Predicate for whether or not gas lift optimisation applies to a group at simulation restart time.
Definition GasLiftOpt.cpp:37
void serializeOp(Serializer &serializer)
Convert between byte array and object representation.
Definition GasLiftOpt.hpp:119
const std::string & name() const
Group name.
Definition GasLiftOpt.hpp:108
bool operator==(const GasLiftGroup &other) const
Equality predicate.
Definition GasLiftOpt.cpp:60
void max_total_gas(const double value)
Assign maximum total gas limit for this group.
Definition GasLiftOpt.hpp:98
GasLiftGroup(const std::string &name)
Construct gas lift optimisation parameter collection for a single group.
Definition GasLiftOpt.hpp:47
GasLiftGroup()=default
Default constructor.
const std::optional< double > & max_lift_gas() const
Maximum lift gas limit for this group.
Definition GasLiftOpt.hpp:69
const std::optional< double > & max_total_gas() const
Maximum total gas limit for this group.
Definition GasLiftOpt.hpp:89
Gas lift optimisation parameters for all wells and groups.
Definition GasLiftOpt.hpp:356
void serializeOp(Serializer &serializer)
Convert between byte array and object representation.
Definition GasLiftOpt.hpp:474
void add_well(const GasLiftWell &well)
Incorporate gas lift and gas lift optimisation parameters for a single well into collection.
Definition GasLiftOpt.cpp:192
std::size_t num_wells() const
Number of wells currently known to gas lift optimisation facility.
Definition GasLiftOpt.hpp:451
bool active() const
Whether or not gas lift optimisation is currently enabled in the run.
Definition GasLiftOpt.cpp:120
const GasLiftGroup & group(const std::string &gname) const
Retrieve gas lift optimisation parameters for a single named group.
Definition GasLiftOpt.cpp:165
bool all_newton() const
Whether or not to include gas lift optimisation in all of the first "NUPCOL" non-linear iterations.
Definition GasLiftOpt.cpp:160
void add_group(const GasLiftGroup &group)
Incorporate gas lift optimisation parameters for a single group into collection.
Definition GasLiftOpt.cpp:187
double min_wait() const
Retrieve minimum wait time between gas lift optimisation runs.
Definition GasLiftOpt.cpp:150
bool operator==(const GasLiftOpt &other) const
Equality predicate.
Definition GasLiftOpt.cpp:228
bool has_well(const std::string &well) const
Whether or not gas lift parameters exists for single named well.
Definition GasLiftOpt.cpp:177
const GasLiftWell & well(const std::string &wname) const
Retrieve gas lift and gas lift optimisation parameters for a single named well.
Definition GasLiftOpt.cpp:197
double gaslift_increment() const
Lift gas rate increment.
Definition GasLiftOpt.cpp:130
static GasLiftOpt serializationTestObject()
Create a serialisation test object.
Definition GasLiftOpt.cpp:209
bool has_group(const std::string &group) const
Whether or not gas lift optimisation parameters exists for single named group.
Definition GasLiftOpt.cpp:182
double min_eco_gradient() const
Retrieve minimum economical gradient threshold to continue increasing lift gas injection rate.
Definition GasLiftOpt.cpp:140
Gas lift and gas lift optimisation parameters at the well level.
Definition GasLiftOpt.hpp:154
const std::optional< double > & max_rate() const
Retrieve maximum gas lift rate for this well.
Definition GasLiftOpt.hpp:224
void inc_weight_factor(const double value)
Assign incremental gas rate weighting factor for this well.
Definition GasLiftOpt.hpp:248
void min_rate(const double value)
Assign minimum rate of lift gas injection for this well.
Definition GasLiftOpt.hpp:266
bool operator==(const GasLiftWell &other) const
Equality predicate.
Definition GasLiftOpt.cpp:106
double min_rate() const
Retrieve this well's minimum lift gas injection rate.
Definition GasLiftOpt.hpp:274
static bool active(const RestartIO::RstWell &rst_well)
Predicate for whether or not gas lift optimisation applies to a group at simulation restart time.
Definition GasLiftOpt.cpp:84
GasLiftWell(const std::string &name, const bool use_glo)
Construct gas lift optimisation parameter collection for a single well.
Definition GasLiftOpt.hpp:169
bool alloc_extra_gas() const
Whether or not to allocate extra lift gas if available, even if group target is or would be exceeded.
Definition GasLiftOpt.hpp:292
double weight_factor() const
Retrieve weighting factor for preferential allocation of lift gas.
Definition GasLiftOpt.hpp:240
GasLiftWell()=default
Default constructor.
void weight_factor(const double value)
Assign weighting factor for preferential allocation of lift gas.
Definition GasLiftOpt.hpp:232
void alloc_extra_gas(const bool value)
Assign flag for whether or not to allocate extra lift gas if available, even if group target is or wo...
Definition GasLiftOpt.hpp:283
const std::string & name() const
Well name.
Definition GasLiftOpt.hpp:192
void serializeOp(Serializer &serializer)
Convert between byte array and object representation.
Definition GasLiftOpt.hpp:303
bool use_glo() const
Whether or not this well is subject to gas lift optimisation.
Definition GasLiftOpt.hpp:198
double inc_weight_factor() const
Retrieve incremental gas rate weighting factor for this well.
Definition GasLiftOpt.hpp:256
static GasLiftWell serializationTestObject()
Create a serialisation test object.
Definition GasLiftOpt.cpp:91
void max_rate(const double value)
Assign maximum gas lift rate for this well.
Definition GasLiftOpt.hpp:206
Class for (de-)serializing.
Definition Serializer.hpp:94
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30
Definition group.hpp:38
Definition well.hpp:43