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 WellState& wellState,
57 GroupState& group_state);
58
59 void accumulateGroupEfficiencyFactor(const Group& group,
60 const Schedule& schedule,
61 const int reportStepIdx,
62 double& factor);
63
64 double sumWellSurfaceRates(const Group& group,
65 const Schedule& schedule,
66 const WellState& wellState,
67 const int reportStepIdx,
68 const int phasePos,
69 const bool injector);
70
71 double sumWellResRates(const Group& group,
72 const Schedule& schedule,
73 const WellState& wellState,
74 const int reportStepIdx,
75 const int phasePos,
76 const bool injector);
77
78 double sumSolventRates(const Group& group,
79 const Schedule& schedule,
80 const WellState& wellState,
81 const int reportStepIdx,
82 const bool injector);
83
84 void updateGroupTargetReduction(const Group& group,
85 const Schedule& schedule,
86 const int reportStepIdx,
87 const bool isInjector,
88 const PhaseUsage& pu,
89 const GuideRate& guide_rate,
90 const WellState& wellState,
91 GroupState& group_state,
92 std::vector<double>& groupTargetReduction);
93
94 template <class Comm>
95 void updateGuideRates(const Group& group,
96 const Schedule& schedule,
97 const SummaryState& summary_state,
98 const PhaseUsage& pu,
99 int report_step,
100 double sim_time,
101 WellState& well_state,
102 const GroupState& group_state,
103 const Comm& comm,
104 GuideRate* guide_rate,
105 std::vector<double>& pot,
106 Opm::DeferredLogger& deferred_logge);
107
108 template <class Comm>
109 void updateGuideRateForProductionGroups(const Group& group,
110 const Schedule& schedule,
111 const PhaseUsage& pu,
112 const int reportStepIdx,
113 const double& simTime,
114 WellState& wellState,
115 const GroupState& group_state,
116 const Comm& comm,
117 GuideRate* guideRate,
118 std::vector<double>& pot);
119
120 template <class Comm>
121 void updateGuideRatesForWells(const Schedule& schedule,
122 const PhaseUsage& pu,
123 const int reportStepIdx,
124 const double& simTime,
125 const WellState& wellState,
126 const Comm& comm,
127 GuideRate* guideRate);
128
129 void updateGuideRatesForInjectionGroups(const Group& group,
130 const Schedule& schedule,
131 const SummaryState& summaryState,
132 const Opm::PhaseUsage& pu,
133 const int reportStepIdx,
134 const WellState& wellState,
135 const GroupState& group_state,
136 GuideRate* guideRate,
137 Opm::DeferredLogger& deferred_logger);
138
139 void updateVREPForGroups(const Group& group,
140 const Schedule& schedule,
141 const int reportStepIdx,
142 const WellState& wellState,
143 GroupState& group_state);
144
145 void updateReservoirRatesInjectionGroups(const Group& group,
146 const Schedule& schedule,
147 const int reportStepIdx,
148 const WellState& wellState,
149 GroupState& group_state);
150
151 void updateSurfaceRatesInjectionGroups(const Group& group,
152 const Schedule& schedule,
153 const int reportStepIdx,
154 const WellState& wellState,
155 GroupState& group_state);
156
157 void updateWellRates(const Group& group,
158 const Schedule& schedule,
159 const int reportStepIdx,
160 const WellState& wellStateNupcol,
161 WellState& wellState);
162
163 void updateGroupProductionRates(const Group& group,
164 const Schedule& schedule,
165 const int reportStepIdx,
166 const WellState& wellState,
167 GroupState& group_state);
168
169 void updateWellRatesFromGroupTargetScale(const double scale,
170 const Group& group,
171 const Schedule& schedule,
172 const int reportStepIdx,
173 bool isInjector,
174 const GroupState& group_state,
175 WellState& wellState);
176
177 void updateREINForGroups(const Group& group,
178 const Schedule& schedule,
179 const int reportStepIdx,
180 const PhaseUsage& pu,
181 const SummaryState& st,
182 const WellState& wellState,
183 GroupState& group_state);
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