OpenCAEPoro  0.2.0 Sep/22/2022
A simulator for multicomponent porous media flow
Public Member Functions | Public Attributes | List of all members
ParamReservoir Class Reference

#include <ParamReservoir.hpp>

Public Member Functions

vector< OCP_DBL > * FindPtr (const string &varName)
 Find pointer to the specified variable. More...
 
TableSetFindPtr_T (const string &varName)
 Find pointer to the specified table. More...
 
void Init ()
 Initialize the default value in reservoir, such as temperature, density, table. More...
 
void InitTable ()
 Initialize the tables' name and num of colum. More...
 
template<typename T >
void setVal (vector< T > &obj, const T &val, const vector< USI > &index)
 It's used in InputEQUALS, assigning values in batches. More...
 
template<typename T >
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. More...
 
void MultiplyVal (vector< OCP_DBL > &obj, const OCP_DBL &val, const vector< USI > &index)
 TODO: Add Doxygen. More...
 
void InputCOMPS (ifstream &ifs)
 TODO: Add Doxygen. More...
 
void InputDIMENS (ifstream &ifs)
 TODO: Add Doxygen. More...
 
void DisplayDIMENS ()
 Display the dimens, it's used to chech input. More...
 
void InputRTEMP (ifstream &ifs)
 Input the keyword: RTEMP. RTEMP gives the temperature of reservoir. More...
 
void InputEQUALS (ifstream &ifs)
 TODO: Add Doxygen. More...
 
void InputGRID (ifstream &ifs, string &keyword)
 TODO: Add Doxygen. More...
 
void InputCOPY (ifstream &ifs)
 Input the keyword: COPY. COPY could copy the value of one variable to another. More...
 
void InputMULTIPLY (ifstream &ifs)
 TODO: Add Doxygen. More...
 
void InputTABLE (ifstream &ifs, const string &tabName)
 Input PVTtable and SATtable such as SWOF, PVCO. More...
 
void InputROCK (ifstream &ifs)
 Read data from the ROCK keyword. More...
 
void InputMISCSTR (ifstream &ifs)
 Input the Miscibility information. More...
 
void InputGRAVITY (ifstream &ifs)
 Input the reference gravity of oil, water, and air in standard condition. More...
 
void InputDENSITY (ifstream &ifs)
 Input the reference density of oil, water, and air in standard condition. More...
 
void InputEQUIL (ifstream &ifs)
 EQUIL contains initial information of reservoir; see ParamEQUIL. More...
 
void InputTABDIMS (ifstream &ifs)
 TABDIMS contains the num of saturation region and PVT region. More...
 
void InputRegion (ifstream &ifs, const string &keyword)
 Input the keyword: SATNUM and PVTNUM. More...
 
void InputCNAMES (ifstream &ifs)
 
void InputCOM (ifstream &ifs)
 
void InputCOMPONENTS (ifstream &ifs, const string &keyword)
 
void InputLBCCOEF (ifstream &ifs)
 
void InputBIC (ifstream &ifs)
 
void InputSSMSTA (ifstream &ifs)
 
void InputNRSTA (ifstream &ifs)
 
void InputSSMSP (ifstream &ifs)
 
void InputNRSP (ifstream &ifs)
 
void InputRR (ifstream &ifs)
 
void CheckParam ()
 Check the reservoir param from input file. More...
 
void CheckGrid ()
 Check the size of properties of grids. More...
 
void CheckEQUIL () const
 Check if keyword EQUIL is given. More...
 
void CheckDenGra () const
 Check if density and gravity are both input, only one of them is needed. More...
 
void CheckPhase () const
 Check existence of disgas, it could only exist when both oil and gas exist. More...
 
void CheckPhaseTab () const
 Check existence of PVTtable and SATtable. More...
 
void CheckRegion () const
 Check if each grid is assigned to an area or all defaulted. More...
 
void CheckEqlRegion () const
 (Todo) Initialization of equilibration of only one region is realized. More...
 

Public Attributes

Dimens dimens
 Dimension of grid: the number of grids along x,y,z direction.
 
OCP_USI numGrid
 Num of grids.
 
vector< OCP_DBLtops
 Depth of the top surface of the uppermost grids.
 
vector< OCP_DBLdx
 Size along the x - direction for each grid.
 
vector< OCP_DBLdy
 Size along the y - direction for each grid.
 
vector< OCP_DBLdz
 Size along the z - direction for each grid.
 
vector< OCP_DBLcoord
 TODO: Add Doxygen.
 
vector< OCP_DBLzcorn
 TODO: Add Doxygen.
 
vector< OCP_DBLntg
 Net to gross for each grid.
 
vector< OCP_DBLporo
 Porosity for each grid.
 
vector< OCP_DBLpermX
 Permeability along the x - direction for each grid.
 
vector< OCP_DBLpermY
 Permeability along the y-direction for each grid.
 
vector< OCP_DBLpermZ
 Permeability along the z-direction for each grid.
 
OCP_DBL rsTemp
 Temperature for reservoir.
 
Rock rock
 
Miscstr miscstr
 reference Miscibility surface tension
 
vector< OCP_DBLP
 Initial pressure of components in each grid.
 
vector< OCP_DBLNi
 Initial moles of components in each grid.
 
vector< OCP_DBLSwat
 Initial water saturation in each grid.
 
bool ScalePcow {false}
 whether Pcow should be scaled.
 
