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;
|
||||
using GasLiftSingleWell = ::Opm::GasLiftSingleWell<TypeTag>;
|
||||
using GasLiftStage2 = ::Opm::GasLiftStage2<TypeTag>;
|
||||
using GLiftWellState = ::Opm::GasLiftWellState<TypeTag>;
|
||||
using GLiftWellState = GasLiftWellState;
|
||||
using GLiftWellStateMap =
|
||||
std::map<std::string,std::unique_ptr<GLiftWellState>>;
|
||||
using GLiftOptWells =
|
||||
|
@ -60,8 +60,7 @@ namespace Opm
|
||||
{
|
||||
using Simulator = GetPropType<TypeTag, Properties::Simulator>;
|
||||
using WellState = WellStateFullyImplicitBlackoil;
|
||||
using StdWell = Opm::StandardWell<TypeTag>;
|
||||
using GLiftWellState = Opm::GasLiftWellState<TypeTag>;
|
||||
using StdWell = StandardWell<TypeTag>;
|
||||
// TODO: same definition with WellInterface, and
|
||||
// WellStateFullyImplicitBlackoil eventually they should go
|
||||
// to a common header file.
|
||||
@ -70,7 +69,6 @@ namespace Opm
|
||||
static const int Gas = BlackoilPhases::Vapour;
|
||||
static constexpr double ALQ_EPSILON = 1e-8;
|
||||
struct OptimizeState;
|
||||
class Stage2State;
|
||||
public:
|
||||
GasLiftSingleWell(
|
||||
const StdWell &std_well,
|
||||
@ -82,12 +80,9 @@ namespace Opm
|
||||
struct GradInfo;
|
||||
std::optional<GradInfo> calcIncOrDecGradient(
|
||||
double oil_rate, double gas_rate, double alq, bool increase) const;
|
||||
std::pair<double, double> getStage2Rates();
|
||||
const WellInterface<TypeTag> &getStdWell() const { return std_well_; }
|
||||
bool hasStage2Rates();
|
||||
std::unique_ptr<GLiftWellState> runOptimize();
|
||||
std::unique_ptr<GasLiftWellState> runOptimize();
|
||||
const std::string& name() const {return well_name_; }
|
||||
void updateStage2State(const GradInfo &gi, bool increase);
|
||||
|
||||
struct GradInfo
|
||||
{
|
||||
@ -155,13 +150,13 @@ namespace Opm
|
||||
reduceALQtoOilTarget_(double alq, double oil_rate, double gas_rate,
|
||||
bool oil_is_limited, bool gas_is_limited, std::vector<double> &potentials);
|
||||
|
||||
std::unique_ptr<GLiftWellState> runOptimize1_();
|
||||
std::unique_ptr<GLiftWellState> runOptimize2_();
|
||||
std::unique_ptr<GLiftWellState> runOptimizeLoop_(bool increase);
|
||||
std::unique_ptr<GasLiftWellState> runOptimize1_();
|
||||
std::unique_ptr<GasLiftWellState> runOptimize2_();
|
||||
std::unique_ptr<GasLiftWellState> runOptimizeLoop_(bool increase);
|
||||
void setAlqMaxRate_(const GasLiftOpt::Well &well);
|
||||
void setAlqMinRate_(const GasLiftOpt::Well &well);
|
||||
std::unique_ptr<GLiftWellState> tryIncreaseLiftGas_();
|
||||
std::unique_ptr<GLiftWellState> tryDecreaseLiftGas_();
|
||||
std::unique_ptr<GasLiftWellState> tryIncreaseLiftGas_();
|
||||
std::unique_ptr<GasLiftWellState> tryDecreaseLiftGas_();
|
||||
void updateWellStateAlqFixedValue_(const GasLiftOpt::Well &well);
|
||||
bool useFixedAlq_(const GasLiftOpt::Well &well);
|
||||
void warnMaxIterationsExceeded_();
|
||||
|
@ -199,11 +199,11 @@ calcIncOrDecGradient(double oil_rate, double gas_rate, double alq, bool increase
|
||||
*
|
||||
*/
|
||||
template<typename TypeTag>
|
||||
std::unique_ptr<typename GasLiftSingleWell<TypeTag>::GLiftWellState>
|
||||
std::unique_ptr<GasLiftWellState>
|
||||
GasLiftSingleWell<TypeTag>::
|
||||
runOptimize()
|
||||
{
|
||||
std::unique_ptr<GLiftWellState> state;
|
||||
std::unique_ptr<GasLiftWellState> state;
|
||||
if (this->optimize_) {
|
||||
if (this->debug_limit_increase_decrease_) {
|
||||
state = runOptimize1_();
|
||||
@ -224,11 +224,11 @@ runOptimize()
|
||||
}
|
||||
|
||||
template<typename TypeTag>
|
||||
std::unique_ptr<typename GasLiftSingleWell<TypeTag>::GLiftWellState>
|
||||
std::unique_ptr<GasLiftWellState>
|
||||
GasLiftSingleWell<TypeTag>::
|
||||
runOptimize2_()
|
||||
{
|
||||
std::unique_ptr<GLiftWellState> state;
|
||||
std::unique_ptr<GasLiftWellState> state;
|
||||
state = tryIncreaseLiftGas_();
|
||||
if (!state || !(state->alqChanged())) {
|
||||
state = tryDecreaseLiftGas_();
|
||||
@ -237,11 +237,11 @@ runOptimize2_()
|
||||
}
|
||||
|
||||
template<typename TypeTag>
|
||||
std::unique_ptr<typename GasLiftSingleWell<TypeTag>::GLiftWellState>
|
||||
std::unique_ptr<GasLiftWellState>
|
||||
GasLiftSingleWell<TypeTag>::
|
||||
runOptimize1_()
|
||||
{
|
||||
std::unique_ptr<GLiftWellState> state;
|
||||
std::unique_ptr<GasLiftWellState> state;
|
||||
auto inc_count = this->well_state_.gliftGetAlqIncreaseCount(this->well_name_);
|
||||
auto dec_count = this->well_state_.gliftGetAlqDecreaseCount(this->well_name_);
|
||||
if (dec_count == 0 && inc_count == 0) {
|
||||
@ -848,15 +848,15 @@ reduceALQtoOilTarget_(double alq, double oil_rate, double gas_rate,
|
||||
//
|
||||
// OUTPUT:
|
||||
//
|
||||
// - return value: a new GLiftWellState or nullptr
|
||||
// - return value: a new GasLiftWellState or nullptr
|
||||
//
|
||||
template<typename TypeTag>
|
||||
std::unique_ptr<typename GasLiftSingleWell<TypeTag>::GLiftWellState>
|
||||
std::unique_ptr<GasLiftWellState>
|
||||
GasLiftSingleWell<TypeTag>::
|
||||
runOptimizeLoop_(bool increase)
|
||||
{
|
||||
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;
|
||||
bool alq_is_limited = false;
|
||||
bool oil_is_limited = false;
|
||||
@ -960,7 +960,7 @@ runOptimizeLoop_(bool increase)
|
||||
else {
|
||||
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);
|
||||
return ret_value;
|
||||
}
|
||||
@ -1025,7 +1025,7 @@ setAlqMinRate_(const GasLiftOpt::Well &well)
|
||||
}
|
||||
|
||||
template<typename TypeTag>
|
||||
std::unique_ptr<typename GasLiftSingleWell<TypeTag>::GLiftWellState>
|
||||
std::unique_ptr<GasLiftWellState>
|
||||
GasLiftSingleWell<TypeTag>::
|
||||
tryDecreaseLiftGas_()
|
||||
{
|
||||
@ -1033,7 +1033,7 @@ tryDecreaseLiftGas_()
|
||||
}
|
||||
|
||||
template<typename TypeTag>
|
||||
std::unique_ptr<typename GasLiftSingleWell<TypeTag>::GLiftWellState>
|
||||
std::unique_ptr<GasLiftWellState>
|
||||
GasLiftSingleWell<TypeTag>::
|
||||
tryIncreaseLiftGas_()
|
||||
{
|
||||
|
@ -61,7 +61,7 @@ namespace Opm
|
||||
using WellState = WellStateFullyImplicitBlackoil;
|
||||
using BlackoilWellModel = ::Opm::BlackoilWellModel<TypeTag>;
|
||||
using GasLiftSingleWell = ::Opm::GasLiftSingleWell<TypeTag>;
|
||||
using GLiftWellState = ::Opm::GasLiftWellState<TypeTag>;
|
||||
using GLiftWellState = GasLiftWellState;
|
||||
using GLiftOptWells = typename BlackoilWellModel::GLiftOptWells;
|
||||
using GLiftProdWells = typename BlackoilWellModel::GLiftProdWells;
|
||||
using GLiftWellStateMap = typename BlackoilWellModel::GLiftWellStateMap;
|
||||
|
@ -20,14 +20,11 @@
|
||||
#ifndef OPM_GASLIFT_WELL_STATE_HEADER_INCLUDED
|
||||
#define OPM_GASLIFT_WELL_STATE_HEADER_INCLUDED
|
||||
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
template<class TypeTag>
|
||||
class GasLiftWellState
|
||||
{
|
||||
public:
|
||||
@ -77,6 +74,4 @@ namespace Opm
|
||||
|
||||
} // namespace Opm
|
||||
|
||||
#include "GasLiftWellState_impl.hpp"
|
||||
|
||||
#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