OpenCAEPoro  v0.5.0
A simulator for multicomponent porous media flow
Public Member Functions | Public Attributes | List of all members
ParamWell Class Reference

#include <ParamWell.hpp>

Public Member Functions

void Init ()
 Initialize the inputting the params of wells.
 
void InitTime ()
 Initialize the critical time.
 
void InputWELSPECS (ifstream &ifs)
 
void InputCOMPDAT (ifstream &ifs)
 
void InputWCONINJE (ifstream &ifs)
 
void InputWCONPROD (ifstream &ifs)
 
void InputTSTEP (ifstream &ifs)
 
void InputWELTARG (ifstream &ifs)
 
void InputWTEMP (ifstream &ifs)
 Input the temperature of injected fluid.
 
void InputUNWEIGHT (ifstream &ifs)
 Input injector type – MOBWEIGHT(defaulted) or UNWEIGHT.
 
void InputWELLSTRE (ifstream &ifs)
 
void InputPSURF (ifstream &ifs)
 Input surface pressure.
 
void InputTSURF (ifstream &ifs)
 Input surface temperature.
 
void CheckParam (const OCP_BOOL &boModel) const
 Check if wrong params are input.
 
void CheckPerf () const
 Check if params of Perforation is wrong.
 
void CheckINJFluid () const
 

Public Attributes

vector< WellParamwell
 Contains all the information of wells.
 
vector< OCP_DBLcriticalTime
 Records the critical time given by users.
 
vector< SolventsolSet
 Sets of Solvent.
 
OCP_DBL Psurf {PRESSURE_STD}
 Pressure in surface condition.
 
OCP_DBL Tsurf {TEMPERATURE_STD}
 Temperature in surface condition.
 

Detailed Description

ParamWell is an internal structure used to stores the information of wells from input files. It is an intermediate interface and independent of the main simulator. After all file inputting finishes, the params in it will pass to corresponding modules.

Definition at line 99 of file ParamWell.hpp.

Member Function Documentation

◆ InputCOMPDAT()

void ParamWell::InputCOMPDAT ( ifstream &  ifs)

Input the well keyword COMPDAT. COMPDAT contains the information of perforations of wells, for example the location, the trans or directions.

Definition at line 80 of file ParamWell.cpp.

81 {
82  USI num = well.size();
83  vector<string> vbuf;
84  while (ReadLine(ifs, vbuf)) {
85  if (vbuf[0] == "/") break;
86 
87  DealDefault(vbuf);
88  string src = vbuf[0];
89  string::size_type pos = src.find("*");
90  OCP_BOOL match = (pos != string::npos);
91  if (match) {
92  src.erase(pos);
93  }
94  OCP_BOOL tmp = OCP_FALSE;
95 
96  for (USI w = 0; w < num; w++) {
97  if (match)
98  tmp = (well[w].name.substr(0, pos) == src);
99  else
100  tmp = (well[w].name == src);
101 
102  if (tmp) {
103 
104  USI k1 = stoi(vbuf[3]);
105  USI k2 = stoi(vbuf[4]);
106 
107  for (USI k = k1; k <= k2; k++) {
108  if (vbuf[1] == "DEFAULT" || vbuf[2] == "DEFAULT") {
109  well[w].I_perf.push_back(well[w].I);
110  well[w].J_perf.push_back(well[w].J);
111  } else {
112  well[w].I_perf.push_back(stoi(vbuf[1]));
113  well[w].J_perf.push_back(stoi(vbuf[2]));
114  }
115  well[w].K_perf.push_back(k);
116 
117  if (vbuf[5] != "DEFAULT")
118  well[w].WI.push_back(stod(vbuf[5]));
119  else
120  well[w].WI.push_back(-1.0);
121 
122  if (vbuf[6] != "DEFAULT")
123  well[w].diameter.push_back(stod(vbuf[6]));
124  else
125  well[w].diameter.push_back(1.0);
126 
127  if (vbuf[7] != "DEFAULT")
128  well[w].kh.push_back(stod(vbuf[7]));
129  else
130  well[w].kh.push_back(-1.0);
131 
132  if (vbuf[8] != "DEFAULT")
133  well[w].skinFactor.push_back(stod(vbuf[8]));
134  else
135  well[w].skinFactor.push_back(0.0);
136 
137  if (vbuf[9] != "DEFAULT")
138  well[w].direction.push_back(vbuf[9]);
139  else
140  well[w].direction.push_back("z");
141  }
142  }
143  }
144  }
145  // cout << "COMPDAT" << endl;
146 }
unsigned int USI
Generic unsigned integer.
Definition: OCPConst.hpp:23
unsigned int OCP_BOOL
OCP_BOOL in OCP.
Definition: OCPConst.hpp:29
void DealDefault(vector< string > &result)
Definition: UtilInput.cpp:50
OCP_BOOL ReadLine(ifstream &ifs, vector< string > &result)
Definition: UtilInput.cpp:14
vector< WellParam > well
Contains all the information of wells.
Definition: ParamWell.hpp:102