Type_A_r< OCP_DBLdensity
 Density of oil, water, gas in standard conditions.
 
Type_A_r< OCP_DBLgravity
 Gravity of oil, water, gas in standard conditions.
 
bool blackOil {false}
 If ture, blackoil model will be used.
 
bool comps {false}
 If true, compositional model will be used.
 
bool oil {false}
 If true, oil phase could exist.
 
bool gas {false}
 If true, gas phase could exist.
 
bool water {false}
 If true, water phase could exist.
 
bool disGas {false}
 If true, dissolve gas could exist in oil phase.
 
EoSparam EoSp
 Initial component composition, used in compositional models.
 
USI NTSFUN {1}
 Num of SAT regions.
 
USI NTPVT {1}
 Num of PVT regions.
 
Type_A_r< OCP_DBLSATNUM
 Records the index of SAT region for each grid.
 
Type_A_r< OCP_DBLPVTNUM
 Records the index of PVT region for each grid.
 
Type_A_r< OCP_DBLACTNUM
 Records the index of Active region for each grid.
 
TableSet SWFN_T
 Table set of SWFN.
 
TableSet SWOF_T
 Table set of SWOF.
 
TableSet SGFN_T
 Table set of SGFN.
 
TableSet SGOF_T
 Table set of SGOF.
 
TableSet SOF3_T
 Table set of SOF3.
 
TableSet PBVD_T
 Table set of PBVD.
 
TableSet ZMFVD_T
 Table set of ZMFVD.
 
vector< OCP_DBLEQUIL
 See ParamEQUIL.
 
USI numPhase
 Number of phases.
 
USI numCom
 Number of components(hydrocarbon components), used in Compositional Model when input.
 
TableSet PVCO_T
 Table set of PVCO.
 
TableSet PVDO_T
 Table set of PVDO.
 
TableSet PVDG_T
 Table set of PVDG.
 
TableSet PVTW_T
 Table set of PVTW.
 

Detailed Description

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

Definition at line 136 of file ParamReservoir.hpp.

Member Function Documentation

◆ CheckDenGra()

void ParamReservoir::CheckDenGra ( ) const

Check if density and gravity are both input, only one of them is needed.

TODO: Add Doxygen.

Definition at line 697 of file ParamReservoir.cpp.

698 {
699  if (density.activity && gravity.activity) {
700  OCP_ABORT("Both DENSITY and GRAVITY have been given, just one can be used!");
701  }
702 }
#define OCP_ABORT(msg)
Abort if critical error happens.
Definition: UtilError.hpp:47
Type_A_r< OCP_DBL > density
Density of oil, water, gas in standard conditions.
Type_A_r< OCP_DBL > gravity
Gravity of oil, water, gas in standard conditions.
bool activity
If false, this param is not given.

References Type_A_r< T >::activity, density, gravity, and OCP_ABORT.

◆ CheckEqlRegion()

void ParamReservoir::CheckEqlRegion ( ) const

(Todo) Initialization of equilibration of only one region is realized.

TODO: Add Doxygen.

Definition at line 740 of file ParamReservoir.cpp.

741 {
742  if (PBVD_T.data.size() > 1) {
743  OCP_ABORT("Only one equilibration region is supported!");
744  }
745 }
TableSet PBVD_T
Table set of PBVD.
vector< vector< vector< OCP_DBL > > > data
All table with the same name.

References TableSet::data, OCP_ABORT, and PBVD_T.

◆ CheckEQUIL()

void ParamReservoir::CheckEQUIL ( ) const

Check if keyword EQUIL is given.

Check EQUIL keywords.

Definition at line 691 of file ParamReservoir.cpp.

692 {
693  if (EQUIL.empty()) OCP_ABORT("EQUIL is missing!");
694 }
vector< OCP_DBL > EQUIL
See ParamEQUIL.

References EQUIL, and OCP_ABORT.

◆ CheckGrid()

void ParamReservoir::CheckGrid ( )

Check the size of properties of grids.

Check data dimension for potential problems.

Definition at line 667 of file ParamReservoir.cpp.

668 {
669  if (coord.size() == 0) {
670  if (tops.size() != dimens.nx * dimens.ny) OCP_ABORT("Wrong TOPS size!");
671  if (dx.size() != numGrid) OCP_ABORT("Wrong DX size!");
672  if (dy.size() != numGrid) OCP_ABORT("Wrong DY size!");
673  if (dz.size() != numGrid) OCP_ABORT("Wrong DZ size!");
674  } else {
675  if (coord.size() != (dimens.nx + 1) * (dimens.ny + 1) * 6)
676  OCP_ABORT("Wrong COORD size!");
677  if (zcorn.size() != numGrid * 8) OCP_ABORT("Wrong ZCORN size!");
678  }
679 
680  if (poro.size() != numGrid) OCP_ABORT("Wrong PORO size!");
681  if (permX.size() != numGrid) OCP_ABORT("Wrong PERMX size!");
682  if (permY.size() != numGrid) OCP_ABORT("Wrong PERMY size!");
683  if (permZ.size() != numGrid) OCP_ABORT("Wrong PERMZ size!");
684  if (ntg.size() != numGrid) {
685  ntg.resize(numGrid, 1);
686  cout << "Reset Ntg size to 1!" << endl;
687  }
688 }
USI nx
Num of bulks along x-direction.
USI ny
Num of bulks along y-direction.
vector< OCP_DBL > permY
Permeability along the y-direction for each grid.
vector< OCP_DBL > zcorn
TODO: Add Doxygen.
vector< OCP_DBL > poro
Porosity for each grid.
vector< OCP_DBL > dy
Size along the y - direction for each grid.
vector< OCP_DBL > permX
Permeability along the x - direction for each grid.
vector< OCP_DBL > permZ
Permeability along the z-direction for each grid.
vector< OCP_DBL > dx
Size along the x - direction for each grid.
vector< OCP_DBL > tops
Depth of the top surface of the uppermost grids.
vector< OCP_DBL > ntg
Net to gross for each grid.
vector< OCP_DBL > coord
TODO: Add Doxygen.
Dimens dimens
Dimension of grid: the number of grids along x,y,z direction.
vector< OCP_DBL > dz
Size along the z - direction for each grid.
OCP_USI numGrid
Num of grids.

