mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #3284 from akva2/gasliftsinglewell_cleanup
Some small cleanups in GasLiftWellState
This commit is contained in:
commit
3dbab3b7d6
@ -109,7 +109,7 @@ namespace Opm {
|
|||||||
typedef typename BaseAuxiliaryModule<TypeTag>::NeighborSet NeighborSet;
|
typedef typename BaseAuxiliaryModule<TypeTag>::NeighborSet NeighborSet;
|
||||||
using GasLiftSingleWell = ::Opm::GasLiftSingleWell<TypeTag>;
|
using GasLiftSingleWell = ::Opm::GasLiftSingleWell<TypeTag>;
|
||||||
using GasLiftStage2 = ::Opm::GasLiftStage2<TypeTag>;
|
using GasLiftStage2 = ::Opm::GasLiftStage2<TypeTag>;
|
||||||
using GLiftWellState = ::Opm::GasLiftWellState<TypeTag>;
|
using GLiftWellState = GasLiftWellState;
|
||||||
using GLiftWellStateMap =
|
using GLiftWellStateMap =
|
||||||
std::map<std::string,std::unique_ptr<GLiftWellState>>;
|
std::map<std::string,std::unique_ptr<GLiftWellState>>;
|
||||||
using GLiftOptWells =
|
using GLiftOptWells =
|
||||||
|
@ -60,8 +60,7 @@ namespace Opm
|
|||||||
{
|
{
|
||||||
using Simulator = GetPropType<TypeTag, Properties::Simulator>;
|
using Simulator = GetPropType<TypeTag, Properties::Simulator>;
|
||||||
using WellState = WellStateFullyImplicitBlackoil;
|
using WellState = WellStateFullyImplicitBlackoil;
|
||||||
using StdWell = Opm::StandardWell<TypeTag>;
|
using StdWell = StandardWell<TypeTag>;
|
||||||
using GLiftWellState = Opm::GasLiftWellState<TypeTag>;
|
|
||||||
// TODO: same definition with WellInterface, and
|
// TODO: same definition with WellInterface, and
|
||||||
// WellStateFullyImplicitBlackoil eventually they should go
|
// WellStateFullyImplicitBlackoil eventually they should go
|
||||||
// to a common header file.
|
// to a common header file.
|
||||||
@ -70,7 +69,6 @@ namespace Opm
|
|||||||
static const int Gas = BlackoilPhases::Vapour;
|
static const int Gas = BlackoilPhases::Vapour;
|
||||||
static constexpr double ALQ_EPSILON = 1e-8;
|
static constexpr double ALQ_EPSILON = 1e-8;
|
||||||
struct OptimizeState;
|
struct OptimizeState;
|
||||||
class Stage2State;
|
|
||||||
public:
|
public:
|
||||||
GasLiftSingleWell(
|
GasLiftSingleWell(
|
||||||
const StdWell &std_well,
|
const StdWell &std_well,
|
||||||
@ -82,12 +80,9 @@ namespace Opm
|
|||||||
struct GradInfo;
|
struct GradInfo;
|
||||||
std::optional<GradInfo> calcIncOrDecGradient(
|
std::optional<GradInfo> calcIncOrDecGradient(
|
||||||
double oil_rate, double gas_rate, double alq, bool increase) const;
|
double oil_rate, double gas_rate, double alq, bool increase) const;
|
||||||
std::pair<double, double> getStage2Rates();
|
|
||||||
const WellInterface<TypeTag> &getStdWell() const { return std_well_; }
|
const WellInterface<TypeTag> &getStdWell() const { return std_well_; }
|
||||||
bool hasStage2Rates();
|
std::unique_ptr<GasLiftWellState> runOptimize();
|
||||||
std::unique_ptr<GLiftWellState> runOptimize();
|
|
||||||
const std::string& name() const {return well_name_; }
|
const std::string& name() const {return well_name_; }
|
||||||
void updateStage2State(const GradInfo &gi, bool increase);
|
|
||||||
|
|
||||||
struct GradInfo
|
struct GradInfo
|
||||||
{
|
{
|
||||||
@ -155,13 +150,13 @@ namespace Opm
|
|||||||
reduceALQtoOilTarget_(double alq, double oil_rate, double gas_rate,
|
reduceALQtoOilTarget_(double alq, double oil_rate, double gas_rate,
|
||||||
bool oil_is_limited, bool gas_is_limited, std::vector<double> &potentials);
|
bool oil_is_limited, bool gas_is_limited, std::vector<double> &potentials);
|
||||||
|
|
||||||
std::unique_ptr<GLiftWellState> runOptimize1_();
|
std::unique_ptr<GasLiftWellState> runOptimize1_();
|
||||||
std::unique_ptr<GLiftWellState> runOptimize2_();
|
std::unique_ptr<GasLiftWellState> runOptimize2_();
|
||||||
std::unique_ptr<GLiftWellState> runOptimizeLoop_(bool increase);
|
std::unique_ptr<GasLiftWellState> runOptimizeLoop_(bool increase);
|
||||||
void setAlqMaxRate_(const GasLiftOpt::Well &well);
|
void setAlqMaxRate_(const GasLiftOpt::Well &well);
|
||||||
void setAlqMinRate_(const GasLiftOpt::Well &well);
|
void setAlqMinRate_(const GasLiftOpt::Well &well);
|
||||||
std::unique_ptr<GLiftWellState> tryIncreaseLiftGas_();
|
std::unique_ptr<GasLiftWellState> tryIncreaseLiftGas_();
|
||||||
std::unique_ptr<GLiftWellState> tryDecreaseLiftGas_();
|
std::unique_ptr<GasLiftWellState> tryDecreaseLiftGas_();
|
||||||
void updateWellStateAlqFixedValue_(const GasLiftOpt::Well &well);
|
void updateWellStateAlqFixedValue_(const GasLiftOpt::Well &well);
|
||||||
bool useFixedAlq_(const GasLiftOpt::Well &well);
|
bool useFixedAlq_(const GasLiftOpt::Well &well);
|
||||||
void warnMaxIterationsExceeded_();
|
void warnMaxIterationsExceeded_();
|
||||||
|
@ -199,11 +199,11 @@ calcIncOrDecGradient(double oil_rate, double gas_rate, double alq, bool increase
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
template<typename TypeTag>
|
template<typename TypeTag>
|
||||||
std::unique_ptr<typename GasLiftSingleWell<TypeTag>::GLiftWellState>
|
std::unique_ptr<GasLiftWellState>
|
||||||
GasLiftSingleWell<TypeTag>::
|
GasLiftSingleWell<TypeTag>::
|
||||||
runOptimize()
|
runOptimize()
|
||||||
{
|
{
|
||||||
std::unique_ptr<GLiftWellState> state;
|
std::unique_ptr<GasLiftWellState> state;
|
||||||
if (this->optimize_) {
|
if (this->optimize_) {
|
||||||
if (this->debug_limit_increase_decrease_) {
|
if (this->debug_limit_increase_decrease_) {
|
||||||
state = runOptimize1_();
|
state = runOptimize1_();
|
||||||
@ -224,11 +224,11 @@ runOptimize()
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename TypeTag>
|
template<typename TypeTag>
|
||||||
std::unique_ptr<typename GasLiftSingleWell<TypeTag>::GLiftWellState>
|
std::unique_ptr<GasLiftWellState>
|
||||||
GasLiftSingleWell<TypeTag>::
|
GasLiftSingleWell<TypeTag>::
|
||||||
runOptimize2_()
|
runOptimize2_()
|
||||||
{
|
{
|
||||||
std::unique_ptr<GLiftWellState> state;
|
std::unique_ptr<GasLiftWellState> state;
|
||||||
state = tryIncreaseLiftGas_();
|
state = tryIncreaseLiftGas_();
|
||||||
if (!state || !(state->alqChanged())) {
|
if (!state || !(state->alqChanged())) {
|
||||||
state = tryDecreaseLiftGas_();
|
state = tryDecreaseLiftGas_();
|
||||||
@ -237,11 +237,11 @@ runOptimize2_()
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename TypeTag>
|
template<typename TypeTag>
|
||||||
std::unique_ptr<typename GasLiftSingleWell<TypeTag>::GLiftWellState>
|
std::unique_ptr<GasLiftWellState>
|
||||||
GasLiftSingleWell<TypeTag>::
|
GasLiftSingleWell<TypeTag>::
|
||||||
runOptimize1_()
|
runOptimize1_()
|
||||||
{
|
{
|
||||||
std::unique_ptr<GLiftWellState> state;
|
std::unique_ptr<GasLiftWellState> state;
|
||||||
auto inc_count = this->well_state_.gliftGetAlqIncreaseCount(this->well_name_);
|
auto inc_count = this->well_state_.gliftGetAlqIncreaseCount(this->well_name_);
|
||||||
auto dec_count = this->well_state_.gliftGetAlqDecreaseCount(this->well_name_);
|
auto dec_count = this->well_state_.gliftGetAlqDecreaseCount(this->well_name_);
|
||||||
if (dec_count == 0 && inc_count == 0) {
|
if (dec_count == 0 && inc_count == 0) {
|
||||||
@ -848,15 +848,15 @@ reduceALQtoOilTarget_(double alq, double oil_rate, double gas_rate,
|
|||||||
//
|
//
|
||||||
// OUTPUT:
|
// OUTPUT:
|
||||||
//
|
//
|
||||||
// - return value: a new GLiftWellState or nullptr
|
// - return value: a new GasLiftWellState or nullptr
|
||||||
//
|
//
|
||||||
template<typename TypeTag>
|
template<typename TypeTag>
|
||||||
std::unique_ptr<typename GasLiftSingleWell<TypeTag>::GLiftWellState>
|
std::unique_ptr<GasLiftWellState>
|
||||||
GasLiftSingleWell<TypeTag>::
|
GasLiftSingleWell<TypeTag>::
|
||||||
runOptimizeLoop_(bool increase)
|
runOptimizeLoop_(bool increase)
|
||||||
{
|
{
|
||||||
std::vector<double> potentials(this->num_phases_, 0.0);
|
std::vector<double> potentials(this->num_phases_, 0.0);
|
||||||
std::unique_ptr<GLiftWellState> ret_value; // nullptr initially
|
std::unique_ptr<GasLiftWellState> ret_value; // nullptr initially
|
||||||
if (!computeInitialWellRates_(potentials)) return ret_value;
|
if (!computeInitialWellRates_(potentials)) return ret_value;
|
||||||
bool alq_is_limited = false;
|
bool alq_is_limited = false;
|
||||||
bool oil_is_limited = false;
|
bool oil_is_limited = false;
|
||||||
@ -960,7 +960,7 @@ runOptimizeLoop_(bool increase)
|
|||||||
else {
|
else {
|
||||||
increase_opt = std::nullopt;
|
increase_opt = std::nullopt;
|
||||||
}
|
}
|
||||||
ret_value = std::make_unique<GLiftWellState>(oil_rate, oil_is_limited,
|
ret_value = std::make_unique<GasLiftWellState>(oil_rate, oil_is_limited,
|
||||||
gas_rate, gas_is_limited, cur_alq, alq_is_limited, increase_opt);
|
gas_rate, gas_is_limited, cur_alq, alq_is_limited, increase_opt);
|
||||||
return ret_value;
|
return ret_value;
|
||||||
}
|
}
|
||||||
@ -1025,7 +1025,7 @@ setAlqMinRate_(const GasLiftOpt::Well &well)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename TypeTag>
|
template<typename TypeTag>
|
||||||
std::unique_ptr<typename GasLiftSingleWell<TypeTag>::GLiftWellState>
|
std::unique_ptr<GasLiftWellState>
|
||||||
GasLiftSingleWell<TypeTag>::
|
GasLiftSingleWell<TypeTag>::
|
||||||
tryDecreaseLiftGas_()
|
tryDecreaseLiftGas_()
|
||||||
{
|
{
|
||||||
@ -1033,7 +1033,7 @@ tryDecreaseLiftGas_()
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename TypeTag>
|
template<typename TypeTag>
|
||||||
std::unique_ptr<typename GasLiftSingleWell<TypeTag>::GLiftWellState>
|
std::unique_ptr<GasLiftWellState>
|
||||||
GasLiftSingleWell<TypeTag>::
|
GasLiftSingleWell<TypeTag>::
|
||||||
tryIncreaseLiftGas_()
|
tryIncreaseLiftGas_()
|
||||||
{
|
{
|
||||||
|
@ -61,7 +61,7 @@ namespace Opm
|
|||||||
using WellState = WellStateFullyImplicitBlackoil;
|
using WellState = WellStateFullyImplicitBlackoil;
|
||||||
using BlackoilWellModel = ::Opm::BlackoilWellModel<TypeTag>;
|
using BlackoilWellModel = ::Opm::BlackoilWellModel<TypeTag>;
|
||||||
using GasLiftSingleWell = ::Opm::GasLiftSingleWell<TypeTag>;
|
using GasLiftSingleWell = ::Opm::GasLiftSingleWell<TypeTag>;
|
||||||
using GLiftWellState = ::Opm::GasLiftWellState<TypeTag>;
|
using GLiftWellState = GasLiftWellState;
|
||||||
using GLiftOptWells = typename BlackoilWellModel::GLiftOptWells;
|
using GLiftOptWells = typename BlackoilWellModel::GLiftOptWells;
|
||||||
using GLiftProdWells = typename BlackoilWellModel::GLiftProdWells;
|
using GLiftProdWells = typename BlackoilWellModel::GLiftProdWells;
|
||||||
using GLiftWellStateMap = typename BlackoilWellModel::GLiftWellStateMap;
|
using GLiftWellStateMap = typename BlackoilWellModel::GLiftWellStateMap;
|
||||||
|
@ -20,14 +20,11 @@
|
|||||||
#ifndef OPM_GASLIFT_WELL_STATE_HEADER_INCLUDED
|
#ifndef OPM_GASLIFT_WELL_STATE_HEADER_INCLUDED
|
||||||
#define OPM_GASLIFT_WELL_STATE_HEADER_INCLUDED
|
#define OPM_GASLIFT_WELL_STATE_HEADER_INCLUDED
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <string>
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
namespace Opm
|
namespace Opm
|
||||||
{
|
{
|
||||||
template<class TypeTag>
|
|
||||||
class GasLiftWellState
|
class GasLiftWellState
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -77,6 +74,4 @@ namespace Opm
|
|||||||
|
|
||||||
} // namespace Opm
|
} // namespace Opm
|
||||||
|
|
||||||
#include "GasLiftWellState_impl.hpp"
|
|
||||||
|
|
||||||
#endif // OPM_GASLIFT_WELL_STATE_HEADER_INCLUDED
|
#endif // OPM_GASLIFT_WELL_STATE_HEADER_INCLUDED
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2021 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/>.
|
|
||||||
*/
|
|
Loading…
Reference in New Issue
Block a user