My Project
WellInterfaceEval.hpp
1 /*
2  Copyright 2017 SINTEF Digital, Mathematics and Cybernetics.
3  Copyright 2017 Statoil ASA.
4  Copyright 2017 IRIS
5  Copyright 2019 Norce
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 
23 
24 #ifndef OPM_WELLINTERFACE_EVAL_HEADER_INCLUDED
25 #define OPM_WELLINTERFACE_EVAL_HEADER_INCLUDED
26 
27 #include <opm/core/props/BlackoilPhases.hpp>
28 
29 #include <opm/parser/eclipse/EclipseState/Schedule/ScheduleTypes.hpp>
30 #include <opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp>
31 
32 #include <functional>
33 
34 namespace Opm
35 {
36 
37 class DeferredLogger;
38 class Group;
39 class GroupState;
40 class Schedule;
41 class SummaryState;
42 template<class FluidSystem> class WellInterfaceFluidSystem;
43 class WellState;
44 
45 template<class FluidSystem>
47  static constexpr int Water = BlackoilPhases::Aqua;
48  static constexpr int Oil = BlackoilPhases::Liquid;
49  static constexpr int Gas = BlackoilPhases::Vapour;
50 
51 public:
52  template <class EvalWell>
53  EvalWell calculateBhpFromThp(const WellState& well_state,
54  const std::vector<EvalWell>& rates,
55  const Well& well,
56  const SummaryState& summaryState,
57  const double rho,
58  DeferredLogger& deferred_logger) const;
59  template<class EvalWell>
60  void getGroupInjectionControl(const Group& group,
61  const WellState& well_state,
62  const GroupState& group_state,
63  const Schedule& schedule,
64  const SummaryState& summaryState,
65  const InjectorType& injectorType,
66  const EvalWell& bhp,
67  const EvalWell& injection_rate,
68  EvalWell& control_eq,
69  double efficiencyFactor,
70  DeferredLogger& deferred_logger) const;
71 
72 
73  template<class EvalWell>
74  void getGroupProductionControl(const Group& group,
75  const WellState& well_state,
76  const GroupState& group_state,
77  const Schedule& schedule,
78  const SummaryState& summaryState,
79  const EvalWell& bhp,
80  const std::vector<EvalWell>& rates,
81  EvalWell& control_eq,
82  double efficiencyFactor) const;
83 
84  template<class EvalWell, class BhpFromThpFunc>
85  void assembleControlEqProd(const WellState& well_state,
86  const GroupState& group_state,
87  const Schedule& schedule,
88  const SummaryState& summaryState,
89  const Well::ProductionControls& controls,
90  const EvalWell& bhp,
91  const std::vector<EvalWell>& rates, // Always 3 canonical rates.
92  BhpFromThpFunc bhp_from_thp,
93  EvalWell& control_eq,
94  DeferredLogger& deferred_logger) const
95  {
96  std::function<EvalWell()> eval = [&bhp_from_thp]() { return bhp_from_thp(); };
97  assembleControlEqProd_(well_state,
98  group_state,
99  schedule,
100  summaryState,
101  controls,
102  bhp,
103  rates,
104  eval,
105  control_eq,
106  deferred_logger);
107  }
108 
109  template<class EvalWell>
110  void assembleControlEqProd_(const WellState& well_state,
111  const GroupState& group_state,
112  const Schedule& schedule,
113  const SummaryState& summaryState,
114  const Well::ProductionControls& controls,
115  const EvalWell& bhp,
116  const std::vector<EvalWell>& rates, // Always 3 canonical rates.
117  const std::function<EvalWell()>& bhp_from_thp,
118  EvalWell& control_eq,
119  DeferredLogger& deferred_logger) const;
120 
121  template<class EvalWell, class BhpFromThpFunc>
122  void assembleControlEqInj(const WellState& well_state,
123  const GroupState& group_state,
124  const Schedule& schedule,
125  const SummaryState& summaryState,
126  const Well::InjectionControls& controls,
127  const EvalWell& bhp,
128  const EvalWell& injection_rate,
129  BhpFromThpFunc bhp_from_thp,
130  EvalWell& control_eq,
131  DeferredLogger& deferred_logger) const
132  {
133  std::function<EvalWell()> eval = [&bhp_from_thp]() { return bhp_from_thp(); };
134  assembleControlEqInj_(well_state,
135  group_state,
136  schedule,
137  summaryState,
138  controls,
139  bhp,
140  injection_rate,
141  eval,
142  control_eq,
143  deferred_logger);
144  }
145 
146  template<class EvalWell>
147  void assembleControlEqInj_(const WellState& well_state,
148  const GroupState& group_state,
149  const Schedule& schedule,
150  const SummaryState& summaryState,
151  const Well::InjectionControls& controls,
152  const EvalWell& bhp,
153  const EvalWell& injection_rate,
154  const std::function<EvalWell()>& bhp_from_thp,
155  EvalWell& control_eq,
156  DeferredLogger& deferred_logger) const;
157 
158 protected:
160 
162 };
163 
164 }
165 
166 #endif // OPM_WELLINTERFACE_EVAL_HEADER_INCLUDED
Definition: DeferredLogger.hpp:57
Definition: GroupState.hpp:34
Definition: WellInterfaceEval.hpp:46
Definition: WellInterfaceFluidSystem.hpp:46
The state of a set of wells, tailored for use by the fully implicit blackoil simulator.
Definition: WellState.hpp:56
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: BlackoilPhases.hpp:26