References coord, dimens, dx, dy, dz, ntg, numGrid, Dimens::nx, Dimens::ny, OCP_ABORT, permX, permY, permZ, poro, tops, and zcorn.

◆ CheckParam()

void ParamReservoir::CheckParam ( )

Check the reservoir param from input file.

Check consistency of input parameters.

Definition at line 656 of file ParamReservoir.cpp.

657 {
658  CheckGrid();
659  CheckEQUIL();
660  CheckDenGra();
661  CheckPhase();
662  // CheckPhaseTab();
663  CheckRegion();
664 }
void CheckEQUIL() const
Check if keyword EQUIL is given.
void CheckPhase() const
Check existence of disgas, it could only exist when both oil and gas 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 CheckDenGra() const
Check if density and gravity are both input, only one of them is needed.

References CheckDenGra(), CheckEQUIL(), CheckGrid(), CheckPhase(), and CheckRegion().

◆ CheckPhase()

void ParamReservoir::CheckPhase ( ) const

Check existence of disgas, it could only exist when both oil and gas exist.

TODO: Add Doxygen.

Definition at line 705 of file ParamReservoir.cpp.

706 {
707  if (blackOil && disGas && (!gas && !oil)) {
708  OCP_ABORT("DISGAS can only be used only if OIL and GAS are both present!");
709  }
710 }
bool disGas
If true, dissolve gas could exist in oil phase.
bool gas
If true, gas phase could exist.
bool oil
If true, oil phase could exist.
bool blackOil
If ture, blackoil model will be used.

References blackOil, disGas, gas, OCP_ABORT, and oil.

◆ CheckPhaseTab()

void ParamReservoir::CheckPhaseTab ( ) const

Check existence of PVTtable and SATtable.

Check tables: Different tables will be used under different conditions.

Definition at line 713 of file ParamReservoir.cpp.

714 {
715  if (!blackOil && !comps) OCP_ABORT("Unknown model: Use BLACKOIL or COMPS!");
716 
717  if (water && oil && SWOF_T.data.empty()) OCP_ABORT("SWOF is missing!");
718  if (gas && oil && SGOF_T.data.empty()) OCP_ABORT("SGOF is missing!");
719  if (water && PVTW_T.data.empty()) OCP_ABORT("PVTW is missing!");
720 
721  if (blackOil) {
722  if (oil && disGas && PVCO_T.data.empty()) OCP_ABORT("PVCO is missing!");
723  if (oil && (!disGas) && PVDO_T.data.empty()) OCP_ABORT("PVDO is missing!");
724  if (gas && PVDG_T.data.empty()) OCP_ABORT("PVDG is missing!");
725  }
726 }
TableSet PVDG_T
Table set of PVDG.
TableSet PVDO_T
Table set of PVDO.
TableSet SGOF_T
Table set of SGOF.
TableSet PVTW_T
Table set of PVTW.
bool comps
If true, compositional model will be used.
TableSet SWOF_T
Table set of SWOF.
TableSet PVCO_T
Table set of PVCO.
bool water
If true, water phase could exist.

References blackOil, comps, TableSet::data, disGas, gas, OCP_ABORT, oil, PVCO_T, PVDG_T, PVDO_T, PVTW_T, SGOF_T, SWOF_T, and water.

◆ CheckRegion()

void ParamReservoir::CheckRegion ( ) const

Check if each grid is assigned to an area or all defaulted.

TODO: Add Doxygen.

Definition at line 729 of file ParamReservoir.cpp.

730 {
731  if (SATNUM.activity && SATNUM.data.size() != numGrid) {
732  OCP_ABORT("Missing data in SATNUM!");
733  }
734  if (PVTNUM.activity && PVTNUM.data.size() != numGrid) {
735  OCP_ABORT("Missing data in PVTNUM!");
736  }
737 }
Type_A_r< OCP_DBL > SATNUM
Records the index of SAT region for each grid.
Type_A_r< OCP_DBL > PVTNUM
Records the index of PVT region for each grid.
vector< T > data
Data of param.

References Type_A_r< T >::activity, Type_A_r< T >::data, numGrid, OCP_ABORT, PVTNUM, and SATNUM.

◆ CopyVal()

template<typename T >
void ParamReservoir::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.

TODO: Add Doxygen.

Definition at line 229 of file ParamReservoir.cpp.

231 {
232  USI Nx = dimens.nx;
233  USI Ny = dimens.ny;
234  OCP_USI NxNy = Nx * Ny;
235  OCP_USI id = 0;
236 
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;
241  obj[id] = src[id];
242  }
243  }
244  }
245 }
unsigned int USI
Generic unsigned integer.
Definition: OCPConst.hpp:22
unsigned int OCP_USI
Long unsigned integer.
Definition: OCPConst.hpp:24

