OpenCAEPoro  v0.5.0
A simulator for multicomponent porous media flow
MixtureBO.hpp
Go to the documentation of this file.
1 
12 #ifndef __MIXTUREBO_HEADER__
13 #define __MIXTUREBO_HEADER__
14 
15 #include <cmath>
16 
17 // OpenCAEPoro header files
18 #include "Mixture.hpp"
19 #include "OCPTable.hpp"
20 
22 class BOMixture : public Mixture
23 {
24 public:
25  BOMixture() = default;
26  void SetupOptionalFeatures(OptionalFeatures& optFeatures,
27  const OCP_USI& numBulk) override{};
28  void BOMixtureInit(const ParamReservoir& rs_param);
29  void InitFlashFIMn(const OCP_DBL& Pin,
30  const OCP_DBL& Pbbin,
31  const OCP_DBL& Tin,
32  const OCP_DBL* Sjin,
33  const OCP_DBL& Vpore,
34  const OCP_DBL* Ziin,
35  const OCP_USI& bId) override
36  {
37  OCP_ABORT("Not Used!");
38  };
39 
40  // For Well
41  void CalProdWeight(const OCP_DBL& Pin,
42  const OCP_DBL& Tin,
43  const OCP_DBL* Niin,
44  const vector<OCP_DBL>& prodPhase,
45  vector<OCP_DBL>& prodWeight) override
46  {
47  prodWeight = prodPhase;
48  }
49 
50  void CalProdRate(const OCP_DBL& Pin,
51  const OCP_DBL& Tin,
52  const OCP_DBL* Niin,
53  vector<OCP_DBL>& prodRate) override
54  {
55  prodRate.assign(Niin, Niin + numCom);
56  };
57  OCP_DBL CalInjWellEnthalpy(const OCP_DBL& Tin, const OCP_DBL* Ziin) override
58  {
59  OCP_ABORT("Can not be used in Black Oil Model!");
60  }
61 
62  OCP_DBL GetErrorPEC() override
63  {
64  OCP_ABORT("Should not be used in Black Oil mode!");
65  return 0;
66  }
67  void OutMixtureIters() const override{};
68 
69 protected:
70  // USI mixtureType; ///< indicates the type of mixture, black oil or compositional
71  // or
73  // std_Gamma* = std_Rho* * GRAVITY_FACTOR.
74  // only one of rho and gamma is needed, the other will be calculated from it.
78 };
79 
81 // BOMixture_W
83 
84 class BOMixture_W : public BOMixture
85 {
86 public:
87  BOMixture_W() = default;
88  BOMixture_W(const ParamReservoir& rs_param, const USI& i)
89  {
90  OCP_ABORT("Not Completed!");
91  };
92  void Flash(const OCP_DBL& Pin, const OCP_DBL& Tin, const OCP_DBL* Niin) override
93  {
94  OCP_ABORT("Not Completed!");
95  }
96  void InitFlashIMPEC(const OCP_DBL& Pin,
97  const OCP_DBL& Pbbin,
98  const OCP_DBL& Tin,
99  const OCP_DBL* Sjin,
100  const OCP_DBL& Vpore,
101  const OCP_DBL* Ziin,
102  const OCP_USI& bId) override
103  {
104  OCP_ABORT("Not Completed!");
105  };
106  void InitFlashFIM(const OCP_DBL& Pin,
107  const OCP_DBL& Pbbin,
108  const OCP_DBL& Tin,
109  const OCP_DBL* Sjin,
110  const OCP_DBL& Vpore,
111  const OCP_DBL* Ziin,
112  const OCP_USI& bId) override
113  {
114  OCP_ABORT("Not Completed!");
115  };
116  void FlashIMPEC(const OCP_DBL& Pin,
117  const OCP_DBL& Tin,
118  const OCP_DBL* Niin,
119  const USI& lastNP,
120  const OCP_DBL* xijin,
121  const OCP_USI& bId) override
122  {
123  OCP_ABORT("Not Completed!");
124  };
125  void FlashFIM(const OCP_DBL& Pin,
126  const OCP_DBL& Tin,
127  const OCP_DBL* Niin,
128  const OCP_DBL* Sjin,
129  const USI& lastNP,
130  const OCP_DBL* xijin,
131  const OCP_USI& bId) override
132  {
133  OCP_ABORT("Not Completed!");
134  };
135  void FlashFIMn(const OCP_DBL& Pin,
136  const OCP_DBL& Tin,
137  const OCP_DBL* Niin,
138  const OCP_DBL* Sjin,
139  const OCP_DBL* xijin,
140  const OCP_DBL* njin,
141  const USI* phaseExistin,
142  const USI& lastNP,
143  const OCP_USI& bId) override
144  {
145  OCP_ABORT("Not Completed!");
146  }
147  OCP_DBL XiPhase(const OCP_DBL& Pin,
148  const OCP_DBL& Tin,
149  const OCP_DBL* Ziin,
150  const USI& tarPhase) override
151  {
152  OCP_ABORT("Not Completed!");
153  return 0;
154  };
156  const OCP_DBL& Pbb,
157  const OCP_DBL& Tin,
158  const OCP_DBL* Ziin,
159  const USI& tarPhase) override
160  {
161  OCP_ABORT("Not Completed!");
162  return 0;
163  };
164 
165  // for Well
167  const vector<SolventINJ>& sols,
168  const OCP_DBL& Psurf,
169  const OCP_DBL& Tsurf) override
170  {
171  OCP_ABORT("Not Completed!");
172  };
173 
174 private:
175  OCPTable PVTW;
176 };
177 
179 // BOMixture_OW
181 
182 class BOMixture_OW : public BOMixture
183 {
184 public:
185  BOMixture_OW() = default;
186  BOMixture_OW(const ParamReservoir& rs_param, const USI& i);
187  void Flash(const OCP_DBL& Pin, const OCP_DBL& Tin, const OCP_DBL* Niin) override;
188  void InitFlashIMPEC(const OCP_DBL& Pin,
189  const OCP_DBL& Pbbin,
190  const OCP_DBL& Tin,
191  const OCP_DBL* Sjin,
192  const OCP_DBL& Vpore,
193  const OCP_DBL* Ziin,
194  const OCP_USI& bId) override;
195  void InitFlashFIM(const OCP_DBL& Pin,
196  const OCP_DBL& Pbbin,
197  const OCP_DBL& Tin,
198  const OCP_DBL* Sjin,
199  const OCP_DBL& Vpore,
200  const OCP_DBL* Ziin,
201  const OCP_USI& bId) override;
202  void FlashIMPEC(const OCP_DBL& Pin,
203  const OCP_DBL& Tin,
204  const OCP_DBL* Niin,
205  const USI& lastNP,
206  const OCP_DBL* xijin,
207  const OCP_USI& bId) override;
208  void FlashFIM(const OCP_DBL& Pin,
209  const OCP_DBL& Tin,
210  const OCP_DBL* Niin,
211  const OCP_DBL* Sjin,
212  const USI& lastNP,
213  const OCP_DBL* xijin,
214  const OCP_USI& bId) override;
215  void FlashFIMn(const OCP_DBL& Pin,
216  const OCP_DBL& Tin,
217  const OCP_DBL* Niin,
218  const OCP_DBL* Sjin,
219  const OCP_DBL* xijin,
220  const OCP_DBL* njin,
221  const USI* phaseExistin,
222  const USI& lastNP,
223  const OCP_USI& bId) override
224  {
225  OCP_ABORT("Not Completed!");
226  }
227  OCP_DBL XiPhase(const OCP_DBL& Pin,
228  const OCP_DBL& Tin,
229  const OCP_DBL* Ziin,
230  const USI& tarPhase) override;
231  OCP_DBL RhoPhase(const OCP_DBL& Pin,
232  const OCP_DBL& Pbb,
233  const OCP_DBL& Tin,
234  const OCP_DBL* Ziin,
235  const USI& tarPhase) override;
236 
237  // for Well
238  void SetupWellOpt(WellOpt& opt,
239  const vector<SolventINJ>& sols,
240  const OCP_DBL& Psurf,
241  const OCP_DBL& Tsurf) override;
242 
243 private:
244  OCPTable PVDO;
245  OCPTable PVTW;
246  vector<OCP_DBL> data;
248  vector<OCP_DBL> cdata;
250 };
251 
253 // BOMixture_ODGW
255 
256 class BOMixture_ODGW : public BOMixture
257 {
258 public:
259  BOMixture_ODGW() = default;
260  BOMixture_ODGW(const ParamReservoir& rs_param, const USI& i);
261 
262  void Flash(const OCP_DBL& Pin, const OCP_DBL& Tin, const OCP_DBL* Niin) override;
263  void InitFlashIMPEC(const OCP_DBL& Pin,
264  const OCP_DBL& Pbbin,
265  const OCP_DBL& Tin,
266  const OCP_DBL* Sjin,
267  const OCP_DBL& Vpore,
268  const OCP_DBL* Ziin,
269  const OCP_USI& bId) override;
270  void InitFlashFIM(const OCP_DBL& Pin,
271  const OCP_DBL& Pbbin,
272  const OCP_DBL& Tin,
273  const OCP_DBL* Sjin,
274  const OCP_DBL& Vpore,
275  const OCP_DBL* Ziin,
276  const OCP_USI& bId) override;
277  void FlashIMPEC(const OCP_DBL& Pin,
278  const OCP_DBL& Tin,
279  const OCP_DBL* Niin,
280  const USI& lastNP,
281  const OCP_DBL* xijin,
282  const OCP_USI& bId) override;
283  void FlashFIM(const OCP_DBL& Pin,
284  const OCP_DBL& Tin,
285  const OCP_DBL* Niin,
286  const OCP_DBL* Sjin,
287  const USI& lastNP,
288  const OCP_DBL* xijin,
289  const OCP_USI& bId) override;
290  void FlashFIMn(const OCP_DBL& Pin,
291  const OCP_DBL& Tin,
292  const OCP_DBL* Niin,
293  const OCP_DBL* Sjin,
294  const OCP_DBL* xijin,
295  const OCP_DBL* njin,
296  const USI* phaseExistin,
297  const USI& lastNP,
298  const OCP_USI& bId) override
299  {
300  OCP_ABORT("Not Completed!");
301  }
302  OCP_DBL XiPhase(const OCP_DBL& Pin,
303  const OCP_DBL& Tin,
304  const OCP_DBL* Ziin,
305  const USI& tarPhase) override;
306  OCP_DBL RhoPhase(const OCP_DBL& Pin,
307  const OCP_DBL& Pbb,
308  const OCP_DBL& Tin,
309  const OCP_DBL* Ziin,
310  const USI& tarPhase) override;
311 
312  // for Well
313  void SetupWellOpt(WellOpt& opt,
314  const vector<SolventINJ>& sols,
315  const OCP_DBL& Psurf,
316  const OCP_DBL& Tsurf) override;
317 
318 private:
319  OCPTable PVCO;
320  OCPTable PVDG;
321  OCPTable PVTW;
322  vector<OCP_DBL> data;
324  vector<OCP_DBL> cdata;
326 };
327 
328 #endif /* end if __MIXTUREBO_HEADER__ */
329 
330 /*----------------------------------------------------------------------------*/
331 /* Brief Change History of This File */
332 /*----------------------------------------------------------------------------*/
333 /* Author Date Actions */
334 /*----------------------------------------------------------------------------*/
335 /* Shizhe Li Oct/01/2021 Create file */
336 /* Chensong Zhang Oct/15/2021 Format file */
337 /*----------------------------------------------------------------------------*/
Mixture class declaration.
unsigned int USI
Generic unsigned integer.
Definition: OCPConst.hpp:23
double OCP_DBL
Double precision.
Definition: OCPConst.hpp:27
unsigned int OCP_USI
Long unsigned integer.
Definition: OCPConst.hpp:25
OCPTable class declaration.
#define OCP_ABORT(msg)
Abort if critical error happens.
Definition: UtilError.hpp:47
void FlashFIM(const OCP_DBL &Pin, const OCP_DBL &Tin, const OCP_DBL *Niin, const OCP_DBL *Sjin, const USI &lastNP, const OCP_DBL *xijin, const OCP_USI &bId) override
Flash calculation with moles of components and Calculate the derivative.
OCP_DBL RhoPhase(const OCP_DBL &Pin, const OCP_DBL &Pbb, const OCP_DBL &Tin, const OCP_DBL *Ziin, const USI &tarPhase) override
return mass density of phase
void SetupWellOpt(WellOpt &opt, const vector< SolventINJ > &sols, const OCP_DBL &Psurf, const OCP_DBL &Tsurf) override
void FlashIMPEC(const OCP_DBL &Pin, const OCP_DBL &Tin, const OCP_DBL *Niin, const USI &lastNP, const OCP_DBL *xijin, const OCP_USI &bId) override
Flash calculation with moles of components.
OCP_DBL XiPhase(const OCP_DBL &Pin, const OCP_DBL &Tin, const OCP_DBL *Ziin, const USI &tarPhase) override
return mass density of phase
void Flash(const OCP_DBL &Pin, const OCP_DBL &Tin, const OCP_DBL *Niin) override
flash calculation with saturation of phases.
OCP_DBL RhoPhase(const OCP_DBL &Pin, const OCP_DBL &Pbb, const OCP_DBL &Tin, const OCP_DBL *Ziin, const USI &tarPhase) override
return mass density of phase
OCP_DBL XiPhase(const OCP_DBL &Pin, const OCP_DBL &Tin, const OCP_DBL *Ziin, const USI &tarPhase) override
return mass density of phase
void FlashFIM(const OCP_DBL &Pin, const OCP_DBL &Tin, const OCP_DBL *Niin, const OCP_DBL *Sjin, const USI &lastNP, const OCP_DBL *xijin, const OCP_USI &bId) override
Flash calculation with moles of components and Calculate the derivative.
void Flash(const OCP_DBL &Pin, const OCP_DBL &Tin, const OCP_DBL *Niin) override
flash calculation with saturation of phases.
void FlashIMPEC(const OCP_DBL &Pin, const OCP_DBL &Tin, const OCP_DBL *Niin, const USI &lastNP, const OCP_DBL *xijin, const OCP_USI &bId) override
Flash calculation with moles of components.
void SetupWellOpt(WellOpt &opt, const vector< SolventINJ > &sols, const OCP_DBL &Psurf, const OCP_DBL &Tsurf) override
void SetupWellOpt(WellOpt &opt, const vector< SolventINJ > &sols, const OCP_DBL &Psurf, const OCP_DBL &Tsurf) override
Definition: MixtureBO.hpp:166
OCP_DBL RhoPhase(const OCP_DBL &Pin, const OCP_DBL &Pbb, const OCP_DBL &Tin, const OCP_DBL *Ziin, const USI &tarPhase) override
return mass density of phase
Definition: MixtureBO.hpp:155
void Flash(const OCP_DBL &Pin, const OCP_DBL &Tin, const OCP_DBL *Niin) override
flash calculation with saturation of phases.
Definition: MixtureBO.hpp:92
void FlashFIM(const OCP_DBL &Pin, const OCP_DBL &Tin, const OCP_DBL *Niin, const OCP_DBL *Sjin, const USI &lastNP, const OCP_DBL *xijin, const OCP_USI &bId) override
Flash calculation with moles of components and Calculate the derivative.
Definition: MixtureBO.hpp:125
void FlashIMPEC(const OCP_DBL &Pin, const OCP_DBL &Tin, const OCP_DBL *Niin, const USI &lastNP, const OCP_DBL *xijin, const OCP_USI &bId) override
Flash calculation with moles of components.
Definition: MixtureBO.hpp:116
OCP_DBL XiPhase(const OCP_DBL &Pin, const OCP_DBL &Tin, const OCP_DBL *Ziin, const USI &tarPhase) override
return mass density of phase
Definition: MixtureBO.hpp:147
BOMixture is inherited class of Mixture, it's used for black oil model.
Definition: MixtureBO.hpp:23
OCP_DBL std_RhoW
The density of water at surface conditions : lb/ft3.
Definition: MixtureBO.hpp:77
void CalProdWeight(const OCP_DBL &Pin, const OCP_DBL &Tin, const OCP_DBL *Niin, const vector< OCP_DBL > &prodPhase, vector< OCP_DBL > &prodWeight) override
Calculate ProdWeight for PROD well.
Definition: MixtureBO.hpp:41
OCP_DBL std_RhoG
The density of gas at surface conditions : lb/ft3.
Definition: MixtureBO.hpp:76
OCP_DBL std_RhoO
< others.
Definition: MixtureBO.hpp:67
void CalProdRate(const OCP_DBL &Pin, const OCP_DBL &Tin, const OCP_DBL *Niin, vector< OCP_DBL > &prodRate) override
Calculate Production rate for PROD well.
Definition: MixtureBO.hpp:50
USI numCom
num of components.
Definition: Mixture.hpp:242