OpenCAEPoro  v0.5.0
A simulator for multicomponent porous media flow
ParamReservoir.cpp
Go to the documentation of this file.
1 
12 #include "ParamReservoir.hpp"
13 
15 vector<OCP_DBL>* ParamReservoir::FindPtr(const string& varName)
16 {
17  vector<OCP_DBL>* myPtr = nullptr;
18 
19  switch (Map_Str2Int(&varName[0], varName.size())) {
20  case Map_Str2Int("DX", 2):
21  dx.reserve(numGrid);
22  myPtr = &dx;
23  break;
24 
25  case Map_Str2Int("DY", 2):
26  dy.reserve(numGrid);
27  myPtr = &dy;
28  break;
29 
30  case Map_Str2Int("DZ", 2):
31  dz.reserve(numGrid);
32  myPtr = &dz;
33  break;
34 
35  case Map_Str2Int("COORD", 5):
36  coord.reserve((dimens.nx + 1) * (dimens.ny + 1) * 6);
37  myPtr = &coord;
38  break;
39 
40  case Map_Str2Int("ZCORN", 5):
41  zcorn.reserve(numGrid * 8);
42  myPtr = &zcorn;
43  break;
44 
45  case Map_Str2Int("PORO", 4):
46  poro.reserve(numGrid);
47  myPtr = &poro;
48  break;
49 
50  case Map_Str2Int("NTG", 3):
51  ntg.reserve(numGrid);
52  myPtr = &ntg;
53  break;
54 
55  case Map_Str2Int("PERMX", 5):
56  permX.reserve(numGrid);
57  myPtr = &permX;
58  break;
59 
60  case Map_Str2Int("PERMY", 5):
61  permY.reserve(numGrid);
62  myPtr = &permY;
63  break;
64 
65  case Map_Str2Int("PERMZ", 5):
66  permZ.reserve(numGrid);
67  myPtr = &permZ;
68  break;
69 
70  case Map_Str2Int("THCONR", 6):
71  thconr.reserve(numGrid);
72  myPtr = &thconr;
73  break;
74 
75  case Map_Str2Int("TOPS", 4):
76  tops.reserve(dimens.nx * dimens.ny);
77  myPtr = &tops;
78  break;
79 
80  case Map_Str2Int("PRESSURE", 8):
81  P.reserve(numGrid);
82  myPtr = &P;
83  break;
84 
85  case Map_Str2Int("Ni", 2):
86  Ni.reserve(numGrid);
87  myPtr = &Ni;
88  break;
89 
90  case Map_Str2Int("SWATINIT", 8):
91  Swat.reserve(numGrid);
92  myPtr = &Swat;
93  ScalePcow = OCP_TRUE;
94  break;
95 
96  case Map_Str2Int("SATNUM", 6):
97  SATNUM.activity = OCP_TRUE;
98  SATNUM.data.reserve(numGrid);
99  myPtr = &SATNUM.data;
100  break;
101 
102  case Map_Str2Int("PVTNUM", 6):
103  PVTNUM.activity = OCP_TRUE;
104  PVTNUM.data.reserve(numGrid);
105  myPtr = &PVTNUM.data;
106  break;
107 
108  case Map_Str2Int("ROCKNUM", 7):
109  ROCKNUM.activity = OCP_TRUE;
110  ROCKNUM.data.reserve(numGrid);
111  myPtr = &ROCKNUM.data;
112  break;
113  }
114 
115  return myPtr;
116 }
117 
119 TableSet* ParamReservoir::FindPtr_T(const string& varName)
120 {
121  TableSet* myPtr = nullptr;
122 
123  switch (Map_Str2Int(&varName[0], varName.size())) {
124  case Map_Str2Int("SWFN", 4):
125  myPtr = &SWFN_T;
126  break;
127 
128  case Map_Str2Int("SWOF", 4):
129  myPtr = &SWOF_T;
130  break;
131 
132  case Map_Str2Int("SGFN", 4):
133  myPtr = &SGFN_T;
134  break;
135 
136  case Map_Str2Int("SGOF", 4):
137  myPtr = &SGOF_T;
138  break;
139 
140  case Map_Str2Int("SOF3", 4):
141  myPtr = &SOF3_T;
142  break;
143 
144  case Map_Str2Int("PBVD", 4):
145  myPtr = &PBVD_T;
146  break;
147 
148  case Map_Str2Int("PVCO", 4):
149  myPtr = &PVCO_T;
150  break;
151 
152  case Map_Str2Int("PVDO", 4):
153  myPtr = &PVDO_T;
154  break;
155 
156  case Map_Str2Int("PVDG", 4):
157  myPtr = &PVDG_T;
158  break;
159 
160  case Map_Str2Int("PVTW", 4):
161  myPtr = &PVTW_T;
162  break;
163 
164  case Map_Str2Int("ZMFVD", 5):
165  myPtr = &ZMFVD_T;
166  break;
167 
168  case Map_Str2Int("TEMPVD", 6):
169  myPtr = &TEMPVD_T;
170  break;
171  }
172 
173  return myPtr;
174 }
175 
178 {
179  InitTable();
180 
181  gravity.data.resize(3);
182  gravity.data[0] = 45.5; // oil
183  gravity.data[1] = 1.0; // pure water
184  gravity.data[2] = 0.7773; // air
185 
186  density.data.resize(3);
187  density.data[0] = 37.457; // The density of oil at surface conditions: lb/ft3
188  density.data[1] = 62.366416; // The density of water at surface conditions: lb/ft3
189  density.data[2] = 0.062428; // The density of gas at surface conditions: lb/ft3
190 
191  rsTemp = 60.0;
192 }
193 
196 {
197  SWFN_T.name = "SWFN";
198  SWFN_T.colNum = 3;
199  SWOF_T.name = "SWOF";
200  SWOF_T.colNum = 4;
201  SGFN_T.name = "SGFN";
202  SGFN_T.colNum = 3;
203  SGOF_T.name = "SGOF";
204  SGOF_T.colNum = 4;
205  SOF3_T.name = "SOF3";
206  SOF3_T.colNum = 3;
207  PBVD_T.name = "PBVD";
208  PBVD_T.colNum = 2;
209  PVCO_T.name = "PVCO";
210  PVCO_T.colNum = 6;
211  PVDO_T.name = "PVDO";
212  PVDO_T.colNum = 3;
213  PVDG_T.name = "PVDG";
214  PVDG_T.colNum = 3;
215  PVTW_T.name = "PVTW";
216  PVTW_T.colNum = 5;
217  ZMFVD_T.name = "ZMFVD"; // colnum equals numCom(hydrocarbon) + 1
218  TEMPVD_T.name = "TEMPVD"; // colnum equals 2
219  TEMPVD_T.colNum = 2;
220 }
221 
223 template <typename T>
224 void ParamReservoir::setVal(vector<T>& obj, const T& val, const vector<USI>& index)
225 {
226  USI Nx = dimens.nx;
227  USI Ny = dimens.ny;
228  OCP_USI NxNy = Nx * Ny;
229  OCP_USI id = 0;
230 
231  for (USI k = index[4]; k <= index[5]; k++) {
232  for (USI j = index[2]; j <= index[3]; j++) {
233  for (USI i = index[0]; i <= index[1]; i++) {
234  id = k * NxNy + j * Nx + i;
235  obj[id] = val;
236  }
237  }
238  }
239 }
240 
242 template <typename T>
243 void ParamReservoir::CopyVal(vector<T>& obj,
244  const vector<T>& src,
245  const vector<USI>& index)
246 {
247  USI Nx = dimens.nx;
248  USI Ny = dimens.ny;
249  OCP_USI NxNy = Nx * Ny;
250  OCP_USI id = 0;
251 
252  for (USI k = index[4]; k <= index[5]; k++) {
253  for (USI j = index[2]; j <= index[3]; j++) {
254  for (USI i = index[0]; i <= index[1]; i++) {
255  id = k * NxNy + j * Nx + i;
256  obj[id] = src[id];
257  }
258  }
259  }
260 }
261 
263 void ParamReservoir::MultiplyVal(vector<OCP_DBL>& obj,
264  const OCP_DBL& val,
265  const vector<USI>& index)
266 {
267  USI Nx = dimens.nx;
268  USI Ny = dimens.ny;
269  OCP_USI NxNy = Nx * Ny;
270  OCP_USI id = 0;
271 
272  for (USI k = index[4]; k <= index[5]; k++) {
273  for (USI j = index[2]; j <= index[3]; j++) {
274  for (USI i = index[0]; i <= index[1]; i++) {
275  id = k * NxNy + j * Nx + i;
276  obj[id] *= val;
277  }
278  }
279  }
280 }
281 
283 void ParamReservoir::InputCOMPS(ifstream& ifs)
284 {
285  comps = OCP_TRUE;
286  vector<string> vbuf;
287  ReadLine(ifs, vbuf);
288  numCom = stoi(vbuf[0]);
290  comsParam.Init();
291 
292  cout << endl << "COMPS" << endl;
293  cout << numCom << endl;
294 }
295 
297 void ParamReservoir::InputDIMENS(ifstream& ifs)
298 {
299  vector<string> vbuf;
300  ReadLine(ifs, vbuf);
301  dimens.nx = stoi(vbuf[0]);
302  dimens.ny = stoi(vbuf[1]);
303  dimens.nz = stoi(vbuf[2]);
305 
306  DisplayDIMENS();
307 }
308 
311 {
312  cout << "\n---------------------" << endl
313  << "DIMENS"
314  << "\n---------------------" << endl;
315  cout << " " << dimens.nx << " " << dimens.ny << " " << dimens.nz << endl;
316 }
317 
319 void ParamReservoir::InputRTEMP(ifstream& ifs)
320 {
321  vector<string> vbuf;
322  ReadLine(ifs, vbuf);
323  if (vbuf[0] == "/") return;
324 
325  rsTemp = stod(vbuf[0]);
326  cout << "RTEMP\n" << rsTemp << endl << endl;
327 }
328 
330 void ParamReservoir::InputEQUALS(ifstream& ifs)
331 {
332  cout << "\n---------------------" << endl
333  << "EQUALS"
334  << "\n---------------------" << endl;
335 
336  vector<USI> index(6, 0);
337  vector<string> vbuf;
338 
339  while (ReadLine(ifs, vbuf)) {
340  if (vbuf[0] == "/") break;
341 
342  for (auto v : vbuf) {
343  if (v != "/") cout << setw(10) << v;
344  }
345  cout << "\n";
346 
347  index[0] = 0, index[1] = dimens.nx - 1;
348  index[2] = 0, index[3] = dimens.ny - 1;
349  index[4] = 0, index[5] = dimens.nz - 1;
350 
351  string objName = vbuf[0];
352  OCP_DBL val = stod(vbuf[1]);
353 
354  DealDefault(vbuf);
355 
356  for (USI n = 2; n < 8; n++) {
357  if (vbuf[n] != "DEFAULT") index[n - 2] = stoi(vbuf[n]) - 1;
358  }
359  if (index[0] < 0 || index[2] < 0 || index[4] < 0 || index[1] > dimens.nx - 1 ||
360  index[3] > dimens.ny - 1 || index[5] > dimens.nz - 1) {
361  OCP_ABORT("WRONG Range in " + objName + " in EQUALS!");
362  }
363 
364  vector<OCP_DBL>* objPtr = FindPtr(objName);
365 
366  if (objPtr != nullptr) {
367  if (objName == "TOPS") {
368  objPtr->resize(dimens.nx * dimens.ny);
369  index[4] = index[5] = 0;
370  } else {
371  objPtr->resize(numGrid);
372  }
373  setVal(*objPtr, val, index);
374  } else {
375  OCP_ABORT("Wrong object name: " + objName);
376  }
377  }
378 }
379 
381 void ParamReservoir::InputGRID(ifstream& ifs, string& keyword)
382 {
383  vector<OCP_DBL>* objPtr = nullptr;
384 
385  objPtr = FindPtr(keyword);
386  if (objPtr == nullptr) {
387  OCP_ABORT("Unknown keyword!");
388  }
389 
390  vector<string> vbuf;
391  while (ReadLine(ifs, vbuf)) {
392  if (vbuf[0] == "/") break;
393 
394  for (auto& str : vbuf) {
395  // if m*n occurs, then push back n m times
396  auto pos = str.find('*');
397  if (pos == string::npos) {
398  objPtr->push_back(stod(str));
399  } else {
400  USI len = str.size();
401  OCP_USI num = stoi(str.substr(0, pos));
402  OCP_DBL val = stod(str.substr(pos + 1, len - (pos + 1)));
403  for (USI i = 0; i < num; i++) objPtr->push_back(val);
404  }
405  }
406  }
407 }
408 
410 void ParamReservoir::InputCOPY(ifstream& ifs)
411 {
412  cout << "\n---------------------" << endl
413  << "COPY"
414  << "\n---------------------" << endl;
415 
416  vector<string> vbuf;
417  vector<USI> index(6, 0);
418 
419  while (ReadLine(ifs, vbuf)) {
420  if (vbuf[0] == "/") break;
421 
422  for (auto v : vbuf) {
423  if (v != "/") cout << setw(10) << v;
424  }
425  cout << "\n";
426 
427  index[0] = 0, index[1] = dimens.nx - 1;
428  index[2] = 0, index[3] = dimens.ny - 1;
429  index[4] = 0, index[5] = dimens.nz - 1;
430 
431  string srcName = vbuf[0];
432  string objName = vbuf[1];
433  DealDefault(vbuf);
434  for (USI n = 2; n < 8; n++) {
435  if (vbuf[n] != "DEFAULT") index[n - 2] = stoi(vbuf[n]) - 1;
436  }
437 
438  vector<OCP_DBL>* srcPtr = FindPtr(srcName);
439  vector<OCP_DBL>* objPtr = FindPtr(objName);
440  if (srcPtr != nullptr && objPtr != nullptr) {
441  objPtr->resize(srcPtr->size());
442  CopyVal(*objPtr, *srcPtr, index);
443  } else {
444  OCP_ABORT("Wrong object names: " + srcName + ", " + objName);
445  }
446  }
447 }
448 
450 void ParamReservoir::InputMULTIPLY(ifstream& ifs)
451 {
452  vector<string> vbuf;
453  vector<USI> index(6, 0);
454 
455  while (ReadLine(ifs, vbuf)) {
456  if (vbuf[0] == "/") break;
457 
458  index[0] = 0, index[1] = dimens.nx - 1;
459  index[2] = 0, index[3] = dimens.ny - 1;
460  index[4] = 0, index[5] = dimens.nz - 1;
461 
462  string objName = vbuf[0];
463  OCP_DBL val = stod(vbuf[1]);
464 
465  DealDefault(vbuf);
466  for (USI n = 2; n < 8; n++) {
467  if (vbuf[n] != "DEFAULT") index[n - 2] = stoi(vbuf[n]) - 1;
468  }
469 
470  vector<OCP_DBL>* objPtr = FindPtr(objName);
471  if (objPtr != nullptr) {
472  if (objName == "TOPS") {
473  index[4] = index[5] = 0;
474  }
475  MultiplyVal(*objPtr, val, index);
476  } else {
477  OCP_ABORT("Wrong object name: " + objName);
478  }
479  }
480 }
481 
483 void ParamReservoir::InputTABLE(ifstream& ifs, const string& tabName)
484 {
485  TableSet* obj;
486  obj = FindPtr_T(tabName);
487  if (obj == nullptr) {
488  OCP_ABORT("Wrong table name :" + tabName);
489  }
490 
491  USI col = obj->colNum;
492  if (tabName == "ZMFVD") {
493  if (!comps) OCP_ABORT("COMPS isn't set correctly!");
494  obj->colNum = numCom + 1;
495  col = obj->colNum;
496  }
497  vector<vector<OCP_DBL>> tmpTab(col);
498 
499  vector<string> vbuf;
500  while (ReadLine(ifs, vbuf)) {
501  if (vbuf[0] == "/") break;
502 
503  for (USI i = 0; i < col; i++) {
504  tmpTab[i].push_back(stod(vbuf[i]));
505  }
506 
507  if (vbuf.back() == "/") {
508  obj->data.push_back(tmpTab);
509  for (USI j = 0; j < col; j++) {
510  tmpTab[j].clear();
511  }
512  }
513  }
514  if (!tmpTab[0].empty()) obj->data.push_back(tmpTab);
515 
516  obj->DisplayTable();
517 }
518 
520 void ParamReservoir::InputROCK(ifstream& ifs)
521 {
522  cout << "\n---------------------" << endl
523  << "ROCK"
524  << "\n---------------------" << endl;
525 
526  vector<string> vbuf;
527  while (true) {
528  ReadLine(ifs, vbuf);
529  if (vbuf[0] == "/") break;
530 
531  RockParam rock;
532  rock.type = vbuf[0];
533  rock.Pref = stod(vbuf[1]);
534  rock.cp1 = stod(vbuf[2]);
535 
536  if (rock.type == "LINEAR02") {
537  if (vbuf.size() > 3 && vbuf[3] != "/") {
538  rock.cp2 = stod(vbuf[3]);
539  } else {
540  rock.cp2 = rock.cp1;
541  }
542  }
543  rockSet.push_back(rock);
544 
545  cout << " " << rock.type << " " << rock.Pref << " " << rock.cp1 << " "
546  << rock.cp2 << endl;
547  }
548 }
549 
551 void ParamReservoir::InputROCKT(ifstream& ifs)
552 {
553  cout << "\n---------------------" << endl
554  << "ROCKT"
555  << "\n---------------------" << endl;
556 
557  RockParam rock;
558  vector<string> vbuf;
559  while (true) {
560  ReadLine(ifs, vbuf);
561  if (vbuf[0] == "/") break;
562 
563  USI index = 0;
564  USI len = vbuf.size();
565  while (index < len) {
566  if (vbuf[index] == "*PORFORM") {
567  rock.type = vbuf[index + 1];
568  } else if (vbuf[index] == "*PRPOR") {
569  rock.Pref = stod(vbuf[index + 1]);
570  } else if (vbuf[index] == "*TRPOR") {
571  rock.Tref = stod(vbuf[index + 1]);
572  } else if (vbuf[index] == "*CPOR") {
573  rock.cp1 = stod(vbuf[index + 1]);
574  } else if (vbuf[index] == "*CTPOR") {
575  rock.ct = stod(vbuf[index + 1]);
576  } else if (vbuf[index] == "*CPTPOR") {
577  rock.cpt = stod(vbuf[index + 1]);
578  } else if (vbuf[index] == "*VOLCONST") {
579  if (vbuf[index + 1] == "BULK") rock.ConstRock = OCP_FALSE;
580  } else if (vbuf[index] == "*CP1") {
581  rock.HCP1 = stod(vbuf[index + 1]);
582  } else if (vbuf[index] == "*CP2") {
583  rock.HCP2 = stod(vbuf[index + 1]);
584  }
585  index += 2;
586  }
587  }
588  rockSet.push_back(rock);
589 
590  cout << "*PORFORM " << rock.type << endl;
591  cout << "*PRPOR " << rock.Pref << endl;
592  cout << "*TRPOR " << rock.Tref << endl;
593  cout << "*CPOR " << rock.cp1 << endl;
594  cout << "*CTPOR " << rock.ct << endl;
595  cout << "*CPTPOR " << rock.cpt << endl;
596  cout << "*VOLCONST " << (rock.ConstRock ? "ROCK" : "BULK") << endl;
597  cout << "*CP1 " << rock.HCP1 << endl;
598  cout << "*CP2 " << rock.HCP2 << endl;
599 }
600 
601 void ParamReservoir::InputHLOSS(ifstream& ifs)
602 {
603  cout << "\n---------------------" << endl
604  << "HLOSSPROR"
605  << "\n---------------------" << endl;
606 
607  hLoss.ifHLoss = OCP_TRUE;
608 
609  vector<string> vbuf;
610  while (true) {
611  ReadLine(ifs, vbuf);
612  if (vbuf[0] == "/") break;
613 
614  USI index = 0;
615  USI len = vbuf.size();
616  while (index < len) {
617  if (vbuf[index] == "*OVERBUR") {
618  hLoss.obC = stod(vbuf[index + 1]);
619  hLoss.obK = stod(vbuf[index + 2]);
620  } else if (vbuf[index] == "*UNDERBUR") {
621  hLoss.ubC = stod(vbuf[index + 1]);
622  hLoss.ubK = stod(vbuf[index + 2]);
623  }
624  index += 3;
625  }
626  }
627  cout << "*OVERBUR " << hLoss.obC << " " << hLoss.obK << endl;
628  cout << "*UNDERBUR " << hLoss.ubC << " " << hLoss.ubK << endl;
629 }
630 
632 void ParamReservoir::InputMISCSTR(ifstream& ifs)
633 {
634  if (!comsParam.miscible) {
635  OCP_WARNING("MISCIBLE has not been declared. Keyword ignored!");
636  } else {
637  vector<string> vbuf;
638  ReadLine(ifs, vbuf);
639  if (vbuf[0] == "/") return;
640  if (vbuf.back() == "/") vbuf.pop_back();
641 
642  USI len = vbuf.size();
643  for (USI i = 0; i < len; i++) {
644  miscstr.surTenRef.push_back(stod(vbuf[i]));
645  }
646  }
647  cout << "\n---------------------" << endl
648  << "MISCSTR"
649  << "\n---------------------" << endl;
650  for (auto& v : miscstr.surTenRef) cout << v << " ";
651  cout << endl;
652 }
653 
655 void ParamReservoir::InputGRAVITY(ifstream& ifs)
656 {
657  gravity.activity = OCP_TRUE;
658  vector<string> vbuf;
659  ReadLine(ifs, vbuf);
660  if (vbuf[0] == "/") return;
661  DealDefault(vbuf);
662  OCP_ASSERT(vbuf.size() == 4, "Wrong Keyword GRAVITY!");
663  for (USI i = 0; i < 3; i++) {
664  if (vbuf[i] != "DEFAULT") {
665  gravity.data[i] = stod(vbuf[i]);
666  }
667  }
668 
669  cout << "\n---------------------" << endl
670  << "GRAVITY"
671  << "\n---------------------" << endl;
672  cout << " " << gravity.data[0] << " " << gravity.data[1] << " "
673  << gravity.data[2] << endl;
674 }
675 
677 void ParamReservoir::InputDENSITY(ifstream& ifs)
678 {
679  vector<string> vbuf;
680  ReadLine(ifs, vbuf);
681  if (vbuf[0] == "/") return;
682 
683  DealDefault(vbuf);
684  OCP_ASSERT(vbuf.size() == 3, "Wrong Keyword DENSITY!");
685  for (USI i = 0; i < 3; i++) {
686  if (vbuf[i] != "DEFAULT") {
687  density.activity = OCP_TRUE;
688  density.data[i] = stod(vbuf[i]);
689  }
690  }
691 
692  cout << "\n---------------------" << endl
693  << "DENSITY"
694  << "\n---------------------" << endl;
695  cout << density.data[0] << " " << density.data[1] << " " << density.data[2]
696  << endl;
697 }
698 
700 void ParamReservoir::InputTHCON(ifstream& ifs, const string& keyword)
701 {
702  vector<string> vbuf;
703  ReadLine(ifs, vbuf);
704  if (keyword == "THCONO") {
705  thcono = stod(vbuf[0]);
706  } else if (keyword == "THCONG") {
707  thcong = stod(vbuf[0]);
708  } else if (keyword == "THCONW") {
709  thconw = stod(vbuf[0]);
710  }
711 
712  cout << "THCONO\n" << thcono << endl << endl;
713  cout << "THCONG\n" << thcong << endl << endl;
714  cout << "THCONW\n" << thconw << endl << endl;
715 }
716 
718 void ParamReservoir::InputEQUIL(ifstream& ifs)
719 {
720  vector<string> vbuf;
721  ReadLine(ifs, vbuf);
722  if (vbuf[0] == "/") return;
723 
724  EQUIL.resize(6, 0);
725  DealDefault(vbuf);
726  for (USI i = 0; i < 6; i++) {
727  if (vbuf[i] != "DEFAULT") EQUIL[i] = stod(vbuf[i]);
728  }
729 
730  cout << "\n---------------------" << endl
731  << "EQUIL"
732  << "\n---------------------" << endl;
733  cout << " ";
734  for (USI i = 0; i < 6; i++) cout << EQUIL[i] << " ";
735  cout << endl;
736 }
737 
739 void ParamReservoir::InputTABDIMS(ifstream& ifs)
740 {
741  vector<string> vbuf;
742  ReadLine(ifs, vbuf);
743 
744  if (vbuf.size() < 3) {
745  OCP_ABORT("Input the number of Saturation tables, PVT tables, and Rock tables "
746  "in turn!");
747  }
748 
749  NTSFUN = stoi(vbuf[0]);
750  NTPVT = stoi(vbuf[1]);
751  NTROOC = stoi(vbuf[2]);
752 
753  cout << "\n---------------------" << endl
754  << "TABDIMS"
755  << "\n---------------------" << endl;
756  cout << " " << NTSFUN << " " << NTPVT << " " << NTROOC << endl;
757 }
758 
761 void ParamReservoir::InputRegion(ifstream& ifs, const string& keyword)
762 {
763  Type_A_r<OCP_DBL>* ptr = &PVTNUM;
764  USI lim = NTPVT;
765 
766  if (keyword == "SATNUM") {
767  ptr = &SATNUM;
768  lim = NTSFUN;
769  } else if (keyword == "ACTNUM") {
770  ptr = &ACTNUM;
771  } else if (keyword == "ROCKNUM") {
772  ptr = &ROCKNUM;
773  }
774 
775  ptr->activity = OCP_TRUE;
776  ptr->data.reserve(numGrid);
777  vector<string> vbuf;
778  vector<OCP_USI> obj;
779  vector<USI> region;
780 
781  while (ReadLine(ifs, vbuf)) {
782  if (vbuf[0] == "/") break;
783 
784  for (auto& str : vbuf) {
785  // if m*n occurs, then push back n m times
786  auto pos = str.find('*');
787  if (pos == string::npos) {
788  ptr->data.push_back(stod(str));
789  } else {
790  USI len = str.size();
791  OCP_USI num = stoi(str.substr(0, pos));
792  OCP_DBL val = stod(str.substr(pos + 1, len - (pos + 1)));
793  for (USI i = 0; i < num; i++) ptr->data.push_back(val);
794  }
795  }
796  }
797 
798  cout << "Number of Tables = " << lim << endl;
799 }
800 
803 {
804  CheckGrid();
805  CheckEQUIL();
806  CheckDenGra();
807  CheckPhase();
808  CheckRegion();
809  CheckRock();
810 }
811 
814 {
815  if (coord.size() == 0) {
816  if (tops.size() != dimens.nx * dimens.ny) OCP_ABORT("Wrong TOPS size!");
817  if (dx.size() != numGrid) OCP_ABORT("Wrong DX size!");
818  if (dy.size() != numGrid) OCP_ABORT("Wrong DY size!");
819  if (dz.size() != numGrid) OCP_ABORT("Wrong DZ size!");
820  } else {
821  if (coord.size() != (dimens.nx + 1) * (dimens.ny + 1) * 6)
822  OCP_ABORT("Wrong COORD size!");
823  if (zcorn.size() != numGrid * 8) OCP_ABORT("Wrong ZCORN size!");
824  }
825 
826  if (poro.size() != numGrid) OCP_ABORT("Wrong PORO size!");
827  if (permX.size() != numGrid) OCP_ABORT("Wrong PERMX size!");
828  if (permY.size() != numGrid) OCP_ABORT("Wrong PERMY size!");
829  if (permZ.size() != numGrid) OCP_ABORT("Wrong PERMZ size!");
830 
831  if (ntg.size() != numGrid) {
832  ntg.resize(numGrid, 1);
833  cout << "Set net-to-gross ratio to 1.0!" << endl;
834  }
835 }
836 
839 {
840  if (rockSet.size() != NTROOC) {
841  OCP_ABORT("Wrong ROCK or ROCKT!");
842  }
843 }
844 
847 {
848  if (EQUIL.empty()) OCP_ABORT("EQUIL is missing!");
849 }
850 
853 {
854  if (density.activity && gravity.activity) {
855  OCP_ABORT("Both DENSITY and GRAVITY have been given, just one can be used!");
856  }
857 }
858 
861 {
862  if (blackOil && disGas && (!gas && !oil)) {
863  OCP_ABORT("DISGAS can only be used only if OIL and GAS are both present!");
864  }
865 }
866 
869 {
870  if (!blackOil && !comps) OCP_ABORT("Unknown model: Use BLACKOIL or COMPS!");
871 
872  if (water && oil && SWOF_T.data.empty()) OCP_ABORT("SWOF is missing!");
873  if (gas && oil && SGOF_T.data.empty()) OCP_ABORT("SGOF is missing!");
874  if (water && PVTW_T.data.empty()) OCP_ABORT("PVTW is missing!");
875 
876  if (blackOil) {
877  if (oil && disGas && PVCO_T.data.empty()) OCP_ABORT("PVCO is missing!");
878  if (oil && (!disGas) && PVDO_T.data.empty()) OCP_ABORT("PVDO is missing!");
879  if (gas && PVDG_T.data.empty()) OCP_ABORT("PVDG is missing!");
880  }
881 }
882 
885 {
886  if (SATNUM.activity && SATNUM.data.size() != numGrid) {
887  OCP_ABORT("Missing data in SATNUM!");
888  }
889  if (PVTNUM.activity && PVTNUM.data.size() != numGrid) {
890  OCP_ABORT("Missing data in PVTNUM!");
891  }
892  if (ACTNUM.activity && ACTNUM.data.size() != numGrid) {
893  OCP_ABORT("Missing data in ACTNUM!");
894  }
895  if (ROCKNUM.activity && ROCKNUM.data.size() != numGrid) {
896  OCP_ABORT("Missing data in ROCKNUM!");
897  }
898 }
899 
902 {
903  if (PBVD_T.data.size() > 1) {
904  OCP_ABORT("More than one equilibrium region is not supported!");
905  }
906 }
907 
910 {
911  cout << "\n---------------------" << endl
912  << name << "\n---------------------" << endl;
913 
914  for (USI n = 0; n < data.size(); n++) {
915  if (refName.size() > n) {
916  cout << refName[n] << " ";
917  cout << refData[n] << endl;
918  }
919 
920  const USI len = data[n][0].size();
921  for (USI i = 0; i < len; i++) {
922  for (USI j = 0; j < colNum; j++) {
923  cout << setw(10) << data[n][j][i];
924  }
925  cout << "\n";
926  }
927  }
928 }
929 
931 {
932  // Init LBC coefficient
933  LBCcoef.resize(5);
934  LBCcoef[0] = 0.1023;
935  LBCcoef[1] = 0.023364;
936  LBCcoef[2] = 0.058533;
937  LBCcoef[3] = -0.040758;
938  LBCcoef[4] = 0.0093324;
939 }
940 
942 {
943  Type_A_r<vector<OCP_DBL>>* myPtr = nullptr;
944 
945  switch (Map_Str2Int(&varName[0], varName.size())) {
946  case Map_Str2Int("TCRIT", 5):
947  myPtr = &Tc;
948  break;
949 
950  case Map_Str2Int("PCRIT", 5):
951  myPtr = &Pc;
952  break;
953 
954  case Map_Str2Int("VCRIT", 5):
955  myPtr = &Vc;
956  break;
957 
958  case Map_Str2Int("ZCRIT", 5):
959  myPtr = &Zc;
960  break;
961 
962  case Map_Str2Int("MW", 2):
963  myPtr = &MW;
964  break;
965 
966  case Map_Str2Int("ACF", 3):
967  myPtr = &Acf;
968  break;
969 
970  case Map_Str2Int("OMEGAA", 6):
971  myPtr = &OmegaA;
972  break;
973 
974  case Map_Str2Int("OMEGAB", 6):
975  myPtr = &OmegaB;
976  break;
977 
978  case Map_Str2Int("SSHIFT", 6):
979  myPtr = &Vshift;
980  break;
981 
982  case Map_Str2Int("PARACHOR", 8):
983  myPtr = &Parachor;
984  break;
985 
986  case Map_Str2Int("VCRITVIS", 8):
987  myPtr = &Vcvis;
988  break;
989 
990  case Map_Str2Int("ZCRITVIS", 8):
991  myPtr = &Zcvis;
992  break;
993 
994  case Map_Str2Int("MOLDEN", 6):
995  myPtr = &molden;
996  break;
997 
998  case Map_Str2Int("CP", 2):
999  myPtr = &cp;
1000  break;
1001 
1002  case Map_Str2Int("CT1", 3):
1003  myPtr = &ct1;
1004  break;
1005 
1006  case Map_Str2Int("CT2", 3):
1007  myPtr = &ct2;
1008  break;
1009 
1010  case Map_Str2Int("CPT", 3):
1011  myPtr = &cpt;
1012  break;
1013 
1014  case Map_Str2Int("CPL1", 4):
1015  myPtr = &cpl1;
1016  break;
1017 
1018  case Map_Str2Int("CPL2", 4):
1019  myPtr = &cpl2;
1020  break;
1021 
1022  case Map_Str2Int("CPL3", 4):
1023  myPtr = &cpl3;
1024  break;
1025 
1026  case Map_Str2Int("CPL4", 4):
1027  myPtr = &cpl4;
1028  break;
1029 
1030  case Map_Str2Int("CPG1", 4):
1031  myPtr = &cpg1;
1032  break;
1033 
1034  case Map_Str2Int("CPG2", 4):
1035  myPtr = &cpg2;
1036  break;
1037 
1038  case Map_Str2Int("CPG3", 4):
1039  myPtr = &cpg3;
1040  break;
1041 
1042  case Map_Str2Int("CPG4", 4):
1043  myPtr = &cpg4;
1044  break;
1045 
1046  case Map_Str2Int("HVAPR", 5):
1047  myPtr = &hvapr;
1048  break;
1049 
1050  case Map_Str2Int("HVR", 3):
1051  myPtr = &hvr;
1052  break;
1053 
1054  case Map_Str2Int("EV", 2):
1055  myPtr = &ev;
1056  break;
1057 
1058  case Map_Str2Int("AVSIC", 5):
1059  myPtr = &avisc;
1060  break;
1061 
1062  case Map_Str2Int("BVSIC", 5):
1063  myPtr = &bvisc;
1064  break;
1065 
1066  case Map_Str2Int("AVG", 3):
1067  myPtr = &avg;
1068  break;
1069 
1070  case Map_Str2Int("BVG", 3):
1071  myPtr = &bvg;
1072  break;
1073  }
1074 
1075  return myPtr;
1076 }
1077 
1078 void ComponentParam::InputRefPR(ifstream& ifs, const string& keyword)
1079 {
1080  OCP_ASSERT(NTPVT > 0, "NTPVT has not been set!");
1081 
1082  vector<OCP_DBL>* objPtr = nullptr;
1083  objPtr = FindPtr02(keyword);
1084  if (objPtr == nullptr) {
1085  OCP_ABORT("Unknown keyword!");
1086  }
1087 
1088  vector<string> vbuf;
1089  while (OCP_TRUE) {
1090  ReadLine(ifs, vbuf);
1091 
1092  if (vbuf[0] == "/") break;
1093 
1094  for (auto& v : vbuf) {
1095  if (v != "/") objPtr->push_back(stod(v));
1096  if (objPtr->size() >= NTPVT) break;
1097  }
1098  if (objPtr->size() >= NTPVT) break;
1099  }
1100  cout << keyword << endl;
1101  for (USI i = 0; i < NTPVT; i++) {
1102  cout << objPtr->at(i) << " ";
1103  }
1104  cout << "\n/" << endl << endl;
1105 }
1106 
1107 vector<OCP_DBL>* ComponentParam::FindPtr02(const string& varName)
1108 {
1109  vector<OCP_DBL>* myPtr = nullptr;
1110 
1111  switch (Map_Str2Int(&varName[0], varName.size())) {
1112  case Map_Str2Int("PRSR", 4):
1113  myPtr = &Pref;
1114  break;
1115 
1116  case Map_Str2Int("TEMR", 4):
1117  myPtr = &Tref;
1118  break;
1119  }
1120 
1121  return myPtr;
1122 }
1123 
1124 void ComponentParam::InputCOMPONENTS(ifstream& ifs, const string& keyword)
1125 {
1126  OCP_ASSERT((numCom > 0) && (NTPVT > 0), "NPNC has not been set!");
1127 
1128  Type_A_r<vector<OCP_DBL>>* objPtr = nullptr;
1129  objPtr = FindPtr01(keyword);
1130  if (objPtr == nullptr) {
1131  OCP_ABORT("Unknown keyword!");
1132  }
1133  objPtr->activity = OCP_TRUE;
1134 
1135  vector<string> vbuf;
1136  vector<OCP_DBL> tmp;
1137  USI nReg = 0;
1138 
1139  while (OCP_TRUE) {
1140  ReadLine(ifs, vbuf);
1141  if (vbuf[0] == "/") {
1142  nReg++;
1143  objPtr->data.push_back(tmp);
1144  if (nReg >= NTPVT) break;
1145  tmp.clear();
1146  continue;
1147  }
1148  for (auto& v : vbuf) {
1149  if (v != "/") {
1150  tmp.push_back(stod(v));
1151  }
1152  }
1153  if (vbuf.back() == "/") {
1154  nReg++;
1155  objPtr->data.push_back(tmp);
1156  tmp.clear();
1157  if (nReg >= NTPVT) break;
1158  }
1159  }
1160 
1161  cout << keyword << endl;
1162  for (USI i = 0; i < NTPVT; i++) {
1163  for (auto& v : objPtr->data[i]) {
1164  cout << v << endl;
1165  }
1166  cout << "/" << endl;
1167  }
1168  cout << endl;
1169 }
1170 
1171 void ComponentParam::InputCNAMES(ifstream& ifs)
1172 {
1173  OCP_ASSERT(numCom > 0, "numCom has not been set!");
1174 
1175  vector<string> vbuf;
1176  while (OCP_TRUE) {
1177  ReadLine(ifs, vbuf);
1178  if (vbuf[0] == "/") {
1179  break;
1180  }
1181  for (auto& v : vbuf) {
1182  if (v != "/") Cname.push_back(v);
1183  }
1184  if (vbuf.back() == "/") break;
1185  }
1186 
1187  OCP_FUNCNAME;
1188  cout << "CNAMES" << endl;
1189  for (USI i = 0; i < numCom; i++) {
1190  cout << Cname[i] << " ";
1191  }
1192  cout << endl << endl;
1193 }
1194 
1195 void ComponentParam::InputLBCCOEF(ifstream& ifs)
1196 {
1197  vector<string> vbuf;
1198  ReadLine(ifs, vbuf);
1199  DealDefault(vbuf);
1200  for (USI i = 0; i < 5; i++) {
1201  if (vbuf[i] != "DEFAULT") LBCcoef[i] = stod(vbuf[i]);
1202  }
1203 
1204  OCP_FUNCNAME;
1205  cout << "LBCCOEF" << endl;
1206  for (USI i = 0; i < 5; i++) {
1207  cout << LBCcoef[i] << " ";
1208  }
1209  cout << endl << endl;
1210 }
1211 
1213 void ComponentParam::InputBIC(ifstream& ifs)
1214 {
1215  OCP_ASSERT((numCom > 0) && (NTPVT > 0), "numCom or NTPVT has not been set!");
1216 
1217  BIC.resize(NTPVT);
1218 
1219  vector<string> vbuf;
1220  USI nReg = 0;
1221  while (OCP_TRUE) {
1222  ReadLine(ifs, vbuf);
1223  if (vbuf[0] == "/") {
1224  nReg++;
1225  if (nReg >= NTPVT) break;
1226  continue;
1227  }
1228  for (auto& v : vbuf) {
1229  if (v != "/") {
1230  BIC[nReg].push_back(stod(v));
1231  cout << setw(10) << BIC[nReg].back();
1232  }
1233  }
1234  cout << endl;
1235  if (vbuf.back() == "/") {
1236  nReg++;
1237  if (nReg >= NTPVT) break;
1238  }
1239  }
1240 }
1241 
1242 void ComponentParam::InputVISCTAB(ifstream& ifs)
1243 {
1244  vector<string> vbuf;
1245  vector<vector<OCP_DBL>> tmp;
1246  USI ncol = numCom + 1; // temp + comps
1247  tmp.resize(ncol);
1248  OCP_BOOL flag = OCP_TRUE;
1249 
1250  while (OCP_TRUE) {
1251  if (flag) {
1252  ReadLine(ifs, vbuf);
1253  flag = OCP_FALSE;
1254  }
1255 
1256  if (vbuf[0] == "/") break;
1257 
1258  if (vbuf[0] == "ATPRES") {
1259  viscTab.refName.push_back("ATPRES");
1260  viscTab.refData.push_back(stod(vbuf[1]));
1261  ReadLine(ifs, vbuf);
1262  }
1263  // Read Table
1264  while (OCP_TRUE) {
1265  for (USI i = 0; i < ncol; i++) {
1266  tmp[i].push_back(stod(vbuf[i]));
1267  }
1268  ReadLine(ifs, vbuf);
1269  if (vbuf[0] == "ATPRES" || vbuf[0] == "/") {
1270  viscTab.data.push_back(tmp);
1271  tmp.clear();
1272  tmp.resize(ncol);
1273  break;
1274  }
1275  }
1276  if (vbuf[0] == "/") break;
1277  }
1278  viscTab.name = "VISCTAB";
1279  viscTab.colNum = ncol;
1280  // output
1282 
1283  cout << "/" << endl;
1284 }
1285 
1287 void ComponentParam::InputSSMSTA(ifstream& ifs)
1288 {
1289  vector<string> vbuf;
1290  ReadLine(ifs, vbuf);
1291  int len = vbuf.size();
1292  for (int i = 0; i < len; i++) {
1293  SSMparamSTA.push_back(vbuf[i]);
1294  }
1295  OCP_FUNCNAME;
1296  for (int i = 0; i < len; i++) {
1297  cout << SSMparamSTA[i] << " ";
1298  }
1299  cout << endl << endl;
1300 }
1301 
1303 void ComponentParam::InputNRSTA(ifstream& ifs)
1304 {
1305  vector<string> vbuf;
1306  ReadLine(ifs, vbuf);
1307  for (int i = 0; i < 2; i++) {
1308  NRparamSTA.push_back(vbuf[i]);
1309  }
1310  OCP_FUNCNAME;
1311  for (int i = 0; i < 2; i++) {
1312  cout << NRparamSTA[i] << " ";
1313  }
1314  cout << endl << endl;
1315 }
1316 
1318 void ComponentParam::InputSSMSP(ifstream& ifs)
1319 {
1320  vector<string> vbuf;
1321  ReadLine(ifs, vbuf);
1322  for (USI i = 0; i < 2; i++) {
1323  SSMparamSP.push_back(vbuf[i]);
1324  }
1325  OCP_FUNCNAME;
1326  for (USI i = 0; i < 2; i++) {
1327  cout << SSMparamSP[i] << " ";
1328  }
1329  cout << endl << endl;
1330 }
1331 
1333 void ComponentParam::InputNRSP(ifstream& ifs)
1334 {
1335  vector<string> vbuf;
1336  ReadLine(ifs, vbuf);
1337  for (USI i = 0; i < 2; i++) {
1338  NRparamSP.push_back(vbuf[i]);
1339  }
1340  OCP_FUNCNAME;
1341  for (USI i = 0; i < 2; i++) {
1342  cout << NRparamSP[i] << " ";
1343  }
1344  cout << endl << endl;
1345 }
1346 
1348 void ComponentParam::InputRR(ifstream& ifs)
1349 {
1350  vector<string> vbuf;
1351  ReadLine(ifs, vbuf);
1352  for (USI i = 0; i < 2; i++) {
1353  RRparam.push_back(vbuf[i]);
1354  }
1355  OCP_FUNCNAME;
1356  for (USI i = 0; i < 2; i++) {
1357  cout << RRparam[i] << " ";
1358  }
1359  cout << endl << endl;
1360 }
1361 
1362 /*----------------------------------------------------------------------------*/
1363 /* Brief Change History of This File */
1364 /*----------------------------------------------------------------------------*/
1365 /* Author Date Actions */
1366 /*----------------------------------------------------------------------------*/
1367 /* Shizhe Li Oct/01/2021 Create file */
1368 /* Chensong Zhang Oct/15/2021 Format file */
1369 /* Chensong Zhang Jan/09/2022 Update output and Doxygen */
1370 /*----------------------------------------------------------------------------*/
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
unsigned int OCP_BOOL
OCP_BOOL in OCP.
Definition: OCPConst.hpp:29
ParamReservoir class declaration.
#define OCP_FUNCNAME
Print Function Name.
Definition: UtilError.hpp:73
#define OCP_WARNING(msg)
Log warning messages.
Definition: UtilError.hpp:39
#define OCP_ASSERT(cond, msg)
Assert condition and log user messages in DEBUG mode.
Definition: UtilError.hpp:58
#define OCP_ABORT(msg)
Abort if critical error happens.
Definition: UtilError.hpp:47
void DealDefault(vector< string > &result)
Definition: UtilInput.cpp:50
OCP_BOOL ReadLine(ifstream &ifs, vector< string > &result)
Definition: UtilInput.cpp:14
constexpr long long Map_Str2Int(const char *mystr, const USI &len)
Definition: UtilInput.hpp:34
Type_A_r< vector< OCP_DBL > > cpg4
Type_A_r< vector< OCP_DBL > > cpl1
void InputLBCCOEF(ifstream &ifs)
Input LBC coefficients for viscosity calculation.
void InputSSMSP(ifstream &ifs)
TODO: Add Doxygen.
Type_A_r< vector< OCP_DBL > > Tc
Critical temperature of hydrocarbon components.
Type_A_r< vector< OCP_DBL > > Vcvis
Critical volume used for viscosity calculations only.
vector< OCP_DBL > * FindPtr02(const string &varName)
Find corresponding variable according to the name of variable.
Type_A_r< vector< OCP_DBL > > ev
coefficients in the vaporization enthalpy calculations
Type_A_r< vector< OCP_DBL > > Zc
Critical Z-factor of hydrocarbon components.
Type_A_r< vector< OCP_DBL > > MW
Molecular Weight of hydrocarbon components.
Type_A_r< vector< OCP_DBL > > cpg2
Type_A_r< vector< OCP_DBL > > avisc
coefficients in water and oil viscosity correlation formulae
Type_A_r< vector< OCP_DBL > > bvisc
coefficients in water and oil viscosity correlation formulae
vector< OCP_DBL > Pref
reference pressure
Type_A_r< vector< OCP_DBL > > bvg
void InputRR(ifstream &ifs)
TODO: Add Doxygen.
Type_A_r< vector< OCP_DBL > > cpl3
void InputVISCTAB(ifstream &ifs)
Input VISCTAB.
void InputBIC(ifstream &ifs)
Input the Binary interaction of components.
USI numCom
num of components, water is excluded.
Type_A_r< vector< OCP_DBL > > cpl4
Type_A_r< vector< OCP_DBL > > hvapr
coefficients in the component gas enthalpy calculations, Btu/lbmol
vector< string > Cname
Name of hydrocarbon components.
Type_A_r< vector< OCP_DBL > > ct1
the first ifThermal expansion coefficient, 1/F
Type_A_r< vector< OCP_DBL > > avg
coefficients Ak in gas viscosity correlation formulae
void InputCOMPONENTS(ifstream &ifs, const string &keyword)
Input the information of hydrocarbon components.
Type_A_r< vector< OCP_DBL > > cpt
Type_A_r< vector< OCP_DBL > > Acf
Acentric factor of hydrocarbon components.
void InputNRSTA(ifstream &ifs)
TODO: Add Doxygen.
Type_A_r< vector< OCP_DBL > > Vshift
Volume shift of hydrocarbon components.
Type_A_r< vector< OCP_DBL > > hvr
coefficients in the vaporization enthalpy calculations
void InputCNAMES(ifstream &ifs)
Input the names of hydrocarbon components.
Type_A_r< vector< OCP_DBL > > Zcvis
Critical Z-factor used for viscosity calculations only.
Type_A_r< vector< OCP_DBL > > OmegaB
OMEGA_B of hydrocarbon components.
Type_A_r< vector< OCP_DBL > > cpg1
Type_A_r< vector< OCP_DBL > > ct2
the second ifThermal expansion coefficient, 1/F
Type_A_r< vector< OCP_DBL > > Vc
Critical volume of hydrocarbon components.
void Init()
Init Params.
Type_A_r< vector< OCP_DBL > > cpg3
Type_A_r< vector< OCP_DBL > > Pc
Critical pressure of hydrocarbon components.
void InputSSMSTA(ifstream &ifs)
TODO: Add Doxygen.
Type_A_r< vector< OCP_DBL > > cpl2
Type_A_r< vector< OCP_DBL > > OmegaA
OMEGA_A of hydrocarbon components.
Type_A_r< vector< OCP_DBL > > cp
component compressibility, 1/psi
vector< vector< OCP_DBL > > BIC
Binary interaction.
USI NTPVT
num of EoS region, constant now.
Type_A_r< vector< OCP_DBL > > * FindPtr01(const string &varName)
void InputNRSP(ifstream &ifs)
TODO: Add Doxygen.
Type_A_r< vector< OCP_DBL > > molden
vector< OCP_DBL > LBCcoef
LBC coefficients for viscosity calculation.
vector< OCP_DBL > Tref
reference temperature
void InputRefPR(ifstream &ifs, const string &keyword)
input reference pressure, temperature
Type_A_r< vector< OCP_DBL > > Parachor
PARACHOR of hydrocarbon components.
USI nx
Num of bulks along x-direction.
USI ny
Num of bulks along y-direction.
USI nz
Num of bulks along z-direction.
OCP_DBL obC
Volumetric heat capacity of overburden rock.
OCP_BOOL ifHLoss
If use Heat loss.
OCP_DBL obK
Thermal conductivity of overburden rock.
OCP_DBL ubK
Thermal conductivity of underburden rock.
OCP_DBL ubC
Volumetric heat capacity of underburden rock.
Params for NR in Phase Split.
Definition: MixtureComp.hpp:72
Params for NR in Phase Stability Analysis.
Definition: MixtureComp.hpp:46
vector< RockParam > rockSet
a set of rock
vector< OCP_DBL > permY
Permeability along the y-direction for each grid.
OCP_BOOL oil
If OCP_TRUE, oil phase could exist.
void InputDIMENS(ifstream &ifs)
TODO: Add Doxygen.
void CheckEQUIL() const
Check if keyword EQUIL is given.
USI NTSFUN
Num of SAT regions.
vector< OCP_DBL > Ni
Initial moles of components in each grid.
void InputTABDIMS(ifstream &ifs)
TABDIMS contains the num of saturation region and PVT region.
USI NTROOC
Num of Rock regions.
void CheckParam()
Check the reservoir param from input file.
vector< OCP_DBL > zcorn
TODO: Add Doxygen.
Type_A_r< OCP_DBL > SATNUM
Records the index of SAT region for each grid.
TableSet ZMFVD_T
Table set of ZMFVD.
vector< OCP_DBL > EQUIL
See ParamEQUIL.
Type_A_r< OCP_DBL > ACTNUM
Records the index of Active region for each grid.
vector< OCP_DBL > poro
Porosity for each grid.
void InputTHCON(ifstream &ifs, const string &keyword)
Input the phase ifThermal conductivity.
ComponentParam comsParam
information for components
void InputGRID(ifstream &ifs, string &keyword)
TODO: Add Doxygen.
TableSet * FindPtr_T(const string &varName)
Find pointer to the specified table.
OCP_DBL thconw
water ifThermal conductivity
vector< OCP_DBL > dy
Size along the y - direction for each grid.
vector< OCP_DBL > permX
Permeability along the x - direction for each grid.
void MultiplyVal(vector< OCP_DBL > &obj, const OCP_DBL &val, const vector< USI > &index)
TODO: Add Doxygen.
void CheckPhase() const
Check existence of disgas, it could only exist when both oil and gas exist.
void InputMISCSTR(ifstream &ifs)
Input the Miscibility information.
TableSet PVDG_T
Table set of PVDG.
vector< OCP_DBL > permZ
Permeability along the z-direction for each grid.
OCP_BOOL gas
If OCP_TRUE, gas phase could exist.
TableSet SOF3_T
Table set of SOF3.
vector< OCP_DBL > dx
Size along the x - direction for each grid.
TableSet PBVD_T
Table set of PBVD.
void InputEQUIL(ifstream &ifs)
EQUIL contains initial information of reservoir; see ParamEQUIL.
Type_A_r< OCP_DBL > density
Density of oil, water, gas in standard conditions.
TableSet PVDO_T
Table set of PVDO.
void InputCOMPS(ifstream &ifs)
TODO: Add Doxygen.
OCP_BOOL comps
If OCP_TRUE, compositional model will be used.
vector< OCP_DBL > tops
Depth of the top surface of the uppermost grids.
TableSet SGOF_T
Table set of SGOF.
Type_A_r< OCP_DBL > PVTNUM
Records the index of PVT region for each grid.
void CopyVal(vector< T > &obj, const vector< T > &src, const vector< USI > &index)
It's used in InputCOPY, copying the value of one variable to another.
void DisplayDIMENS()
Display the dimens, it's used to chech input.
void InputRegion(ifstream &ifs, const string &keyword)
Input the keyword: SATNUM and PVTNUM.
TableSet TEMPVD_T
Table set of TEMPVD.
void InitTable()
Initialize the tables' name and num of colum.
void InputMULTIPLY(ifstream &ifs)
TODO: Add Doxygen.
void CheckEqlRegion() const
(Todo) Initialization of equilibration of only one region is realized.
void CheckGrid()
Check the size of properties of grids.
void CheckRegion() const
Check if each grid is assigned to an area or all defaulted.
void Init()
Initialize the default value in reservoir, such as temperature, density, table.
void InputEQUALS(ifstream &ifs)
TODO: Add Doxygen.
vector< OCP_DBL > ntg
Net to gross for each grid.
void InputTABLE(ifstream &ifs, const string &tabName)
Input PVTtable and SATtable such as SWOF, PVCO.
vector< OCP_DBL > thconr
Rock ifThermal conductivity.
void InputROCK(ifstream &ifs)
Read data from the ROCK keyword.
void CheckPhaseTab() const
Check existence of PVTtable and SATtable.
OCP_DBL thcong
gas ifThermal conductivity
OCP_BOOL blackOil
If ture, blackoil model will be used.
void InputDENSITY(ifstream &ifs)
Input the reference density of oil, water, and air in standard condition.
OCP_BOOL disGas
If OCP_TRUE, dissolve gas could exist in oil phase.
TableSet SGFN_T
Table set of SGFN.
vector< OCP_DBL > coord
TODO: Add Doxygen.
Type_A_r< OCP_DBL > gravity
Gravity of oil, water, gas in standard conditions.
void setVal(vector< T > &obj, const T &val, const vector< USI > &index)
It's used in InputEQUALS, assigning values in batches.
void CheckDenGra() const
Check if density and gravity are both input, only one of them is needed.
void InputCOPY(ifstream &ifs)
Input the keyword: COPY. COPY could copy the value of one variable to another.
void InputHLOSS(ifstream &ifs)
Input heat loss property for overburden rock and underburden rock.
TableSet PVTW_T
Table set of PVTW.
Dimens dimens
Dimension of grid: the number of grids along x,y,z direction.
vector< OCP_DBL > * FindPtr(const string &varName)
Find pointer to the specified variable.
Type_A_r< OCP_DBL > ROCKNUM
Records the index of ROCK region for each grid.
vector< OCP_DBL > dz
Size along the z - direction for each grid.
void InputROCKT(ifstream &ifs)
Input Rock information for ifThermal model.
TableSet SWOF_T
Table set of SWOF.
vector< OCP_DBL > Swat
Initial water saturation in each grid.
void InputGRAVITY(ifstream &ifs)
Input the reference gravity of oil, water, and air in standard condition.
Miscstr miscstr
reference Miscibility surface tension
vector< OCP_DBL > P
Initial pressure of components in each grid.
HLoss hLoss
Heat loss property.
OCP_DBL thcono
oil ifThermal conductivity
TableSet PVCO_T
Table set of PVCO.
TableSet SWFN_T
Table set of SWFN.
USI NTPVT
Num of PVT regions.
void CheckRock()
Check Rock.
OCP_DBL rsTemp
Temperature for reservoir.
OCP_BOOL water
If OCP_TRUE, water phase could exist.
void InputRTEMP(ifstream &ifs)
Input the keyword: RTEMP. RTEMP gives the temperature of reservoir.
OCP_USI numGrid
Num of grids.
Param for Solving Rachford-Rice Equations.
Definition: MixtureComp.hpp:85
RockParam class contains information about the keyword ROCK.
OCP_DBL cpt
cross items, ifThermal only
OCP_DBL cp1
Compressibility factor of rock in reservoir.
OCP_DBL HCP1
coefficients of the rock enthalpy formula, Btu/ft^3 - F
OCP_DBL Pref
Reference pressure at initial porosity.
OCP_DBL HCP2
coefficients of the rock enthalpy formula, Btu/ft^3 - F
OCP_DBL ct
Expansion factor of rock in reservoir, ifThermal only.
OCP_DBL Tref
Reference temperature at initial porosity.
string type
LINEAR or EXPONENT for porosity model.
OCP_DBL cp2
2 order Compressibility factor of rock in reservoir.
OCP_BOOL ConstRock
Params for SSM in Phase Split.
Definition: MixtureComp.hpp:59
Params for SSM in Phase Stability Analysis.
Definition: MixtureComp.hpp:29
vector< string > refName
name of refData
vector< vector< vector< OCP_DBL > > > data
All table with the same name.
vector< OCP_DBL > refData
refData for each sub data.
USI colNum
Number of columns of table.
void DisplayTable() const
Print table.
string name
Name of table.
OCP_BOOL activity
If OCP_FALSE, this param is not given.
vector< T > data
Data of param.