References dimens, Dimens::nx, and Dimens::ny.

◆ DisplayDIMENS()

void ParamReservoir::DisplayDIMENS ( )

Display the dimens, it's used to chech input.

TODO: Add Doxygen.

Definition at line 293 of file ParamReservoir.cpp.

294 {
295  cout << "DIMENS" << endl;
296  cout << dimens.nx << " " << dimens.ny << " " << dimens.nz << "\n\n";;
297 }
USI nz
Num of bulks along z-direction.

References dimens, Dimens::nx, Dimens::ny, and Dimens::nz.

◆ FindPtr()

vector< OCP_DBL > * ParamReservoir::FindPtr ( const string &  varName)

Find pointer to the specified variable.

Find corresponding variable according to the name of variable. It is used for the basic properties of reservoir such as DX.

Definition at line 15 of file ParamReservoir.cpp.

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("TOPS", 4):
71  tops.reserve(dimens.nx * dimens.ny);
72  myPtr = &tops;
73  break;
74 
75  case Map_Str2Int("PRESSURE", 8):
76  P.reserve(numGrid);
77  myPtr = &P;
78  break;
79 
80  case Map_Str2Int("Ni", 2):
81  Ni.reserve(numGrid);
82  myPtr = &Ni;
83  break;
84 
85  case Map_Str2Int("SWATINIT", 8):
86  Swat.reserve(numGrid);
87  myPtr = &Swat;
88  ScalePcow = true;
89  break;
90 
91  case Map_Str2Int("SATNUM", 6):
92  SATNUM.activity = true;
93  SATNUM.data.reserve(numGrid);
94  myPtr = &SATNUM.data;
95  break;
96 
97  case Map_Str2Int("PVTNUM", 6):
98  PVTNUM.activity = true;
99  PVTNUM.data.reserve(numGrid);
100  myPtr = &PVTNUM.data;
101  break;
102  }
103 
104  return myPtr;
105 }
constexpr long long Map_Str2Int(const char *mystr, const USI &len)
Definition: UtilInput.hpp:34
vector< OCP_DBL > Ni
Initial moles of components in each grid.
bool ScalePcow
whether Pcow should be scaled.
vector< OCP_DBL > Swat
Initial water saturation in each grid.
vector< OCP_DBL > P
Initial pressure of components in each grid.

References Type_A_r< T >::activity, coord, Type_A_r< T >::data, dimens, dx, dy, dz, Map_Str2Int(), Ni, ntg, numGrid, Dimens::nx, Dimens::ny, P, permX, permY, permZ, poro, PVTNUM, SATNUM, ScalePcow, Swat, tops, and zcorn.

◆ FindPtr_T()

TableSet * ParamReservoir::FindPtr_T ( const string &  varName)

Find pointer to the specified table.

Find corresponding variable according to the name of variable. It is used for the scope of the table.

Definition at line 108 of file ParamReservoir.cpp.

109 {
110  TableSet* myPtr = nullptr;
111 
112  switch (Map_Str2Int(&varName[0], varName.size()))
113  {
114  case Map_Str2Int("SWFN", 4):
115  myPtr = &SWFN_T;
116  break;
117 
118  case Map_Str2Int("SWOF", 4):
119  myPtr = &SWOF_T;
120  break;
121 
122  case Map_Str2Int("SGFN", 4):
123  myPtr = &SGFN_T;
124  break;
125 
126  case Map_Str2Int("SGOF", 4):
127  myPtr = &SGOF_T;
128  break;
129 
130  case Map_Str2Int("SOF3", 4):
131  myPtr = &SOF3_T;
132  break;
133 
134  case Map_Str2Int("PBVD", 4):
135  myPtr = &PBVD_T;
136  break;
137 
138  case Map_Str2Int("PVCO", 4):
139  myPtr = &PVCO_T;
140  break;
141 
142  case Map_Str2Int("PVDO", 4):
143  myPtr = &PVDO_T;
144  break;
145 
146  case Map_Str2Int("PVDG", 4):
147  myPtr = &PVDG_T;
148  break;
149 
150  case Map_Str2Int("PVTW", 4):
151  myPtr = &PVTW_T;
152  break;
153 
154  case Map_Str2Int("ZMFVD", 5):
155  myPtr = &ZMFVD_T;
156  break;
157  }
158 
159  return myPtr;
160 }
TableSet ZMFVD_T
Table set of ZMFVD.
TableSet SOF3_T
Table set of SOF3.
TableSet SGFN_T
Table set of SGFN.
TableSet SWFN_T
Table set of SWFN.

References Map_Str2Int(), PBVD_T, PVCO_T, PVDG_T, PVDO_T, PVTW_T, SGFN_T, SGOF_T, SOF3_T, SWFN_T, SWOF_T, and ZMFVD_T.

◆ Init()

void ParamReservoir::Init ( )

Initialize the default value in reservoir, such as temperature, density, table.

Initialize tables and other reservoir parameters.

Definition at line 163 of file ParamReservoir.cpp.