References DealDefault(), ReadLine(), and well.

◆ InputTSTEP()

void ParamWell::InputTSTEP ( ifstream &  ifs)

Input the keyword: TSTEP. TSTEP is used to divide the simulation time and ususally the time point is critical, at which for example, the operation mode of well will change. So the params of solving equations could be adjusted correspondingly.

Definition at line 214 of file ParamWell.cpp.

215 {
216  assert(criticalTime.size() > 0);
217 
218  vector<string> vbuf;
219  while (ReadLine(ifs, vbuf)) {
220  if (vbuf[0] == "/") break;
221 
222  DealDefault(vbuf);
223  OCP_INT len = vbuf.size();
224  for (OCP_INT i = 0; i < len - 1; i++) {
225  OCP_DBL t = criticalTime.back() + stod(vbuf[i]);
226  criticalTime.push_back(t);
227  }
228  if (vbuf.back() != "/") {
229  OCP_DBL t = criticalTime.back() + stod(vbuf.back());
230  criticalTime.push_back(t);
231  }
232  }
233 }
double OCP_DBL
Double precision.
Definition: OCPConst.hpp:27
int OCP_INT
Long integer.
Definition: OCPConst.hpp:26
vector< OCP_DBL > criticalTime
Records the critical time given by users.
Definition: ParamWell.hpp:103

References criticalTime, DealDefault(), and ReadLine().

◆ InputWCONINJE()

void ParamWell::InputWCONINJE ( ifstream &  ifs)

Input the well keyword WCONINJE. WCONINJE describes the initial operation mode of injection well.

Definition at line 148 of file ParamWell.cpp.

149 {
150  assert(criticalTime.size() > 0);
151 
152  const USI d = criticalTime.size() - 1;
153  const USI num = well.size();
154  vector<string> vbuf;
155  while (ReadLine(ifs, vbuf)) {
156  if (vbuf[0] == "/") break;
157 
158  DealDefault(vbuf);
159  string src = vbuf[0];
160  string::size_type pos = src.find("*");
161  const OCP_BOOL fuzzyMatch = (pos != string::npos);
162  if (fuzzyMatch) {
163  src.erase(pos);
164  }
165 
166  if (fuzzyMatch) {
167  for (USI w = 0; w < num; w++) {
168  if (well[w].name.find(src) != string::npos) {
169  well[w].optParam.push_back(WellOptPair(d, "INJ", vbuf));
170  }
171  }
172  } else {
173  for (USI w = 0; w < num; w++) {
174  if (well[w].name == src) {
175  well[w].optParam.push_back(WellOptPair(d, "INJ", vbuf));
176  }
177  }
178  }
179  }
180  // cout << "WCONINJE" << endl;
181 }

References criticalTime, DealDefault(), ReadLine(), and well.

◆ InputWCONPROD()

void ParamWell::InputWCONPROD ( ifstream &  ifs)

Input the well keyword WCONPROD. WCONPROD describes the initial operation mode of production well.

Definition at line 183 of file ParamWell.cpp.

184 {
185  assert(criticalTime.size() > 0);
186 
187  const USI d = criticalTime.size() - 1;
188  const USI num = well.size();
189  vector<string> vbuf;
190  while (ReadLine(ifs, vbuf)) {
191  if (vbuf[0] == "/") break;
192 
193  DealDefault(vbuf);
194  string src = vbuf[0];
195  string::size_type pos = src.find("*");
196  const OCP_BOOL fuzzyMatch = (pos != string::npos);
197  if (fuzzyMatch) {
198  src.erase(pos);
199  }
200 
201  if (fuzzyMatch) {
202  for (USI w = 0; w < num; w++)
203  if (well[w].name.find(src) != string::npos)
204  well[w].optParam.push_back(WellOptPair(d, "PROD", vbuf));
205  } else {
206  for (USI w = 0; w < num; w++)
207  if (well[w].name == src)
208  well[w].optParam.push_back(WellOptPair(d, "PROD", vbuf));
209  }
210  }
211  // cout << "WCONPROD" << endl;
212 }

