OpenCAEPoro  v0.5.0
A simulator for multicomponent porous media flow
AllWells.hpp
Go to the documentation of this file.
1 
12 #ifndef __WELLGROUP_HEADER__
13 #define __WELLGROUP_HEADER__
14 
15 // OpenCAEPoro header files
16 #include "ParamWell.hpp"
17 #include "Well.hpp"
18 
19 using namespace std;
20 
25 class WellGroup
26 {
27  friend class AllWells;
28 
29 public:
30  WellGroup() = default;
31  WellGroup(const string& gname)
32  : name(gname){};
33 
34  OCP_BOOL IfReInj() const { return reInj; }
35 
36 private:
37  string name;
38  vector<USI> wId;
39  vector<USI> wIdINJ;
40  vector<USI> wIdPROD;
41 
42  // for Reinjection
43  OCP_BOOL reInj{OCP_FALSE};
44  USI reInjPhase;
45 
48  USI prodGroup{0};
49  OCP_DBL saleRate;
52  OCP_DBL reInjXi;
54  vector<OCP_DBL> reInjZi;
55  OCP_DBL
56  reInjFactor;
57 
58  /*
59  OCP_DBL GOPR{0}; ///< Group oil production rate
60  OCP_DBL GGPR{0}; ///< Group gas production rate
61  OCP_DBL GWPR{0}; ///< Group water production rate
62  OCP_DBL GOPT{0}; ///< Group oil total production
63  OCP_DBL GGPT{0}; ///< Group gas total production
64  OCP_DBL GWPT{0}; ///< Group water total production
65  OCP_DBL GGIR{0}; ///< Group gas injection rate
66  OCP_DBL GWIR{0}; ///< Group water injection rate
67  OCP_DBL GGIT{0}; ///< Group gas total injection
68  OCP_DBL GWIT{0}; ///< Group gas total injection
69  */
70 };
71 
75 class AllWells
76 {
77 
78  // temp
79  friend class Reservoir;
80  friend class Out4RPT;
81  friend class Out4VTK;
82 
83  friend class IsoT_FIM;
84  friend class IsoT_IMPEC;
85  friend class IsoT_AIMc;
86  friend class IsoT_FIMn;
87  friend class T_FIM;
88 
89 public:
90  AllWells() = default;
91 
93  // Input Param and Setup
95 
96 public:
98  void InputParam(const ParamWell& paramWell, const ParamOutput& output_param);
100  void Setup(const Grid& myGrid, const Bulk& myBulk);
102  void SetupWell(const Grid& myGrid, const Bulk& myBulk);
104  void SetupWellGroup(const Bulk& myBulk);
106  void SetupMixture(const Bulk& myBulk);
108  void SetupWellBulk(Bulk& myBulk) const;
110  void SetupConnWell2Bulk(const Bulk& myBulk);
111 
113  // General
115 
116 public:
118  void ApplyControl(const USI& i);
120  void InitBHP(const Bulk& myBulk);
122  void PrepareWell(const Bulk& myBulk);
124  void CalTrans(const Bulk& myBulk);
126  void CalFlux(const Bulk& myBulk);
128  void CaldG(const Bulk& myBulk);
130  void CalIPRT(const Bulk& myBulk, OCP_DBL dt);
132  void CalReInjFluid(const Bulk& myBulk);
133  void UpdateLastTimeStepBHP()
134  {
135  for (auto& w : wells) w.lbhp = w.bhp;
136  }
137  void ResetBHP();
139  OCP_INT CheckP(const Bulk& myBulk);
141  USI GetWellNum() const { return numWell; }
143  string GetWellName(const USI& i) const { return wells[i].name; }
145  USI GetIndex(const string& name) const;
147  USI GetWellPerfNum(const USI& i) const { return wells[i].numPerf; }
149  USI GetWellPerfNum() const;
151  USI GetMaxWellPerNum() const;
152  void CalMaxBHPChange();
153  OCP_DBL GetdBHPmax() const { return dPmax; }
154 
156  OCP_DBL GetWBHP(const USI& w) const
157  {
158  if (wells[w].IsOpen())
159  return wells[w].bhp;
160  else
161  return 0;
162  }
164  OCP_DBL GetWellDG(const USI& w, const USI& p) const { return wells[w].dG[p]; }
165  void ShowWellStatus(const Bulk& myBulk)
166  {
167  for (USI w = 0; w < numWell; w++) wells[w].ShowPerfStatus(myBulk);
168  }
169  OCP_BOOL GetWellChange() const { return wellChange; }
170  const auto& GetWell2Bulk() const { return well2bulk; }
171 
172 protected:
174  vector<Well> wells;
176  vector<WellGroup> wellGroup;
177  vector<vector<OCP_USI>> well2bulk;
178 
180  vector<SolventINJ> solvents;
181  OCP_DBL dPmax{0};
182 
183  vector<Mixture*> flashCal;
186 
188  // Injection/Production Rate
190 
191 public:
193  OCP_DBL GetFGIT() const { return FGIT; }
195  OCP_DBL GetFWIR() const { return FWIR; }
197  OCP_DBL GetFWIT() const { return FWIT; }
199  OCP_DBL GetFOPR() const { return FOPR; }
201  OCP_DBL GetFOPT() const { return FOPT; }
203  OCP_DBL GetFGPR() const { return FGPR; }
205  OCP_DBL GetFGPT() const { return FGPt; }
207  OCP_DBL GetFWPR() const { return FWPR; }
209  OCP_DBL GetFWPT() const { return FWPT; }
211  OCP_DBL GetFGIR() const { return FGIR; }
212 
214  OCP_DBL GetWGIR(const USI& w) const { return wells[w].WGIR; }
216  OCP_DBL GetWGIT(const USI& w) const { return wells[w].WGIT; }
218  OCP_DBL GetWWIR(const USI& w) const { return wells[w].WWIR; }
220  OCP_DBL GetWWIT(const USI& w) const { return wells[w].WWIT; }
222  OCP_DBL GetWOPR(const USI& w) const { return wells[w].WOPR; }
224  OCP_DBL GetWOPT(const USI& w) const { return wells[w].WOPT; }
226  OCP_DBL GetWGPR(const USI& w) const { return wells[w].WGPR; }
228  OCP_DBL GetWGPT(const USI& w) const { return wells[w].WGPT; }
230  OCP_DBL GetWWPR(const USI& w) const { return wells[w].WWPR; }
232  OCP_DBL GetWWPT(const USI& w) const { return wells[w].WWPT; }
233 
234 protected:
235  OCP_DBL FGIR{0};
236  OCP_DBL FGIT{0};
237  OCP_DBL FWIR{0};
238  OCP_DBL FWIT{0};
239  OCP_DBL FOPR{0};
240  OCP_DBL FOPT{0};
241  OCP_DBL FGPR{0};
242  OCP_DBL FGPt{0};
243  OCP_DBL FWPR{0};
244  OCP_DBL FWPT{0};
245 
246  // for output
247 private:
248  OCP_BOOL useVTK{OCP_FALSE};
249  vector<OCPpolyhedron> polyhedronWell;
250  // When the well is under the BHP control, then give it's BHP
251  // When the well is under the RATE control, then give it's RATE
252  mutable vector<OCP_DBL> wellVal;
253 
254 public:
255  void SetPolyhedronWell(const Grid& myGrid);
256  void SetWellVal() const;
257 };
258 
259 #endif /* end if __WELLGROUP_HEADER__ */
260 
261 /*----------------------------------------------------------------------------*/
262 /* Brief Change History of This File */
263 /*----------------------------------------------------------------------------*/
264 /* Author Date Actions */
265 /*----------------------------------------------------------------------------*/
266 /* Shizhe Li Oct/01/2021 Create file */
267 /* Chensong Zhang Oct/15/2021 Format file */
268 /* Shizhe Li Feb/08/2022 Rename to AllWells */
269 /*----------------------------------------------------------------------------*/
unsigned int USI
Generic unsigned integer.
Definition: OCPConst.hpp:23
double OCP_DBL
Double precision.
Definition: OCPConst.hpp:27
const OCP_DBL TEMPERATURE_STD
Standard temperature: F.
Definition: OCPConst.hpp:60
int OCP_INT
Long integer.
Definition: OCPConst.hpp:26
unsigned int OCP_BOOL
OCP_BOOL in OCP.
Definition: OCPConst.hpp:29
const OCP_DBL PRESSURE_STD
14.6959 psia = 1 atm
Definition: OCPConst.hpp:59
ParamWell class declaration.
Well class declaration.
OCP_DBL GetWGIR(const USI &w) const
Return gas injection rate of the wth well.
Definition: AllWells.hpp:214
vector< vector< OCP_USI > > well2bulk
connections between wells and bulks
Definition: AllWells.hpp:177
vector< Well > wells
well set.
Definition: AllWells.hpp:174
vector< SolventINJ > solvents
Sets of Solvent.
Definition: AllWells.hpp:180
OCP_DBL GetWGIT(const USI &w) const
Return total gas injection of the wth well.
Definition: AllWells.hpp:216
OCP_DBL GetWellDG(const USI &w, const USI &p) const
Return the pth dG of wth well.
Definition: AllWells.hpp:164
OCP_DBL GetFWPT() const
Return total water production in field.
Definition: AllWells.hpp:209
OCP_DBL GetFWIR() const
Return water injection rate in field.
Definition: AllWells.hpp:195
OCP_DBL GetFGPT() const
Return total gas production in field.
Definition: AllWells.hpp:205
OCP_DBL GetWWIR(const USI &w) const
Return water injection rate of the wth well.
Definition: AllWells.hpp:218
OCP_DBL GetWWPR(const USI &w) const
Return water production rate of the wth well.
Definition: AllWells.hpp:230
OCP_DBL GetWWIT(const USI &w) const
Return total water injection of the wth well.
Definition: AllWells.hpp:220
OCP_DBL GetWGPR(const USI &w) const
Return gas production rate of the wth well.
Definition: AllWells.hpp:226
string GetWellName(const USI &i) const
Return the name of specified well.
Definition: AllWells.hpp:143
OCP_DBL GetFWPR() const
Return water production rate in field.
Definition: AllWells.hpp:207
vector< WellGroup > wellGroup
wellGroup set
Definition: AllWells.hpp:176
OCP_DBL GetWBHP(const USI &w) const
Return the BHP of wth well.
Definition: AllWells.hpp:156
OCP_BOOL wellChange
if wells change, then OCP_TRUE
Definition: AllWells.hpp:179
OCP_DBL GetFWIT() const
Return total water injection in field.
Definition: AllWells.hpp:197
OCP_DBL GetFGIT() const
Return gas water injection in field.
Definition: AllWells.hpp:193
OCP_DBL GetWOPT(const USI &w) const
Return total oil production of the wth well.
Definition: AllWells.hpp:224
OCP_DBL GetFOPT() const
Return total oil production in field.
Definition: AllWells.hpp:201
OCP_DBL GetWGPT(const USI &w) const
Return total gas production of the wth well.
Definition: AllWells.hpp:228
OCP_DBL GetWWPT(const USI &w) const
Return total water production of the wth well.
Definition: AllWells.hpp:232
USI GetWellPerfNum(const USI &i) const
Return the num of perforations of well i.
Definition: AllWells.hpp:147
OCP_DBL GetWOPR(const USI &w) const
Return oil production rate of the wth well.
Definition: AllWells.hpp:222
USI numGroup
num of groups
Definition: AllWells.hpp:175
OCP_DBL GetFGPR() const
Return gas production rate in field.
Definition: AllWells.hpp:203
USI GetWellNum() const
Return the num of wells.
Definition: AllWells.hpp:141
vector< Mixture * > flashCal
Useless now.
Definition: AllWells.hpp:183
USI numWell
num of wells.
Definition: AllWells.hpp:173
OCP_DBL GetFGIR() const
Return gas injection rate in field.
Definition: AllWells.hpp:211
OCP_DBL GetFOPR() const
Return oil production rate in field.
Definition: AllWells.hpp:199
Physical information of each active reservoir bulk.
Definition: Bulk.hpp:104
Definition: Grid.hpp:89
IsoT_FIM is FIM (Fully Implicit Method).
IsoT_IMPEC is IMPEC (implicit pressure explict saturation) method.
Collect more detailed information of each time step.
Definition: OCPOutput.hpp:211