164 {
165  InitTable();
166 
167  gravity.data.resize(3);
168  gravity.data[0] = 45.5; // oil
169  gravity.data[1] = 1.0; // pure water
170  gravity.data[2] = 0.7773; // air
171 
172  density.data.resize(3);
173  density.data[0] = 37.457; // oil
174  density.data[1] = 62.366416; // pure water
175  density.data[2] = 0.062428; // air
176 
177  rsTemp = 60.0;
178  rock.Pref = 14.7;
179  rock.Cr = 3.406E-6;
180 }
void InitTable()
Initialize the tables' name and num of colum.
OCP_DBL rsTemp
Temperature for reservoir.
OCP_DBL Cr
Compressibility factor of rock in reservoir.
OCP_DBL Pref
Reference pressure at initial porosity.

References Rock::Cr, Type_A_r< T >::data, density, gravity, InitTable(), Rock::Pref, rock, and rsTemp.

◆ InitTable()

void ParamReservoir::InitTable ( )

Initialize the tables' name and num of colum.

Initialize tables.

Definition at line 183 of file ParamReservoir.cpp.

184 {
185  SWFN_T.name = "SWFN";
186  SWFN_T.colNum = 3;
187  SWOF_T.name = "SWOF";
188  SWOF_T.colNum = 4;
189  SGFN_T.name = "SGFN";
190  SGFN_T.colNum = 3;
191  SGOF_T.name = "SGOF";
192  SGOF_T.colNum = 4;
193  SOF3_T.name = "SOF3";
194  SOF3_T.colNum = 3;
195  PBVD_T.name = "PBVD";
196  PBVD_T.colNum = 2;
197  PVCO_T.name = "PVCO";
198  PVCO_T.colNum = 6;
199  PVDO_T.name = "PVDO";
200  PVDO_T.colNum = 3;
201  PVDG_T.name = "PVDG";
202  PVDG_T.colNum = 3;
203  PVTW_T.name = "PVTW";
204  PVTW_T.colNum = 5;
205  ZMFVD_T.name = "ZMFVD"; // colnum equals numCom(hydrocarbon) + 1
206 }
USI colNum
Number of columns of table.
string name
Name of table.

References TableSet::colNum, TableSet::name, PBVD_T, PVCO_T, PVDG_T, PVDO_T, PVTW_T, SGFN_T, SGOF_T, SOF3_T, SWFN_T, SWOF_T, and ZMFVD_T.

◆ InputCOMPS()

void ParamReservoir::InputCOMPS ( ifstream &  ifs)

TODO: Add Doxygen.

Input the keyword: COMPS. COMPS is used in compositional model, which gives the num of components.

Definition at line 267 of file ParamReservoir.cpp.

268 {
269  comps = true;
270  vector<string> vbuf;
271  ReadLine(ifs, vbuf);
272  numCom = stoi(vbuf[0]);
273  EoSp.numCom = numCom;
274  EoSp.InitEoSparam();
275 
276  cout << "COMPS" << endl << numCom << "\n\n";
277 }
bool ReadLine(ifstream &ifs, vector< string > &result)
Definition: UtilInput.cpp:14
USI numCom
num of components, water is excluded.
void InitEoSparam()
Init Params.
USI numCom
Number of components(hydrocarbon components), used in Compositional Model when input.
EoSparam EoSp
Initial component composition, used in compositional models.

References comps, EoSp, EoSparam::InitEoSparam(), EoSparam::numCom, numCom, and ReadLine().

◆ InputCOPY()

void ParamReservoir::InputCOPY ( ifstream &  ifs)

Input the keyword: COPY. COPY could copy the value of one variable to another.

TODO: Add Doxygen.

Definition at line 391 of file ParamReservoir.cpp.

392 {
393  cout << "COPY" << endl;
394 
395  vector<string> vbuf;
396  vector<USI> index(6, 0);
397 
398  while (ReadLine(ifs, vbuf)) {
399  if (vbuf[0] == "/") break;
400 
401  for (auto v : vbuf) { if (v != "/") cout << setw(10) << v; } cout << "\n";
402 
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;
406 
407  string srcName = vbuf[0];
408  string objName = vbuf[1];
409  DealDefault(vbuf);
410  for (USI n = 2; n < 8; n++) {
411  if (vbuf[n] != "DEFAULT") index[n - 2] = stoi(vbuf[n]) - 1;
412  }
413 
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);
419  } else {
420  OCP_ABORT("Wrong object names: " + srcName + ", " + objName);
421  }
422  }
423  cout << "/\n\n";
424 }
void DealDefault(vector< string > &result)
Definition: UtilInput.cpp:50
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.
vector< OCP_DBL > * FindPtr(const string &varName)
Find pointer to the specified variable.

References CopyVal(), DealDefault(), dimens, FindPtr(), Dimens::nx, Dimens::ny, Dimens::nz, OCP_ABORT, and ReadLine().

◆ InputDENSITY()

void ParamReservoir::InputDENSITY ( ifstream &  ifs)

Input the reference density of oil, water, and air in standard condition.

Read data from the DENSITY keyword.

Definition at line 558 of file ParamReservoir.cpp.

559 {
560  vector<string> vbuf;
561  ReadLine(ifs, vbuf);
562  if (vbuf[0] == "/") return;
563 
564  DealDefault(vbuf);
565  OCP_ASSERT(vbuf.size() == 4, "Wrong Keyword DENSITY!");
566  for (USI i = 0; i < 3; i++) {
567  if (vbuf[i] != "DEFAULT") {
568  density.activity = true;
569  density.data[i] = stod(vbuf[i]);
570  }
571  }
572 
573  cout << "---------------------" << endl
574  << "DENSITY" << endl
575  << "---------------------" << endl;
576  cout << density.data[0] << " " << density.data[1] << " " << density.data[2]
577  << endl;
578 }
#define OCP_ASSERT(cond, msg)
Assert condition and log user messages in DEBUG mode.
Definition: UtilError.hpp:58

