BlackoilWellModelGasLift.hpp
Go to the documentation of this file.
1/*
2 Copyright 2016 SINTEF ICT, Applied Mathematics.
3 Copyright 2016 - 2017 Statoil ASA.
4 Copyright 2017 Dr. Blatt - HPC-Simulation-Software & Services
5 Copyright 2016 - 2018 IRIS AS
6
7 This file is part of the Open Porous Media project (OPM).
8
9 OPM is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13
14 OPM is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with OPM. If not, see <http://www.gnu.org/licenses/>.
21*/
22#ifndef OPM_BLACKOILWELLMODEL_GASLIFT_HEADER_INCLUDED
23#define OPM_BLACKOILWELLMODEL_GASLIFT_HEADER_INCLUDED
24
27
28#include <memory>
29#include <map>
30#include <string>
31
32namespace Opm {
33
34class DeferredLogger;
35template<class Scalar> class GroupState;
36template<class Scalar> class WellState;
37template<class TypeTag> class WellInterface;
38
39template<class Scalar>
41{
42public:
43 using GLiftOptWells = std::map<std::string, std::unique_ptr<GasLiftSingleWellGeneric<Scalar>>>;
44 using GLiftProdWells = std::map<std::string, const WellInterfaceGeneric<Scalar>*>;
45 using GLiftWellStateMap = std::map<std::string, std::unique_ptr<GasLiftWellState<Scalar>>>;
48
49 explicit BlackoilWellModelGasLiftGeneric(bool terminal_output)
50 : terminal_output_(terminal_output)
51 {}
52
53 static constexpr bool glift_debug = false;
54
55 void gliftDebug(const std::string& msg,
56 DeferredLogger& deferred_logger) const;
57
58 bool terminalOutput() const { return terminal_output_; }
59
60 template<class Serializer>
61 void serializeOp(Serializer& serializer)
62 {
63 serializer(last_glift_opt_time_);
64 }
65
67 { return this->last_glift_opt_time_ == that.last_glift_opt_time_; }
68
69protected:
70 void gliftDebugShowALQ(const std::vector<WellInterfaceGeneric<Scalar>*>& well_container,
71 const WellState<Scalar>& wellState,
72 DeferredLogger& deferred_logger);
73
75 const Schedule& schedule,
76 const SummaryState& summaryState,
77 WellState<Scalar>& wellState,
78 GroupState<Scalar>& groupState,
79 GLiftProdWells& prod_wells,
80 GLiftOptWells& glift_wells,
81 GasLiftGroupInfo<Scalar>& group_info,
83 const int episodeIndex,
84 DeferredLogger& deferred_logger);
85
87 double last_glift_opt_time_ = -1.0;
88};
89
91template<typename TypeTag>
93 public BlackoilWellModelGasLiftGeneric<GetPropType<TypeTag, Properties::Scalar>>
94{
96
97public:
106 using WellInterfacePtr = std::shared_ptr<WellInterface<TypeTag>>;
107
108 BlackoilWellModelGasLift(bool terminal_output,
109 const PhaseUsage& phase_usage)
110 : Base(terminal_output)
111 , phase_usage_(phase_usage)
112 {}
113
114 static void initGliftEclWellMap(const std::vector<WellInterfacePtr>& well_container,
115 GLiftEclWells& ecl_well_map);
116
117 bool maybeDoGasLiftOptimize(const Simulator& simulator,
118 const std::vector<WellInterfacePtr>& well_container,
119 WellState<Scalar>& wellState,
120 GroupState<Scalar>& groupState,
121 DeferredLogger& deferred_logger);
122
123private:
124 void gasLiftOptimizationStage1(const Simulator& simulator,
125 const std::vector<WellInterfacePtr>& well_container,
126 WellState<Scalar>& wellState,
127 GroupState<Scalar>& groupState,
128 GLiftProdWells& prod_wells,
129 GLiftOptWells& glift_wells,
130 GasLiftGroupInfo<Scalar>& group_info,
131 GLiftWellStateMap& state_map,
132 DeferredLogger& deferred_logger);
133
134 // cannot be const since it accesses the non-const WellState
135 void gasLiftOptimizationStage1SingleWell(WellInterface<TypeTag>* well,
136 const Simulator& simulator,
137 WellState<Scalar>& wellState,
138 GroupState<Scalar>& groupState,
139 GLiftProdWells& prod_wells,
140 GLiftOptWells& glift_wells,
141 GasLiftGroupInfo<Scalar>& group_info,
142 GLiftWellStateMap& state_map,
143 GLiftSyncGroups& groups_to_sync,
144 DeferredLogger& deferred_logger);
145
146 const PhaseUsage& phase_usage_;
147};
148
149} // namespace Opm
150
152
153#endif
Defines a type tags and some fundamental properties all models.
Definition: BlackoilWellModelGasLift.hpp:41
void gliftDebugShowALQ(const std::vector< WellInterfaceGeneric< Scalar > * > &well_container, const WellState< Scalar > &wellState, DeferredLogger &deferred_logger)
static constexpr bool glift_debug
Definition: BlackoilWellModelGasLift.hpp:53
std::map< std::string, std::unique_ptr< GasLiftWellState< Scalar > > > GLiftWellStateMap
Definition: BlackoilWellModelGasLift.hpp:45
std::map< std::string, std::unique_ptr< GasLiftSingleWellGeneric< Scalar > > > GLiftOptWells
Definition: BlackoilWellModelGasLift.hpp:43
BlackoilWellModelGasLiftGeneric(bool terminal_output)
Definition: BlackoilWellModelGasLift.hpp:49
bool terminalOutput() const
Definition: BlackoilWellModelGasLift.hpp:58
void gasLiftOptimizationStage2(const Parallel::Communication &comm, const Schedule &schedule, const SummaryState &summaryState, WellState< Scalar > &wellState, GroupState< Scalar > &groupState, GLiftProdWells &prod_wells, GLiftOptWells &glift_wells, GasLiftGroupInfo< Scalar > &group_info, GLiftWellStateMap &map, const int episodeIndex, DeferredLogger &deferred_logger)
void serializeOp(Serializer &serializer)
Definition: BlackoilWellModelGasLift.hpp:61
std::map< std::string, const WellInterfaceGeneric< Scalar > * > GLiftProdWells
Definition: BlackoilWellModelGasLift.hpp:44
typename GasLiftGroupInfo< Scalar >::GLiftEclWells GLiftEclWells
Definition: BlackoilWellModelGasLift.hpp:46
void gliftDebug(const std::string &msg, DeferredLogger &deferred_logger) const
bool terminal_output_
Definition: BlackoilWellModelGasLift.hpp:86
bool operator==(const BlackoilWellModelGasLiftGeneric &that) const
Definition: BlackoilWellModelGasLift.hpp:66
typename GasLiftSingleWellGeneric< Scalar >::GLiftSyncGroups GLiftSyncGroups
Definition: BlackoilWellModelGasLift.hpp:47
double last_glift_opt_time_
Definition: BlackoilWellModelGasLift.hpp:87
Class for handling the gaslift in the blackoil well model.
Definition: BlackoilWellModelGasLift.hpp:94
GetPropType< TypeTag, Properties::Simulator > Simulator
Definition: BlackoilWellModelGasLift.hpp:105
static void initGliftEclWellMap(const std::vector< WellInterfacePtr > &well_container, GLiftEclWells &ecl_well_map)
Definition: BlackoilWellModelGasLift_impl.hpp:299
bool maybeDoGasLiftOptimize(const Simulator &simulator, const std::vector< WellInterfacePtr > &well_container, WellState< Scalar > &wellState, GroupState< Scalar > &groupState, DeferredLogger &deferred_logger)
Definition: BlackoilWellModelGasLift_impl.hpp:42
typename Base::GLiftWellStateMap GLiftWellStateMap
Definition: BlackoilWellModelGasLift.hpp:104
typename GasLiftGroupInfo< Scalar >::GLiftEclWells GLiftEclWells
Definition: BlackoilWellModelGasLift.hpp:100
typename Base::GLiftOptWells GLiftOptWells
Definition: BlackoilWellModelGasLift.hpp:101
std::shared_ptr< WellInterface< TypeTag > > WellInterfacePtr
Definition: BlackoilWellModelGasLift.hpp:106
typename GasLiftSingleWellGeneric< Scalar >::GLiftSyncGroups GLiftSyncGroups
Definition: BlackoilWellModelGasLift.hpp:103
typename Base::GLiftProdWells GLiftProdWells
Definition: BlackoilWellModelGasLift.hpp:102
GetPropType< TypeTag, Properties::Scalar > Scalar
Definition: BlackoilWellModelGasLift.hpp:99
BlackoilWellModelGasLift(bool terminal_output, const PhaseUsage &phase_usage)
Definition: BlackoilWellModelGasLift.hpp:108
Definition: DeferredLogger.hpp:57
Definition: GasLiftGroupInfo.hpp:46
std::map< std::string, std::pair< const Well *, int > > GLiftEclWells
Definition: GasLiftGroupInfo.hpp:70
std::set< int > GLiftSyncGroups
Definition: GasLiftSingleWellGeneric.hpp:59
Definition: GroupState.hpp:43
Manages the initializing and running of time dependent problems.
Definition: simulator.hh:84
Definition: WellInterfaceGeneric.hpp:53
Definition: WellInterface.hpp:77
Definition: WellState.hpp:65
Dune::Communication< MPIComm > Communication
Definition: ParallelCommunication.hpp:30
Definition: blackoilboundaryratevector.hh:39
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property (equivalent to old macro GET_PROP_TYPE(....
Definition: propertysystem.hh:233
Definition: BlackoilPhases.hpp:46