OpenCAEPoro  v0.5.0
A simulator for multicomponent porous media flow
MixtureBO3_ODGW.cpp
Go to the documentation of this file.
1 
12 #include "MixtureBO.hpp"
13 
15 // BOMixture_ODGW
17 
18 BOMixture_ODGW::BOMixture_ODGW(const ParamReservoir& rs_param, const USI& i)
19 {
21  numPhase = 3;
22  numCom = 3;
23  BOMixtureInit(rs_param);
24 
25  PVTW.Setup(rs_param.PVTW_T.data[i]);
26  PVCO.Setup(rs_param.PVCO_T.data[i]);
27  PVDG.Setup(rs_param.PVDG_T.data[i]);
28 
29  data.resize(6, 0);
30  cdata.resize(6, 0);
31 }
32 
33 void BOMixture_ODGW::Flash(const OCP_DBL& Pin, const OCP_DBL& Tin, const OCP_DBL* Niin)
34 {
35  FlashIMPEC(Pin, Tin, Niin, 0, 0, 0);
36 }
37 
38 void BOMixture_ODGW::InitFlashIMPEC(const OCP_DBL& Pin,
39  const OCP_DBL& Pbbin,
40  const OCP_DBL& Tin,
41  const OCP_DBL* Sjin,
42  const OCP_DBL& Vpore,
43  const OCP_DBL* Ziin,
44  const OCP_USI& bId)
45 {
46  for (USI j = 0; j < 3; j++) phaseExist[j] = OCP_FALSE;
47  for (USI i = 0; i < 3; i++) Ni[i] = 0;
48  fill(xij.begin(), xij.end(), 0.0);
49 
50  P = Pin;
51  S[1] = Sjin[1]; // gas saturation
52  S[2] = Sjin[2]; // water saturation
53 
54  // Water Property
55  PVTW.Eval_All(0, P, data, cdata);
56  OCP_DBL Pw0 = data[0];
57  OCP_DBL bw0 = data[1];
58  OCP_DBL cbw = data[2];
59  OCP_DBL bw = bw0 * (1 - cbw * (P - Pw0));
60  OCP_DBL bwp = -cbw * bw0;
61 
62  mu[2] = data[3];
63  rho[2] = std_RhoW / bw;
64  xi[2] = 1 / (CONV1 * bw);
65  Ni[2] = Vpore * S[2] * xi[2];
66 
67  USI phasecae;
68 
69  if (1 - S[1] - S[2] < TINY) {
70  if (S[1] < TINY)
71  phasecae = PHASE_W; // case 1 : water, no oil, no gas
72  else
73  phasecae = PHASE_GW; // case 2 : water, gas, no oil
74  } else if (S[1] < TINY)
75  phasecae = PHASE_OW; // case 3 : water, oil, no gas
76  else
77  phasecae = PHASE_ODGW; // case 4 : water, oil, gas
78 
79  switch (phasecae) {
80  case PHASE_W:
81  {
82  // water
83  phaseExist[2] = OCP_TRUE;
84  S[0] = 0;
85  S[1] = 0;
86  S[2] = 1;
87  xij[2 * 3 + 2] = 1;
88 
89  // hypothetical Oil property
90  PVCO.Eval_All(0, P, data, cdata);
91  OCP_DBL rs = data[1];
92  OCP_DBL bo = data[2];
93 
94  // hypothetical Gas property
95  PVDG.Eval_All(0, P, data, cdata);
96  OCP_DBL bg = data[1] * (CONV1 / 1000);
97 
98  // total
99  vj[0] = 0;
100  vj[1] = 0;
101  vj[2] = CONV1 * Ni[2] * bw;
102  vf = vj[2];
103  vfP = CONV1 * Ni[2] * bwp;
104  vfi[0] = CONV1 * bo - 1000 * rs * bg;
105  vfi[1] = 1000 * bg;
106  vfi[2] = CONV1 * bw;
107 
108  break;
109  }
110  case PHASE_GW:
111  {
112  // water, gas
113  phaseExist[1] = OCP_TRUE;
114  phaseExist[2] = OCP_TRUE;
115  xij[1 * 3 + 1] = 1;
116  xij[2 * 3 + 2] = 1;
117 
118  // hypothetical Oil property
119  PVCO.Eval_All(0, P, data, cdata);
120  OCP_DBL rs = data[1];
121  OCP_DBL bo = data[2];
122 
123  // gas property
124  PVDG.Eval_All(0, P, data, cdata);
125  OCP_DBL bg = data[1] * (CONV1 / 1000);
126  OCP_DBL cbg = cdata[1] * (CONV1 / 1000);
127 
128  mu[1] = data[2];
129  xi[1] = 1 / 1000 / bg;
130  rho[1] = std_RhoG / bg;
131  Ni[1] = Vpore * S[1] * xi[1];
132 
133  vj[0] = 0;
134  vj[1] = 1000 * Ni[1] * bg; // Ni[0] = 0;
135  vj[2] = CONV1 * Ni[2] * bw;
136  // total
137  vf = vj[1] + vj[2];
138  S[0] = 0;
139  S[1] = vj[1] / vf;
140  S[2] = vj[2] / vf;
141  vfP = 1000 * Ni[1] * cbg + CONV1 * Ni[2] * bwp;
142  vfi[0] = CONV1 * bo - 1000 * rs * bg;
143  vfi[1] = 1000 * bg;
144  vfi[2] = CONV1 * bw;
145 
146  break;
147  }
148  case PHASE_OW:
149  {
150  // water, oil, unsaturated
151  phaseExist[0] = OCP_TRUE;
152  phaseExist[2] = OCP_TRUE;
153 
154  // oil property
155  OCP_DBL Pbb = Pbbin;
156  PVCO.Eval_All(0, Pbb, data, cdata);
157  OCP_DBL rs = data[1];
158  OCP_DBL bosat = data[2];
159  OCP_DBL muosat = data[3];
160  OCP_DBL cbosat = data[4];
161  OCP_DBL cmuosat = data[5];
162  OCP_DBL bo = bosat * (1 - cbosat * (P - Pbb));
163  OCP_DBL bop = -bosat * cbosat;
164  OCP_DBL dBo_drs = bo / bosat * cdata[2] +
165  bosat * (cdata[4] * (Pbb - P) + cbosat * cdata[0]);
166  dBo_drs /= cdata[1];
167 
168  Ni[0] = Vpore * (1 - S[1] - S[2]) / (CONV1 * bo);
169  Ni[1] = Ni[0] * rs;
170  xi[0] = (1 + rs) / (CONV1 * bo);
171  rho[0] = (std_RhoO + (1000 / CONV1) * rs * std_RhoG) / bo;
172  mu[0] = muosat * (1 + cmuosat * (P - Pbb));
173 
174  xij[0 * 3 + 0] = Ni[0] / (Ni[0] + Ni[1]);
175  xij[0 * 3 + 1] = 1 - xij[0 * 3 + 0];
176  xij[1 * 3 + 1] = 1;
177  xij[2 * 3 + 2] = 1;
178 
179  // total
180  vj[0] = CONV1 * Ni[0] * bo;
181  vj[2] = CONV1 * Ni[2] * bw;
182  vf = vj[0] + vj[2];
183  S[0] = vj[0] / vf;
184  S[1] = 0;
185  S[2] = vj[2] / vf;
186  vfP = CONV1 * (Ni[0] * bop + Ni[2] * bwp);
187  vfi[0] = CONV1 * (bo - dBo_drs * (Ni[1] / Ni[0]));
188  vfi[1] = CONV1 * dBo_drs;
189  vfi[2] = CONV1 * bw;
190 
191  break;
192  }
193  case PHASE_ODGW:
194  {
195  phaseExist[0] = OCP_TRUE;
196  phaseExist[1] = OCP_TRUE;
197  phaseExist[2] = OCP_TRUE;
198 
199  // oil property
200  PVCO.Eval_All(0, P, data, cdata);
201  OCP_DBL rs = data[1];
202  OCP_DBL bo = data[2];
203  OCP_DBL crs = cdata[1];
204  OCP_DBL cbosat = cdata[2];
205 
206  mu[0] = data[3];
207  Ni[0] = Vpore * (1 - S[1] - S[2]) / (CONV1 * bo);
208  xi[0] = (1 + rs) / (CONV1 * bo);
209  rho[0] = (std_RhoO + (1000 / CONV1) * rs * std_RhoG) / bo;
210 
211  // gas property
212  PVDG.Eval_All(0, P, data, cdata);
213  OCP_DBL bg = data[1] * (CONV1 / 1000);
214  OCP_DBL cbg = cdata[1] * (CONV1 / 1000);
215  Ni[1] = Vpore * S[1] / bg / 1000 + Ni[0] * rs;
216  xi[1] = 1 / CONV1 / data[1];
217  rho[1] = std_RhoG / bg;
218  mu[1] = data[2];
219 
220  xij[0 * 3 + 0] = 1 / (1 + rs);
221  xij[0 * 3 + 1] = 1 - xij[0 * 3 + 0];
222  xij[1 * 3 + 1] = 1;
223  xij[2 * 3 + 2] = 1;
224 
225  // total
226  vj[0] = CONV1 * Ni[0] * bo;
227  vj[1] = 1000 * (Ni[1] - rs * Ni[0]) * bg;
228  vj[2] = CONV1 * Ni[2] * bw;
229 
230  vf = vj[0] + vj[1] + vj[2];
231  S[0] = vj[0] / vf;
232  S[1] = vj[1] / vf;
233  S[2] = vj[2] / vf;
234  vfP = CONV1 * Ni[0] * cbosat +
235  1000 * (-crs * Ni[0] * bg + (Ni[1] - rs * Ni[0]) * cbg) +
236  CONV1 * Ni[2] * bwp;
237  vfi[0] = CONV1 * bo - 1000 * rs * bg;
238  vfi[1] = 1000 * bg;
239  vfi[2] = CONV1 * bw;
240 
241  break;
242  }
243  }
244 }
245 
246 void BOMixture_ODGW::InitFlashFIM(const OCP_DBL& Pin,
247  const OCP_DBL& Pbbin,
248  const OCP_DBL& Tin,
249  const OCP_DBL* Sjin,
250  const OCP_DBL& Vpore,
251  const OCP_DBL* Ziin,
252  const OCP_USI& bId)
253 {
254  // Calculate Ni only frist, then call FlashDer()
255  for (USI i = 0; i < 3; i++) Ni[i] = 0;
256 
257  P = Pin;
258  S[1] = Sjin[1]; // gas saturation
259  S[2] = Sjin[2]; // water saturation
260 
261  // Water Property
262  PVTW.Eval_All(0, P, data, cdata);
263  OCP_DBL Pw0 = data[0];
264  OCP_DBL bw0 = data[1];
265  OCP_DBL cbw = data[2];
266  OCP_DBL bw = bw0 * (1 - cbw * (P - Pw0));
267 
268  xi[2] = 1 / (CONV1 * bw);
269  Ni[2] = Vpore * S[2] * xi[2];
270 
271  USI phasecae;
272 
273  if (1 - S[1] - S[2] < TINY) {
274  if (S[1] < TINY)
275  phasecae = PHASE_W; // case 1 : water, no oil, no gas
276  else
277  phasecae = PHASE_GW; // case 2 : water, gas, no oil
278  } else if (S[1] < TINY)
279  phasecae = PHASE_OW; // case 3 : water, oil, no gas
280  else
281  phasecae = PHASE_ODGW; // case 4 : water, oil, gas
282 
283  switch (phasecae) {
284  case PHASE_W:
285  {
286  // water
287  break;
288  }
289  case PHASE_GW:
290  {
291  // water, gas
292 
293  // Ni[1]
294  PVDG.Eval_All(0, P, data, cdata);
295  OCP_DBL bg = data[1] * (CONV1 / 1000);
296  xi[1] = 1 / 1000 / bg;
297  Ni[1] = Vpore * S[1] * xi[1];
298  break;
299  }
300  case PHASE_OW:
301  {
302  // water, oil, unsaturated
303  // Ni[0] and Ni[1]
304  OCP_DBL Pbb = Pbbin;
305  PVCO.Eval_All(0, Pbb, data, cdata);
306  OCP_DBL rs = data[1];
307  OCP_DBL bosat = data[2];
308  OCP_DBL cbosat = data[4];
309  OCP_DBL bo = bosat * (1 - cbosat * (P - Pbb));
310 
311  Ni[0] = Vpore * (1 - S[1] - S[2]) / (CONV1 * bo);
312  Ni[1] = Ni[0] * rs;
313 
314  break;
315  }
316  case PHASE_ODGW:
317  {
318  // oil property
319  PVCO.Eval_All(0, P, data, cdata);
320  OCP_DBL rs = data[1];
321  OCP_DBL bo = data[2];
322  Ni[0] = Vpore * (1 - S[1] - S[2]) / (CONV1 * bo);
323 
324  // gas property
325  PVDG.Eval_All(0, P, data, cdata);
326  OCP_DBL bg = data[1] * (CONV1 / 1000);
327  Ni[1] = Vpore * S[1] / bg / 1000 + Ni[0] * rs;
328  break;
329  }
330  }
331  FlashFIM(Pin, Tin, &Ni[0], 0, 0, 0, 0);
332 }
333 
335  const OCP_DBL& Tin,
336  const OCP_DBL* Niin,
337  const USI& lastNP,
338  const OCP_DBL* xijin,
339  const OCP_USI& bId)
340 {
341  for (USI j = 0; j < 3; j++) phaseExist[j] = OCP_FALSE;
342  fill(xij.begin(), xij.end(), 0.0);
343 
344  P = Pin;
345  Nt = 0;
346  for (USI i = 0; i < numCom; i++) {
347  Ni[i] = Niin[i];
348  Nt += Ni[i];
349  }
350 
351  // Water property
352  PVTW.Eval_All(0, P, data, cdata);
353  OCP_DBL Pw0 = data[0];
354  OCP_DBL bw0 = data[1];
355  OCP_DBL cbw = data[2];
356  OCP_DBL bw = bw0 * (1 - cbw * (P - Pw0));
357  OCP_DBL bwp = -cbw * bw0;
358 
359  mu[2] = data[3];
360  xi[2] = 1 / (CONV1 * bw);
361  rho[2] = std_RhoW / bw;
362 
363  USI phasecase;
364  OCP_DBL Rs_sat = PVCO.Eval(0, P, 1);
365 
366  if (Ni[0] < Nt * TINY) {
367  if (Ni[1] <= Ni[0] * Rs_sat)
368  phasecase = PHASE_W; // water, no oil, no gas
369  else
370  phasecase = PHASE_GW; // water, gas, no oil
371  } else if (Ni[1] <= Ni[0] * Rs_sat)
372  phasecase = PHASE_OW; // water, oil, no gas
373  else
374  phasecase = PHASE_ODGW; // water, oil ,gas
375 
376  switch (phasecase) {
377  case PHASE_W:
378  {
379  // water
380  phaseExist[2] = OCP_TRUE;
381  S[0] = 0;
382  S[1] = 0;
383  S[2] = 1;
384  xij[2 * 3 + 2] = 1;
385 
386  // hypothetical Oil property
387  PVCO.Eval_All(0, P, data, cdata);
388  OCP_DBL rs = data[1];
389  OCP_DBL bo = data[2];
390 
391  // hypothetical Gas property
392  PVDG.Eval_All(0, P, data, cdata);
393  OCP_DBL bg = data[1] * (CONV1 / 1000);
394 
395  // total
396  vj[0] = 0;
397  vj[1] = 0;
398  vj[2] = CONV1 * Ni[2] * bw;
399  vf = vj[2];
400  vfP = CONV1 * Ni[2] * bwp;
401  vfi[0] = CONV1 * bo - 1000 * rs * bg;
402  vfi[1] = 1000 * bg;
403  vfi[2] = CONV1 * bw;
404 
405  break;
406  }
407  case PHASE_GW:
408  {
409  // water, gas
410  phaseExist[1] = OCP_TRUE;
411  phaseExist[2] = OCP_TRUE;
412  xij[1 * 3 + 1] = 1;
413  xij[2 * 3 + 2] = 1;
414 
415  // hypothetical Oil property
416  PVCO.Eval_All(0, P, data, cdata);
417  OCP_DBL rs = data[1];
418  OCP_DBL bo = data[2];
419 
420  // gas property
421  PVDG.Eval_All(0, P, data, cdata);
422  OCP_DBL bg = data[1] * (CONV1 / 1000);
423  OCP_DBL cbg = cdata[1] * (CONV1 / 1000);
424 
425  mu[1] = data[2];
426  xi[1] = 1 / 1000 / bg;
427  rho[1] = std_RhoG / bg;
428 
429  // total
430  vj[0] = 0;
431  vj[1] = 1000 * (Ni[1] - rs * Ni[0]) * bg;
432  vj[2] = CONV1 * Ni[2] * bw;
433 
434 #ifdef DEBUG
435  if (vj[1] <= 0) OCP_ABORT("gas volume <= 0");
436 #endif // DEBUG
437 
438  vf = vj[1] + vj[2];
439  S[0] = 0;
440  S[1] = vj[1] / vf;
441  S[2] = vj[2] / vf;
442  vfP = 1000 * Ni[1] * cbg + CONV1 * Ni[2] * bwp;
443  vfi[0] = CONV1 * bo - 1000 * rs * bg;
444  vfi[1] = 1000 * bg;
445  vfi[2] = CONV1 * bw;
446 
447  break;
448  }
449  case PHASE_OW:
450  {
451  // water, oil
452  phaseExist[0] = OCP_TRUE;
453  phaseExist[2] = OCP_TRUE;
454  xij[0 * 3 + 0] = Ni[0] / (Ni[0] + Ni[1]);
455  xij[0 * 3 + 1] = 1 - xij[0 * 3 + 0];
456  xij[1 * 3 + 1] = 1;
457  xij[2 * 3 + 2] = 1;
458 
459  // oil property
460  OCP_DBL rs = Ni[1] / Ni[0];
461  PVCO.Eval_All(1, rs, data, cdata);
462  OCP_DBL pbb = data[0];
463  OCP_DBL bosat = data[2];
464  OCP_DBL muosat = data[3];
465  OCP_DBL cbosat = data[4];
466  OCP_DBL cmuosat = data[5];
467  OCP_DBL bo = bosat * (1 - cbosat * (P - pbb));
468  OCP_DBL bop = -bosat * cbosat;
469  OCP_DBL dBo_drs = bo / bosat * cdata[2] +
470  bosat * (cdata[4] * (pbb - P) + cbosat * cdata[0]);
471 
472  mu[0] = muosat * (1 + cmuosat * (P - pbb));
473  xi[0] = (1 + rs) / (CONV1 * bo);
474  rho[0] = (std_RhoO + (1000 / CONV1) * rs * std_RhoG) / bo;
475 
476  // total
477  vj[0] = CONV1 * Ni[0] * bo;
478  vj[2] = CONV1 * Ni[2] * bw;
479  vf = vj[0] + vj[2];
480  S[0] = vj[0] / vf;
481  S[1] = 0;
482  S[2] = vj[2] / vf;
483  vfP = CONV1 * (Ni[0] * bop + Ni[2] * bwp);
484  vfi[0] = CONV1 * (bo - dBo_drs * (Ni[1] / Ni[0]));
485  vfi[1] = CONV1 * dBo_drs;
486  vfi[2] = CONV1 * bw;
487 
488  break;
489  }
490  case PHASE_ODGW:
491  {
492  phaseExist[0] = OCP_TRUE;
493  phaseExist[1] = OCP_TRUE;
494  phaseExist[2] = OCP_TRUE;
495 
496  // oil property
497  PVCO.Eval_All(0, P, data, cdata);
498  OCP_DBL rs = data[1];
499  OCP_DBL bo = data[2];
500  OCP_DBL crs = cdata[1];
501  OCP_DBL cbosat = cdata[2];
502 
503  mu[0] = data[3];
504  xi[0] = (1 + rs) / (CONV1 * bo);
505  rho[0] = (std_RhoO + (1000 / CONV1) * rs * std_RhoG) / bo;
506 
507  // gas property
508  PVDG.Eval_All(0, P, data, cdata);
509  OCP_DBL bg = data[1] * (CONV1 / 1000);
510  OCP_DBL cbg = cdata[1] * (CONV1 / 1000);
511 
512  mu[1] = data[2];
513  xi[1] = 1 / CONV1 / data[1];
514  rho[1] = std_RhoG / bg;
515 
516  // total
517  xij[0 * 3 + 0] = 1 / (1 + rs);
518  xij[0 * 3 + 1] = 1 - xij[0 * 3 + 0];
519  xij[1 * 3 + 1] = 1;
520  xij[2 * 3 + 2] = 1;
521 
522  vj[0] = CONV1 * Ni[0] * bo;
523  vj[1] = 1000 * (Ni[1] - rs * Ni[0]) * bg;
524  vj[2] = CONV1 * Ni[2] * bw;
525  vf = vj[0] + vj[1] + vj[2];
526  S[0] = vj[0] / vf;
527  S[1] = vj[1] / vf;
528  S[2] = vj[2] / vf;
529  vfP = CONV1 * Ni[0] * cbosat +
530  1000 * (-crs * Ni[0] * bg + (Ni[1] - rs * Ni[0]) * cbg) +
531  CONV1 * Ni[2] * bwp;
532  vfi[0] = CONV1 * bo - 1000 * rs * bg;
533  vfi[1] = 1000 * bg;
534  vfi[2] = CONV1 * bw;
535 
536  break;
537  }
538  }
539 }
540 
542  const OCP_DBL& Tin,
543  const OCP_DBL* Niin,
544  const OCP_DBL* Sjin,
545  const USI& lastNP,
546  const OCP_DBL* xijin,
547  const OCP_USI& bId)
548 {
549  for (USI j = 0; j < 3; j++) {
550  phaseExist[j] = OCP_FALSE;
551  rhoP[j] = 0;
552  xiP[j] = 0;
553  muP[j] = 0;
554  }
555  fill(xij.begin(), xij.end(), 0.0);
556  fill(rhox.begin(), rhox.end(), 0.0);
557  fill(xix.begin(), xix.end(), 0.0);
558  fill(mux.begin(), mux.end(), 0.0);
559  fill(dXsdXp.begin(), dXsdXp.end(), 0.0);
560  fill(pSderExist.begin(), pSderExist.end(), OCP_FALSE);
561  fill(pVnumCom.begin(), pVnumCom.end(), 0);
562 
563  P = Pin;
564  Nt = 0;
565  for (USI i = 0; i < numCom; i++) {
566  Ni[i] = Niin[i];
567  Nt += Ni[i];
568  }
569 
570  // Water property
571  PVTW.Eval_All(0, P, data, cdata);
572  OCP_DBL Pw0 = data[0];
573  OCP_DBL bw0 = data[1];
574  OCP_DBL cbw = data[2];
575  OCP_DBL bw = bw0 * (1 - cbw * (P - Pw0));
576  OCP_DBL bwp = -cbw * bw0;
577 
578  mu[2] = data[3];
579  xi[2] = 1 / CONV1 / bw;
580  rho[2] = std_RhoW / bw;
581 
582  muP[2] = cdata[3];
583  xiP[2] = -bwp / (bw * bw * CONV1);
584  rhoP[2] = CONV1 * xiP[2] * std_RhoW;
585 
586  USI phasecase;
587  OCP_DBL Rs_sat = PVCO.Eval(0, P, 1);
588 
589  if (Ni[0] < Nt * TINY) {
590  if (Ni[1] <= Ni[0] * Rs_sat)
591  phasecase = PHASE_W; // water, no oil, no gas
592  else
593  phasecase = PHASE_GW; // water, gas, no oil
594  }
595  // Beacareful when NO = NG = 0, if it's possible.
596  else if (Ni[1] <= Ni[0] * Rs_sat)
597  phasecase = PHASE_OW; // water, oil, no gas
598  else
599  phasecase = PHASE_ODGW; // water, oil ,gas
600 
601  switch (phasecase) {
602  case PHASE_W:
603  {
604  // water
605  phaseExist[2] = OCP_TRUE;
606  S[0] = 0;
607  S[1] = 0;
608  S[2] = 1;
609  xij[2 * 3 + 2] = 1;
610 
611  // hypothetical Oil property
612  PVCO.Eval_All(0, P, data, cdata);
613  OCP_DBL rs = data[1];
614  OCP_DBL bo = data[2];
615 
616  // hypothetical Gas property
617  PVDG.Eval_All(0, P, data, cdata);
618  OCP_DBL bg = data[1] * (CONV1 / 1000);
619 
620  // total
621  vj[0] = 0;
622  vj[1] = 0;
623  vj[2] = CONV1 * Ni[2] * bw;
624  vf = vj[2];
625  vfP = CONV1 * Ni[2] * bwp;
626  vfi[0] = CONV1 * bo - 1000 * rs * bg;
627  vfi[1] = 1000 * bg;
628  vfi[2] = CONV1 * bw;
629 
630  // dXsdXp[0] = 0; // dSo / dP
631  dXsdXp[1] = CONV1 * bo / vf; // dSo / dNo
632  // dXsdXp[2] = 0; // dSo / dNg;
633  // dXsdXp[3] = 0; // dSo / dNw;
634 
635  // dXsdXp[1 * 4 + 0] = 0; // dSg / dP
636  // dXsdXp[1 * 4 + 1] = 0; // dSg / dNo
637  dXsdXp[1 * 4 + 2] = 1000 * bg / vf; // dSg / dNg
638  // dXsdXp[1 * 4 + 3] = 0; // dSg / dNw
639 
640  dXsdXp[2 * 4 + 0] = (Ni[2] * bwp * CONV1 - S[2] * vfP) / vf; // dSw / dP
641  dXsdXp[2 * 4 + 1] = -S[2] * vfi[0] / vf; // dSw / dNo
642  dXsdXp[2 * 4 + 2] = -S[2] * vfi[1] / vf; // dSw / dNg
643  dXsdXp[2 * 4 + 3] = (CONV1 * bw - S[2] * vfi[2]) / vf; // dSw / dNw
644 
645  pSderExist[0] = OCP_TRUE;
646  pSderExist[1] = OCP_TRUE;
647  pSderExist[2] = OCP_TRUE;
648  // pVnumCom[0] = 0; pVnumCom[1] = 0; pVnumCom[2] = 0;
649 
650  break;
651  }
652  case PHASE_GW:
653  {
654  // water, gas
655  phaseExist[1] = OCP_TRUE;
656  phaseExist[2] = OCP_TRUE;
657  xij[1 * 3 + 1] = 1;
658  xij[2 * 3 + 2] = 1;
659 
660  // hypothetical Oil property
661  PVCO.Eval_All(0, P, data, cdata);
662  OCP_DBL rs = data[1];
663  OCP_DBL bo = data[2];
664 
665  // gas property
666  PVDG.Eval_All(0, P, data, cdata);
667  OCP_DBL bg = data[1] * (CONV1 / 1000);
668  OCP_DBL cbg = cdata[1] * (CONV1 / 1000);
669 
670  mu[1] = data[2];
671  xi[1] = 1 / 1000 / bg;
672  rho[1] = std_RhoG / bg;
673 
674  muP[1] = cdata[2];
675  xiP[1] = -cdata[1] / (CONV1 * data[1] * data[1]);
676  rhoP[1] = 1000 * std_RhoG * xiP[1];
677 
678  // total
679  vj[0] = 0;
680  vj[1] = 1000 * (Ni[1] - rs * Ni[0]) * bg;
681  vj[2] = CONV1 * Ni[2] * bw;
682 
683 #ifdef DEBUG
684  if (vj[1] <= 0) OCP_ABORT("gas volume <= 0");
685 #endif // DEBUG
686 
687  vf = vj[1] + vj[2];
688  S[0] = 0;
689  S[1] = vj[1] / vf;
690  S[2] = vj[2] / vf;
691  vfP = 1000 * Ni[1] * cbg + CONV1 * Ni[2] * bwp;
692  vfi[0] = CONV1 * bo - 1000 * rs * bg;
693  vfi[1] = 1000 * bg;
694  vfi[2] = CONV1 * bw;
695 
696  dXsdXp[0] = 0; // dSo / dP
697  dXsdXp[1] = CONV1 * bo / vf; // dSo / dNo
698  dXsdXp[2] = 0; // dSo / dNg
699  dXsdXp[3] = 0; // dSo / dNw
700 
701  dXsdXp[1 * 4 + 0] = (1000 * Ni[1] * cbg - S[1] * vfP) / vf; // dSg / dP
702  dXsdXp[1 * 4 + 1] = (-1000 * rs * bg - S[1] * vfi[0]) / vf; // dSg / dNo
703  dXsdXp[1 * 4 + 2] = (1000 * bg - S[1] * vfi[1]) / vf; // dSg / dNg
704  dXsdXp[1 * 4 + 3] = -S[1] * vfi[2] / vf; // dSg / dNw
705 
706  dXsdXp[2 * 4 + 0] = (CONV1 * Ni[2] * bwp - S[2] * vfP) / vf; // dSw / dP
707  dXsdXp[2 * 4 + 1] = -S[2] * vfi[0] / vf; // dSw / dNo
708  dXsdXp[2 * 4 + 2] = -S[2] * vfi[1] / vf; // dSw / dNg
709  dXsdXp[2 * 4 + 3] = (CONV1 * bw - S[2] * vfi[2]) / vf; // dSw / dNw
710 
711  pSderExist[0] = OCP_TRUE;
712  pSderExist[1] = OCP_TRUE;
713  pSderExist[2] = OCP_TRUE;
714  // pVnumCom[0] = 0; pVnumCom[1] = 0; pVnumCom[2] = 0;
715 
716  break;
717  }
718  case PHASE_OW:
719  {
720  // water, oil
721  phaseExist[0] = OCP_TRUE;
722  phaseExist[2] = OCP_TRUE;
723  xij[0 * 3 + 0] = Ni[0] / (Ni[0] + Ni[1]);
724  xij[0 * 3 + 1] = 1 - xij[0 * 3 + 0];
725  xij[1 * 3 + 1] = 1;
726  xij[2 * 3 + 2] = 1;
727 
728  // oil property
729  OCP_DBL rs = Ni[1] / Ni[0];
730  PVCO.Eval_All(1, rs, data, cdata);
731  OCP_DBL pbb = data[0];
732  OCP_DBL bosat = data[2];
733  OCP_DBL muosat = data[3];
734  OCP_DBL cbosat = data[4];
735  OCP_DBL cmuosat = data[5];
736  OCP_DBL bo = bosat * (1 - cbosat * (P - pbb));
737  OCP_DBL bop = -bosat * cbosat;
738  OCP_DBL dBo_drs = (1 - cbosat * (P - pbb)) * cdata[2] +
739  bosat * (cdata[4] * (pbb - P) + cbosat * cdata[0]);
740 
741  mu[0] = muosat * (1 + cmuosat * (P - pbb));
742  xi[0] = (1 + rs) / (CONV1 * bo);
743  rho[0] = (std_RhoO + (1000 / CONV1) * rs * std_RhoG) / bo;
744 
745  muP[0] = muosat * cmuosat;
746  xiP[0] = -(1 + rs) * bop / (CONV1 * bo * bo);
747  rhoP[0] =
748  -(std_RhoO + (1000 / CONV1) * rs * std_RhoG) / (bo * bo) * bop;
749 
750  OCP_DBL muo_rs = mu[0] / muosat * cdata[3] +
751  muosat * (cdata[5] * (P - pbb) - cmuosat * cdata[0]);
752  OCP_DBL xio_rs =
753  1 / CONV1 / bo - (1 + rs) * dBo_drs / (CONV1 * bo * bo);
754  OCP_DBL rhoo_rs =
755  (1000 / CONV1) * std_RhoG / bo -
756  (std_RhoO + (1000 / CONV1) * rs * std_RhoG) * dBo_drs / (bo * bo);
757 
758  // total
759  vj[0] = CONV1 * Ni[0] * bo;
760  vj[2] = CONV1 * Ni[2] * bw;
761  vf = vj[0] + vj[2];
762  S[0] = vj[0] / vf;
763  S[1] = 0;
764  S[2] = vj[2] / vf;
765  vfP = CONV1 * (Ni[0] * bop + Ni[2] * bwp);
766  vfi[0] = CONV1 * (bo - dBo_drs * (Ni[1] / Ni[0]));
767  vfi[1] = CONV1 * dBo_drs;
768  vfi[2] = CONV1 * bw;
769 
770  dXsdXp[0] =
771  (-CONV1 * Ni[0] * cbosat * bosat - S[0] * vfP) / vf; // dSo / dP
772  dXsdXp[1] =
773  (CONV1 * bo - CONV1 * dBo_drs * (Ni[1] / Ni[0]) - S[0] * vfi[0]) /
774  vf; // dSo / dNo
775  dXsdXp[2] = (CONV1 * dBo_drs - S[0] * vfi[1]) / vf; // dSo / dNg
776  dXsdXp[3] = -S[0] / vf * vfi[2]; // dSo / dNw
777 
778 #ifdef OCP_OLD_FIM
779  dXsdXp[2 * 4 + 0] = (Ni[2] * bwp * CONV1 - S[2] * vfP) / vf; // dSw / dP
780  dXsdXp[2 * 4 + 1] = -S[2] * vfi[0] / vf; // dSw / dNo
781  dXsdXp[2 * 4 + 2] = -S[2] * vfi[1] / vf; // dSw / dNg
782  dXsdXp[2 * 4 + 3] = (CONV1 * bw - S[2] * vfi[2]) / vf; // dSw / dNw
783 
784  dXsdXp[3 * 4 + 1] = Ni[1] / pow((Ni[0] + Ni[1]), 2); // d Xoo / d No
785  dXsdXp[3 * 4 + 2] = -Ni[0] / pow((Ni[0] + Ni[1]), 2); // d Xoo / d Ng
786  dXsdXp[4 * 4 + 1] = -dXsdXp[3 * 4 + 1]; // d Xgo / d No
787  dXsdXp[4 * 4 + 2] = -dXsdXp[3 * 4 + 2]; // d Xgo / d Ng
788 #else
789  dXsdXp[1 * 4 + 0] = (Ni[2] * bwp * CONV1 - S[2] * vfP) / vf; // dSw / dP
790  dXsdXp[1 * 4 + 1] = -S[2] * vfi[0] / vf; // dSw / dNo
791  dXsdXp[1 * 4 + 2] = -S[2] * vfi[1] / vf; // dSw / dNg
792  dXsdXp[1 * 4 + 3] = (CONV1 * bw - S[2] * vfi[2]) / vf; // dSw / dNw
793 
794  dXsdXp[2 * 4 + 1] = Ni[1] / pow((Ni[0] + Ni[1]), 2); // d Xoo / d No
795  dXsdXp[2 * 4 + 2] = -Ni[0] / pow((Ni[0] + Ni[1]), 2); // d Xoo / d Ng
796  dXsdXp[3 * 4 + 1] = -dXsdXp[2 * 4 + 1]; // d Xgo / d No
797  dXsdXp[3 * 4 + 2] = -dXsdXp[2 * 4 + 2]; // d Xgo / d Ng
798 
799 #endif // OCP_OLD_FIM
800 
801  pSderExist[0] = OCP_TRUE;
802  pSderExist[2] = OCP_TRUE;
803  pVnumCom[0] = 2;
804 
805  OCP_DBL tmp = xij[0] * xij[0];
806 
807  mux[0] = -muo_rs * xij[1] / tmp; // dMuo / dXoo
808  mux[1] = muo_rs / xij[0]; // dMuo / dXgo
809 
810  xix[0] = -xio_rs * xij[1] / tmp; // dXio / dXoo
811  xix[1] = xio_rs / xij[0]; // dXio / dXgo
812 
813  rhox[0] = -rhoo_rs * xij[1] / tmp; // dRhoo / dXoo
814  rhox[1] = rhoo_rs / xij[0]; // dRhoo / dXgo
815 
816  // New! right I think
817  // OCP_DBL tmp_new = (1 + rs) * (1 + rs);
818 
819  // mux[0] = -muo_rs * tmp_new; // dMuo / dXoo
820  // mux[1] = muo_rs * tmp_new; // dMuo / dXgo
821 
822  // xix[0] = -xio_rs * tmp_new; // dXio / dXoo
823  // xix[1] = xio_rs * tmp_new; // dXio / dXgo
824 
825  // rhox[0] = -rhoo_rs * tmp_new; // dRhoo / dXoo
826  // rhox[1] = rhoo_rs * tmp_new; // dRhoo / dXgo
827 
828  break;
829  }
830  case PHASE_ODGW:
831  {
832  phaseExist[0] = OCP_TRUE;
833  phaseExist[1] = OCP_TRUE;
834  phaseExist[2] = OCP_TRUE;
835 
836  // oil property
837  PVCO.Eval_All(0, P, data, cdata);
838  OCP_DBL rs = data[1];
839  OCP_DBL bo = data[2];
840  OCP_DBL crs = cdata[1];
841  OCP_DBL cbosat = cdata[2];
842 
843  mu[0] = data[3];
844  xi[0] = (1 + rs) / (CONV1 * bo);
845  rho[0] = (std_RhoO + (1000 / CONV1) * rs * std_RhoG) / bo;
846 
847  muP[0] = cdata[3];
848  xiP[0] = (crs * bo - (1 + rs) * cbosat) / (bo * bo) / CONV1;
849  rhoP[0] =
850  (1000 / CONV1) * std_RhoG * crs / bo -
851  (std_RhoO + (1000 / CONV1) * rs * std_RhoG) * cbosat / (bo * bo);
852 
853  // gas property
854  PVDG.Eval_All(0, P, data, cdata);
855  OCP_DBL bg = data[1] * (CONV1 / 1000);
856  OCP_DBL cbg = cdata[1] * (CONV1 / 1000);
857 
858  mu[1] = data[2];
859  xi[1] = 1 / CONV1 / data[1];
860  rho[1] = std_RhoG / bg;
861 
862  muP[1] = cdata[2];
863  xiP[1] = -cdata[1] / (CONV1 * data[1] * data[1]);
864  rhoP[1] = 1000 * std_RhoG * xiP[1];
865 
866  // total
867  xij[0 * 3 + 0] = 1 / (1 + rs);
868  xij[0 * 3 + 1] = 1 - xij[0 * 3 + 0];
869  xij[1 * 3 + 1] = 1;
870  xij[2 * 3 + 2] = 1;
871 
872  vj[0] = CONV1 * Ni[0] * bo;
873  vj[1] = 1000 * (Ni[1] - rs * Ni[0]) * bg;
874  vj[2] = CONV1 * Ni[2] * bw;
875  vf = vj[0] + vj[1] + vj[2];
876  S[0] = vj[0] / vf;
877  S[1] = vj[1] / vf;
878  S[2] = vj[2] / vf;
879  vfP = CONV1 * Ni[0] * cbosat +
880  1000 * (-crs * Ni[0] * bg + (Ni[1] - rs * Ni[0]) * cbg) +
881  CONV1 * Ni[2] * bwp;
882  vfi[0] = CONV1 * bo - 1000 * rs * bg;
883  vfi[1] = 1000 * bg;
884  vfi[2] = CONV1 * bw;
885 
886  dXsdXp[0] = (CONV1 * Ni[0] * cbosat - S[0] * vfP) / vf; // dSo / dP
887  dXsdXp[1] = (CONV1 * bo - S[0] * vfi[0]) / vf; // dSo / dNo
888  dXsdXp[2] = -S[0] * vfi[1] / vf; // dSo / dNg
889  dXsdXp[3] = -S[0] * vfi[2] / vf; // dSo / dNw
890 
891  dXsdXp[1 * 4 + 0] = (1000 * (Ni[1] - rs * Ni[0]) * cbg -
892  1000 * Ni[0] * bg * crs - S[1] * vfP) /
893  vf; // dSg / dP
894  dXsdXp[1 * 4 + 1] = (-1000 * rs * bg - S[1] * vfi[0]) / vf; // dSg / dNo
895  dXsdXp[1 * 4 + 2] = (1000 * bg - S[1] * vfi[1]) / vf; // dSg / dNg
896  dXsdXp[1 * 4 + 3] = -S[1] * vfi[2] / vf; // dSg / dNw
897 
898  dXsdXp[2 * 4 + 0] = (Ni[2] * bwp * CONV1 - S[2] * vfP) / vf; // dSw / dP
899  dXsdXp[2 * 4 + 1] = -S[2] * vfi[0] / vf; // dSw / dNo
900  dXsdXp[2 * 4 + 2] = -S[2] * vfi[1] / vf; // dSw / dNg
901  dXsdXp[2 * 4 + 3] = (CONV1 * bw - S[2] * vfi[2]) / vf; // dSw / dNw
902 
903  dXsdXp[3 * 4 + 0] = -crs / ((1 + rs) * (1 + rs)); // d Xoo / dP
904  dXsdXp[4 * 4 + 0] = -dXsdXp[3 * 4 + 0]; // d Xgo / dP
905 
906  pSderExist[0] = OCP_TRUE;
907  pSderExist[1] = OCP_TRUE;
908  pSderExist[2] = OCP_TRUE;
909  pVnumCom[0] = 2;
910 
911  break;
912  }
913  }
914 
915 #ifdef Debug
916  for (auto vj : dXsdXp) {
917  if (!isfinite(vj)) {
918  OCP_ABORT("Nan in dXsdXp!");
919  }
920  }
921 #endif
922 }
923 
924 OCP_DBL
926  const OCP_DBL& Tin,
927  const OCP_DBL* Ziin,
928  const USI& tarPhase)
929 {
930  if (tarPhase == GAS) {
931  OCP_DBL bg = PVDG.Eval(0, Pin, 1);
932  // OCP_DBL xig = 1 / (CONV1 * bg);
933  OCP_DBL xig = 1 / CONV1 / bg;
934  return xig;
935  } else if (tarPhase == WATER) {
936 
937  PVTW.Eval_All(0, Pin, data, cdata);
938  OCP_DBL Pw0 = data[0];
939  OCP_DBL bw0 = data[1];
940  OCP_DBL cbw = data[2];
941  OCP_DBL bw = bw0 * (1 - cbw * (Pin - Pw0));
942  OCP_DBL xiw = 1 / CONV1 / bw;
943  return xiw;
944  } else {
945  OCP_ABORT("Wrong tarPhase!");
946  }
947 }
948 
949 OCP_DBL
951  const OCP_DBL& Pbbin,
952  const OCP_DBL& Tin,
953  const OCP_DBL* Ziin,
954  const USI& tarPhase)
955 {
956 
957  if (tarPhase == OIL) {
958  PVCO.Eval_All(0, Pbbin, data, cdata);
959  OCP_DBL rs = data[1];
960  OCP_DBL bosat = data[2];
961  OCP_DBL cbosat = data[4];
962  OCP_DBL bo = bosat * (1 - cbosat * (Pin - Pbbin));
963  OCP_DBL rhoO = (std_RhoO + (1000 / CONV1) * rs * std_RhoG) / bo;
964  return rhoO;
965  } else if (tarPhase == GAS) {
966  OCP_DBL bg = PVDG.Eval(0, Pin, 1);
967  OCP_DBL rhog = (1000 / CONV1) * std_RhoG / bg;
968  return rhog;
969  } else if (tarPhase == WATER) {
970  PVTW.Eval_All(0, Pin, data, cdata);
971  OCP_DBL Pw0 = data[0];
972  OCP_DBL bw0 = data[1];
973  OCP_DBL cbw = data[2];
974  OCP_DBL bw = bw0 * (1 - cbw * (Pin - Pw0));
975  OCP_DBL rhow = std_RhoW / bw;
976  return rhow;
977  } else {
978  OCP_ABORT("WRONG tarPhase!");
979  }
980 }
981 
983  const vector<SolventINJ>& sols,
984  const OCP_DBL& Psurf,
985  const OCP_DBL& Tsurf)
986 {
987  const USI wellType = opt.WellType();
988  if (wellType == INJ) {
989  const string fluidName = opt.InjFluidType();
990  opt.SetInjFactor(1.0);
991 
992  if (fluidName == "WAT") {
993  vector<OCP_DBL> tmpZi({0, 0, 1});
994  opt.SetInjZi(tmpZi);
995  opt.SetInjProdPhase(WATER);
996  } else if (fluidName == "GAS") {
997  vector<OCP_DBL> tmpZi({0, 1, 0});
998  opt.SetInjZi(tmpZi);
999  opt.SetInjProdPhase(GAS);
1000  } else {
1001  OCP_ABORT("WRONG Injecting Fluid!");
1002  }
1003 
1004  } else if (wellType == PROD) {
1005  vector<OCP_DBL> tmpWght(3, 0);
1006  switch (opt.OptMode()) {
1007  case BHP_MODE:
1008  break;
1009  case ORATE_MODE:
1010  tmpWght[0] = 1;
1011  break;
1012  case GRATE_MODE:
1013  tmpWght[1] = 1;
1014  break;
1015  case WRATE_MODE:
1016  tmpWght[2] = 1;
1017  break;
1018  case LRATE_MODE:
1019  tmpWght[0] = tmpWght[2] = 1;
1020  break;
1021  default:
1022  OCP_ABORT("WRONG Opt Mode!");
1023  break;
1024  }
1025  opt.SetProdPhaseWeight(tmpWght);
1026  } else {
1027  OCP_ABORT("Wrong Well Type!");
1028  }
1029 }
1030 
1031 /*----------------------------------------------------------------------------*/
1032 /* Brief Change History of This File */
1033 /*----------------------------------------------------------------------------*/
1034 /* Author Date Actions */
1035 /*----------------------------------------------------------------------------*/
1036 /* Shizhe Li Oct/01/2021 Create file */
1037 /* Chensong Zhang Oct/15/2021 Format file */
1038 /*----------------------------------------------------------------------------*/
MixtureBO class declaration.
const OCP_DBL TINY
Small constant.
Definition: OCPConst.hpp:38
unsigned int USI
Generic unsigned integer.
Definition: OCPConst.hpp:23
const USI GAS
Fluid type = gas.
Definition: OCPConst.hpp:92
double OCP_DBL
Double precision.
Definition: OCPConst.hpp:27
const OCP_DBL CONV1
1 bbl = CONV1 ft3
Definition: OCPConst.hpp:63
const USI LRATE_MODE
Well option = fixed fluid rate???
Definition: OCPConst.hpp:134
const USI WRATE_MODE
Well option = fixed water rate.
Definition: OCPConst.hpp:133
const USI WATER
Fluid type = water.
Definition: OCPConst.hpp:93
const USI PHASE_ODGW
Phase type = oil-dry gas-water.
Definition: OCPConst.hpp:115
const USI ORATE_MODE
Well option = fixed oil rate.
Definition: OCPConst.hpp:131
const USI OIL
Fluid type = oil.
Definition: OCPConst.hpp:91
const USI BLKOIL_ODGW
black oil model with live oil, dry gas, water
Definition: OCPConst.hpp:102
const USI PHASE_W
Phase type = water only.
Definition: OCPConst.hpp:111
unsigned int OCP_USI
Long unsigned integer.
Definition: OCPConst.hpp:25
const USI PHASE_OW
Phase type = oil-water.
Definition: OCPConst.hpp:113
const USI PROD
Well type = producer.
Definition: OCPConst.hpp:123
const USI INJ
Well type = injector.
Definition: OCPConst.hpp:122
const USI BHP_MODE
Well option = fixed bottom-hole-pressure.
Definition: OCPConst.hpp:135
const USI GRATE_MODE
Well option = fixed gas rate.
Definition: OCPConst.hpp:132
const USI PHASE_GW
Phase type = gas-water.
Definition: OCPConst.hpp:112
#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 std_RhoW
The density of water at surface conditions : lb/ft3.
Definition: MixtureBO.hpp:77
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
vector< OCP_DBL > rhoP
d rho / dP: numphase
Definition: Mixture.hpp:265
USI numCom
num of components.
Definition: Mixture.hpp:242
vector< OCP_DBL > dXsdXp
derivatives of second variables wrt. primary variables
Definition: Mixture.hpp:275
vector< OCP_DBL > rho
mass density of phase: numPhase
Definition: Mixture.hpp:254
vector< OCP_DBL > mu
viscosity of phase: numPhase
Definition: Mixture.hpp:256
OCP_DBL P
pressure when flash calculation.
Definition: Mixture.hpp:243
vector< OCP_BOOL > pSderExist
Existence of derivative of phase saturation.
Definition: Mixture.hpp:286
USI numPhase
num of phases.
Definition: Mixture.hpp:241
vector< OCP_DBL > xix
d xi[j] / d x[i][j]: numphase * numCom
Definition: Mixture.hpp:270
vector< OCP_DBL > vj
volume of phase: numPhase;
Definition: Mixture.hpp:251
OCP_DBL vfP
Definition: Mixture.hpp:259
vector< OCP_DBL > rhox
d rho[j] / d x[i][j]: numphase * numCom
Definition: Mixture.hpp:267
vector< OCP_DBL > S
saturation of phase: numPhase
Definition: Mixture.hpp:250
vector< OCP_DBL > xij
Nij / nj: numPhase*numCom.
Definition: Mixture.hpp:253
OCP_DBL Nt
Total moles of Components.
Definition: Mixture.hpp:247
vector< OCP_DBL > Ni
moles of component: numCom
Definition: Mixture.hpp:248
vector< OCP_DBL > vfi
Definition: Mixture.hpp:262
vector< OCP_BOOL > phaseExist
existence of phase: numPhase
Definition: Mixture.hpp:249
vector< OCP_DBL > xiP
d xi / dP: numphase
Definition: Mixture.hpp:268
OCP_DBL vf
volume of total fluids.
Definition: Mixture.hpp:246
vector< USI > pVnumCom
num of variable components in the phase
Definition: Mixture.hpp:287
vector< OCP_DBL > muP
d mu / dP: numPhase
Definition: Mixture.hpp:271
vector< OCP_DBL > mux
d mu[j] / d x[i][j]: numphase * numCom
Definition: Mixture.hpp:273
USI mixtureType
Definition: Mixture.hpp:238
vector< OCP_DBL > xi
molar density of phase: numPhase
Definition: Mixture.hpp:255
USI Eval_All(const USI &j, const OCP_DBL &val, vector< OCP_DBL > &outdata, vector< OCP_DBL > &slope)
Careful: the memory outdata and slope have not be allocated before.
Definition: OCPTable.cpp:47
void Setup(const vector< vector< OCP_DBL >> &src)
Setup tables from existing data of table.
Definition: OCPTable.cpp:27
OCP_DBL Eval(const USI &j, const OCP_DBL &val, const USI &destj)
Definition: OCPTable.cpp:126
TableSet PVDG_T
Table set of PVDG.
TableSet PVTW_T
Table set of PVTW.
TableSet PVCO_T
Table set of PVCO.
vector< vector< vector< OCP_DBL > > > data
All table with the same name.