OpenCAEPoro  v0.5.0
A simulator for multicomponent porous media flow
Grid.hpp
Go to the documentation of this file.
1 
12 #ifndef __GRID_HEADER__
13 #define __GRID_HEADER__
14 
15 // Standard header files
16 #include <iostream>
17 #include <vector>
18 
19 // OpenCAEPoro header files
20 #include "CornerGrid.hpp"
21 #include "OCPConst.hpp"
22 #include "ParamOutput.hpp"
23 #include "ParamReservoir.hpp"
24 #include "UtilOutput.hpp"
25 
26 using namespace std;
27 
29 // Note: GB_Pair contains two variables, which indicates if a grid cell is active or
30 // not and its index among active cells if it is active.
31 class GB_Pair
32 {
33 public:
35  GB_Pair() = default;
37  GB_Pair(const OCP_BOOL& act, const OCP_USI& i)
38  : activity(act)
39  , index(i){};
40 
42  OCP_BOOL IsAct() const { return activity; }
44  OCP_USI GetId() const { return index; }
45 
46 private:
47  OCP_BOOL activity;
48  OCP_USI index;
49 };
50 
52 class GPair
53 {
54 public:
55  GPair() = default;
56  GPair(const OCP_USI& Id,
57  const USI& Direct,
58  const OCP_DBL& AreaB,
59  const OCP_DBL& AreaE)
60  : id(Id)
61  , direction(Direct)
62  , areaB(AreaB)
63  , areaE(AreaE){};
64  static OCP_BOOL lessG(const GPair& G1, const GPair& G2) { return G1.id < G2.id; }
65 
68  OCP_DBL
72 };
73 
75 {
76 public:
77  OCPpolyhedron() = default;
78  OCPpolyhedron(const USI& n)
79  : numPoints(n)
80  {
81  Points.reserve(numPoints);
82  };
83  vector<Point3D> Points;
84  USI numPoints;
85 };
86 
88 class Grid
89 {
90  friend class Bulk;
91  friend class BulkConn;
92  friend class Well;
93  friend class ScalePcow;
94  friend class Out4RPT;
95  friend class Out4VTK;
96 
98  // Input Param and Setup
100 
101 public:
103  void InputParam(const ParamReservoir& rs_param, const ParamOutput& output_param);
104 
106  void SetupIsoT();
108  void SetupT();
110  void Setup();
111 
112 protected:
114  void SetupOrthogonalGrid();
116  void CalDepthVOrthogonalGrid();
118  void SetupNeighborOrthogonalGrid();
119 
121  void SetupCornerGrid();
123  void SetupBasicCornerGrid(const OCP_COORD& CoTmp);
125  void SetupNeighborCornerGrid(const OCP_COORD& CoTmp);
126 
128  void CalActiveGridIsoT(const OCP_DBL& e1, const OCP_DBL& e2);
130  void CalActiveGridT(const OCP_DBL& e1, const OCP_DBL& e2);
131 
133  void SetupGridLocation();
134 
135 public:
136  OCP_USI GetGridNum() const { return numGrid; }
137  OCP_INT GetActIndex(const USI& I, const USI& J, const USI& K) const;
138 
139 protected:
140  // Grid type
143 
144  // structured grid
145  USI nx;
146  USI ny;
147  USI nz;
148 
149  // Corner-point grid
150  vector<OCP_DBL> coord;
151  vector<OCP_DBL> zcorn;
152 
153  // Grid location
154  // Isothermal model: useless now.
155  // Thermal model: only top face and bottom face will be recorded.
156  vector<USI> gLocation;
157 
158  // Orthogonal grid
159  vector<OCP_DBL> tops;
160 
161  // General informations
162  vector<OCP_DBL> dx;
163  vector<OCP_DBL> dy;
164  vector<OCP_DBL> dz;
165  vector<OCP_DBL> v;
166  vector<OCP_DBL> depth;
167 
168  // Rock properties
169  vector<OCP_DBL> ntg;
170  vector<OCP_DBL> poro;
171  vector<OCP_DBL> kx;
172  vector<OCP_DBL> ky;
173  vector<OCP_DBL> kz;
174  vector<OCP_DBL> thconr;
175 
176  // Region
177  vector<USI> SATNUM;
178  vector<USI> PVTNUM;
179  vector<USI> ACTNUM;
181  vector<USI> ROCKNUM;
182 
183  // Initial Properties
184  vector<OCP_DBL> SwatInit;
185 
186  // Connections
187  vector<vector<GPair>> gNeighbor;
188 
189  // Active grid cells
191  vector<OCP_USI>
193  vector<GB_Pair> map_All2Act;
194  // Fluid grid cells
196  vector<GB_Pair> map_All2Flu;
197 
199  // Output
201 
202 public:
203  void GetIJKGrid(USI& i, USI& j, USI& k, const OCP_USI& n) const;
204  void GetIJKBulk(USI& i, USI& j, USI& k, const OCP_USI& n) const;
206  {
207  return useVTK;
208  }
209  void SetHexaherdronGridOrthogonal();
210  void SetHexaherdronGridCorner(
211  const OCP_COORD& mycord);
213  void SetupGridTag();
214  void OutputBaiscInfo() const;
215  void CalNumDigutIJK();
216  USI GetNumDigitIJK() const { return numDigutIJK; }
217 protected:
218  OCP_BOOL useVTK{OCP_FALSE};
219  vector<OCPpolyhedron> polyhedronGrid;
220  vector<USI> gridTag;
222 };
223 
224 #endif /* end if __GRID_HEADER__ */
225 
226 /*----------------------------------------------------------------------------*/
227 /* Brief Change History of This File */
228 /*----------------------------------------------------------------------------*/
229 /* Author Date Actions */
230 /*----------------------------------------------------------------------------*/
231 /* Shizhe Li Oct/01/2021 Create file */
232 /* Chensong Zhang Oct/15/2021 Format file */
233 /* Shizhe Li Nov/18/2021 Add Connections between Grids */
234 /* Chensong Zhang Jan/16/2022 Finish Doxygen */
235 /*----------------------------------------------------------------------------*/
Declaration of classes related to the corner grid.
Definition of build-in datatypes and consts.
unsigned int USI
Generic unsigned integer.
Definition: OCPConst.hpp:23
double OCP_DBL
Double precision.
Definition: OCPConst.hpp:27
unsigned int OCP_USI
Long unsigned integer.
Definition: OCPConst.hpp:25
int OCP_INT
Long integer.
Definition: OCPConst.hpp:26
unsigned int OCP_BOOL
OCP_BOOL in OCP.
Definition: OCPConst.hpp:29
ParamOutput class declaration.
ParamReservoir class declaration.
Supply basic tools used to output files.
Properties and operations on connections between bulks (active grids).
Definition: BulkConn.hpp:71
Physical information of each active reservoir bulk.
Definition: Bulk.hpp:104
Active cell indicator and its index among active cells.
Definition: Grid.hpp:32
GB_Pair()=default
Default constructor.
OCP_BOOL IsAct() const
Return whether this cell is active or not.
Definition: Grid.hpp:42
OCP_USI GetId() const
Return the index of this cell among active cells.
Definition: Grid.hpp:44
GB_Pair(const OCP_BOOL &act, const OCP_USI &i)
Constructor with given information.
Definition: Grid.hpp:37
Effective area of intersection surfaces with neighboring cells.
Definition: Grid.hpp:53
OCP_DBL areaB
Effective intersection area between this cell and the neighbor, self.
Definition: Grid.hpp:69
OCP_USI id
Id of a neighboring cell.
Definition: Grid.hpp:66
USI direction
direction: 1-x, 2-y, 3-z
Definition: Grid.hpp:67
OCP_DBL areaE
Definition: Grid.hpp:70
Definition: Grid.hpp:89
vector< USI > ACTNUM
Definition: Grid.hpp:179
OCP_BOOL IfUseVtk() const
return if use vtk format for outputing
Definition: Grid.hpp:205
vector< OCP_DBL > ky
Absolute permeability in y-direction: numGrid.
Definition: Grid.hpp:172
vector< OCP_DBL > v
Volume of cells: numGrid.
Definition: Grid.hpp:165
vector< OCP_USI > map_Act2All
Mapping from active grid to all grid: activeGridNum.
Definition: Grid.hpp:192
vector< USI > ROCKNUM
index of rock table for each grid: numGrid
Definition: Grid.hpp:181
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
OCP_USI activeGridNum
Num of active grid.
Definition: Grid.hpp:190
vector< OCP_DBL > SwatInit
Initial water saturation.
Definition: Grid.hpp:184
vector< USI > PVTNUM
Identify PVT region for the blackoil model: numGrid.
Definition: Grid.hpp:178
vector< OCP_DBL > depth
Depth of center of grid cells: numGrid.
Definition: Grid.hpp:166
vector< USI > SATNUM
Identify SAT region: numGrid.
Definition: Grid.hpp:177
vector< OCP_DBL > kz
Absolute permeability in z-direction: numGrid.
Definition: Grid.hpp:173
USI gridType
Orthogonal or Corner grid.
Definition: Grid.hpp:141
OCP_USI fluidGridNum
Num of fluid grids.
Definition: Grid.hpp:195
vector< USI > gLocation
Top face, bottom face, side face, numGrid.
Definition: Grid.hpp:156
USI GetNumDigitIJK() const
Return numDigutIJK.
Definition: Grid.hpp:216
vector< OCP_DBL > dz
Size of cell in z-direction: numGrid.
Definition: Grid.hpp:164
USI nz
Number of cells in z-direction.
Definition: Grid.hpp:147
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
vector< OCP_DBL > zcorn
ZValues of a corner-point grid.
Definition: Grid.hpp:151
vector< GB_Pair > map_All2Flu
Mapping from all grid to fluid grid: numGrid.
Definition: Grid.hpp:196
vector< OCP_DBL > coord
Lines of a corner-point grid.
Definition: Grid.hpp:150
vector< OCP_DBL > thconr
Rock if Thermal conductivity: numGrid.
Definition: Grid.hpp:174
vector< OCP_DBL > poro
Initial porosity of rock cells: numGrid.
Definition: Grid.hpp:170
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 > tops
Depth of center of grid cells: numGrid.
Definition: Grid.hpp:159
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 > ntg
Net to gross ratio of cells: numGrid.
Definition: Grid.hpp:169
vector< vector< GPair > > gNeighbor
Neighboring information of grid.
Definition: Grid.hpp:187
vector< OCP_DBL > kx
Absolute permeability in x-direction: numGrid.
Definition: Grid.hpp:171
Record the initial grid information, all of grids are contained.
Definition: Grid.hpp:75
Collect more detailed information of each time step.
Definition: OCPOutput.hpp:211
Definition: Well.hpp:45