/* Copyright 2016 SINTEF ICT, Applied Mathematics. Copyright 2016 - 2017 Statoil ASA. Copyright 2017 Dr. Blatt - HPC-Simulation-Software & Services Copyright 2016 - 2018 IRIS AS 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 . */ #ifndef OPM_BLACKOILWELLMODEL_GASLIFT_HEADER_INCLUDED #define OPM_BLACKOILWELLMODEL_GASLIFT_HEADER_INCLUDED #include "opm/models/utils/basicproperties.hh" #include #include #include #include namespace Opm { class DeferredLogger; template class GroupState; template class WellState; template class WellInterface; template class BlackoilWellModelGasLiftGeneric { public: using GLiftOptWells = std::map>>; using GLiftProdWells = std::map*>; using GLiftWellStateMap = std::map>>; using GLiftEclWells = typename GasLiftGroupInfo::GLiftEclWells; using GLiftSyncGroups = typename GasLiftSingleWellGeneric::GLiftSyncGroups; explicit BlackoilWellModelGasLiftGeneric(bool terminal_output) : terminal_output_(terminal_output) {} static constexpr bool glift_debug = false; void gliftDebug(const std::string& msg, DeferredLogger& deferred_logger) const; bool terminalOutput() const { return terminal_output_; } protected: void gliftDebugShowALQ(const std::vector*>& well_container, const WellState& wellState, DeferredLogger& deferred_logger); void gasLiftOptimizationStage2(const Parallel::Communication& comm, const Schedule& schedule, const SummaryState& summaryState, WellState& wellState, GroupState& groupState, GLiftProdWells& prod_wells, GLiftOptWells& glift_wells, GasLiftGroupInfo& group_info, GLiftWellStateMap& map, const int episodeIndex, DeferredLogger& deferred_logger); bool terminal_output_; double last_glift_opt_time_ = -1.0; }; /// Class for handling the gaslift in the blackoil well model. template class BlackoilWellModelGasLift : public BlackoilWellModelGasLiftGeneric> { using Base = BlackoilWellModelGasLiftGeneric>; public: using Scalar = GetPropType; using GLiftEclWells = typename GasLiftGroupInfo::GLiftEclWells; using GLiftOptWells = typename Base::GLiftOptWells; using GLiftProdWells = typename Base::GLiftProdWells; using GLiftSyncGroups = typename GasLiftSingleWellGeneric::GLiftSyncGroups; using GLiftWellStateMap = typename Base::GLiftWellStateMap; using Simulator = GetPropType; using WellInterfacePtr = std::shared_ptr>; BlackoilWellModelGasLift(bool terminal_output, const PhaseUsage& phase_usage) : Base(terminal_output) , phase_usage_(phase_usage) {} static void initGliftEclWellMap(const std::vector& well_container, GLiftEclWells& ecl_well_map); bool maybeDoGasLiftOptimize(const Simulator& simulator, const std::vector& well_container, WellState& wellState, GroupState& groupState, DeferredLogger& deferred_logger); private: void gasLiftOptimizationStage1(const Simulator& simulator, const std::vector& well_container, WellState& wellState, GroupState& groupState, GLiftProdWells& prod_wells, GLiftOptWells& glift_wells, GasLiftGroupInfo& group_info, GLiftWellStateMap& state_map, DeferredLogger& deferred_logger); // cannot be const since it accesses the non-const WellState void gasLiftOptimizationStage1SingleWell(WellInterface* well, const Simulator& simulator, WellState& wellState, GroupState& groupState, GLiftProdWells& prod_wells, GLiftOptWells& glift_wells, GasLiftGroupInfo& group_info, GLiftWellStateMap& state_map, GLiftSyncGroups& groups_to_sync, DeferredLogger& deferred_logger); const PhaseUsage& phase_usage_; }; } // namespace Opm #include "BlackoilWellModelGasLift_impl.hpp" #endif