diff --git a/opm/simulators/wells/GasLiftSingleWell.hpp b/opm/simulators/wells/GasLiftSingleWell.hpp index da9180764..5fab8c89b 100644 --- a/opm/simulators/wells/GasLiftSingleWell.hpp +++ b/opm/simulators/wells/GasLiftSingleWell.hpp @@ -28,8 +28,6 @@ #include #include -#include -#include namespace Opm { @@ -56,16 +54,18 @@ public: const WellInterfaceGeneric& getWell() const override { return well_; } private: - std::optional - computeBhpAtThpLimit_(double alq, bool debug_ouput=true) const override; + std::optional + computeBhpAtThpLimit_(Scalar alq, + bool debug_ouput = true) const override; - BasicRates computeWellRates_(double bhp, bool bhp_is_limited, + BasicRates computeWellRates_(Scalar bhp, + bool bhp_is_limited, bool debug_output = true) const override; + void setAlqMaxRate_(const GasLiftWell& well); void setupPhaseVariables_(); bool checkThpControl_() const override; - const Simulator& simulator_; const WellInterface& well_; }; diff --git a/opm/simulators/wells/GasLiftSingleWell_impl.hpp b/opm/simulators/wells/GasLiftSingleWell_impl.hpp index 5592ee19b..adc83bef1 100644 --- a/opm/simulators/wells/GasLiftSingleWell_impl.hpp +++ b/opm/simulators/wells/GasLiftSingleWell_impl.hpp @@ -27,37 +27,37 @@ #include #include +#include +#include + namespace Opm { template GasLiftSingleWell:: -GasLiftSingleWell(const WellInterface &well, +GasLiftSingleWell(const WellInterface& well, const Simulator& simulator, - const SummaryState &summary_state, - DeferredLogger &deferred_logger, + const SummaryState& summary_state, + DeferredLogger& deferred_logger, WellState& well_state, const GroupState& group_state, GasLiftGroupInfo& group_info, GLiftSyncGroups &sync_groups, const Parallel::Communication& comm, - bool glift_debug - ) + bool glift_debug) // The parent class GasLiftSingleWellGeneric contains all stuff // that is not dependent on TypeTag - : GasLiftSingleWellGeneric( - deferred_logger, - well_state, - group_state, - well.wellEcl(), - summary_state, - group_info, - well.phaseUsage(), - simulator.vanguard().schedule(), - simulator.episodeIndex(), - sync_groups, - comm, - glift_debug - ) + : GasLiftSingleWellGeneric(deferred_logger, + well_state, + group_state, + well.wellEcl(), + summary_state, + group_info, + well.phaseUsage(), + simulator.vanguard().schedule(), + simulator.episodeIndex(), + sync_groups, + comm, + glift_debug) , simulator_{simulator} , well_{well} { @@ -77,7 +77,7 @@ GasLiftSingleWell(const WellInterface &well, // If gas lift optimization has not been applied to this well yet, the // default value is used. this->orig_alq_ = this->well_state_.getALQ(this->well_name_); - if(this->optimize_) { + if (this->optimize_) { this->setAlqMinRate_(gl_well); // NOTE: According to item 4 in WLIFTOPT, this value does not // have to be positive. @@ -109,11 +109,13 @@ GasLiftSingleWell(const WellInterface &well, template typename GasLiftSingleWell::BasicRates GasLiftSingleWell:: -computeWellRates_( double bhp, bool bhp_is_limited, bool debug_output ) const +computeWellRates_(Scalar bhp, bool bhp_is_limited, bool debug_output ) const { - std::vector potentials(this->NUM_PHASES, 0.0); - this->well_.computeWellRatesWithBhp( - this->simulator_, bhp, potentials, this->deferred_logger_); + std::vector potentials(this->NUM_PHASES, 0.0); + this->well_.computeWellRatesWithBhp(this->simulator_, + bhp, + potentials, + this->deferred_logger_); if (debug_output) { const std::string msg = fmt::format("computed well potentials given bhp {}, " "oil: {}, gas: {}, water: {}", bhp, @@ -123,7 +125,7 @@ computeWellRates_( double bhp, bool bhp_is_limited, bool debug_output ) const } for (auto& potential : potentials) { - potential = std::min(0.0, potential); + potential = std::min(Scalar{0.0}, potential); } return {-potentials[this->oil_pos_], -potentials[this->gas_pos_], @@ -133,9 +135,9 @@ computeWellRates_( double bhp, bool bhp_is_limited, bool debug_output ) const } template -std::optional +std::optional::Scalar> GasLiftSingleWell:: -computeBhpAtThpLimit_(double alq, bool debug_output) const +computeBhpAtThpLimit_(Scalar alq, bool debug_output) const { auto bhp_at_thp_limit = this->well_.computeBhpAtThpLimitProdWithAlq( this->simulator_, @@ -206,7 +208,7 @@ setupPhaseVariables_() template void GasLiftSingleWell:: -setAlqMaxRate_(const GasLiftWell &well) +setAlqMaxRate_(const GasLiftWell& well) { auto& max_alq_optional = well.max_rate(); if (max_alq_optional) {