From 31cb01ae2404eee291a46ed07b936312a5e29835 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Thu, 20 May 2021 12:15:58 +0200 Subject: [PATCH 1/5] no reason for GasLiftWellState to be typetag dependent --- opm/simulators/wells/BlackoilWellModel.hpp | 2 +- opm/simulators/wells/GasLiftSingleWell.hpp | 4 ++-- opm/simulators/wells/GasLiftStage2.hpp | 2 +- opm/simulators/wells/GasLiftWellState.hpp | 1 - 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/opm/simulators/wells/BlackoilWellModel.hpp b/opm/simulators/wells/BlackoilWellModel.hpp index d3d0eb804..de65bed49 100644 --- a/opm/simulators/wells/BlackoilWellModel.hpp +++ b/opm/simulators/wells/BlackoilWellModel.hpp @@ -109,7 +109,7 @@ namespace Opm { typedef typename BaseAuxiliaryModule::NeighborSet NeighborSet; using GasLiftSingleWell = ::Opm::GasLiftSingleWell; using GasLiftStage2 = ::Opm::GasLiftStage2; - using GLiftWellState = ::Opm::GasLiftWellState; + using GLiftWellState = GasLiftWellState; using GLiftWellStateMap = std::map>; using GLiftOptWells = diff --git a/opm/simulators/wells/GasLiftSingleWell.hpp b/opm/simulators/wells/GasLiftSingleWell.hpp index 1526a0b36..41e580186 100644 --- a/opm/simulators/wells/GasLiftSingleWell.hpp +++ b/opm/simulators/wells/GasLiftSingleWell.hpp @@ -60,8 +60,8 @@ namespace Opm { using Simulator = GetPropType; using WellState = WellStateFullyImplicitBlackoil; - using StdWell = Opm::StandardWell; - using GLiftWellState = Opm::GasLiftWellState; + using StdWell = StandardWell; + using GLiftWellState = GasLiftWellState; // TODO: same definition with WellInterface, and // WellStateFullyImplicitBlackoil eventually they should go // to a common header file. diff --git a/opm/simulators/wells/GasLiftStage2.hpp b/opm/simulators/wells/GasLiftStage2.hpp index fceb24529..28de06887 100644 --- a/opm/simulators/wells/GasLiftStage2.hpp +++ b/opm/simulators/wells/GasLiftStage2.hpp @@ -61,7 +61,7 @@ namespace Opm using WellState = WellStateFullyImplicitBlackoil; using BlackoilWellModel = ::Opm::BlackoilWellModel; using GasLiftSingleWell = ::Opm::GasLiftSingleWell; - using GLiftWellState = ::Opm::GasLiftWellState; + using GLiftWellState = GasLiftWellState; using GLiftOptWells = typename BlackoilWellModel::GLiftOptWells; using GLiftProdWells = typename BlackoilWellModel::GLiftProdWells; using GLiftWellStateMap = typename BlackoilWellModel::GLiftWellStateMap; diff --git a/opm/simulators/wells/GasLiftWellState.hpp b/opm/simulators/wells/GasLiftWellState.hpp index 89cd6e11e..30d50c23b 100644 --- a/opm/simulators/wells/GasLiftWellState.hpp +++ b/opm/simulators/wells/GasLiftWellState.hpp @@ -27,7 +27,6 @@ namespace Opm { - template class GasLiftWellState { public: From 09cbfb4cdea310dbbfb98b8039c2252f708242bf Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Thu, 20 May 2021 12:16:21 +0200 Subject: [PATCH 2/5] remove unnecessary includes --- opm/simulators/wells/GasLiftWellState.hpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/opm/simulators/wells/GasLiftWellState.hpp b/opm/simulators/wells/GasLiftWellState.hpp index 30d50c23b..e5cbb1af2 100644 --- a/opm/simulators/wells/GasLiftWellState.hpp +++ b/opm/simulators/wells/GasLiftWellState.hpp @@ -20,9 +20,7 @@ #ifndef OPM_GASLIFT_WELL_STATE_HEADER_INCLUDED #define OPM_GASLIFT_WELL_STATE_HEADER_INCLUDED -#include #include -#include #include namespace Opm From 28b9f047210fc34d6e32cd28f2fc870cf929d3d8 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Thu, 20 May 2021 12:16:54 +0200 Subject: [PATCH 3/5] remove empty _impl file --- opm/simulators/wells/GasLiftWellState.hpp | 2 -- opm/simulators/wells/GasLiftWellState_impl.hpp | 18 ------------------ 2 files changed, 20 deletions(-) delete mode 100644 opm/simulators/wells/GasLiftWellState_impl.hpp diff --git a/opm/simulators/wells/GasLiftWellState.hpp b/opm/simulators/wells/GasLiftWellState.hpp index e5cbb1af2..fe4802114 100644 --- a/opm/simulators/wells/GasLiftWellState.hpp +++ b/opm/simulators/wells/GasLiftWellState.hpp @@ -74,6 +74,4 @@ namespace Opm } // namespace Opm -#include "GasLiftWellState_impl.hpp" - #endif // OPM_GASLIFT_WELL_STATE_HEADER_INCLUDED diff --git a/opm/simulators/wells/GasLiftWellState_impl.hpp b/opm/simulators/wells/GasLiftWellState_impl.hpp deleted file mode 100644 index 1a046e6d4..000000000 --- a/opm/simulators/wells/GasLiftWellState_impl.hpp +++ /dev/null @@ -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 . -*/ From e8603dfea34c2980408ba8a87aba5a20420ad2ee Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Thu, 20 May 2021 14:12:41 +0200 Subject: [PATCH 4/5] drop type alias GasLiftSingleWell::GLiftWellState --- opm/simulators/wells/GasLiftSingleWell.hpp | 13 +++++----- .../wells/GasLiftSingleWell_impl.hpp | 24 +++++++++---------- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/opm/simulators/wells/GasLiftSingleWell.hpp b/opm/simulators/wells/GasLiftSingleWell.hpp index 41e580186..df00c6357 100644 --- a/opm/simulators/wells/GasLiftSingleWell.hpp +++ b/opm/simulators/wells/GasLiftSingleWell.hpp @@ -61,7 +61,6 @@ namespace Opm using Simulator = GetPropType; using WellState = WellStateFullyImplicitBlackoil; using StdWell = StandardWell; - using GLiftWellState = GasLiftWellState; // TODO: same definition with WellInterface, and // WellStateFullyImplicitBlackoil eventually they should go // to a common header file. @@ -85,7 +84,7 @@ namespace Opm std::pair getStage2Rates(); const WellInterface &getStdWell() const { return std_well_; } bool hasStage2Rates(); - std::unique_ptr runOptimize(); + std::unique_ptr runOptimize(); const std::string& name() const {return well_name_; } void updateStage2State(const GradInfo &gi, bool increase); @@ -155,13 +154,13 @@ namespace Opm reduceALQtoOilTarget_(double alq, double oil_rate, double gas_rate, bool oil_is_limited, bool gas_is_limited, std::vector &potentials); - std::unique_ptr runOptimize1_(); - std::unique_ptr runOptimize2_(); - std::unique_ptr runOptimizeLoop_(bool increase); + std::unique_ptr runOptimize1_(); + std::unique_ptr runOptimize2_(); + std::unique_ptr runOptimizeLoop_(bool increase); void setAlqMaxRate_(const GasLiftOpt::Well &well); void setAlqMinRate_(const GasLiftOpt::Well &well); - std::unique_ptr tryIncreaseLiftGas_(); - std::unique_ptr tryDecreaseLiftGas_(); + std::unique_ptr tryIncreaseLiftGas_(); + std::unique_ptr tryDecreaseLiftGas_(); void updateWellStateAlqFixedValue_(const GasLiftOpt::Well &well); bool useFixedAlq_(const GasLiftOpt::Well &well); void warnMaxIterationsExceeded_(); diff --git a/opm/simulators/wells/GasLiftSingleWell_impl.hpp b/opm/simulators/wells/GasLiftSingleWell_impl.hpp index f3838ad4b..68f3234e1 100644 --- a/opm/simulators/wells/GasLiftSingleWell_impl.hpp +++ b/opm/simulators/wells/GasLiftSingleWell_impl.hpp @@ -199,11 +199,11 @@ calcIncOrDecGradient(double oil_rate, double gas_rate, double alq, bool increase * */ template -std::unique_ptr::GLiftWellState> +std::unique_ptr GasLiftSingleWell:: runOptimize() { - std::unique_ptr state; + std::unique_ptr state; if (this->optimize_) { if (this->debug_limit_increase_decrease_) { state = runOptimize1_(); @@ -224,11 +224,11 @@ runOptimize() } template -std::unique_ptr::GLiftWellState> +std::unique_ptr GasLiftSingleWell:: runOptimize2_() { - std::unique_ptr state; + std::unique_ptr state; state = tryIncreaseLiftGas_(); if (!state || !(state->alqChanged())) { state = tryDecreaseLiftGas_(); @@ -237,11 +237,11 @@ runOptimize2_() } template -std::unique_ptr::GLiftWellState> +std::unique_ptr GasLiftSingleWell:: runOptimize1_() { - std::unique_ptr state; + std::unique_ptr 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 -std::unique_ptr::GLiftWellState> +std::unique_ptr GasLiftSingleWell:: runOptimizeLoop_(bool increase) { std::vector potentials(this->num_phases_, 0.0); - std::unique_ptr ret_value; // nullptr initially + std::unique_ptr 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(oil_rate, oil_is_limited, + ret_value = std::make_unique(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 -std::unique_ptr::GLiftWellState> +std::unique_ptr GasLiftSingleWell:: tryDecreaseLiftGas_() { @@ -1033,7 +1033,7 @@ tryDecreaseLiftGas_() } template -std::unique_ptr::GLiftWellState> +std::unique_ptr GasLiftSingleWell:: tryIncreaseLiftGas_() { From 82d125d1c008b47a214679bcc786c2dd33aded44 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Thu, 20 May 2021 14:17:34 +0200 Subject: [PATCH 5/5] GasLiftSingleWell: drop undefined symbols --- opm/simulators/wells/GasLiftSingleWell.hpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/opm/simulators/wells/GasLiftSingleWell.hpp b/opm/simulators/wells/GasLiftSingleWell.hpp index df00c6357..9f7431db3 100644 --- a/opm/simulators/wells/GasLiftSingleWell.hpp +++ b/opm/simulators/wells/GasLiftSingleWell.hpp @@ -69,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, @@ -81,12 +80,9 @@ namespace Opm struct GradInfo; std::optional calcIncOrDecGradient( double oil_rate, double gas_rate, double alq, bool increase) const; - std::pair getStage2Rates(); const WellInterface &getStdWell() const { return std_well_; } - bool hasStage2Rates(); std::unique_ptr runOptimize(); const std::string& name() const {return well_name_; } - void updateStage2State(const GradInfo &gi, bool increase); struct GradInfo {