References Type_A_r< T >::activity, Type_A_r< T >::data, DealDefault(), density, OCP_ASSERT, and ReadLine().

◆ InputDIMENS()

void ParamReservoir::InputDIMENS ( ifstream &  ifs)

TODO: Add Doxygen.

Input the keyword: DIMENS. DIMENS contain the dimension of grids of reservoir. It gives the num of grids along the x,y,z direction.

Definition at line 280 of file ParamReservoir.cpp.

281 {
282  vector<string> vbuf;
283  ReadLine(ifs, vbuf);
284  dimens.nx = stoi(vbuf[0]);
285  dimens.ny = stoi(vbuf[1]);
286  dimens.nz = stoi(vbuf[2]);
288 
289  DisplayDIMENS();
290 }
void DisplayDIMENS()
Display the dimens, it's used to chech input.

References dimens, DisplayDIMENS(), numGrid, Dimens::nx, Dimens::ny, Dimens::nz, and ReadLine().

◆ InputEQUALS()

void ParamReservoir::InputEQUALS ( ifstream &  ifs)

TODO: Add Doxygen.

Input the keyword: EQUALS. EQUALS contains many keywords about grids which has special input format. These keywords contains DX, TOPS, PORO and so on. You can assign values to them in batches

Definition at line 312 of file ParamReservoir.cpp.

313 {
314  cout << "EQUALS" << endl;
315 
316  vector<USI> index(6, 0);
317  vector<string> vbuf;
318 
319  while (ReadLine(ifs, vbuf)) {
320  if (vbuf[0] == "/") break;
321 
322  for (auto v : vbuf) { if (v != "/") cout << setw(10) << v; } cout << "\n";;
323 
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;
327 
328  string objName = vbuf[0];
329  OCP_DBL val = stod(vbuf[1]);
330 
331  DealDefault(vbuf);
332 
333  for (USI n = 2; n < 8; n++) {
334  if (vbuf[n] != "DEFAULT") index[n - 2] = stoi(vbuf[n]) - 1;
335  }
336  if (index[0] < 0 || index[2] < 0 || index[4] < 0 || index[1] > dimens.nx - 1 ||
337  index[3] > dimens.ny - 1 || index[5] > dimens.nz - 1) {
338  OCP_ABORT("WRONG Range in " + objName + " in EQUALS!");
339  }
340 
341  vector<OCP_DBL>* objPtr = FindPtr(objName);
342 
343  if (objPtr != nullptr) {
344  if (objName == "TOPS") {
345  objPtr->resize(dimens.nx * dimens.ny);
346  index[4] = index[5] = 0;
347  } else {
348  objPtr->resize(numGrid);
349  }
350  setVal(*objPtr, val, index);
351  } else {
352  OCP_ABORT("Wrong object name: " + objName);
353  }
354  }
355 
356  cout << "/\n\n";
357 }
double OCP_DBL
Double precision.
Definition: OCPConst.hpp:26
void setVal(vector< T > &obj, const T &val, const vector< USI > &index)
It's used in InputEQUALS, assigning values in batches.

References DealDefault(), dimens, FindPtr(), numGrid, Dimens::nx, Dimens::ny, Dimens::nz, OCP_ABORT, ReadLine(), and setVal().

◆ InputEQUIL()

void ParamReservoir::InputEQUIL ( ifstream &  ifs)

EQUIL contains initial information of reservoir; see ParamEQUIL.

Read data from the EQUIL keyword.

Definition at line 581 of file ParamReservoir.cpp.

582 {
583  vector<string> vbuf;
584  ReadLine(ifs, vbuf);
585  if (vbuf[0] == "/") return;
586 
587  EQUIL.resize(6, 0);
588  DealDefault(vbuf);
589  for (USI i = 0; i < 6; i++) {
590  if (vbuf[i] != "DEFAULT") EQUIL[i] = stod(vbuf[i]);
591  }
592 
593  cout << "---------------------" << endl
594  << "EQUIL" << endl
595  << "---------------------" << endl;
596  for (USI i = 0; i < 6; i++) cout << EQUIL[i] << " ";
597  cout << endl;
598 }

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

◆ InputGRAVITY()

void ParamReservoir::InputGRAVITY ( ifstream &  ifs)

Input the reference gravity of oil, water, and air in standard condition.

Read data from the GRAVITY keyword.

Definition at line 536 of file ParamReservoir.cpp.

537 {
538  gravity.activity = true;
539  vector<string> vbuf;
540  ReadLine(ifs, vbuf);
541  if (vbuf[0] == "/") return;
542  DealDefault(vbuf);
543  OCP_ASSERT(vbuf.size() == 4, "Wrong Keyword GRAVITY!");
544  for (USI i = 0; i < 3; i++) {
545  if (vbuf[i] != "DEFAULT") {
546  gravity.data[i] = stod(vbuf[i]);
547  }
548  }
549 
550  cout << "---------------------" << endl
551  << "GRAVITY" << endl
552  << "---------------------" << endl;
553  cout << gravity.data[0] << " " << gravity.data[1] << " " << gravity.data[2]
554  << endl;
555 }

