17 vector<OCP_DBL>* myPtr =
nullptr;
209 template <
typename T>
217 for (
USI k = index[4]; k <= index[5]; k++) {
218 for (
USI j = index[2]; j <= index[3]; j++) {
219 for (
USI i = index[0]; i <= index[1]; i++) {
220 id = k * NxNy + j * Nx + i;
228 template <
typename T>
230 const vector<USI>& index)
237 for (
USI k = index[4]; k <= index[5]; k++) {
238 for (
USI j = index[2]; j <= index[3]; j++) {
239 for (
USI i = index[0]; i <= index[1]; i++) {
240 id = k * NxNy + j * Nx + i;
249 const vector<USI>& index)
256 for (
USI k = index[4]; k <= index[5]; k++) {
257 for (
USI j = index[2]; j <= index[3]; j++) {
258 for (
USI i = index[0]; i <= index[1]; i++) {
259 id = k * NxNy + j * Nx + i;
276 cout <<
"COMPS" << endl <<
numCom <<
"\n\n";
295 cout <<
"DIMENS" << endl;
304 if (vbuf[0] ==
"/")
return;
307 cout <<
"RTEMP" << endl;
314 cout <<
"EQUALS" << endl;
316 vector<USI> index(6, 0);
320 if (vbuf[0] ==
"/")
break;
322 for (
auto v : vbuf) {
if (v !=
"/") cout << setw(10) << v; } cout <<
"\n";;
324 index[0] = 0, index[1] =
dimens.
nx - 1;
325 index[2] = 0, index[3] =
dimens.
ny - 1;
326 index[4] = 0, index[5] =
dimens.
nz - 1;
328 string objName = vbuf[0];
333 for (
USI n = 2; n < 8; n++) {
334 if (vbuf[n] !=
"DEFAULT") index[n - 2] = stoi(vbuf[n]) - 1;
336 if (index[0] < 0 || index[2] < 0 || index[4] < 0 || index[1] >
dimens.
nx - 1 ||
338 OCP_ABORT(
"WRONG Range in " + objName +
" in EQUALS!");
341 vector<OCP_DBL>* objPtr =
FindPtr(objName);
343 if (objPtr !=
nullptr) {
344 if (objName ==
"TOPS") {
346 index[4] = index[5] = 0;
350 setVal(*objPtr, val, index);
352 OCP_ABORT(
"Wrong object name: " + objName);
362 vector<OCP_DBL>* objPtr =
nullptr;
365 if (objPtr ==
nullptr) {
371 if (vbuf[0] ==
"/")
break;
373 for (
auto& str : vbuf) {
375 auto pos = str.find(
'*');
376 if (pos == string::npos) {
377 objPtr->push_back(stod(str));
380 USI len = str.size();
381 OCP_USI num = stoi(str.substr(0, pos));
382 OCP_DBL val = stod(str.substr(pos + 1, len - (pos + 1)));
383 for (
USI i = 0; i < num; i++)
384 objPtr->push_back(val);
393 cout <<
"COPY" << endl;
396 vector<USI> index(6, 0);
399 if (vbuf[0] ==
"/")
break;
401 for (
auto v : vbuf) {
if (v !=
"/") cout << setw(10) << v; } cout <<
"\n";
403 index[0] = 0, index[1] =
dimens.
nx - 1;
404 index[2] = 0, index[3] =
dimens.
ny - 1;
405 index[4] = 0, index[5] =
dimens.
nz - 1;
407 string srcName = vbuf[0];
408 string objName = vbuf[1];
410 for (
USI n = 2; n < 8; n++) {
411 if (vbuf[n] !=
"DEFAULT") index[n - 2] = stoi(vbuf[n]) - 1;
414 vector<OCP_DBL>* srcPtr =
FindPtr(srcName);
415 vector<OCP_DBL>* objPtr =
FindPtr(objName);
416 if (srcPtr !=
nullptr && objPtr !=
nullptr) {
417 objPtr->resize(srcPtr->size());
418 CopyVal(*objPtr, *srcPtr, index);
420 OCP_ABORT(
"Wrong object names: " + srcName +
", " + objName);
430 vector<USI> index(6, 0);
433 if (vbuf[0] ==
"/")
break;
435 index[0] = 0, index[1] =
dimens.
nx - 1;
436 index[2] = 0, index[3] =
dimens.
ny - 1;
437 index[4] = 0, index[5] =
dimens.
nz - 1;
439 string objName = vbuf[0];
443 for (
USI n = 2; n < 8; n++) {
444 if (vbuf[n] !=
"DEFAULT") index[n - 2] = stoi(vbuf[n]) - 1;
447 vector<OCP_DBL>* objPtr =
FindPtr(objName);
448 if (objPtr !=
nullptr) {
449 if (objName ==
"TOPS") {
450 index[4] = index[5] = 0;
454 OCP_ABORT(
"Wrong object name: " + objName);
464 if (obj ==
nullptr) {
465 OCP_ABORT(
"Wrong table name :" + tabName);
469 if (tabName ==
"ZMFVD") {
474 vector<vector<OCP_DBL>> tmpTab(col);
478 if (vbuf[0] ==
"/")
break;
480 for (
USI i = 0; i < col; i++) {
481 tmpTab[i].push_back(stod(vbuf[i]));
484 if (vbuf.back() ==
"/") {
485 obj->
data.push_back(tmpTab);
486 for (
USI j = 0; j < col; j++) {
491 if (!tmpTab[0].empty()) obj->
data.push_back(tmpTab);
501 if (vbuf[0] ==
"/")
return;
506 cout <<
"---------------------" << endl
508 <<
"---------------------" << endl;
516 OCP_WARNING(
"MISCIBLE has not been declared, this keyword will be ignored!");
520 if (vbuf[0] ==
"/")
return;
521 if (vbuf.back() ==
"/") vbuf.pop_back();
523 USI len = vbuf.size();
524 for (
USI i = 0; i < len; i++) {
525 miscstr.surTenRef.push_back(stod(vbuf[i]));
529 cout <<
"MISCSTR" << endl;
530 for (
auto& v :
miscstr.surTenRef)
532 cout << endl << endl;
541 if (vbuf[0] ==
"/")
return;
543 OCP_ASSERT(vbuf.size() == 4,
"Wrong Keyword GRAVITY!");
544 for (
USI i = 0; i < 3; i++) {
545 if (vbuf[i] !=
"DEFAULT") {
550 cout <<
"---------------------" << endl
552 <<
"---------------------" << endl;
562 if (vbuf[0] ==
"/")
return;
565 OCP_ASSERT(vbuf.size() == 4,
"Wrong Keyword DENSITY!");
566 for (
USI i = 0; i < 3; i++) {
567 if (vbuf[i] !=
"DEFAULT") {
573 cout <<
"---------------------" << endl
575 <<
"---------------------" << endl;
585 if (vbuf[0] ==
"/")
return;
589 for (
USI i = 0; i < 6; i++) {
590 if (vbuf[i] !=
"DEFAULT")
EQUIL[i] = stod(vbuf[i]);
593 cout <<
"---------------------" << endl
595 <<
"---------------------" << endl;
596 for (
USI i = 0; i < 6; i++) cout <<
EQUIL[i] <<
" ";
606 NTPVT = stoi(vbuf[1]);
608 cout <<
"TABDIMS" << endl;
619 if (keyword ==
"SATNUM") {
623 else if (keyword ==
"ACTNUM") {
634 if (vbuf[0] ==
"/")
break;
636 for (
auto& str : vbuf) {
638 auto pos = str.find(
'*');
639 if (pos == string::npos) {
640 ptr->
data.push_back(stod(str));
643 USI len = str.size();
644 OCP_USI num = stoi(str.substr(0, pos));
645 OCP_DBL val = stod(str.substr(pos + 1, len - (pos + 1)));
646 for (
USI i = 0; i < num; i++)
647 ptr->
data.push_back(val);
652 cout <<
"Number of Tables = " << lim << endl;
669 if (
coord.size() == 0) {
686 cout <<
"Reset Ntg size to 1!" << endl;
700 OCP_ABORT(
"Both DENSITY and GRAVITY have been given, just one can be used!");
708 OCP_ABORT(
"DISGAS can only be used only if OIL and GAS are both present!");
743 OCP_ABORT(
"Only one equilibration region is supported!");
750 cout <<
"---------------------\n";
751 cout <<
"TABLE: " <<
name <<
"\n";
752 cout <<
"---------------------\n";
753 for (
auto v :
data) {
754 const USI len = v[0].size();
755 for (
USI i = 0; i < len; i++) {
757 cout << setw(12) << v[j][i];
788 for (
USI i = 0; i < len; i++) {
802 for (
auto& c :
COM) {
803 for (
auto& item : c) {
804 cout << item <<
"\t";
877 if (objPtr ==
nullptr) {
888 if (vbuf[0] ==
"/") {
890 objPtr->
data.push_back(tmp);
896 for (
auto& v : vbuf) {
898 tmp.push_back(stod(v));
901 if (vbuf.back() ==
"/") {
903 objPtr->
data.push_back(tmp);
919 if (vbuf[0] ==
"/") {
922 for (
auto& v : vbuf) {
926 if (vbuf.back() ==
"/")
931 cout <<
"CNAMES" << endl;
933 cout <<
Cname[i] <<
" ";
935 cout << endl << endl;
944 for (
USI i = 0; i < 5; i++) {
945 if (vbuf[i] !=
"DEFAULT")
950 cout <<
"LBCCOEF" << endl;
951 for (
USI i = 0; i < 5; i++) {
954 cout << endl << endl;
968 if (vbuf[0] ==
"/") {
974 for (
auto& v : vbuf) {
976 BIC[nReg].push_back(stod(v));
977 cout << setw(10) <<
BIC[nReg].back();
981 if (vbuf.back() ==
"/") {
994 int len = vbuf.size();
995 for (
USI i = 0; i < len; i++) {
999 for (
USI i = 0; i < len; i++) {
1002 cout << endl << endl;
1008 vector<string> vbuf;
1010 for (
USI i = 0; i < 2; i++) {
1014 for (
USI i = 0; i < 2; i++) {
1017 cout << endl << endl;
1023 vector<string> vbuf;
1025 for (
USI i = 0; i < 2; i++) {
1029 for (
USI i = 0; i < 2; i++) {
1032 cout << endl << endl;
1038 vector<string> vbuf;
1040 for (
USI i = 0; i < 2; i++) {
1044 for (
USI i = 0; i < 2; i++) {
1047 cout << endl << endl;
1053 vector<string> vbuf;
1055 for (
USI i = 0; i < 2; i++) {
1059 for (
USI i = 0; i < 2; i++) {
1062 cout << endl << endl;
unsigned int USI
Generic unsigned integer.
double OCP_DBL
Double precision.
unsigned int OCP_USI
Long unsigned integer.
ParamReservoir class declaration.
#define OCP_FUNCNAME
Print Function Name.
#define OCP_WARNING(msg)
Log warning messages.
#define OCP_ASSERT(cond, msg)
Assert condition and log user messages in DEBUG mode.
#define OCP_ABORT(msg)
Abort if critical error happens.
USI nx
Num of bulks along x-direction.
USI ny
Num of bulks along y-direction.
USI nz
Num of bulks along z-direction.
Type_A_r< vector< OCP_DBL > > Zcvis
Critical Z-factor used for viscosity calculations only.
void InputBIC(ifstream &ifs)
Input the Binary interaction of components.
void InputCNAMES(ifstream &ifs)
Input the names of hydrocarbon components.
Type_A_r< vector< OCP_DBL > > Vcvis
Critical volume used for viscosity calculations only.
Type_A_r< vector< OCP_DBL > > Vshift
Volume shift of hydrocarbon components.
USI numCom
num of components, water is excluded.
void InputSSMSTA(ifstream &ifs)
TODO: Add Doxygen.
vector< OCP_DBL > LBCcoef
LBC coefficients for viscosity calculation.
Type_A_r< vector< OCP_DBL > > MW
Molecular Weight of hydrocarbon components.
void InputCOM(ifstream &ifs)
Input the information of components.
Type_A_r< vector< OCP_DBL > > Acf
Acentric factor of hydrocarbon components.
void InputCOMPONENTS(ifstream &ifs, const string &keyword)
Input the information of hydrocarbon components.
void InputNRSTA(ifstream &ifs)
TODO: Add Doxygen.
void InputNRSP(ifstream &ifs)
TODO: Add Doxygen.
void InputRR(ifstream &ifs)
TODO: Add Doxygen.
vector< string > Cname
Name of hydrocarbon components.
void InitEoSparam()
Init Params.
Type_A_r< vector< OCP_DBL > > OmegaB
OMEGA_B of hydrocarbon components.
vector< vector< string > > COM
Components information.
void InputSSMSP(ifstream &ifs)
TODO: Add Doxygen.
void InputLBCCOEF(ifstream &ifs)
Input LBC coefficients for viscosity calculation.
Type_A_r< vector< OCP_DBL > > Pc
Critical pressure of hydrocarbon components.
Type_A_r< vector< OCP_DBL > > * FindPtr(const string &varName)
Type_A_r< vector< OCP_DBL > > Vc
Critical volume of hydrocarbon components.
Type_A_r< vector< OCP_DBL > > OmegaA
OMEGA_A of hydrocarbon components.
USI NTPVT
num of EoS region, constant now.
vector< vector< OCP_DBL > > BIC
Binary interaction.
Type_A_r< vector< OCP_DBL > > Tc
Critical temperature of hydrocarbon components.
Type_A_r< vector< OCP_DBL > > Parachor
PARACHOR of hydrocarbon components.
Type_A_r< vector< OCP_DBL > > Zc
Critical Z-factor of hydrocarbon components.
bool miscible
Miscible treatment of hydrocarbons, used in compositional Model.
Params for NR in Phase Split.
Params for NR in Phase Stability Analysis.
vector< OCP_DBL > permY
Permeability along the y-direction for each grid.
void InputDIMENS(ifstream &ifs)
TODO: Add Doxygen.
void CheckEQUIL() const
Check if keyword EQUIL is given.
USI NTSFUN
Num of SAT regions.
bool disGas
If true, dissolve gas could exist in oil phase.
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.
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 InputGRID(ifstream &ifs, string &keyword)
TODO: Add Doxygen.
TableSet * FindPtr_T(const string &varName)
Find pointer to the specified table.
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.
bool gas
If 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.
bool ScalePcow
whether Pcow should be scaled.
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.
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.
USI numCom
Number of components(hydrocarbon components), used in Compositional Model when input.
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.
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.
bool oil
If true, oil phase could exist.
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.
void InputROCK(ifstream &ifs)
Read data from the ROCK keyword.
void CheckPhaseTab() const
Check existence of PVTtable and SATtable.
void InputDENSITY(ifstream &ifs)
Input the reference density of oil, water, and air in standard condition.
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.
TableSet PVTW_T
Table set of PVTW.
bool blackOil
If ture, blackoil model will be used.
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.
bool comps
If true, compositional model will be used.
vector< OCP_DBL > dz
Size along the z - direction for each grid.
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.
TableSet PVCO_T
Table set of PVCO.
TableSet SWFN_T
Table set of SWFN.
USI NTPVT
Num of PVT regions.
OCP_DBL rsTemp
Temperature for reservoir.
void InputRTEMP(ifstream &ifs)
Input the keyword: RTEMP. RTEMP gives the temperature of reservoir.
bool water
If true, water phase could exist.
OCP_USI numGrid
Num of grids.
EoSparam EoSp
Initial component composition, used in compositional models.
Param for Solving Rachford-Rice Equations.
OCP_DBL Cr
Compressibility factor of rock in reservoir.
OCP_DBL Pref
Reference pressure at initial porosity.
Params for SSM in Phase Split.
Params for SSM in Phase Stability Analysis.
vector< vector< vector< OCP_DBL > > > data
All table with the same name.
USI colNum
Number of columns of table.
void DisplayTable() const
Print table.
string name
Name of table.
vector< T > data
Data of param.
bool activity
If false, this param is not given.