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

Basic information of computational grid, including the rock properties. More...

#include <Grid.hpp>

Public Member Functions

 Grid ()=default
 Default constructor.
 
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 SetupNeighborOrthogonalGrid ()
 Setup the neighboring info for an orthogonal grid.
 
OCP_DBL CalAkdOrthogonalGrid (const OCP_USI &bId, const OCP_USI &eId, const USI &direction)
 Calculate Akd for an orthogonal grid.
 
void CalDepthVOrthogonalGrid ()
 Calculate the depth and volume for an orthogonal grid.
 
void SetupCornerGrid ()
 Setup a corner-point grid.
 
void SetupNeighborCornerGrid (const COORD &CoTmp)
 Setup the neighboring info for a corner-point grid.
 
OCP_DBL CalAkdCornerGrid (const GeneralConnect &conn)
 Calculate Akd for a corner-point grid.
 
void CalActiveGrid (const OCP_DBL &e1, const OCP_DBL &e2)
 Calculate the activeness of grid cells. More...
 
const GB_PairMapG2B (const OCP_USI &i) const
 Mapping from grid cells to bulks (active cells).
 
OCP_USI GetGridNx () const
 Return nx of grid cell.
 
OCP_USI GetGridNy () const
 Return ny of grid cell.
 
OCP_USI GetGridNz () const
 Return nz of grid cell.
 
OCP_USI GetGridNum () const
 Return the num of grid cells.
 
OCP_USI GetConnNum () const
 Return the num of connections.
 
OCP_USI GetActiveGridNum () const
 Return the num of bulks (active cells).
 
OCP_USI GetActIndex (const USI &i, const USI &j, const USI &k) const
 Return the index of active cell (i, j, k). More...
 
void GetIJKGrid (USI &i, USI &j, USI &k, const OCP_USI &n) const
 Return the 3D coordinate for object grid with Grid index.
 
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 CalSomeInfo () const
 
void CalNumDigutIJK ()
 only used in Structural grid
 
USI GetNumDigitIJK () const
 

Friends

class Bulk
 
class BulkConn
 
class Well
 

Detailed Description

Basic information of computational grid, including the rock properties.

Definition at line 75 of file Grid.hpp.

Member Function Documentation

◆ CalActiveGrid()

void Grid::CalActiveGrid ( const OCP_DBL e1,
const OCP_DBL e2 
)

Calculate the activeness of grid cells.

If porosity or volume of the grid cell is too small, then the cell is inactive.

Definition at line 306 of file Grid.cpp.

307 {
308  activeMap_B2G.reserve(numGrid);
309  activeMap_G2B.resize(numGrid);
310  OCP_USI count = 0;
311  for (OCP_USI n = 0; n < numGrid; n++)
312  {
313  if (ACTNUM[n] == 0 || poro[n] * ntg[n] < e1 || v[n] < e2)
314  {
315  activeMap_G2B[n] = GB_Pair(false, 0);
316  continue;
317  }
318  activeMap_B2G.push_back(n);
319  activeMap_G2B[n] = GB_Pair(true, count);
320  count++;
321  }
322  activeGridNum = count;
323  cout << (numGrid - activeGridNum) * 100.0 / numGrid << "% ("
324  << (numGrid - activeGridNum) << ") of grid cell is inactive" << endl;
325 }
unsigned int OCP_USI
Long unsigned integer.
Definition: OCPConst.hpp:24
Active cell indicator and its index among active cells.
Definition: Grid.hpp:48

◆ GetActIndex()

OCP_USI Grid::GetActIndex ( const USI i,
const USI j,
const USI k 
) const

Return the index of active cell (i, j, k).

Return id of the active cell and abort if the cell is inactive!

Definition at line 328 of file Grid.cpp.

329 {
330  OCP_USI id = k * nx * ny + j * nx + i;
331  if (id > numGrid)
332  {
333  OCP_ABORT("Id is out of Range!");
334  }
335  bool activity = activeMap_G2B[id].IsAct();
336  if (!activity)
337  {
338  OCP_ABORT("(" + to_string(i) + "," + to_string(j) + "," + to_string(k) +
339  ") is inactive");
340  }
341  id = activeMap_G2B[id].GetId();
342  return id;
343 }
#define OCP_ABORT(msg)
Abort if critical error happens.
Definition: UtilError.hpp:47

References OCP_ABORT.


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