References Type_A_r< T >::activity, Type_A_r< T >::data, DealDefault(), gravity, OCP_ASSERT, and ReadLine().

◆ InputGRID()

void ParamReservoir::InputGRID ( ifstream &  ifs,
string &  keyword 
)

TODO: Add Doxygen.

Input the keyword about grids, actually, it's a supplement for EQUALS. It supplies another way to input the params in EQUALS.

Definition at line 360 of file ParamReservoir.cpp.

361 {
362  vector<OCP_DBL>* objPtr = nullptr;
363 
364  objPtr = FindPtr(keyword);
365  if (objPtr == nullptr) {
366  OCP_ABORT("Unknown keyword!");
367  }
368 
369  vector<string> vbuf;
370  while (ReadLine(ifs, vbuf)) {
371  if (vbuf[0] == "/") break;
372 
373  for (auto& str : vbuf) {
374  // if m*n occurs, then push back n m times
375  auto pos = str.find('*');
376  if (pos == string::npos) {
377  objPtr->push_back(stod(str));
378  }
379  else {
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);
385  }
386  }
387  }
388 }

References FindPtr(), OCP_ABORT, and ReadLine().

◆ InputMISCSTR()

void ParamReservoir::InputMISCSTR ( ifstream &  ifs)

Input the Miscibility information.

Read data from the MISCSTR keyword.

Definition at line 513 of file ParamReservoir.cpp.

514 {
515  if (!EoSp.miscible) {
516  OCP_WARNING("MISCIBLE has not been declared, this keyword will be ignored!");
517  }else{
518  vector<string> vbuf;
519  ReadLine(ifs, vbuf);
520  if (vbuf[0] == "/") return;
521  if (vbuf.back() == "/") vbuf.pop_back();
522 
523  USI len = vbuf.size();
524  for (USI i = 0; i < len; i++) {
525  miscstr.surTenRef.push_back(stod(vbuf[i]));
526  }
527  }
528 
529  cout << "MISCSTR" << endl;
530  for (auto& v : miscstr.surTenRef)
531  cout << v << " ";
532  cout << endl << endl;
533 }
#define OCP_WARNING(msg)
Log warning messages.
Definition: UtilError.hpp:39
bool miscible
Miscible treatment of hydrocarbons, used in compositional Model.
Miscstr miscstr
reference Miscibility surface tension

References EoSp, EoSparam::miscible, miscstr, OCP_WARNING, and ReadLine().

◆ InputMULTIPLY()

void ParamReservoir::InputMULTIPLY ( ifstream &  ifs)

TODO: Add Doxygen.

Input the keyword: MULTIPLY. MULTIIPLY could multiply the value of a certain range of a variable by a coefficient.

Definition at line 427 of file ParamReservoir.cpp.

428 {
429  vector<string> vbuf;
430  vector<USI> index(6, 0);
431 
432  while (ReadLine(ifs, vbuf)) {
433  if (vbuf[0] == "/") break;
434 
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;
438 
439  string objName = vbuf[0];
440  OCP_DBL val = stod(vbuf[1]);
441 
442  DealDefault(vbuf);
443  for (USI n = 2; n < 8; n++) {
444  if (vbuf[n] != "DEFAULT") index[n - 2] = stoi(vbuf[n]) - 1;
445  }
446 
447  vector<OCP_DBL>* objPtr = FindPtr(objName);
448  if (objPtr != nullptr) {
449  if (objName == "TOPS") {
450  index[4] = index[5] = 0;
451  }
452  MultiplyVal(*objPtr, val, index);
453  } else {
454  OCP_ABORT("Wrong object name: " + objName);
455  }
456  }
457 }
void MultiplyVal(vector< OCP_DBL > &obj, const OCP_DBL &val, const vector< USI > &index)
TODO: Add Doxygen.

References DealDefault(), dimens, FindPtr(), MultiplyVal(), Dimens::nx, Dimens::ny, Dimens::nz, OCP_ABORT, and ReadLine().

◆ InputRegion()

void ParamReservoir::InputRegion ( ifstream &  ifs,
const string &  keyword 
)

Input the keyword: SATNUM and PVTNUM.

Region information like SATNUM to decide which grid belongs to which saturation region, so corresponding saturation table will be used.

Definition at line 614 of file ParamReservoir.cpp.

615 {
616  Type_A_r<OCP_DBL>* ptr = &PVTNUM;
617  USI lim = NTPVT;
618 
619  if (keyword == "SATNUM") {
620  ptr = &SATNUM;
621  lim = NTSFUN;
622  }
623  else if (keyword == "ACTNUM") {
624  ptr = &ACTNUM;
625  }
626 
627  ptr->activity = true;
628  ptr->data.reserve(numGrid);
629  vector<string> vbuf;
630  vector<OCP_USI> obj;
631  vector<USI> region;
632 
633  while (ReadLine(ifs, vbuf)) {
634  if (vbuf[0] == "/") break;
635 
636  for (auto& str : vbuf) {
637  // if m*n occurs, then push back n m times
638  auto pos = str.find('*');
639  if (pos == string::npos) {
640  ptr->data.push_back(stod(str));
641  }
642  else {
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);
648  }
649  }
650  }
651 
652  cout << "Number of Tables = " << lim << endl;
653 }
USI NTSFUN
Num of SAT regions.
Type_A_r< OCP_DBL > ACTNUM
Records the index of Active region for each grid.
USI NTPVT
Num of PVT regions.

