My Project
WellGroupHelpers.hpp
1/*
2 Copyright 2019 Norce.
3
4 This file is part of the Open Porous Media project (OPM).
5
6 OPM is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 OPM is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with OPM. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20
21#ifndef OPM_WELLGROUPHELPERS_HEADER_INCLUDED
22#define OPM_WELLGROUPHELPERS_HEADER_INCLUDED
23
24#include <opm/input/eclipse/Schedule/Group/GuideRate.hpp>
25
26#include <map>
27#include <string>
28#include <vector>
29
30namespace Opm
31{
32
33class DeferredLogger;
34class Group;
35class GroupState;
36namespace Network { class ExtNetwork; }
37struct PhaseUsage;
38class Schedule;
39class VFPProdProperties;
40class WellState;
41
42namespace Network { class ExtNetwork; }
43
44namespace WellGroupHelpers
45{
46
47
48
49 void setCmodeGroup(const Group& group,
50 const Schedule& schedule,
51 const SummaryState& summaryState,
52 const int reportStepIdx,
53 WellState& wellState,
54 GroupState& group_state);
55
56 void accumulateGroupEfficiencyFactor(const Group& group,
57 const Schedule& schedule,
58 const int reportStepIdx,
59 double& factor);
60
61 double sumWellSurfaceRates(const Group& group,
62 const Schedule& schedule,
63 const WellState& wellState,
64 const int reportStepIdx,
65 const int phasePos,
66 const bool injector);
67
68 double sumWellResRates(const Group& group,
69 const Schedule& schedule,
70 const WellState& wellState,
71 const int reportStepIdx,
72 const int phasePos,
73 const bool injector);
74
75 double sumSolventRates(const Group& group,
76 const Schedule& schedule,
77 const WellState& wellState,
78 const int reportStepIdx,
79 const bool injector);
80
81 void updateGroupTargetReduction(const Group& group,
82 const Schedule& schedule,
83 const int reportStepIdx,
84 const bool isInjector,
85 const PhaseUsage& pu,
86 const GuideRate& guide_rate,
87 const WellState& wellState,
88 GroupState& group_state,
89 std::vector<double>& groupTargetReduction);
90
91 template <class Comm>
92 void updateGuideRates(const Group& group,
93 const Schedule& schedule,
94 const SummaryState& summary_state,
95 const PhaseUsage& pu,
96 int report_step,
97 double sim_time,
98 WellState& well_state,
99 const GroupState& group_state,
100 const Comm& comm,
101 GuideRate* guide_rate,
102 std::vector<double>& pot,
103 Opm::DeferredLogger& deferred_logge);
104
105 template <class Comm>
106 void updateGuideRateForProductionGroups(const Group& group,
107 const Schedule& schedule,
108 const PhaseUsage& pu,
109 const int reportStepIdx,
110 const double& simTime,
111 WellState& wellState,
112 const GroupState& group_state,
113 const Comm& comm,
114 GuideRate* guideRate,
115 std::vector<double>& pot);
116
117 template <class Comm>
118 void updateGuideRatesForWells(const Schedule& schedule,
119 const PhaseUsage& pu,
120 const int reportStepIdx,
121 const double& simTime,
122 const WellState& wellState,
123 const Comm& comm,
124 GuideRate* guideRate);
125
126 void updateGuideRatesForInjectionGroups(const Group& group,
127 const Schedule& schedule,
128 const SummaryState& summaryState,
129 const Opm::PhaseUsage& pu,
130 const int reportStepIdx,
131 const WellState& wellState,
132 const GroupState& group_state,
133 GuideRate* guideRate,
134 Opm::DeferredLogger& deferred_logger);
135
136 void updateVREPForGroups(const Group& group,
137 const Schedule& schedule,
138 const int reportStepIdx,
139 const WellState& wellState,
140 GroupState& group_state);
141
142 void updateReservoirRatesInjectionGroups(const Group& group,
143 const Schedule& schedule,
144 const int reportStepIdx,
145 const WellState& wellState,
146 GroupState& group_state);
147
148 void updateSurfaceRatesInjectionGroups(const Group& group,
149 const Schedule& schedule,
150 const int reportStepIdx,
151 const WellState& wellState,
152 GroupState& group_state);
153
154 void updateWellRates(const Group& group,
155 const Schedule& schedule,
156 const int reportStepIdx,
157 const WellState& wellStateNupcol,
158 WellState& wellState);
159
160 void updateGroupProductionRates(const Group& group,
161 const Schedule& schedule,
162 const int reportStepIdx,
163 const WellState& wellState,
164 GroupState& group_state);
165
166 void updateWellRatesFromGroupTargetScale(const double scale,
167 const Group& group,
168 const Schedule& schedule,
169 const int reportStepIdx,
170 bool isInjector,
171 const GroupState& group_state,
172 WellState& wellState);
173
174 void updateREINForGroups(const Group& group,
175 const Schedule& schedule,
176 const int reportStepIdx,
177 const PhaseUsage& pu,
178 const SummaryState& st,
179 const WellState& wellState,
180 GroupState& group_state);
181
182 template <class RegionalValues>
183 void updateGpMaintTargetForGroups(const Group& group,
184 const Schedule& schedule,
185 const RegionalValues& regional_values,
186 const int reportStepIdx,
187 const double dt,
188 const WellState& well_state,
189 GroupState& group_state);
190
191 std::map<std::string, double>
192 computeNetworkPressures(const Opm::Network::ExtNetwork& network,
193 const WellState& well_state,
194 const GroupState& group_state,
195 const VFPProdProperties& vfp_prod_props,
196 const Schedule& schedule,
197 const int report_time_step);
198
199 GuideRate::RateVector
200 getWellRateVector(const WellState& well_state, const PhaseUsage& pu, const std::string& name);
201
202 GuideRate::RateVector
203 getProductionGroupRateVector(const GroupState& group_state, const PhaseUsage& pu, const std::string& group_name);
204
205 double getGuideRate(const std::string& name,
206 const Schedule& schedule,
207 const WellState& wellState,
208 const GroupState& group_state,
209 const int reportStepIdx,
210 const GuideRate* guideRate,
211 const GuideRateModel::Target target,
212 const PhaseUsage& pu);
213
214
215 double getGuideRateInj(const std::string& name,
216 const Schedule& schedule,
217 const WellState& wellState,
218 const GroupState& group_state,
219 const int reportStepIdx,
220 const GuideRate* guideRate,
221 const GuideRateModel::Target target,
222 const Phase& injectionPhase,
223 const PhaseUsage& pu);
224
225 int groupControlledWells(const Schedule& schedule,
226 const WellState& well_state,
227 const GroupState& group_state,
228 const int report_step,
229 const std::string& group_name,
230 const std::string& always_included_child,
231 const bool is_production_group,
232 const Phase injection_phase);
233
234
236 {
237 public:
238 FractionCalculator(const Schedule& schedule,
239 const WellState& well_state,
240 const GroupState& group_state,
241 const int report_step,
242 const GuideRate* guide_rate,
243 const GuideRateModel::Target target,
244 const PhaseUsage& pu,
245 const bool is_producer,
246 const Phase injection_phase);
247 double fraction(const std::string& name, const std::string& control_group_name, const bool always_include_this);
248 double localFraction(const std::string& name, const std::string& always_included_child);
249
250 private:
251 std::string parent(const std::string& name);
252 double guideRateSum(const Group& group, const std::string& always_included_child);
253 double guideRate(const std::string& name, const std::string& always_included_child);
254 int groupControlledWells(const std::string& group_name, const std::string& always_included_child);
255 GuideRate::RateVector getGroupRateVector(const std::string& group_name);
256 const Schedule& schedule_;
257 const WellState& well_state_;
258 const GroupState& group_state_;
259 int report_step_;
260 const GuideRate* guide_rate_;
261 GuideRateModel::Target target_;
262 const PhaseUsage& pu_;
263 bool is_producer_;
264 Phase injection_phase_;
265 };
266
267
268 std::pair<bool, double> checkGroupConstraintsInj(const std::string& name,
269 const std::string& parent,
270 const Group& group,
271 const WellState& wellState,
272 const GroupState& group_state,
273 const int reportStepIdx,
274 const GuideRate* guideRate,
275 const double* rates,
276 Phase injectionPhase,
277 const PhaseUsage& pu,
278 const double efficiencyFactor,
279 const Schedule& schedule,
280 const SummaryState& summaryState,
281 const std::vector<double>& resv_coeff,
282 DeferredLogger& deferred_logger);
283
284
285
286
287
288
289 std::vector<std::string> groupChainTopBot(const std::string& bottom,
290 const std::string& top,
291 const Schedule& schedule,
292 const int report_step);
293
294
295
296
297 std::pair<bool, double> checkGroupConstraintsProd(const std::string& name,
298 const std::string& parent,
299 const Group& group,
300 const WellState& wellState,
301 const GroupState& group_state,
302 const int reportStepIdx,
303 const GuideRate* guideRate,
304 const double* rates,
305 const PhaseUsage& pu,
306 const double efficiencyFactor,
307 const Schedule& schedule,
308 const SummaryState& summaryState,
309 const std::vector<double>& resv_coeff,
310 DeferredLogger& deferred_logger);
311
312
313} // namespace WellGroupHelpers
314
315} // namespace Opm
316
317#endif
Definition: DeferredLogger.hpp:57
Definition: GroupState.hpp:34
Definition: WellGroupHelpers.hpp:236
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:27
Definition: BlackoilPhases.hpp:46