OpenCAEPoro  v0.5.0
A simulator for multicomponent porous media flow
ParamOutput.cpp
Go to the documentation of this file.
1 
12 #include "ParamOutput.hpp"
13 
14 void ParamOutput::InputSUMMARY(ifstream& ifs)
15 {
16  vector<string> vbuf;
17  while (ReadLine(ifs, vbuf)) {
18  if (vbuf[0] == "/") break;
19  string keyword = vbuf[0];
20 
21  switch (Map_Str2Int(&keyword[0], keyword.size())) {
22  case Map_Str2Int("FPR", 3):
23  summary.FPR = OCP_TRUE;
24  break;
25 
26  case Map_Str2Int("FTR", 3):
27  summary.FTR = OCP_TRUE;
28  break;
29 
30  // Field
31  case Map_Str2Int("FOPR", 4):
32  summary.FOPR = OCP_TRUE;
33  break;
34 
35  case Map_Str2Int("FOPT", 4):
36  summary.FOPT = OCP_TRUE;
37  break;
38 
39  case Map_Str2Int("FGPR", 4):
40  summary.FGPR = OCP_TRUE;
41  break;
42 
43  case Map_Str2Int("FGPT", 4):
44  summary.FGPt = OCP_TRUE;
45  break;
46 
47  case Map_Str2Int("FWPR", 4):
48  summary.FWPR = OCP_TRUE;
49  break;
50 
51  case Map_Str2Int("FWPT", 4):
52  summary.FWPT = OCP_TRUE;
53  break;
54 
55  case Map_Str2Int("FGIR", 4):
56  summary.FGIR = OCP_TRUE;
57  break;
58 
59  case Map_Str2Int("FGIT", 4):
60  summary.FGIT = OCP_TRUE;
61  break;
62 
63  case Map_Str2Int("FWIR", 4):
64  summary.FWIR = OCP_TRUE;
65  break;
66 
67  case Map_Str2Int("FWIT", 4):
68  summary.FWIT = OCP_TRUE;
69  break;
70 
71  // Well
72  case Map_Str2Int("WOPR", 4):
73  InputType_A(ifs, summary.WOPR);
74  break;
75 
76  case Map_Str2Int("WOPT", 4):
77  InputType_A(ifs, summary.WOPT);
78  break;
79 
80  case Map_Str2Int("WGPR", 4):
81  InputType_A(ifs, summary.WGPR);
82  break;
83 
84  case Map_Str2Int("WGPT", 4):
85  InputType_A(ifs, summary.WGPT);
86  break;
87 
88  case Map_Str2Int("WWPR", 4):
89  InputType_A(ifs, summary.WWPR);
90  break;
91 
92  case Map_Str2Int("WWPT", 4):
93  InputType_A(ifs, summary.WWPT);
94  break;
95 
96  case Map_Str2Int("WGIR", 4):
97  InputType_A(ifs, summary.WGIR);
98  break;
99 
100  case Map_Str2Int("WGIT", 4):
101  InputType_A(ifs, summary.WGIT);
102  break;
103 
104  case Map_Str2Int("WWIR", 4):
105  InputType_A(ifs, summary.WWIR);
106  break;
107 
108  case Map_Str2Int("WWIT", 4):
109  InputType_A(ifs, summary.WWIT);
110  break;
111 
112  case Map_Str2Int("WBHP", 4):
113  InputType_A(ifs, summary.WBHP);
114  break;
115 
116  case Map_Str2Int("DG", 2):
117  InputType_A(ifs, summary.DG);
118  break;
119 
120  case Map_Str2Int("BPR", 3):
121  InputType_B(ifs, summary.BPR);
122  break;
123 
124  case Map_Str2Int("SOIL", 4):
125  InputType_B(ifs, summary.SOIL);
126  break;
127 
128  case Map_Str2Int("SGAS", 4):
129  InputType_B(ifs, summary.SGAS);
130  break;
131 
132  case Map_Str2Int("SWAT", 4):
133  InputType_B(ifs, summary.SWAT);
134  break;
135  default:
136  break;
137  }
138  }
139  // cout << "SUMMARY" << endl;
140 }
141 
142 void ParamOutput::InputType_A(ifstream& ifs, Type_A_o& obj)
143 {
144  obj.activity = OCP_TRUE;
145  vector<string> vbuf;
146  ReadLine(ifs, vbuf);
147  if (vbuf[0] == "/") {
148  obj.obj.push_back("All");
149  } else {
150  OCP_INT len = vbuf.size();
151  for (OCP_INT i = 0; i < len - 1; i++) {
152  obj.obj.push_back(vbuf[i]);
153  }
154  if (vbuf.back() != "/") obj.obj.push_back(vbuf.back());
155 
156  while (ReadLine(ifs, vbuf)) {
157  if (vbuf[0] == "/") break;
158 
159  OCP_INT len = vbuf.size();
160  for (OCP_INT i = 0; i < len - 1; i++) {
161  obj.obj.push_back(vbuf[i]);
162  }
163  if (vbuf.back() != "/") obj.obj.push_back(vbuf.back());
164  }
165  }
166  // cout << "Type_A" << endl;
167 }
168 
169 void ParamOutput::InputType_B(ifstream& ifs, Type_B_o& obj)
170 {
171 
172  vector<string> vbuf;
173  while (ReadLine(ifs, vbuf)) {
174  if (vbuf[0] == "/") break;
175 
176  obj.activity = OCP_TRUE;
177  DealDefault(vbuf);
178  USI i = stoi(vbuf[0]);
179  USI j = stoi(vbuf[1]);
180  USI k = stoi(vbuf[2]);
181 
182  obj.obj.push_back(COOIJK(i, j, k));
183  }
184  // cout << "Type_B" << endl;
185 }
186 
187 void ParamOutput::InputRPTSCHED(ifstream& ifs, const string& keyword)
188 {
189  BasicGridPropertyParam* tmpBgpp;
190  if (keyword == "RPTSCHED") {
191  outRPTParam.useRPT = OCP_TRUE;
192  tmpBgpp = &outRPTParam.bgp;
193  } else if (keyword == "VTKSCHED") {
194  outVTKParam.useVTK = OCP_TRUE;
195  tmpBgpp = &outVTKParam.bgp;
196  } else {
197  return;
198  }
199 
200  vector<string> vbuf;
201  while (ReadLine(ifs, vbuf)) {
202  if (vbuf[0] == "/") break;
203 
204  USI len = vbuf.size();
205 
206  for (USI i = 0; i < len; i++) {
207 
208  string keyword = vbuf[i];
209 
210  switch (Map_Str2Int(&keyword[0], keyword.size())) {
211  case Map_Str2Int("PRES", 4):
212  case Map_Str2Int("PRESSURE", 8):
213  tmpBgpp->PRE = OCP_TRUE;
214  break;
215  case Map_Str2Int("PGAS", 4):
216  tmpBgpp->PGAS = OCP_TRUE;
217  break;
218  case Map_Str2Int("PWAT", 4):
219  tmpBgpp->PWAT = OCP_TRUE;
220  break;
221  case Map_Str2Int("SOIL", 4):
222  tmpBgpp->SOIL = OCP_TRUE;
223  break;
224  case Map_Str2Int("SGAS", 4):
225  tmpBgpp->SGAS = OCP_TRUE;
226  break;
227  case Map_Str2Int("SWAT", 4):
228  tmpBgpp->SWAT = OCP_TRUE;
229  break;
230  case Map_Str2Int("DENO", 4):
231  tmpBgpp->DENO = OCP_TRUE;
232  break;
233  case Map_Str2Int("DENG", 4):
234  tmpBgpp->DENG = OCP_TRUE;
235  break;
236  case Map_Str2Int("DENW", 4):
237  tmpBgpp->DENW = OCP_TRUE;
238  break;
239  case Map_Str2Int("KRO", 3):
240  tmpBgpp->KRO = OCP_TRUE;
241  break;
242  case Map_Str2Int("KRG", 3):
243  tmpBgpp->KRG = OCP_TRUE;
244  break;
245  case Map_Str2Int("KRW", 3):
246  tmpBgpp->KRW = OCP_TRUE;
247  break;
248  case Map_Str2Int("BOIL", 4):
249  tmpBgpp->BOIL = OCP_TRUE;
250  break;
251  case Map_Str2Int("BGAS", 4):
252  tmpBgpp->BGAS = OCP_TRUE;
253  break;
254  case Map_Str2Int("BWAT", 4):
255  tmpBgpp->BWAT = OCP_TRUE;
256  break;
257  case Map_Str2Int("VOIL", 4):
258  tmpBgpp->VOIL = OCP_TRUE;
259  break;
260  case Map_Str2Int("VGAS", 4):
261  tmpBgpp->VGAS = OCP_TRUE;
262  break;
263  case Map_Str2Int("VWAT", 4):
264  tmpBgpp->VWAT = OCP_TRUE;
265  break;
266  case Map_Str2Int("XMF", 3):
267  tmpBgpp->XMF = OCP_TRUE;
268  break;
269  case Map_Str2Int("YMF", 3):
270  tmpBgpp->YMF = OCP_TRUE;
271  break;
272  case Map_Str2Int("PCW", 3):
273  tmpBgpp->PCW = OCP_TRUE;
274  break;
275  default:
276  break;
277  }
278  }
279  }
280  // cout << keyword << endl;
281 }
282 
283 /*----------------------------------------------------------------------------*/
284 /* Brief Change History of This File */
285 /*----------------------------------------------------------------------------*/
286 /* Author Date Actions */
287 /*----------------------------------------------------------------------------*/
288 /* Shizhe Li Oct/01/2021 Create file */
289 /* Chensong Zhang Oct/15/2021 Format file */
290 /*----------------------------------------------------------------------------*/
unsigned int USI
Generic unsigned integer.
Definition: OCPConst.hpp:23
int OCP_INT
Long integer.
Definition: OCPConst.hpp:26
ParamOutput class declaration.
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
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.
A structure of three-dimensional coordinates.
Definition: ParamOutput.hpp:24
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
void InputType_A(ifstream &ifs, Type_A_o &obj)
void InputType_B(ifstream &ifs, Type_B_o &obj)
void InputRPTSCHED(ifstream &ifs, const string &keyword)
OutputVTKParam outVTKParam
See OutputVTKParam.
void InputSUMMARY(ifstream &ifs)
Definition: ParamOutput.cpp:14
OutputSummary summary
See OutputSummary.
OutputRPTParam outRPTParam
See OutputRPTParam.
Used to store the contents of keyword whose contents are in form of string.
Definition: ParamOutput.hpp:46
Used to store the contents of keyword whose contents are in form of coordinates.
Definition: ParamOutput.hpp:38