References Type_A_r< T >::activity, ACTNUM, Type_A_r< T >::data, NTPVT, NTSFUN, numGrid, PVTNUM, ReadLine(), and SATNUM.

◆ InputROCK()

void ParamReservoir::InputROCK ( ifstream &  ifs)

Read data from the ROCK keyword.

Input the keyword: ROCK. ROCK contains the compressibility factor and reference pressure at initial porosity.

Definition at line 497 of file ParamReservoir.cpp.

498 {
499  vector<string> vbuf;
500  ReadLine(ifs, vbuf);
501  if (vbuf[0] == "/") return;
502 
503  rock.Pref = stod(vbuf[0]);
504  rock.Cr = stod(vbuf[1]);
505 
506  cout << "---------------------" << endl
507  << "ROCK" << endl
508  << "---------------------" << endl;
509  cout << rock.Pref << " " << rock.Cr << endl;
510 }

References Rock::Cr, Rock::Pref, ReadLine(), and rock.

◆ InputRTEMP()

void ParamReservoir::InputRTEMP ( ifstream &  ifs)

Input the keyword: RTEMP. RTEMP gives the temperature of reservoir.

TODO: Add Doxygen.

Definition at line 300 of file ParamReservoir.cpp.

301 {
302  vector<string> vbuf;
303  ReadLine(ifs, vbuf);
304  if (vbuf[0] == "/") return;
305 
306  rsTemp = stod(vbuf[0]);
307  cout << "RTEMP" << endl;
308  cout << rsTemp << endl;
309 }

References ReadLine(), and rsTemp.

◆ InputTABDIMS()

void ParamReservoir::InputTABDIMS ( ifstream &  ifs)

TABDIMS contains the num of saturation region and PVT region.

Read data from the TABDIMS keyword.

Definition at line 601 of file ParamReservoir.cpp.

602 {
603  vector<string> vbuf;
604  ReadLine(ifs, vbuf);
605  NTSFUN = stoi(vbuf[0]);
606  NTPVT = stoi(vbuf[1]);
607 
608  cout << "TABDIMS" << endl;
609  cout << NTSFUN << " " << NTPVT << "\n\n";
610 }

References NTPVT, NTSFUN, and ReadLine().

◆ InputTABLE()

void ParamReservoir::InputTABLE ( ifstream &  ifs,
const string &  tabName 
)

Input PVTtable and SATtable such as SWOF, PVCO.

TODO: Add Doxygen.

Definition at line 460 of file ParamReservoir.cpp.

461 {
462  TableSet* obj;
463  obj = FindPtr_T(tabName);
464  if (obj == nullptr) {
465  OCP_ABORT("Wrong table name :" + tabName);
466  }
467 
468  USI col = obj->colNum;
469  if (tabName == "ZMFVD") {
470  if (!comps) OCP_ABORT("COMPS isn't set correctly!");
471  obj->colNum = numCom + 1;
472  col = obj->colNum;
473  }
474  vector<vector<OCP_DBL>> tmpTab(col);
475 
476  vector<string> vbuf;
477  while (ReadLine(ifs, vbuf)) {
478  if (vbuf[0] == "/") break;
479 
480  for (USI i = 0; i < col; i++) {
481  tmpTab[i].push_back(stod(vbuf[i]));
482  }
483 
484  if (vbuf.back() == "/") {
485  obj->data.push_back(tmpTab);
486  for (USI j = 0; j < col; j++) {
487  tmpTab[j].clear();
488  }
489  }
490  }
491  if (!tmpTab[0].empty()) obj->data.push_back(tmpTab);
492 
493  obj->DisplayTable();
494 }
TableSet * FindPtr_T(const string &varName)
Find pointer to the specified table.
void DisplayTable() const
Print table.

References TableSet::colNum, comps, TableSet::data, TableSet::DisplayTable(), FindPtr_T(), numCom, OCP_ABORT, and ReadLine().

◆ MultiplyVal()

void ParamReservoir::MultiplyVal ( vector< OCP_DBL > &  obj,
const OCP_DBL val,
const vector< USI > &  index 
)

TODO: Add Doxygen.

It's used in InputMULTIPLY, multipling the value of a certain range of a variable by a coefficient.

Definition at line 248 of file ParamReservoir.cpp.

250 {
251  USI Nx = dimens.nx;
252  USI Ny = dimens.ny;
253  OCP_USI NxNy = Nx * Ny;
254  OCP_USI id = 0;
255 
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;
260  obj[id] *= val;
261  }
262  }
263  }
264 }

References dimens, Dimens::nx, and Dimens::ny.

◆ setVal()

template<typename T >
void ParamReservoir::setVal ( vector< T > &  obj,
const T &  val,
const vector< USI > &  index 
)

It's used in InputEQUALS, assigning values in batches.

TODO: Add Doxygen.

Definition at line 210 of file ParamReservoir.cpp.

211 {
212  USI Nx = dimens.nx;
213  USI Ny = dimens.ny;
214  OCP_USI NxNy = Nx * Ny;
215  OCP_USI id = 0;
216 
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;
221  obj[id] = val;
222  }
223  }
224  }
225 }

References dimens, Dimens::nx, and Dimens::ny.

Member Data Documentation

◆ rock

Rock ParamReservoir::rock

Contains the compressibility factor and reference pressure at initial porosity.

Definition at line 160 of file ParamReservoir.hpp.


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