OpenCAEPoro  v0.5.0
A simulator for multicomponent porous media flow
OCPOutput.cpp
Go to the documentation of this file.
1 
12 #include "OCPOutput.hpp"
13 
14 void Summary::InputParam(const OutputSummary& summary_param)
15 {
16  FPR = summary_param.FPR;
17  FTR = summary_param.FTR;
18  FOPR = summary_param.FOPR;
19  FOPT = summary_param.FOPT;
20  FGPR = summary_param.FGPR;
21  FGPt = summary_param.FGPt;
22  FWPR = summary_param.FWPR;
23  FWPT = summary_param.FWPT;
24  FGIR = summary_param.FGIR;
25  FGIT = summary_param.FGIT;
26  FWIR = summary_param.FWIR;
27  FWIT = summary_param.FWIT;
28 
29  WOPR = summary_param.WOPR;
30  WOPT = summary_param.WOPT;
31  WGPR = summary_param.WGPR;
32  WGPT = summary_param.WGPT;
33  WWPR = summary_param.WWPR;
34  WWPT = summary_param.WWPT;
35  WGIR = summary_param.WGIR;
36  WGIT = summary_param.WGIT;
37  WWIR = summary_param.WWIR;
38  WWIT = summary_param.WWIT;
39 
40  WBHP = summary_param.WBHP;
41  DG = summary_param.DG;
42 
43  BPR = summary_param.BPR;
44  SOIL = summary_param.SOIL;
45  SGAS = summary_param.SGAS;
46  SWAT = summary_param.SWAT;
47 
48  // cout << "Summary::InputParam" << endl;
49 }
50 
51 void Summary::Setup(const Reservoir& rs, const OCP_DBL& totalTime)
52 {
53  Sumdata.push_back(SumItem("TIME", " ", "DAY", "fixed"));
54  Sumdata.push_back(SumItem("NRiter", " ", " ", "int"));
55  Sumdata.push_back(SumItem("LSiter", " ", " ", "int"));
56  if (FPR) Sumdata.push_back(SumItem("FPR", " ", "PSIA", "float"));
57  if (FTR) Sumdata.push_back(SumItem("FTR", " ", "F", "float"));
58  if (FOPR) Sumdata.push_back(SumItem("FOPR", " ", "STB/DAY", "float"));
59  if (FOPT) Sumdata.push_back(SumItem("FOPT", " ", "STB", "float"));
60  if (FGPR) Sumdata.push_back(SumItem("FGPR", " ", "MSCF/DAY", "float"));
61  if (FGPt) Sumdata.push_back(SumItem("FGPT", " ", "MSCF", "float"));
62  if (FWPR) Sumdata.push_back(SumItem("FWPR", " ", "STB/DAY", "float"));
63  if (FWPT) Sumdata.push_back(SumItem("FWPT", " ", "STB", "float"));
64  if (FGIR) Sumdata.push_back(SumItem("FGIR", " ", "MSCF/DAY", "float"));
65  if (FGIT) Sumdata.push_back(SumItem("FGIT", " ", "MSCF", "float"));
66  if (FWIR) Sumdata.push_back(SumItem("FWIR", " ", "STB/DAY", "float"));
67  if (FWIT) Sumdata.push_back(SumItem("FWIT", " ", "STB", "float"));
68 
69  const Grid& initGrid = rs.grid;
70  const AllWells& wells = rs.allWells;
71 
72  const USI sp = initGrid.GetNumDigitIJK();
73 
74  const USI wellnum = wells.GetWellNum();
75  string wellname;
76  USI num;
77 
78  if (WOPR.activity) {
79  if (WOPR.obj[0] == "All") {
80  WOPR.obj.clear();
81  for (USI w = 0; w < wellnum; w++) {
82  wellname = wells.GetWellName(w);
83  WOPR.obj.push_back(wellname);
84  Sumdata.push_back(SumItem("WOPR", wellname, "STB/DAY", "float"));
85  WOPR.index.push_back(w);
86  }
87  } else {
88  num = WOPR.obj.size();
89  for (USI w = 0; w < num; w++) {
90  Sumdata.push_back(SumItem("WOPR", WOPR.obj[w], "STB/DAY", "float"));
91  WOPR.index.push_back(wells.GetIndex(WOPR.obj[w]));
92  }
93  }
94  }
95 
96  if (WOPT.activity) {
97  if (WOPT.obj[0] == "All") {
98  WOPT.obj.clear();
99  for (USI w = 0; w < wellnum; w++) {
100  wellname = wells.GetWellName(w);
101  WOPT.obj.push_back(wellname);
102  Sumdata.push_back(SumItem("WOPT", wellname, "STB", "float"));
103  WOPT.index.push_back(w);
104  }
105  } else {
106  num = WOPT.obj.size();
107  for (USI w = 0; w < num; w++) {
108  Sumdata.push_back(SumItem("WOPT", WOPT.obj[w], "STB", "float"));
109  WOPT.index.push_back(wells.GetIndex(WOPT.obj[w]));
110  }
111  }
112  }
113 
114  if (WGPR.activity) {
115  if (WGPR.obj[0] == "All") {
116  WGPR.obj.clear();
117  for (USI w = 0; w < wellnum; w++) {
118  wellname = wells.GetWellName(w);
119  WGPR.obj.push_back(wellname);
120  Sumdata.push_back(SumItem("WGPR", wellname, "MSCF/DAY", "float"));
121  WGPR.index.push_back(w);
122  }
123  } else {
124  num = WGPR.obj.size();
125  for (USI w = 0; w < num; w++) {
126  Sumdata.push_back(SumItem("WGPR", WGPR.obj[w], "MSCF/DAY", "float"));
127  WGPR.index.push_back(wells.GetIndex(WGPR.obj[w]));
128  }
129  }
130  }
131 
132  if (WGPT.activity) {
133  if (WGPT.obj[0] == "All") {
134  WGPT.obj.clear();
135  for (USI w = 0; w < wellnum; w++) {
136  wellname = wells.GetWellName(w);
137  WGPT.obj.push_back(wellname);
138  Sumdata.push_back(SumItem("WGPT", wellname, "MSCF", "float"));
139  WGPT.index.push_back(w);
140  }
141  } else {
142  num = WGPT.obj.size();
143  for (USI w = 0; w < num; w++) {
144  Sumdata.push_back(SumItem("WGPT", WGPT.obj[w], "MSCF", "float"));
145  WGPT.index.push_back(wells.GetIndex(WGPT.obj[w]));
146  }
147  }
148  }
149 
150  if (WWPR.activity) {
151  if (WWPR.obj[0] == "All") {
152  WWPR.obj.clear();
153  for (USI w = 0; w < wellnum; w++) {
154  wellname = wells.GetWellName(w);
155  WWPR.obj.push_back(wellname);
156  Sumdata.push_back(SumItem("WWPR", wellname, "STB/DAY", "float"));
157  WWPR.index.push_back(w);
158  }
159  } else {
160  num = WWPR.obj.size();
161  for (USI w = 0; w < num; w++) {
162  Sumdata.push_back(SumItem("WWPR", WWPR.obj[w], "STB/DAY", "float"));
163  WWPR.index.push_back(wells.GetIndex(WWPR.obj[w]));
164  }
165  }
166  }
167 
168  if (WWPT.activity) {
169  if (WWPT.obj[0] == "All") {
170  WWPT.obj.clear();
171  for (USI w = 0; w < wellnum; w++) {
172  wellname = wells.GetWellName(w);
173  WWPT.obj.push_back(wellname);
174  Sumdata.push_back(SumItem("WWPT", wellname, "STB", "float"));
175  WWPT.index.push_back(w);
176  }
177  } else {
178  num = WWPT.obj.size();
179  for (USI w = 0; w < num; w++) {
180  Sumdata.push_back(SumItem("WWPT", WWPT.obj[w], "STB", "float"));
181  WWPT.index.push_back(wells.GetIndex(WWPT.obj[w]));
182  }
183  }
184  }
185 
186  if (WGIR.activity) {
187  if (WGIR.obj[0] == "All") {
188  WGIR.obj.clear();
189  for (USI w = 0; w < wellnum; w++) {
190  wellname = wells.GetWellName(w);
191  WGIR.obj.push_back(wellname);
192  Sumdata.push_back(SumItem("WGIR", wellname, "MSCF/DAY", "float"));
193  WGIR.index.push_back(w);
194  }
195  } else {
196  num = WGIR.obj.size();
197  for (USI w = 0; w < num; w++) {
198  Sumdata.push_back(SumItem("WGIR", WGIR.obj[w], "MSCF/DAY", "float"));
199  WGIR.index.push_back(wells.GetIndex(WGIR.obj[w]));
200  }
201  }
202  }
203 
204  if (WGIT.activity) {
205  if (WGIT.obj[0] == "All") {
206  WGIT.obj.clear();
207  for (USI w = 0; w < wellnum; w++) {
208  wellname = wells.GetWellName(w);
209  WGIT.obj.push_back(wellname);
210  Sumdata.push_back(SumItem("WGIT", wellname, "MSCF", "float"));
211  WGIT.index.push_back(w);
212  }
213  } else {
214  num = WGIT.obj.size();
215  for (USI w = 0; w < num; w++) {
216  Sumdata.push_back(SumItem("WGIT", WGIT.obj[w], "MSCF", "float"));
217  WGIT.index.push_back(wells.GetIndex(WGIT.obj[w]));
218  }
219  }
220  }
221 
222  if (WWIR.activity) {
223  if (WWIR.obj[0] == "All") {
224  WWIR.obj.clear();
225  for (USI w = 0; w < wellnum; w++) {
226  wellname = wells.GetWellName(w);
227  WWIR.obj.push_back(wellname);
228  Sumdata.push_back(SumItem("WWIR", wellname, "STB/DAY", "float"));
229  WWIR.index.push_back(w);
230  }
231  } else {
232  num = WWIR.obj.size();
233  for (USI w = 0; w < num; w++) {
234  Sumdata.push_back(SumItem("WWIR", WWIR.obj[w], "STB/DAY", "float"));
235  WWIR.index.push_back(wells.GetIndex(WWIR.obj[w]));
236  }
237  }
238  }
239 
240  if (WWIT.activity) {
241  if (WWIT.obj[0] == "All") {
242  WWIT.obj.clear();
243  for (USI w = 0; w < wellnum; w++) {
244  wellname = wells.GetWellName(w);
245  WWIT.obj.push_back(wellname);
246  Sumdata.push_back(SumItem("WWIT", wellname, "STB", "float"));
247  WWIT.index.push_back(w);
248  }
249  } else {
250  num = WWIT.obj.size();
251  for (USI w = 0; w < num; w++) {
252  Sumdata.push_back(SumItem("WWIT", WWIT.obj[w], "STB", "float"));
253  WWIT.index.push_back(wells.GetIndex(WWIT.obj[w]));
254  }
255  }
256  }
257 
258  if (WBHP.activity) {
259  if (WBHP.obj[0] == "All") {
260  WBHP.obj.clear();
261  for (USI w = 0; w < wellnum; w++) {
262  wellname = wells.GetWellName(w);
263  WBHP.obj.push_back(wellname);
264  Sumdata.push_back(SumItem("WBHP", wellname, "PSIA", "float"));
265  WBHP.index.push_back(w);
266  }
267  } else {
268  num = WBHP.obj.size();
269  for (USI w = 0; w < num; w++) {
270  Sumdata.push_back(SumItem("WBHP", WBHP.obj[w], "PSIA", "float"));
271  WBHP.index.push_back(wells.GetIndex(WBHP.obj[w]));
272  }
273  }
274  }
275 
276  if (DG.activity) {
277  if (DG.obj[0] == "All") {
278  DG.obj.clear();
279  for (USI w = 0; w < wellnum; w++) {
280  string wellname = wells.GetWellName(w);
281  DG.obj.push_back(wellname);
282  USI perfnum = wells.GetWellPerfNum(w);
283  for (USI p = 0; p < perfnum; p++) {
284  Sumdata.push_back(SumItem("DG", wellname + " Perf" + to_string(p),
285  "PSIA", "float"));
286  DG.index.push_back(w);
287  }
288  }
289  } else {
290  num = DG.obj.size();
291  for (USI w = 0; w < num; w++) {
292  USI wId = wells.GetIndex(DG.obj[w]);
293  USI perfnum = wells.GetWellPerfNum(wId);
294  for (USI p = 0; p < perfnum; p++) {
295  Sumdata.push_back(SumItem("DG", DG.obj[w] + " P" + to_string(p),
296  "PSIA", "float"));
297  DG.index.push_back(wId);
298  }
299  }
300  }
301  }
302 
303  if (BPR.activity) {
304  num = BPR.obj.size();
305  for (USI i = 0; i < num; i++) {
306  string temp = GetIJKformat(to_string(BPR.obj[i].I), to_string(BPR.obj[i].J),
307  to_string(BPR.obj[i].K), sp);
308  Sumdata.push_back(SumItem("BPR", temp, "PSIA", "float"));
309  USI I = BPR.obj[i].I - 1;
310  USI J = BPR.obj[i].J - 1;
311  USI K = BPR.obj[i].K - 1;
312 
313  const OCP_INT tarId = initGrid.GetActIndex(I, J, K);
314  if (tarId < 0)
315  OCP_WARNING("Non Fluid Grid: " + GetIJKformat(I + 1, J + 1, K + 1, sp) +
316  "in BPR in SUMMARY");
317  else
318  BPR.index.push_back(tarId);
319  }
320  }
321 
322  if (SOIL.activity) {
323  num = SOIL.obj.size();
324  for (USI i = 0; i < num; i++) {
325  string temp =
326  GetIJKformat(to_string(SOIL.obj[i].I), to_string(SOIL.obj[i].J),
327  to_string(SOIL.obj[i].K), sp);
328  Sumdata.push_back(SumItem("SOIL", temp, " ", "float"));
329  USI I = SOIL.obj[i].I - 1;
330  USI J = SOIL.obj[i].J - 1;
331  USI K = SOIL.obj[i].K - 1;
332 
333  const OCP_INT tarId = initGrid.GetActIndex(I, J, K);
334  if (tarId < 0)
335  OCP_WARNING("Non Fluid Grid: " + GetIJKformat(I + 1, J + 1, K + 1, sp) +
336  "in SOIL in SUMMARY");
337  else
338  SOIL.index.push_back(tarId);
339  }
340  }
341 
342  if (SGAS.activity) {
343  num = SGAS.obj.size();
344  for (USI i = 0; i < num; i++) {
345  string temp =
346  GetIJKformat(to_string(SGAS.obj[i].I), to_string(SGAS.obj[i].J),
347  to_string(SGAS.obj[i].K), sp);
348  Sumdata.push_back(SumItem("SGAS", temp, " ", "float"));
349  USI I = SGAS.obj[i].I - 1;
350  USI J = SGAS.obj[i].J - 1;
351  USI K = SGAS.obj[i].K - 1;
352 
353  const OCP_INT tarId = initGrid.GetActIndex(I, J, K);
354  if (tarId < 0)
355  OCP_WARNING("Non Fluid Grid: " + GetIJKformat(I + 1, J + 1, K + 1, sp) +
356  "in SOIL in SUMMARY");
357  else
358  SGAS.index.push_back(tarId);
359  }
360  }
361 
362  if (SWAT.activity) {
363  num = SWAT.obj.size();
364  for (USI i = 0; i < num; i++) {
365  string temp =
366  GetIJKformat(to_string(SWAT.obj[i].I), to_string(SWAT.obj[i].J),
367  to_string(SWAT.obj[i].K), sp);
368  Sumdata.push_back(SumItem("SWAT", temp, " ", "float"));
369  USI I = SWAT.obj[i].I - 1;
370  USI J = SWAT.obj[i].J - 1;
371  USI K = SWAT.obj[i].K - 1;
372 
373  const OCP_INT tarId = initGrid.GetActIndex(I, J, K);
374  if (tarId < 0)
375  OCP_WARNING("Non Fluid Grid: " + GetIJKformat(I + 1, J + 1, K + 1, sp) +
376  "in SWAT in SUMMARY");
377  else
378  SWAT.index.push_back(tarId);
379  }
380  }
381 
382  // Allocate memory
383  const USI maxRowNum = totalTime / 0.1;
384  const USI cs = Sumdata.size();
385  for (USI i = 0; i < cs; i++) {
386  Sumdata[i].val.reserve(maxRowNum);
387  }
388 
389  // cout << "Summary::Setup" << endl;
390 }
391 
392 void Summary::SetVal(const Reservoir& rs, const OCPControl& ctrl)
393 {
394  const Bulk& bulk = rs.bulk;
395  const AllWells& wells = rs.allWells;
396 
397  USI n = 0;
398 
399  // TIME
400  Sumdata[n++].val.push_back(ctrl.GetCurTime());
401  // NRiter
402  Sumdata[n++].val.push_back(ctrl.GetNRiterT());
403  // LSiter
404  Sumdata[n++].val.push_back(ctrl.GetLSiterT());
405 
406  // FPR
407  if (FPR) Sumdata[n++].val.push_back(bulk.CalFPR());
408  if (FTR) Sumdata[n++].val.push_back(bulk.CalFTR());
409  if (FOPR) Sumdata[n++].val.push_back(wells.GetFOPR());
410  if (FOPT) Sumdata[n++].val.push_back(wells.GetFOPT());
411  if (FGPR) Sumdata[n++].val.push_back(wells.GetFGPR());
412  if (FGPt) Sumdata[n++].val.push_back(wells.GetFGPT());
413  if (FWPR) Sumdata[n++].val.push_back(wells.GetFWPR());
414  if (FWPT) Sumdata[n++].val.push_back(wells.GetFWPT());
415  if (FGIR) Sumdata[n++].val.push_back(wells.GetFGIR());
416  if (FGIT) Sumdata[n++].val.push_back(wells.GetFGIT());
417  if (FWIR) Sumdata[n++].val.push_back(wells.GetFWIR());
418  if (FWIT) Sumdata[n++].val.push_back(wells.GetFWIT());
419 
420  USI len = 0;
421  // WOPR
422  len = WOPR.index.size();
423  for (USI w = 0; w < len; w++)
424  Sumdata[n++].val.push_back(wells.GetWOPR(WOPR.index[w]));
425 
426  // WOPT
427  len = WOPT.index.size();
428  for (USI w = 0; w < len; w++)
429  Sumdata[n++].val.push_back(wells.GetWOPT(WOPT.index[w]));
430 
431  // WGPR
432  len = WGPR.index.size();
433  for (USI w = 0; w < len; w++)
434  Sumdata[n++].val.push_back(wells.GetWGPR(WGPR.index[w]));
435 
436  // WGPT
437  len = WGPT.index.size();
438  for (USI w = 0; w < len; w++)
439  Sumdata[n++].val.push_back(wells.GetWGPT(WGPT.index[w]));
440 
441  // WWPR
442  len = WWPR.index.size();
443  for (USI w = 0; w < len; w++)
444  Sumdata[n++].val.push_back(wells.GetWWPR(WWPR.index[w]));
445 
446  // WWPT
447  len = WWPT.index.size();
448  for (USI w = 0; w < len; w++)
449  Sumdata[n++].val.push_back(wells.GetWWPT(WWPT.index[w]));
450 
451  // WGIR
452  len = WGIR.index.size();
453  for (USI w = 0; w < len; w++)
454  Sumdata[n++].val.push_back(wells.GetWGIR(WGIR.index[w]));
455 
456  // WGIT
457  len = WGIT.index.size();
458  for (USI w = 0; w < len; w++)
459  Sumdata[n++].val.push_back(wells.GetWGIT(WGIT.index[w]));
460 
461  // WWIR
462  len = WWIR.index.size();
463  for (USI w = 0; w < len; w++)
464  Sumdata[n++].val.push_back(wells.GetWWIR(WWIR.index[w]));
465 
466  // WWIT
467  len = WWIT.index.size();
468  for (USI w = 0; w < len; w++)
469  Sumdata[n++].val.push_back(wells.GetWWIT(WWIT.index[w]));
470 
471  // WBHP
472  len = WBHP.index.size();
473  for (USI w = 0; w < len; w++)
474  Sumdata[n++].val.push_back(wells.GetWBHP(WBHP.index[w]));
475 
476  // DG
477  len = DG.obj.size();
478  for (USI w = 0; w < len; w++) {
479  USI numperf = rs.allWells.GetWellPerfNum(DG.index[w]);
480  for (USI p = 0; p < numperf; p++) {
481  Sumdata[n++].val.push_back(wells.GetWellDG(DG.index[w], p));
482  }
483  }
484 
485  // BPR
486  len = BPR.index.size();
487  for (USI i = 0; i < len; i++) Sumdata[n++].val.push_back(bulk.GetP(BPR.index[i]));
488 
489  // SOIL
490  len = SOIL.index.size();
491  for (USI i = 0; i < len; i++)
492  Sumdata[n++].val.push_back(bulk.GetSOIL(SOIL.index[i]));
493 
494  // SGAS
495  len = SGAS.index.size();
496  for (USI i = 0; i < len; i++)
497  Sumdata[n++].val.push_back(bulk.GetSGAS(SGAS.index[i]));
498 
499  // SWAT
500  len = SWAT.index.size();
501  for (USI i = 0; i < len; i++)
502  Sumdata[n++].val.push_back(bulk.GetSWAT(SWAT.index[i]));
503 }
504 
506 void Summary::PrintInfo(const string& dir) const
507 {
508  string FileOut = dir + "SUMMARY.out";
509  ofstream outF(FileOut);
510  if (!outF.is_open()) {
511  OCP_ABORT("Can not open " + FileOut);
512  }
513 
514  const USI ns = 12;
515  const USI col = 10;
516  const USI num = Sumdata.size();
517  const USI len = Sumdata[0].val.size();
518 
519  USI row = 0;
520  USI id = 0;
521  USI ID = 1;
522 
523  while (id != num) {
524 
525  outF << "Row " << ++row << "\n";
526 
527  // Item
528  outF << "\t" << setw(ns) << Sumdata[0].Item;
529 
530  id = ID;
531  for (USI i = 1; i < col; i++) {
532  outF << "\t" << setw(ns) << Sumdata[id++].Item;
533  if (id == num) break;
534  }
535  outF << "\n";
536 
537  // Unit
538  outF << "\t" << setw(ns) << Sumdata[0].Unit;
539 
540  id = ID;
541  for (USI i = 1; i < col; i++) {
542  outF << "\t" << setw(ns) << Sumdata[id++].Unit;
543  if (id == num) break;
544  }
545  outF << "\n";
546 
547  // Obj Name
548  outF << "\t" << setw(ns) << Sumdata[0].Obj;
549 
550  id = ID;
551  for (USI i = 1; i < col; i++) {
552  outF << "\t" << setw(ns) << Sumdata[id++].Obj;
553  if (id == num) break;
554  }
555  outF << "\n";
556 
557  // Data
558  for (USI l = 0; l < len; l++) {
559 
560  // Time
561  outF << "\t" << setw(ns) << fixed << setprecision(3) << Sumdata[0].val[l];
562 
563  id = ID;
564  for (USI i = 1; i < col; i++) {
565  if (Sumdata[id].Type == "int") {
566  outF << fixed << setprecision(0);
567  } else if (Sumdata[id].Type == "fixed") {
568  outF << fixed << setprecision(3);
569  } else if (Sumdata[id].Type == "float") {
570  outF << scientific << setprecision(5);
571  }
572  outF << "\t" << setw(ns) << Sumdata[id++].val[l];
573  if (id == num) break;
574  }
575  outF << "\n";
576  }
577 
578  ID += (col - 1);
579 
580  outF << "\n";
581  }
582 
583  outF.close();
584 }
585 
586 void CriticalInfo::Setup(const OCP_DBL& totalTime)
587 {
588  // Allocate memory
589  USI rc = totalTime / 0.1;
590  time.reserve(rc);
591  dt.reserve(rc);
592  dPmax.reserve(rc);
593  dVmax.reserve(rc);
594  dSmax.reserve(rc);
595  dNmax.reserve(rc);
596  cfl.reserve(rc);
597 }
598 
599 void CriticalInfo::SetVal(const Reservoir& rs, const OCPControl& ctrl)
600 {
601  const Bulk& bulk = rs.bulk;
602 
603  time.push_back(ctrl.GetCurTime());
604  dt.push_back(ctrl.GetLastDt());
605  dPmax.push_back(bulk.GetdPmax());
606  dVmax.push_back(bulk.GeteVmax());
607  dSmax.push_back(bulk.GetdSmax());
608  dNmax.push_back(bulk.GetdNmax());
609  cfl.push_back(bulk.GetMaxCFL());
610 }
611 
612 void CriticalInfo::PrintFastReview(const string& dir) const
613 {
614  string FileOut = dir + "FastReview.out";
615  const USI ns = 12;
616 
617  ofstream outF(FileOut);
618  if (!outF.is_open()) {
619  OCP_ABORT("Can not open " + FileOut);
620  }
621 
622  // Item
623  outF << setw(ns) << "Time";
624  outF << setw(ns) << "dt";
625  outF << setw(ns) << "dPmax";
626  outF << setw(ns) << "dVmax";
627  outF << setw(ns) << "dSmax";
628  outF << setw(ns) << "dNmax";
629  outF << setw(ns) << "CFL" << endl;
630  // Unit
631  outF << setw(ns) << "Days";
632  outF << setw(ns) << "Days";
633  outF << setw(ns) << "Psia";
634  outF << setw(ns) << " ";
635  outF << setw(ns) << " ";
636  outF << setw(ns) << " ";
637  outF << setw(ns) << " " << endl;
638 
639  USI n = time.size();
640  for (USI i = 0; i < n; i++) {
641  outF << setw(ns) << fixed << setprecision(3) << time[i];
642  outF << setw(ns) << fixed << setprecision(3) << dt[i];
643  outF << setw(ns) << scientific << setprecision(3) << dPmax[i];
644  outF << setw(ns) << scientific << setprecision(3) << dVmax[i];
645  outF << setw(ns) << scientific << setprecision(3) << dSmax[i];
646  outF << setw(ns) << scientific << setprecision(3) << dNmax[i];
647  outF << setw(ns) << scientific << setprecision(3) << cfl[i];
648  outF << "\n";
649  }
650 
651  outF.close();
652 }
653 
654 void BasicGridProperty::SetBasicGridProperty(const BasicGridPropertyParam& param)
655 {
656  PRE = param.PRE;
657  PGAS = param.PGAS;
658  PWAT = param.PWAT;
659  SOIL = param.SOIL;
660  SGAS = param.SGAS;
661  SWAT = param.SWAT;
662  DENO = param.DENO;
663  DENG = param.DENG;
664  DENW = param.DENW;
665  KRO = param.KRO;
666  KRG = param.KRG;
667  KRW = param.KRW;
668  BOIL = param.BOIL;
669  BGAS = param.BGAS;
670  BWAT = param.BWAT;
671  VOIL = param.VOIL;
672  VGAS = param.VGAS;
673  VWAT = param.VWAT;
674  XMF = param.XMF;
675  YMF = param.YMF;
676  PCW = param.PCW;
677 }
678 
679 void Out4RPT::InputParam(const OutputRPTParam& RPTparam)
680 {
681  useRPT = RPTparam.useRPT;
682  if (!useRPT) return;
683 
684  bgp.SetBasicGridProperty(RPTparam.bgp);
685 }
686 
687 void Out4RPT::Setup(const string& dir, const Reservoir& rs)
688 {
689  if (!useRPT) return;
690 
691  string FileOut = dir + "RPT.out";
692  ofstream outF(FileOut);
693  if (!outF.is_open()) {
694  OCP_ABORT("Can not open " + FileOut);
695  }
696  outF.close();
697 
698  const Grid& initGrid = rs.grid;
699 
700  nx = initGrid.nx;
701  ny = initGrid.ny;
702  numGrid = initGrid.numGrid;
703  IJKspace = initGrid.numDigutIJK;
704 }
705 
706 void Out4RPT::PrintRPT(const string& dir,
707  const Reservoir& rs,
708  const OCP_DBL& days) const
709 {
710 
711  if (!useRPT) return;
712 
713  string FileOut = dir + "RPT.out";
714  ofstream outRPT;
715  outRPT.open(FileOut, ios::app);
716  if (!outRPT.is_open()) {
717  OCP_ABORT("Can not open " + FileOut);
718  }
719 
720  const Grid& initGrid = rs.grid;
721  const Bulk& bulk = rs.bulk;
722 
723  const USI np = bulk.numPhase;
724  const USI nc = bulk.numCom;
725  const USI OIndex = bulk.phase2Index[OIL];
726  const USI GIndex = bulk.phase2Index[GAS];
727  const USI WIndex = bulk.phase2Index[WATER];
728  const vector<GB_Pair>& g2bp = initGrid.map_All2Act;
729 
730  outRPT << OCP_SEP02(50) << "\n";
731 
732  // Well Info
733  USI numWell = rs.allWells.GetWellNum();
734  outRPT << "Well Information"
735  << " ";
736  outRPT << fixed << setprecision(3) << days << " DAYS"
737  << "\n";
738  // INJ
739  for (USI w = 0; w < numWell; w++) {
740  if (rs.allWells.wells[w].opt.type == INJ) {
741  outRPT << "-------------------------------------"
742  << "\n";
743  outRPT << rs.allWells.wells[w].name << " " << w << " "
744  << rs.allWells.wells[w].depth << " (feet) ";
745  outRPT << rs.allWells.wells[w].I << " " << rs.allWells.wells[w].J << "\n";
746 
747  if (rs.allWells.wells[w].opt.state == OPEN) {
748  outRPT << "OPEN\t" << rs.allWells.wells[w].WGIR << " (MSCF/DAY)\t"
749  << rs.allWells.wells[w].WWIR << " (STB/DAY)"
750  << "\n";
751  } else {
752  outRPT << "SHUTIN"
753  << "\n";
754  }
755  // perf
756  for (USI p = 0; p < rs.allWells.wells[w].numPerf; p++) {
757  outRPT << "perf" << p << " " << rs.allWells.wells[w].perf[p].I
758  << " " << rs.allWells.wells[w].perf[p].J << " "
759  << rs.allWells.wells[w].perf[p].K << " "
760  << rs.allWells.wells[w].perf[p].depth << " ";
761  if (rs.allWells.wells[w].perf[p].state == OPEN) {
762  outRPT << "OPEN";
763  } else {
764  outRPT << "SHUTIN";
765  }
766  outRPT << " " << rs.allWells.wells[w].perf[p].location << "\n";
767  }
768  }
769  }
770  // PROD
771  for (USI w = 0; w < numWell; w++) {
772  if (rs.allWells.wells[w].opt.type == PROD) {
773  outRPT << "-------------------------------------"
774  << "\n";
775  outRPT << rs.allWells.wells[w].name << " " << w << " "
776  << rs.allWells.wells[w].depth << " (feet) ";
777  outRPT << rs.allWells.wells[w].I << " " << rs.allWells.wells[w].J << "\n";
778 
779  if (rs.allWells.wells[w].opt.state == OPEN) {
780  outRPT << "OPEN\t" << rs.allWells.wells[w].WOPR << " (STB/DAY)\t"
781  << rs.allWells.wells[w].WGPR << " (MSCF/DAY)\t"
782  << rs.allWells.wells[w].WWPR << " (STB/DAY)"
783  << "\n";
784  } else {
785  outRPT << "SHUTIN"
786  << "\n";
787  }
788  // perf
789  for (USI p = 0; p < rs.allWells.wells[w].numPerf; p++) {
790  outRPT << "perf" << p << " " << rs.allWells.wells[w].perf[p].I
791  << " " << rs.allWells.wells[w].perf[p].J << " "
792  << rs.allWells.wells[w].perf[p].K << " "
793  << rs.allWells.wells[w].perf[p].depth << " ";
794  if (rs.allWells.wells[w].perf[p].state == OPEN) {
795  outRPT << "OPEN";
796  } else {
797  outRPT << "SHUTIN";
798  }
799  outRPT << " " << rs.allWells.wells[w].perf[p].location << "\n";
800  }
801  }
802  }
803 
804  outRPT << "\n\n";
805 
806  static OCP_BOOL flag = OCP_FALSE;
807  // Print once
808  if (flag) {
809  PrintRPT_Scalar(outRPT, "DX : feet", days, &initGrid.dx[0], 1, g2bp, OCP_FALSE);
810  PrintRPT_Scalar(outRPT, "DY : feet", days, &initGrid.dy[0], 1, g2bp, OCP_FALSE);
811  PrintRPT_Scalar(outRPT, "DZ : feet", days, &initGrid.dz[0], 1, g2bp, OCP_FALSE);
812  PrintRPT_Scalar(outRPT, "Depth : feet", days, &initGrid.depth[0], 1, g2bp,
813  OCP_FALSE);
814  PrintRPT_Scalar(outRPT, "PERMX : MDarcy", days, &initGrid.kx[0], 1, g2bp,
815  OCP_FALSE);
816  PrintRPT_Scalar(outRPT, "PERMY : MDarcy", days, &initGrid.ky[0], 1, g2bp,
817  OCP_FALSE);
818  PrintRPT_Scalar(outRPT, "PERMZ : MDarcy", days, &initGrid.kz[0], 1, g2bp,
819  OCP_FALSE);
820  flag = OCP_FALSE;
821  }
822 
823  // PRESSURE
824  if (bgp.PRE) {
825  PrintRPT_Scalar(outRPT, "PRESSURE : psia", days, &bulk.P[0], 1, g2bp, OCP_TRUE);
826  }
827 
828  // DENSITY of OIL
829  if (bgp.DENO && bulk.oil) {
830  PrintRPT_Scalar(outRPT, "DENO : lb/ft3", days, &bulk.rho[OIndex], np, g2bp,
831  OCP_TRUE);
832  }
833  outRPT << endl;
834 
835  // DENSITY of GAS
836  if (bgp.DENG && bulk.gas) {
837  PrintRPT_Scalar(outRPT, "DENG : lb/ft3", days, &bulk.rho[GIndex], np, g2bp,
838  OCP_TRUE);
839  }
840 
841  // DENSITY of WATER
842  if (bgp.DENW && bulk.water) {
843  PrintRPT_Scalar(outRPT, "DENW : lb/ft3", days, &bulk.rho[WIndex], np, g2bp,
844  OCP_TRUE);
845  }
846 
847  // SATURATION of OIL
848  if (bgp.SOIL && bulk.oil) {
849  PrintRPT_Scalar(outRPT, "SOIL ", days, &bulk.S[OIndex], np, g2bp,
850  OCP_TRUE);
851  }
852 
853  // SATURATION of GAS
854  if (bgp.SGAS && bulk.gas) {
855  PrintRPT_Scalar(outRPT, "SGAS ", days, &bulk.S[GIndex], np, g2bp,
856  OCP_TRUE);
857  }
858 
859  // SATURATION of WATER
860  if (bgp.SWAT && bulk.water) {
861  PrintRPT_Scalar(outRPT, "SWAT ", days, &bulk.S[WIndex], np, g2bp,
862  OCP_TRUE);
863  }
864 
865  // Relative Permeability of OIL
866  if (bgp.KRO && bulk.oil) {
867  PrintRPT_Scalar(outRPT, "KRO ", days, &bulk.kr[OIndex], np, g2bp,
868  OCP_TRUE);
869  }
870 
871  // Relative Permeability of GAS
872  if (bgp.KRG && bulk.gas) {
873  PrintRPT_Scalar(outRPT, "KRG ", days, &bulk.kr[GIndex], np, g2bp,
874  OCP_TRUE);
875  }
876 
877  // Relative Permeability of WATER
878  if (bgp.KRW && bulk.water) {
879  PrintRPT_Scalar(outRPT, "KRW ", days, &bulk.kr[WIndex], np, g2bp,
880  OCP_TRUE);
881  }
882 
883  // Molar Density of OIL
884  if (bgp.BOIL && bulk.oil && bulk.IfUseEoS()) {
885  PrintRPT_Scalar(outRPT, "BOIL : lb-M/rb", days, &bulk.xi[OIndex], np, g2bp,
886  OCP_TRUE);
887  }
888 
889  // Molar Density of GAS
890  if (bgp.BGAS && bulk.gas && bulk.IfUseEoS()) {
891  PrintRPT_Scalar(outRPT, "BGAS : lb-M/rb", days, &bulk.xi[GIndex], np, g2bp,
892  OCP_TRUE);
893  }
894 
895  // Molar Density of WATER
896  if (bgp.BWAT && bulk.water) {
897  PrintRPT_Scalar(outRPT, "BWAT : lb-M/rb", days, &bulk.xi[WIndex], np, g2bp,
898  OCP_TRUE, (CONV1 * 19.437216));
899  }
900 
901  // Viscosity of OIL
902  if (bgp.VOIL && bulk.oil) {
903  PrintRPT_Scalar(outRPT, "VOIL : lb-M/rb", days, &bulk.mu[OIndex], np, g2bp,
904  OCP_TRUE);
905  }
906 
907  // Viscosity of GAS
908  if (bgp.VGAS && bulk.gas) {
909  PrintRPT_Scalar(outRPT, "VGAS : lb-M/rb", days, &bulk.mu[GIndex], np, g2bp,
910  OCP_TRUE);
911  }
912 
913  // Viscosity of WATER
914  if (bgp.VWAT && bulk.water) {
915  PrintRPT_Scalar(outRPT, "VWAT : lb-M/rb", days, &bulk.mu[WIndex], np, g2bp,
916  OCP_TRUE);
917  }
918 
919  // liquid component mole fractions.
920  if (bgp.XMF && bulk.IfUseEoS()) {
921  for (USI i = 0; i < nc - 1; i++) {
922  PrintRPT_Scalar(outRPT, "XMF : Oil " + to_string(i + 1) + "th Component",
923  days, &bulk.xij[OIndex * nc + i], np * nc, g2bp, OCP_TRUE);
924  }
925  }
926 
927  // gas component mole fractions.
928  if (bgp.YMF && bulk.IfUseEoS()) {
929  for (USI i = 0; i < nc - 1; i++) {
930  PrintRPT_Scalar(outRPT, "YMF : Gas " + to_string(i + 1) + "th Component",
931  days, &bulk.xij[GIndex * nc + i], np * nc, g2bp, OCP_TRUE);
932  }
933  }
934 
935  // Po - Pw
936  if (bgp.PCW) {
937  PrintRPT_Scalar(outRPT, "PCW : psia ", days, &bulk.Pc[WIndex], np, g2bp,
938  OCP_TRUE);
939 
940  // PrintRPT_Scalar(outRPT, "PPCW : psia ", days,
941  // &rs.optFeatures.scalePcow.scaleVal[0],
942  // 1, g2bp, OCP_TRUE, 103.053 - 0.116);
943  }
944 
945  outRPT.close();
946 }
947 
948 void Out4RPT::GetIJKGrid(USI& i, USI& j, USI& k, const OCP_USI& n) const
949 {
950  // i,j,k begin from 1
951  // n must be the index of grids instead bulks
952  k = n / (nx * ny) + 1;
953  j = (n - (k - 1) * nx * ny) / nx + 1;
954  i = n - (k - 1) * nx * ny - (j - 1) * nx + 1;
955 }
956 
957 void Out4VTK::InputParam(const OutputVTKParam& VTKParam)
958 {
959  useVTK = VTKParam.useVTK;
960  if (!useVTK) return;
961 
962  bgp.SetBasicGridProperty(VTKParam.bgp);
963 }
964 
965 void Out4VTK::Setup(const string& dir, const Reservoir& rs, const USI& ndates)
966 {
967  if (!useVTK) return;
968 
969  string file = dir + "grid" + to_string(index) + ".vtk";
970  string newfile;
971  string title = "test";
972 
973  const Grid& initGrid = rs.grid;
974 
975  out4vtk.Init(file, title, VTK_ASCII, VTK_UNSTRUCTURED_GRID,
976  initGrid.polyhedronGrid.size(), rs.allWells.polyhedronWell.size());
977  out4vtk.OutputPOINTS(file, initGrid.polyhedronGrid, rs.allWells.polyhedronWell,
978  VTK_FLOAT);
979  out4vtk.OutputCELLS(file, initGrid.polyhedronGrid, rs.allWells.polyhedronWell);
980  out4vtk.OutputCELL_TYPES(file, initGrid.polyhedronGrid, rs.allWells.polyhedronWell);
981  out4vtk.BeginCellData();
982  // output dead grid, live grid, well
983  vector<USI> tmpW(rs.allWells.numWell, 10);
984  out4vtk.OutputCELL_DATA_SCALARS(file, "CellType", VTK_UNSIGNED_INT,
985  &initGrid.gridTag[0], 1, initGrid.map_All2Act,
986  OCP_FALSE, &tmpW[0]);
987 
988  for (USI i = 1; i < ndates; i++) {
989  index++;
990  newfile = dir + "grid" + to_string(index) + ".vtk";
991  ;
992  ifstream source(file, ios::binary);
993  ofstream dest(newfile, ios::binary);
994  dest << source.rdbuf();
995  source.close();
996  dest.close();
997  }
998  index = 0;
999 
1000 #ifdef USE_METIS
1001  metisTest.Setup(rs);
1002 #endif // USE_METIS
1003 }
1004 
1005 void Out4VTK::PrintVTK(const string& dir,
1006  const Reservoir& rs,
1007  const OCP_DBL& days) const
1008 {
1009  if (!useVTK) return;
1010 
1011  string file = dir + "grid" + to_string(index) + ".vtk";
1012  // Calulcate Well val for output
1013  rs.allWells.SetWellVal();
1014 
1015  const Grid& initGrid = rs.grid;
1016  const Bulk& bulk = rs.bulk;
1017  const vector<GB_Pair>& g2bp = initGrid.map_All2Act;
1018  const vector<OCP_DBL>& well = rs.allWells.wellVal;
1019  const USI np = bulk.numPhase;
1020  const USI OIndex = bulk.phase2Index[OIL];
1021  const USI GIndex = bulk.phase2Index[GAS];
1022  const USI WIndex = bulk.phase2Index[WATER];
1023 
1024  // output
1025  if (bgp.PRE)
1026  out4vtk.OutputCELL_DATA_SCALARS(file, "PRESSURE", VTK_FLOAT, &bulk.P[0], 1,
1027  g2bp, OCP_TRUE, &well[0]);
1028  if (bgp.SOIL)
1029  out4vtk.OutputCELL_DATA_SCALARS(file, "SOIL", VTK_FLOAT, &bulk.S[OIndex], np,
1030  g2bp, OCP_TRUE, &well[0]);
1031  if (bgp.SGAS)
1032  out4vtk.OutputCELL_DATA_SCALARS(file, "SGAS", VTK_FLOAT, &bulk.S[GIndex], np,
1033  g2bp, OCP_TRUE, &well[0]);
1034  if (bgp.SWAT)
1035  out4vtk.OutputCELL_DATA_SCALARS(file, "SWAT", VTK_FLOAT, &bulk.S[WIndex], np,
1036  g2bp, OCP_TRUE, &well[0]);
1037 
1038 #ifdef USE_METIS
1039  if (metisTest.useMetis) {
1040  // partition and print
1041  // vertex weights set to 1 now
1042  metisTest.vwgt.resize(metisTest.nvtxs, 1);
1043  // metisTest.MyPartitionFunc(METIS_PartGraphRecursive);
1044  metisTest.MyPartitionFunc(METIS_PartGraphKway);
1045  metisTest.SetPartitions(initGrid.map_Act2All);
1046  out4vtk.OutputCELL_DATA_SCALARS(file, "PARTIONS", VTK_UNSIGNED_INT,
1047  &metisTest.partitions[0], 1, g2bp, OCP_FALSE,
1048  &metisTest.partitions[metisTest.ng]);
1049  }
1050 #endif // USE_METIS
1051 
1052  index++;
1053 }
1054 
1055 void OCPOutput::InputParam(const ParamOutput& paramOutput)
1056 {
1057  summary.InputParam(paramOutput.summary);
1058  out4RPT.InputParam(paramOutput.outRPTParam);
1059  out4VTK.InputParam(paramOutput.outVTKParam);
1060 }
1061 
1062 void OCPOutput::Setup(const Reservoir& reservoir, const OCPControl& ctrl)
1063 {
1064  workDir = ctrl.workDir;
1065  summary.Setup(reservoir, ctrl.criticalTime.back());
1066  crtInfo.Setup(ctrl.criticalTime.back());
1067  out4RPT.Setup(workDir, reservoir);
1068  out4VTK.Setup(workDir, reservoir, ctrl.criticalTime.size());
1069 }
1070 
1071 void OCPOutput::SetVal(const Reservoir& reservoir, const OCPControl& ctrl)
1072 {
1073  summary.SetVal(reservoir, ctrl);
1074  crtInfo.SetVal(reservoir, ctrl);
1075 }
1076 
1077 void OCPOutput::PrintInfo() const
1078 {
1079  summary.PrintInfo(workDir);
1080  crtInfo.PrintFastReview(workDir);
1081 }
1082 
1083 void OCPOutput::PrintInfoSched(const Reservoir& rs,
1084  const OCPControl& ctrl,
1085  const OCP_DBL& time) const
1086 {
1087  OCP_DBL days = ctrl.current_time;
1088 
1089  // print timing info on the screen
1090  if (ctrl.printLevel >= PRINT_MIN) {
1091  cout << "Timestep " << setw(6) << left << ctrl.numTstep << ": " << fixed
1092  << setw(10) << setprecision(3) << right << days << " Days"
1093  << " Wall time: " << time / 1000 << " Sec" << endl;
1094  }
1095 
1096  // print to output file
1097  // TODO: Add a control flag to enable or disable --zcs
1098  GetWallTime timer;
1099  timer.Start();
1100  out4RPT.PrintRPT(workDir, rs, days);
1101  out4VTK.PrintVTK(workDir, rs, days);
1102  outputTime += timer.Stop() / 1000;
1103 }
1104 
1105 /*----------------------------------------------------------------------------*/
1106 /* Brief Change History of This File */
1107 /*----------------------------------------------------------------------------*/
1108 /* Author Date Actions */
1109 /*----------------------------------------------------------------------------*/
1110 /* Shizhe Li Oct/01/2021 Create file */
1111 /* Chensong Zhang Oct/15/2021 Format file */
1112 /* Chensong Zhang Jan/09/2022 Update Doxygen */
1113 /*----------------------------------------------------------------------------*/
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 WATER
Fluid type = water.
Definition: OCPConst.hpp:93
const OCP_BOOL OPEN
Well type = open.
Definition: OCPConst.hpp:126
const USI OIL
Fluid type = oil.
Definition: OCPConst.hpp:91
unsigned int OCP_USI
Long unsigned integer.
Definition: OCPConst.hpp:25
const USI PROD
Well type = producer.
Definition: OCPConst.hpp:123
int OCP_INT
Long integer.
Definition: OCPConst.hpp:26
const USI INJ
Well type = injector.
Definition: OCPConst.hpp:122
unsigned int OCP_BOOL
OCP_BOOL in OCP.
Definition: OCPConst.hpp:29
OCPOutput class declaration.
#define OCP_WARNING(msg)
Log warning messages.
Definition: UtilError.hpp:39
#define OCP_ABORT(msg)
Abort if critical error happens.
Definition: UtilError.hpp:47
OCP_DBL GetWGIR(const USI &w) const
Return gas injection rate of the wth well.
Definition: AllWells.hpp:214
vector< Well > wells
well set.
Definition: AllWells.hpp:174
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
OCP_DBL GetWBHP(const USI &w) const
Return the BHP of wth well.
Definition: AllWells.hpp:156
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 GetIndex(const string &name) const
Return the index of specified well.
Definition: AllWells.cpp:373
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
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
OCP_BOOL DENG
Gas density of grids.
OCP_BOOL PWAT
Water pressure of grids.
Definition: ParamOutput.hpp:95
OCP_BOOL DENW
Water density of grids.
OCP_BOOL XMF
liquid component mole fractions.
OCP_BOOL SWAT
Water saturation of grids.
Definition: ParamOutput.hpp:98
OCP_BOOL BWAT
Water reservoir molar densities of grids.
OCP_BOOL PRE
Pressure of grids.
Definition: ParamOutput.hpp:93
OCP_BOOL BOIL
Oil reservoir molar densities of grids.
OCP_BOOL PCW
capillary pressure: Po - Pw.
OCP_BOOL YMF
gas component mole fractions.
OCP_BOOL VOIL
Oil viscosity of grids.
OCP_BOOL KRG
Gas relative permeability of grids.
OCP_BOOL VWAT
Water viscosity of grids.
OCP_BOOL SOIL
Oil saturation of grids.
Definition: ParamOutput.hpp:96
OCP_BOOL VGAS
Gas viscosity of grids.
OCP_BOOL SGAS
Gas saturation of grids.
Definition: ParamOutput.hpp:97
OCP_BOOL KRW
Water relative permeability of grids.
OCP_BOOL DENO
Oil density of grids.
Definition: ParamOutput.hpp:99
OCP_BOOL PGAS
Gas pressure of grids.
Definition: ParamOutput.hpp:94
OCP_BOOL KRO
Oil relative permeability of grids.
OCP_BOOL BGAS
Gas reservoir molar densities of grids.
Physical information of each active reservoir bulk.
Definition: Bulk.hpp:104
vector< OCP_DBL > mu
Viscosity of phase: numPhase*numBulk.
Definition: Bulk.hpp:320
vector< OCP_DBL > Pc
Capillary pressure of phase: numPhase*numBulk.
Definition: Bulk.hpp:312
USI numPhase
Number of phase.
Definition: Bulk.hpp:154
vector< OCP_DBL > S
Saturation of phase: numPhase*numBulk.
Definition: Bulk.hpp:314
OCP_BOOL oil
If OCP_TRUE, oil phase could exist.
Definition: Bulk.hpp:222
vector< OCP_DBL > rho
Mass density of phase: numPhase*numBulk.
Definition: Bulk.hpp:318
OCP_DBL GeteVmax() const
Return eVmax.
Definition: Bulk.hpp:453
OCP_BOOL gas
If OCP_TRUE, gas phase could exist.
Definition: Bulk.hpp:223
vector< OCP_DBL > xij
Nij / Nj: numPhase*numCom*numBulk.
Definition: Bulk.hpp:317
vector< OCP_DBL > kr
Relative permeability of phase: numPhase*numBulk.
Definition: Bulk.hpp:321
vector< USI > phase2Index
Location of phase according to its name: numPhase.
Definition: Bulk.hpp:302
OCP_DBL GetSOIL(const OCP_USI &n) const
Return oil saturation of the n-th bulk.
Definition: Bulk.hpp:286
OCP_DBL GetMaxCFL() const
Return maxCFL.
Definition: Bulk.hpp:455
vector< OCP_DBL > xi
Moles density of phase: numPhase*numBulk.
Definition: Bulk.hpp:319
OCP_DBL GetSWAT(const OCP_USI &n) const
Return water saturation of the n-th bulk.
Definition: Bulk.hpp:296
OCP_DBL CalFTR() const
Calculate average Temperature in reservoir.
Definition: Bulk.cpp:1216
OCP_DBL GetSGAS(const OCP_USI &n) const
Return gas saturation of the n-th bulk.
Definition: Bulk.hpp:291
OCP_DBL GetdSmax() const
Return dSmax.
Definition: Bulk.hpp:451
OCP_BOOL IfUseEoS() const
Return ifUseEoS.
Definition: Bulk.hpp:215
OCP_BOOL water
If OCP_TRUE, water phase could exist.
Definition: Bulk.hpp:224
OCP_DBL GetdNmax() const
Return dNmax.
Definition: Bulk.hpp:449
OCP_DBL GetdPmax() const
Return dPmax.
Definition: Bulk.hpp:445
OCP_DBL CalFPR() const
Calculate average pressure in reservoir.
Definition: Bulk.cpp:1190
OCP_DBL GetP(const OCP_USI &n) const
Return pressure of the n-th bulk.
Definition: Bulk.hpp:284
vector< OCP_DBL > P
Pressure: numBulk.
Definition: Bulk.hpp:309
USI numCom
Number of component.
Definition: Bulk.hpp:155
void SetVal(const Reservoir &reservoir, const OCPControl &ctrl)
TODO: Add Doxygen.
Definition: OCPOutput.cpp:599
void PrintFastReview(const string &dir) const
TODO: Add Doxygen.
Definition: OCPOutput.cpp:612
void Setup(const OCP_DBL &totalTime)
TODO: Add Doxygen.
Definition: OCPOutput.cpp:586
Get elapsed wall-time in millisecond.
Definition: UtilTiming.hpp:32
__inline__ double Stop() const
Stop the timer and return duration from start() in ms.
Definition: UtilTiming.hpp:54
__inline__ void Start()
Start the timer.
Definition: UtilTiming.hpp:51
Definition: Grid.hpp:89
vector< OCP_DBL > ky
Absolute permeability in y-direction: numGrid.
Definition: Grid.hpp:172
vector< OCP_USI > map_Act2All
Mapping from active grid to all grid: activeGridNum.
Definition: Grid.hpp:192
USI nx
Number of cells in x-direction.
Definition: Grid.hpp:145
USI numDigutIJK
number of digits of maximum nx,ny,nz
Definition: Grid.hpp:221
vector< OCP_DBL > depth
Depth of center of grid cells: numGrid.
Definition: Grid.hpp:166
vector< OCP_DBL > kz
Absolute permeability in z-direction: numGrid.
Definition: Grid.hpp:173
USI GetNumDigitIJK() const
Return numDigutIJK.
Definition: Grid.hpp:216
vector< OCP_DBL > dz
Size of cell in z-direction: numGrid.
Definition: Grid.hpp:164
vector< OCPpolyhedron > polyhedronGrid
Coordinates of grid points.
Definition: Grid.hpp:219
vector< USI > gridTag
Tag of grid: dead, live(fluid), live(rock)
Definition: Grid.hpp:220
USI ny
Number of cells in y-direction.
Definition: Grid.hpp:146
vector< OCP_DBL > dy
Size of cell in y-direction: numGrid.
Definition: Grid.hpp:163
vector< GB_Pair > map_All2Act
Mapping from grid to active all grid: numGrid.
Definition: Grid.hpp:193
vector< OCP_DBL > dx
Size of cell in x-direction: numGrid.
Definition: Grid.hpp:162
OCP_USI numGrid
Number of all cells.
Definition: Grid.hpp:142
vector< OCP_DBL > kx
Absolute permeability in x-direction: numGrid.
Definition: Grid.hpp:171
All control parameters except for well controllers.
Definition: OCPControl.hpp:94
OCP_DBL GetLastDt() const
Return last time step size.
Definition: OCPControl.hpp:136
USI GetLSiterT() const
Return the total number of linear iterations.
Definition: OCPControl.hpp:142
OCP_DBL GetCurTime() const
Return the current time.
Definition: OCPControl.hpp:130
USI GetNRiterT() const
Return the total number of Newton iterations.
Definition: OCPControl.hpp:148
vector< USI > index
Records the index of bulk or well, whose properties will be printed.
Definition: OCPOutput.hpp:78
void Init(const string &myFile, const string &shortInfo, const string &myCodeWay, const string &girdType, const VTK_USI &nG, const VTK_USI &nW)
create a new file and write basic information
Definition: Output4Vtk.cpp:14
Type_A_o WWIR
Well water injection rate.
Definition: ParamOutput.hpp:79
Type_B_o SOIL
Oil saturation of bulk.
Definition: ParamOutput.hpp:85
OCP_BOOL FGIT
Field total gas injection.
Definition: ParamOutput.hpp:67
Type_A_o WGPR
Well gas production rate.
Definition: ParamOutput.hpp:73
OCP_BOOL FPR
Field average Pressure.
Definition: ParamOutput.hpp:58
OCP_BOOL FGPR
Field gas production rate.
Definition: ParamOutput.hpp:62
Type_A_o DG
Pressure difference between wells and perforations.
Definition: ParamOutput.hpp:82
Type_A_o WOPT
Well total oil production rate.
Definition: ParamOutput.hpp:72
OCP_BOOL FTR
Field average Temperature.
Definition: ParamOutput.hpp:59
Type_A_o WGPT
Well total gas production.
Definition: ParamOutput.hpp:74
OCP_BOOL FOPT
Field total oil production.
Definition: ParamOutput.hpp:61
Type_A_o WWPT
Well total water production.
Definition: ParamOutput.hpp:76
OCP_BOOL FWPT
Field total water production.
Definition: ParamOutput.hpp:65
Type_B_o BPR
Bulk pressure.
Definition: ParamOutput.hpp:84
Type_B_o SWAT
Water saturation of bulk.
Definition: ParamOutput.hpp:87
Type_A_o WOPR
Well oil production rate.
Definition: ParamOutput.hpp:71
OCP_BOOL FGIR
Field gas injection rate.
Definition: ParamOutput.hpp:66
OCP_BOOL FGPt
Field total gas production.
Definition: ParamOutput.hpp:63
Type_A_o WGIR
Well gas injection rate.
Definition: ParamOutput.hpp:77
Type_B_o SGAS
Gas saturation of bulk.
Definition: ParamOutput.hpp:86
Type_A_o WGIT
Well total gas injection.
Definition: ParamOutput.hpp:78
OCP_BOOL FWPR
Field water production rate.
Definition: ParamOutput.hpp:64
OCP_BOOL FOPR
Field oil production rate.
Definition: ParamOutput.hpp:60
OCP_BOOL FWIT
Field total water injection.
Definition: ParamOutput.hpp:69
Type_A_o WBHP
Well pressure.
Definition: ParamOutput.hpp:81
Type_A_o WWIT
Well total water injection.
Definition: ParamOutput.hpp:80
Type_A_o WWPR
Well water production rate.
Definition: ParamOutput.hpp:75
OCP_BOOL FWIR
Field water injection rate.
Definition: ParamOutput.hpp:68
OutputVTKParam outVTKParam
See OutputVTKParam.
OutputSummary summary
See OutputSummary.
OutputRPTParam outRPTParam
See OutputRPTParam.
Grid grid
Init Grid info.
Definition: Reservoir.hpp:73
Bulk bulk
Active grid info.
Definition: Reservoir.hpp:74
AllWells allWells
Wells class info.
Definition: Reservoir.hpp:75
The SumItem class is an auxiliary structure storing summary data to output.
Definition: OCPOutput.hpp:83
void Setup(const Reservoir &reservoir, const OCP_DBL &totalTime)
TODO: Add Doxygen.
Definition: OCPOutput.cpp:51
void SetVal(const Reservoir &reservoir, const OCPControl &ctrl)
TODO: Add Doxygen.
Definition: OCPOutput.cpp:392
void PrintInfo(const string &dir) const
Write output information to a file.
Definition: OCPOutput.cpp:506
void InputParam(const OutputSummary &summary_param)
TODO: Add Doxygen.
Definition: OCPOutput.cpp:14