21 if (!rs_param.
coord.empty())
26 coord = rs_param.
coord;
27 zcorn = rs_param.
zcorn;
34 numConn = 3 * nx * ny * nz - nx * ny - ny * nz - nz * nx;
46 SwatInit = rs_param.
Swat;
48 SATNUM.resize(numGrid, 0);
51 for (
OCP_USI i = 0; i < numGrid; i++)
53 SATNUM[i] = round(rs_param.
SATNUM.
data[i]) - 1;
56 PVTNUM.resize(numGrid, 0);
59 for (
OCP_USI i = 0; i < numGrid; i++)
61 PVTNUM[i] = round(rs_param.
PVTNUM.
data[i]) - 1;
64 ACTNUM.resize(numGrid, 1);
67 for (
OCP_USI i = 0; i < numGrid; i++)
104 gNeighbor.resize(numGrid);
106 for (
OCP_USI n = 0; n < numGrid; n++)
108 gNeighbor[n].reserve(6);
116 for (
USI k = 0; k < nz; k++)
118 for (
USI j = 0; j < ny; j++)
120 for (
USI i = 0; i < nx; i++)
123 bIdg = k * nxny + j * nx + i;
129 gNeighbor[bIdg].push_back(
GPair(eIdg, area));
130 gNeighbor[eIdg].push_back(
GPair(bIdg, area));
138 gNeighbor[bIdg].push_back(
GPair(eIdg, area));
139 gNeighbor[eIdg].push_back(
GPair(bIdg, area));
147 gNeighbor[bIdg].push_back(
GPair(eIdg, area));
148 gNeighbor[eIdg].push_back(
GPair(bIdg, area));
158 const USI &direction)
166 T1 = kx[bId] * ntg[bId] * dy[bId] * dz[bId] / dx[bId];
167 T2 = kx[eId] * ntg[eId] * dy[eId] * dz[eId] / dx[eId];
168 return (2 / (1 / T1 + 1 / T2));
172 T1 = ky[bId] * ntg[bId] * dz[bId] * dx[bId] / dy[bId];
173 T2 = ky[eId] * ntg[eId] * dz[eId] * dx[eId] / dy[eId];
174 return (2 / (1 / T1 + 1 / T2));
178 T1 = kz[bId] * dx[bId] * dy[bId] / dz[bId];
179 T2 = kz[eId] * dx[eId] * dy[eId] / dz[eId];
180 return (2 / (1 / T1 + 1 / T2));
189 depth.resize(numGrid, 0);
192 for (
USI j = 0; j < ny; j++)
194 for (
USI i = 0; i < nx; i++)
197 depth[id] = tops[id] + dz[id] / 2;
201 for (
USI k = 1; k < nz; k++)
204 for (
USI j = 0; j < ny; j++)
206 for (
USI i = 0; i < nx; i++)
208 OCP_USI id = knxny + j * nx + i;
209 depth[id] = depth[
id - nxny] + dz[
id - nxny] / 2 + dz[id] / 2;
215 for (
OCP_USI i = 0; i < numGrid; i++)
216 v[i] = dx[i] * dy[i] * dz[i];
222 coordTmp.Allocate(nx, ny, nz);
223 coordTmp.InputData(coord, zcorn);
225 coordTmp.SetupCornerPoints();
239 gNeighbor.resize(numGrid);
241 for (
OCP_USI n = 0; n < numGrid; n++)
243 gNeighbor[n].reserve(10);
251 for (
OCP_USI n = 0; n < CoTmp.numConn; n++)
254 bIdg = ConnTmp.begin;
257 gNeighbor[bIdg].push_back(
GPair(eIdg, area));
258 gNeighbor[eIdg].push_back(
GPair(bIdg, area));
278 OCP_DBL bArea = conn.Ad_dd_begin;
279 OCP_DBL eArea = conn.Ad_dd_end;
282 switch (conn.directionType)
285 T1 = ntg[bId] * kx[bId] * bArea;
286 T2 = ntg[eId] * kx[eId] * eArea;
287 return 1 / (1 / T1 + 1 / T2);
290 T1 = ntg[bId] * ky[bId] * bArea;
291 T2 = ntg[eId] * ky[eId] * eArea;
292 return 1 / (1 / T1 + 1 / T2);
295 T1 = kz[bId] * bArea;
296 T2 = kz[eId] * eArea;
297 return 1 / (1 / T1 + 1 / T2);
308 activeMap_B2G.reserve(numGrid);
309 activeMap_G2B.resize(numGrid);
311 for (
OCP_USI n = 0; n < numGrid; n++)
313 if (ACTNUM[n] == 0 || poro[n] * ntg[n] < e1 || v[n] < e2)
315 activeMap_G2B[n] =
GB_Pair(
false, 0);
318 activeMap_B2G.push_back(n);
319 activeMap_G2B[n] =
GB_Pair(
true, count);
322 activeGridNum = count;
323 cout << (numGrid - activeGridNum) * 100.0 / numGrid <<
"% ("
324 << (numGrid - activeGridNum) <<
") of grid cell is inactive" << endl;
330 OCP_USI id = k * nx * ny + j * nx + i;
335 bool activity = activeMap_G2B[id].IsAct();
338 OCP_ABORT(
"(" + to_string(i) +
"," + to_string(j) +
"," + to_string(k) +
341 id = activeMap_G2B[id].GetId();
350 k = n / (nx * ny) + 1;
351 j = (n - (k - 1) * nx * ny) / nx + 1;
352 i = n - (k - 1) * nx * ny - (j - 1) * nx + 1;
362 void Grid::CalSomeInfo()
const
381 for (
OCP_USI n = 0; n < numGrid; n++)
386 if (depthMax < depth[n])
391 if (depthMin > depth[n])
428 cout <<
"---------------------" << endl
430 <<
"---------------------" << endl;
431 cout <<
" Depthmax = " << depthMax << endl
432 <<
" Depthmin = " << depthMin << endl
433 <<
" DXmax = " << dxMax << endl
434 <<
" DXmin = " << dxMin << endl
435 <<
" DYmax = " << dyMax << endl
436 <<
" DYmin = " << dyMin << endl
437 <<
" DZmax = " << dzMax << endl
438 <<
" DZmin = " << dzMin << endl;
443 OCP_ASSERT((nx > 0 & ny > 0 & nz > 0),
"Wrong Dimension!");
445 if (log10(nx) > numDigutIJK) numDigutIJK = ceil(log10(nx));
446 if (log10(ny) > numDigutIJK) numDigutIJK = ceil(log10(ny));
447 if (log10(nz) > numDigutIJK) numDigutIJK = ceil(log10(nz));
const USI CORNER_GRID
Grid type = corner-point.
unsigned int USI
Generic unsigned integer.
double OCP_DBL
Double precision.
const USI ORTHOGONAL_GRID
Grid type = orthogonal.
unsigned int OCP_USI
Long unsigned integer.
#define OCP_FUNCNAME
Print Function Name.
#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.
Active cell indicator and its index among active cells.
Effective area of intersection surfaces with neighboring cells.
void CalNumDigutIJK()
only used in Structural grid
OCP_USI GetActIndex(const USI &i, const USI &j, const USI &k) const
Return the index of active cell (i, j, k).
void SetupCornerGrid()
Setup a corner-point grid.
OCP_DBL CalAkdOrthogonalGrid(const OCP_USI &bId, const OCP_USI &eId, const USI &direction)
Calculate Akd for an orthogonal grid.
void GetIJKGrid(USI &i, USI &j, USI &k, const OCP_USI &n) const
Return the 3D coordinate for object grid with Grid index.
OCP_DBL CalAkdCornerGrid(const GeneralConnect &conn)
Calculate Akd for a corner-point grid.
void SetupNeighborCornerGrid(const COORD &CoTmp)
Setup the neighboring info for a corner-point grid.
void InputParam(const ParamReservoir &rs_param)
Input parameters from the internal param structure.
void Setup()
Setup the grid information and calculate the properties.
void SetupOrthogonalGrid()
Setup an orthogonal grid.
void CalActiveGrid(const OCP_DBL &e1, const OCP_DBL &e2)
Calculate the activeness of grid cells.
void CalDepthVOrthogonalGrid()
Calculate the depth and volume for an orthogonal grid.
void GetIJKBulk(USI &i, USI &j, USI &k, const OCP_USI &n) const
Return the 3D coordinate for object grid with bulk(active grids) index.
void SetupNeighborOrthogonalGrid()
Setup the neighboring info for an orthogonal grid.
vector< OCP_DBL > permY
Permeability along the y-direction for each grid.
vector< OCP_DBL > zcorn
TODO: Add Doxygen.
Type_A_r< OCP_DBL > SATNUM
Records the index of SAT region for each grid.
Type_A_r< OCP_DBL > ACTNUM
Records the index of Active region for each grid.
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.
Type_A_r< OCP_DBL > PVTNUM
Records the index of PVT region for each grid.
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.
vector< OCP_DBL > Swat
Initial water saturation in each grid.
OCP_USI numGrid
Num of grids.
vector< T > data
Data of param.
bool activity
If false, this param is not given.