Loading...
Searching...
No Matches
GasLiftOpt.hpp
/*
Copyright 2020 Equinor ASA.
This file is part of the Open Porous Media project (OPM).
OPM 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 3 of the License, or
(at your option) any later version.
OPM 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 OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GAS_LIFT_OPT_HPP
#define GAS_LIFT_OPT_HPP
#include <opm/io/eclipse/rst/group.hpp>
#include <opm/io/eclipse/rst/well.hpp>
#include <cstddef>
#include <map>
#include <optional>
#include <string>
namespace Opm {
class GasLiftGroup
{
public:
GasLiftGroup() = default;
explicit GasLiftGroup(const std::string& name)
: m_name(name)
{}
explicit GasLiftGroup(const RestartIO::RstGroup& rst_group);
static bool active(const RestartIO::RstGroup& rst_group);
const std::optional<double>& max_lift_gas() const
{
return this->m_max_lift_gas;
}
void max_lift_gas(const double value)
{
if (! (value < 0.0)) {
this->m_max_lift_gas = value;
}
}
const std::optional<double>& max_total_gas() const
{
return this->m_max_total_gas;
}
void max_total_gas(const double value)
{
if (! (value < 0.0)) {
this->m_max_total_gas = value;
}
}
const std::string& name() const
{
return this->m_name;
}
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(m_name);
serializer(m_max_lift_gas);
serializer(m_max_total_gas);
}
static GasLiftGroup serializationTestObject();
bool operator==(const GasLiftGroup& other) const;
private:
std::string m_name{};
std::optional<double> m_max_lift_gas{};
std::optional<double> m_max_total_gas{};
};
// ---------------------------------------------------------------------------
class GasLiftWell
{
public:
GasLiftWell() = default;
GasLiftWell(const std::string& name, const bool use_glo)
: m_name { name }
, m_use_glo { use_glo }
{}
explicit GasLiftWell(const RestartIO::RstWell& rst_well);
static bool active(const RestartIO::RstWell& rst_well);
const std::string& name() const
{
return this->m_name;
}
bool use_glo() const
{
return this->m_use_glo;
}
void max_rate(const double value)
{
this->m_max_rate = value;
}
const std::optional<double>& max_rate() const
{
return this->m_max_rate;
}
void weight_factor(const double value)
{
if (this->m_use_glo) {
this->m_weight = value;
}
}
double weight_factor() const
{
return this->m_weight;
}
void inc_weight_factor(const double value)
{
if (this->m_use_glo) {
this->m_inc_weight = value;
}
}
double inc_weight_factor() const
{
return this->m_inc_weight;
}
void min_rate(const double value)
{
if (this->m_use_glo) {
this->m_min_rate = value;
}
}
double min_rate() const
{
return this->m_min_rate;
}
void alloc_extra_gas(const bool value)
{
if (this->m_use_glo) {
this->m_alloc_extra_gas = value;
}
}
bool alloc_extra_gas() const
{
return this->m_alloc_extra_gas;
}
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(m_name);
serializer(m_use_glo);
serializer(m_max_rate);
serializer(m_min_rate);
serializer(m_weight);
serializer(m_inc_weight);
serializer(m_alloc_extra_gas);
}
static GasLiftWell serializationTestObject();
bool operator==(const GasLiftWell& other) const;
private:
std::string m_name{};
std::optional<double> m_max_rate{};
double m_min_rate { 0.0 };
bool m_use_glo { false };
double m_weight { 1.0 };
double m_inc_weight { 0.0 };
bool m_alloc_extra_gas { false };
};
// ---------------------------------------------------------------------------
class GasLiftOpt
{
public:
const GasLiftGroup& group(const std::string& gname) const;
const GasLiftWell& well(const std::string& wname) const;
double gaslift_increment() const;
void gaslift_increment(double gaslift_increment);
double min_eco_gradient() const;
void min_eco_gradient(double min_eco_gradient);
double min_wait() const;
void min_wait(double min_wait);
bool all_newton() const;
void all_newton(bool all_newton);
void add_group(const GasLiftGroup& group);
void add_well(const GasLiftWell& well);
bool active() const;
bool has_well(const std::string& well) const;
bool has_group(const std::string& group) const;
std::size_t num_wells() const
{
return this->m_wells.size();
}
static GasLiftOpt serializationTestObject();
bool operator==(const GasLiftOpt& other) const;
template<class Serializer>
void serializeOp(Serializer& serializer)
{
serializer(m_increment);
serializer(m_min_eco_gradient);
serializer(m_min_wait);
serializer(m_all_newton);
serializer(m_groups);
serializer(m_wells);
}
private:
double m_increment { 0.0 };
double m_min_eco_gradient { 0.0 };
double m_min_wait { 0.0 };
bool m_all_newton { true };
std::map<std::string, GasLiftGroup> m_groups{};
std::map<std::string, GasLiftWell> m_wells{};
};
} // namespace Opm
#endif // GAS_LIFT_OPT_HPP
Opm::GasLiftGroup
Gas lift optimisation parameters at the group level.
Definition GasLiftOpt.hpp:35
Opm::GasLiftGroup::max_lift_gas
void max_lift_gas(const double value)
Assign maximum lift gas limit for this group.
Definition GasLiftOpt.hpp:77
Opm::GasLiftGroup::serializationTestObject
static GasLiftGroup serializationTestObject()
Create a serialisation test object.
Definition GasLiftOpt.cpp:49
Opm::GasLiftGroup::active
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
Opm::GasLiftGroup::serializeOp
void serializeOp(Serializer &serializer)
Convert between byte array and object representation.
Definition GasLiftOpt.hpp:119
Opm::GasLiftGroup::name
const std::string & name() const
Group name.
Definition GasLiftOpt.hpp:108
Opm::GasLiftGroup::operator==
bool operator==(const GasLiftGroup &other) const
Equality predicate.
Definition GasLiftOpt.cpp:60
Opm::GasLiftGroup::max_total_gas
void max_total_gas(const double value)
Assign maximum total gas limit for this group.
Definition GasLiftOpt.hpp:98
Opm::GasLiftGroup::GasLiftGroup
GasLiftGroup(const std::string &name)
Construct gas lift optimisation parameter collection for a single group.
Definition GasLiftOpt.hpp:47
Opm::GasLiftGroup::GasLiftGroup
GasLiftGroup()=default
Default constructor.
Opm::GasLiftGroup::max_lift_gas
const std::optional< double > & max_lift_gas() const
Maximum lift gas limit for this group.
Definition GasLiftOpt.hpp:69
Opm::GasLiftGroup::max_total_gas
const std::optional< double > & max_total_gas() const
Maximum total gas limit for this group.
Definition GasLiftOpt.hpp:89
Opm::GasLiftOpt
Gas lift optimisation parameters for all wells and groups.
Definition GasLiftOpt.hpp:356
Opm::GasLiftOpt::serializeOp
void serializeOp(Serializer &serializer)
Convert between byte array and object representation.
Definition GasLiftOpt.hpp:474
Opm::GasLiftOpt::add_well
void add_well(const GasLiftWell &well)
Incorporate gas lift and gas lift optimisation parameters for a single well into collection.
Definition GasLiftOpt.cpp:192
Opm::GasLiftOpt::num_wells
std::size_t num_wells() const
Number of wells currently known to gas lift optimisation facility.
Definition GasLiftOpt.hpp:451
Opm::GasLiftOpt::active
bool active() const
Whether or not gas lift optimisation is currently enabled in the run.
Definition GasLiftOpt.cpp:120
Opm::GasLiftOpt::group
const GasLiftGroup & group(const std::string &gname) const
Retrieve gas lift optimisation parameters for a single named group.
Definition GasLiftOpt.cpp:165
Opm::GasLiftOpt::all_newton
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
Opm::GasLiftOpt::add_group
void add_group(const GasLiftGroup &group)
Incorporate gas lift optimisation parameters for a single group into collection.
Definition GasLiftOpt.cpp:187
Opm::GasLiftOpt::min_wait
double min_wait() const
Retrieve minimum wait time between gas lift optimisation runs.
Definition GasLiftOpt.cpp:150
Opm::GasLiftOpt::operator==
bool operator==(const GasLiftOpt &other) const
Equality predicate.
Definition GasLiftOpt.cpp:228
Opm::GasLiftOpt::has_well
bool has_well(const std::string &well) const
Whether or not gas lift parameters exists for single named well.
Definition GasLiftOpt.cpp:177
Opm::GasLiftOpt::well
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
Opm::GasLiftOpt::gaslift_increment
double gaslift_increment() const
Lift gas rate increment.
Definition GasLiftOpt.cpp:130
Opm::GasLiftOpt::serializationTestObject
static GasLiftOpt serializationTestObject()
Create a serialisation test object.
Definition GasLiftOpt.cpp:209
Opm::GasLiftOpt::has_group
bool has_group(const std::string &group) const
Whether or not gas lift optimisation parameters exists for single named group.
Definition GasLiftOpt.cpp:182
Opm::GasLiftOpt::min_eco_gradient
double min_eco_gradient() const
Retrieve minimum economical gradient threshold to continue increasing lift gas injection rate.
Definition GasLiftOpt.cpp:140
Opm::GasLiftWell
Gas lift and gas lift optimisation parameters at the well level.
Definition GasLiftOpt.hpp:154
Opm::GasLiftWell::max_rate
const std::optional< double > & max_rate() const
Retrieve maximum gas lift rate for this well.
Definition GasLiftOpt.hpp:224
Opm::GasLiftWell::inc_weight_factor
void inc_weight_factor(const double value)
Assign incremental gas rate weighting factor for this well.
Definition GasLiftOpt.hpp:248
Opm::GasLiftWell::min_rate
void min_rate(const double value)
Assign minimum rate of lift gas injection for this well.
Definition GasLiftOpt.hpp:266
Opm::GasLiftWell::operator==
bool operator==(const GasLiftWell &other) const
Equality predicate.
Definition GasLiftOpt.cpp:106
Opm::GasLiftWell::min_rate
double min_rate() const
Retrieve this well's minimum lift gas injection rate.
Definition GasLiftOpt.hpp:274
Opm::GasLiftWell::active
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
Opm::GasLiftWell::GasLiftWell
GasLiftWell(const std::string &name, const bool use_glo)
Construct gas lift optimisation parameter collection for a single well.
Definition GasLiftOpt.hpp:169
Opm::GasLiftWell::alloc_extra_gas
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
Opm::GasLiftWell::weight_factor
double weight_factor() const
Retrieve weighting factor for preferential allocation of lift gas.
Definition GasLiftOpt.hpp:240
Opm::GasLiftWell::GasLiftWell
GasLiftWell()=default
Default constructor.
Opm::GasLiftWell::weight_factor
void weight_factor(const double value)
Assign weighting factor for preferential allocation of lift gas.
Definition GasLiftOpt.hpp:232
Opm::GasLiftWell::alloc_extra_gas
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
Opm::GasLiftWell::name
const std::string & name() const
Well name.
Definition GasLiftOpt.hpp:192
Opm::GasLiftWell::serializeOp
void serializeOp(Serializer &serializer)
Convert between byte array and object representation.
Definition GasLiftOpt.hpp:303
Opm::GasLiftWell::use_glo
bool use_glo() const
Whether or not this well is subject to gas lift optimisation.
Definition GasLiftOpt.hpp:198
Opm::GasLiftWell::inc_weight_factor
double inc_weight_factor() const
Retrieve incremental gas rate weighting factor for this well.
Definition GasLiftOpt.hpp:256
Opm::GasLiftWell::serializationTestObject
static GasLiftWell serializationTestObject()
Create a serialisation test object.
Definition GasLiftOpt.cpp:91
Opm::GasLiftWell::max_rate
void max_rate(const double value)
Assign maximum gas lift rate for this well.
Definition GasLiftOpt.hpp:206
Opm::Serializer
Class for (de-)serializing.
Definition Serializer.hpp:94
Opm
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30
Opm::RestartIO::RstGroup
Definition group.hpp:38
Opm::RestartIO::RstWell
Definition well.hpp:43