References criticalTime, DealDefault(), ReadLine(), and well.

◆ InputWELLSTRE()

void ParamWell::InputWELLSTRE ( ifstream &  ifs)

Input well keyword: Solvent. It describes the molar fraction of components of fluid injected to reservoir from INJ.

Definition at line 373 of file ParamWell.cpp.

374 {
375  vector<string> vbuf;
376  while (ReadLine(ifs, vbuf)) {
377  if (vbuf[0] == "/") break;
378  solSet.push_back(Solvent(vbuf));
379  }
380  // cout << "WELLSTRE" << endl;
381 }
vector< Solvent > solSet
Sets of Solvent.
Definition: ParamWell.hpp:104
Describe the molar fraction of components of fluid injected to reservoir from INJ.
Definition: ParamWell.hpp:87

References ReadLine(), and solSet.

◆ InputWELSPECS()

void ParamWell::InputWELSPECS ( ifstream &  ifs)

Input the well keyword WELSPECS. WELSPECS defines wells including well name, well location, well depth and son on.

Definition at line 68 of file ParamWell.cpp.

69 {
70  vector<string> vbuf;
71  while (ReadLine(ifs, vbuf)) {
72  if (vbuf[0] == "/") break;
73 
74  DealDefault(vbuf);
75  well.push_back(WellParam(vbuf));
76  }
77  // cout << "WELSPECS" << endl;
78 }
TODO: Add Doxygen.
Definition: ParamWell.hpp:59

References DealDefault(), ReadLine(), and well.

◆ InputWELTARG()

void ParamWell::InputWELTARG ( ifstream &  ifs)

Input the well keyword: WELTARG. WELTARG is used to change the operation mode of well anytime. For example, the oil production rate is changed from 1000 stb/day to 1500 stb/day at the 100th day.

Definition at line 235 of file ParamWell.cpp.

236 {
237  assert(criticalTime.size() > 0);
238 
239  cout << "\n---------------------" << endl
240  << "WELTARG"
241  << "\n---------------------" << endl;
242 
243  const USI d = criticalTime.size() - 1;
244  const USI num = well.size();
245  vector<string> vbuf;
246  while (ReadLine(ifs, vbuf)) {
247  if (vbuf[0] == "/") break;
248 
249  for (const auto& s : vbuf) {
250  cout << s << " ";
251  }
252  cout << endl;
253 
254  string src = vbuf[0];
255  string::size_type pos = src.find("*");
256  const OCP_BOOL fuzzyMatch = (pos != string::npos);
257  if (fuzzyMatch) {
258  src.erase(pos);
259  }
260  OCP_BOOL succMatch = OCP_FALSE;
261 
262  for (USI w = 0; w < num; w++) {
263  if (fuzzyMatch)
264  succMatch = (well[w].name.find(src) != string::npos);
265  else
266  succMatch = (well[w].name == src);
267 
268  if (succMatch) {
269  if (well[w].optParam.size() == 0) {
270  OCP_ABORT("No Well Control Defined in Advance!");
271  }
272  WellOptPair tar = well[w].optParam.back();
273  tar.d = d;
274  tar.opt.optMode = vbuf[1];
275  OCP_DBL val = stod(vbuf[2]);
276  if (vbuf[1] == "BHP") {
277  if (tar.opt.type == "INJ")
278  tar.opt.maxBHP = val;
279  else
280  tar.opt.minBHP = val;
281  } else {
282  tar.opt.maxRate = val;
283  }
284  well[w].optParam.push_back(tar);
285  }
286  }
287  }
288 }
#define OCP_ABORT(msg)
Abort if critical error happens.
Definition: UtilError.hpp:47
OCP_DBL maxBHP
Maximum allowable pressure in the injection well.
Definition: ParamWell.hpp:39
string type
Type of well, injection or production?
Definition: ParamWell.hpp:33
OCP_DBL maxRate
Maximum allowable flow rate into/out the well.
Definition: ParamWell.hpp:38
string optMode
Mode of well, Rate or BHP?
Definition: ParamWell.hpp:36
OCP_DBL minBHP
Minimum allowable pressure in the production well.
Definition: ParamWell.hpp:40

References criticalTime, ReadLine(), and well.


The documentation for this class was generated from the following files: