My Project
Loading...
Searching...
No Matches
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#include <opm/input/eclipse/EclipseState/Grid/FieldPropsManager.hpp>
26
27
28#include <map>
29#include <string>
30#include <vector>
31
32namespace Opm
33{
34
35class DeferredLogger;
36class Group;
37class GroupState;
38namespace Network { class ExtNetwork; }
39struct PhaseUsage;
40class Schedule;
41class VFPProdProperties;
42class WellState;
43class FieldPropsManager;
44
45namespace Network { class ExtNetwork; }
46
47namespace WellGroupHelpers
48{
49
50
51
52 void setCmodeGroup(const Group& group,
53 const Schedule& schedule,
54 const SummaryState& summaryState,
55 const int reportStepIdx,
56 GroupState& group_state);
57
58 void accumulateGroupEfficiencyFactor(const Group& group,
59 const Schedule& schedule,
60 const int reportStepIdx,
61 double& factor);
62
63 double sumWellSurfaceRates(const Group& group,
64 const Schedule& schedule,
65 const WellState& wellState,
66 const int reportStepIdx,
67 const int phasePos,
68 const bool injector);
69
70 double sumWellResRates(const Group& group,
71 const Schedule& schedule,
72 const WellState& wellState,
73 const int reportStepIdx,
74 const int phasePos,
75 const bool injector);
76
77 double sumSolventRates(const Group& group,
78 const Schedule& schedule,
79 const WellState& wellState,
80 const int reportStepIdx,
81 const bool injector);
82
83 void updateGroupTargetReduction(const Group& group,
84 const Schedule& schedule,
85 const int reportStepIdx,
86 const bool isInjector,
87 const PhaseUsage& pu,
88 const GuideRate& guide_rate,
89 const WellState& wellState,
90 GroupState& group_state,
91 std::vector<double>& groupTargetReduction);
92
93 template <class Comm>
94 void updateGuideRates(const Group& group,
95 const Schedule& schedule,
96 const SummaryState& summary_state,
97 const PhaseUsage& pu,
98 int report_step,
99 double sim_time,
100 WellState& well_state,
101 const GroupState& group_state,
102 const Comm& comm,
103 GuideRate* guide_rate,
104 std::vector<double>& pot,
105 Opm::DeferredLogger& deferred_logge);
106
107 template <class Comm>
108 void updateGuideRateForProductionGroups(const Group& group,
109 const Schedule& schedule,
110 const PhaseUsage& pu,
111 const int reportStepIdx,
112 const double& simTime,
113 WellState& wellState,
114 const GroupState& group_state,
115 const Comm& comm,
116 GuideRate* guideRate,
117 std::vector<double>& pot);
118
119 template <class Comm>
120 void updateGuideRatesForWells(const Schedule& schedule,
121 const PhaseUsage& pu,
122 const int reportStepIdx,
123 const double& simTime,
124 const WellState& wellState,
125 const Comm& comm,
126 GuideRate* guideRate);
127
128 void updateGuideRatesForInjectionGroups(const Group& group,
129 const Schedule& schedule,
130 const SummaryState& summaryState,
131 const Opm::PhaseUsage& pu,
132 const int reportStepIdx,
133 const WellState& wellState,
134 const GroupState& group_state,
135 GuideRate* guideRate,
136 Opm::DeferredLogger& deferred_logger);
137
138 void updateVREPForGroups(const Group& group,
139 const Schedule& schedule,
140 const int reportStepIdx,
141 const WellState& wellState,
142 GroupState& group_state);
143
144 void updateReservoirRatesInjectionGroups(const Group& group,
145 const Schedule& schedule,
146 const int reportStepIdx,
147 const WellState& wellState,
148 GroupState& group_state);
149
150 void updateSurfaceRatesInjectionGroups(const Group& group,
151 const Schedule& schedule,
152 const int reportStepIdx,
153 const WellState& wellState,
154 GroupState& group_state);
155
156 void updateWellRates(const Group& group,
157 const Schedule& schedule,
158 const int reportStepIdx,
159 const WellState& wellStateNupcol,
160 WellState& wellState);
161
162 void updateGroupProductionRates(const Group& group,
163 const Schedule& schedule,
164 const int reportStepIdx,
165 const WellState& wellState,
166 GroupState& group_state);
167
168 void updateWellRatesFromGroupTargetScale(const double scale,
169 const Group& group,
170 const Schedule& schedule,
171 const int reportStepIdx,
172 bool isInjector,
173 const GroupState& group_state,
174 WellState& wellState);
175
176 void updateREINForGroups(const Group& group,
177 const Schedule& schedule,
178 const int reportStepIdx,
179 const PhaseUsage& pu,
180 const SummaryState& st,
181 const WellState& wellState,
182 GroupState& group_state,
183 bool sum_rank);
184
185 template <class RegionalValues>
186 void updateGpMaintTargetForGroups(const Group& group,
187 const Schedule& schedule,
188 const RegionalValues& regional_values,
189 const int reportStepIdx,
190 const double dt,
191 const WellState& well_state,
192 GroupState& group_state);
193
194 std::map<std::string, double>
195 computeNetworkPressures(const Opm::Network::ExtNetwork& network,
196 const WellState& well_state,
197 const GroupState& group_state,
198 const VFPProdProperties& vfp_prod_props,
199 const Schedule& schedule,
200 const int report_time_step);
201
202 GuideRate::RateVector
203 getWellRateVector(const WellState& well_state, const PhaseUsage& pu, const std::string& name);
204
205 GuideRate::RateVector
206 getProductionGroupRateVector(const GroupState& group_state, const PhaseUsage& pu, const std::string& group_name);
207
208 double getGuideRate(const std::string& name,
209 const Schedule& schedule,
210 const WellState& wellState,
211 const GroupState& group_state,
212 const int reportStepIdx,
213 const GuideRate* guideRate,
214 const GuideRateModel::Target target,
215 const PhaseUsage& pu);
216
217
218 double getGuideRateInj(const std::string& name,
219 const Schedule& schedule,
220 const WellState& wellState,
221 const GroupState& group_state,
222 const int reportStepIdx,
223 const GuideRate* guideRate,
224 const GuideRateModel::Target target,
225 const Phase& injectionPhase,
226 const PhaseUsage& pu);
227
228 int groupControlledWells(const Schedule& schedule,
229 const WellState& well_state,
230 const GroupState& group_state,
231 const int report_step,
232 const std::string& group_name,
233 const std::string& always_included_child,
234 const bool is_production_group,
235 const Phase injection_phase);
236
237
239 {
240 public:
241 FractionCalculator(const Schedule& schedule,
242 const WellState& well_state,
243 const GroupState& group_state,
244 const int report_step,
245 const GuideRate* guide_rate,
246 const GuideRateModel::Target target,
247 const PhaseUsage& pu,
248 const bool is_producer,
249 const Phase injection_phase);
250 double fraction(const std::string& name, const std::string& control_group_name, const bool always_include_this);
251 double localFraction(const std::string& name, const std::string& always_included_child);
252
253 private:
254 std::string parent(const std::string& name);
255 double guideRateSum(const Group& group, const std::string& always_included_child);
256 double guideRate(const std::string& name, const std::string& always_included_child);
257 int groupControlledWells(const std::string& group_name, const std::string& always_included_child);
258 GuideRate::RateVector getGroupRateVector(const std::string& group_name);
259 const Schedule& schedule_;
260 const WellState& well_state_;
261 const GroupState& group_state_;
262 int report_step_;
263 const GuideRate* guide_rate_;
264 GuideRateModel::Target target_;
265 const PhaseUsage& pu_;
266 bool is_producer_;
267 Phase injection_phase_;
268 };
269
270
271 std::pair<bool, double> checkGroupConstraintsInj(const std::string& name,
272 const std::string& parent,
273 const Group& group,
274 const WellState& wellState,
275 const GroupState& group_state,
276 const int reportStepIdx,
277 const GuideRate* guideRate,
278 const double* rates,
280 const PhaseUsage& pu,
281 const double efficiencyFactor,
282 const Schedule& schedule,
283 const SummaryState& summaryState,
284 const std::vector<double>& resv_coeff,
286
287
288
289
290
291
292 std::vector<std::string> groupChainTopBot(const std::string& bottom,
293 const std::string& top,
294 const Schedule& schedule,
295 const int report_step);
296
297
298
299
300 std::pair<bool, double> checkGroupConstraintsProd(const std::string& name,
301 const std::string& parent,
302 const Group& group,
303 const WellState& wellState,
304 const GroupState& group_state,
305 const int reportStepIdx,
306 const GuideRate* guideRate,
307 const double* rates,
308 const PhaseUsage& pu,
309 const double efficiencyFactor,
310 const Schedule& schedule,
311 const SummaryState& summaryState,
312 const std::vector<double>& resv_coeff,
314
315 template <class AverageRegionalPressureType>
316 void setRegionAveragePressureCalculator(const Group& group,
317 const Schedule& schedule,
318 const int reportStepIdx,
319 const FieldPropsManager& fp,
320 const PhaseUsage& pu,
321 std::map<std::string, std::unique_ptr<AverageRegionalPressureType>>& regionalAveragePressureCalculator);
322
323
324} // namespace WellGroupHelpers
325
326} // namespace Opm
327
328#endif
Definition AquiferInterface.hpp:35
Definition DeferredLogger.hpp:57
Definition GroupState.hpp:34
Definition WellGroupHelpers.hpp:239
The state of a set of wells, tailored for use by the fully implicit blackoil simulator.
Definition WellState.hpp:60
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition BlackoilPhases.hpp:27
Definition BlackoilPhases.hpp:46