42 vector<GPair> tmp1, tmp2;
56 for (
USI i = 0; i < len; i++) {
60 tmp1[i].id = GBtmp2.
GetId();
61 tmp2.push_back(tmp1[i]);
65 tmp2.push_back(
GPair(bIdb, 0, 0.0, 0.0));
67 sort(tmp2.begin(), tmp2.end(), GPair::lessG);
70 for (
USI i = 0; i < len; i++) {
71 neighbor[bIdb].push_back(tmp2[i].
id);
72 if (tmp2[i].
id == bIdb) {
76 for (
USI j =
selfPtr[bIdb] + 1; j < len; j++) {
78 tmp2[j].areaB, tmp2[j].areaE));
101 T1 = myBulk.
ntg[bId] * myBulk.
rockKx[bId] * areaB;
102 T2 = myBulk.
ntg[eId] * myBulk.
rockKx[eId] * areaE;
105 T1 = myBulk.
ntg[bId] * myBulk.
rockKy[bId] * areaB;
106 T2 = myBulk.
ntg[eId] * myBulk.
rockKy[eId] * areaE;
109 T1 = myBulk.
rockKz[bId] * areaB;
110 T2 = myBulk.
rockKz[eId] * areaE;
128 cout <<
"[" <<
selfPtr[i] <<
"]";
139 void BulkConn::PrintConnectionInfoCoor(
const Grid& myGrid)
const
145 cout <<
"BulkConn : " <<
numConn << endl;
151 myGrid.GetIJKGrid(I, J, K, bIdg);
152 cout << GetIJKformat(I, J, K, sp) <<
" ";
153 cout << setw(6) << bIdg;
155 cout << setw(6) << bIdb;
157 myGrid.GetIJKGrid(I, J, K, eIdg);
158 cout << GetIJKformat(I, J, K, sp) <<
" ";
159 cout << setw(6) << eIdg;
161 cout << setw(6) << eIdb;
182 for (
USI j = 0; j < np; j++) {
183 bId_np_j = bId * np + j;
184 eId_np_j = eId * np + j;
189 if ((exbegin) && (exend)) {
190 rho = (myBulk.
rho[bId_np_j] * myBulk.
S[bId_np_j] +
191 myBulk.
rho[eId_np_j] * myBulk.
S[eId_np_j]) /
192 (myBulk.
S[bId_np_j] + myBulk.
S[eId_np_j]);
193 }
else if (exbegin && (!exend)) {
194 rho = myBulk.
rho[bId_np_j];
195 }
else if ((!exbegin) && (exend)) {
196 rho = myBulk.
rho[eId_np_j];
202 Pbegin = myBulk.
Pj[bId_np_j];
203 Pend = myBulk.
Pj[eId_np_j];
216 void BulkConn::CalResFIMS(vector<OCP_DBL>& res,
const Bulk& myBulk,
const OCP_DBL& dt)
222 const USI len = nc + 1;
231 res[bId] = myBulk.
rockVp[n] - myBulk.
vf[n];
232 for (
USI i = 0; i < nc; i++) {
233 res[bId + 1 + i] = myBulk.
Ni[bIdb + i] - myBulk.
lNi[bIdb + i];
237 OCP_USI bId_np_j, eId_np_j, uId_np_j;
248 for (
USI j = 0; j < np; j++) {
249 bId_np_j = bId * np + j;
250 eId_np_j = eId * np + j;
255 if ((exbegin) && (exend)) {
256 rho = (myBulk.
rho[bId_np_j] * myBulk.
S[bId_np_j] +
257 myBulk.
rho[eId_np_j] * myBulk.
S[eId_np_j]) /
258 (myBulk.
S[bId_np_j] + myBulk.
S[eId_np_j]);
259 }
else if (exbegin && (!exend)) {
260 rho = myBulk.
rho[bId_np_j];
261 }
else if ((!exbegin) && (exend)) {
262 rho = myBulk.
rho[eId_np_j];
268 Pbegin = myBulk.
Pj[bId_np_j];
269 Pend = myBulk.
Pj[eId_np_j];
279 uId_np_j = uId * np + j;
281 tmp = dt * Akd * myBulk.
xi[uId_np_j] * myBulk.
kr[uId_np_j] /
282 myBulk.
mu[uId_np_j] * dP;
284 for (
USI i = 0; i < nc; i++) {
285 dNi = tmp * myBulk.
xij[uId_np_j * nc + i];
286 res[bId * len + 1 + i] += dNi;
287 res[eId * len + 1 + i] -= dNi;
BulkConn class declaration.
unsigned int USI
Generic unsigned integer.
double OCP_DBL
Double precision.
const OCP_DBL CONV1
1 bbl = CONV1 ft3
const OCP_DBL GRAVITY_FACTOR
0.00694444 ft2 psi / lb
unsigned int OCP_USI
Long unsigned integer.
unsigned int OCP_BOOL
OCP_BOOL in OCP.
const OCP_DBL CONV2
Darcy constant in field unit.
#define OCP_FUNCNAME
Print Function Name.
#define OCP_ABORT(msg)
Abort if critical error happens.
OCP_USI numConn
Number of connections between bulks.
vector< OCP_USI > upblock
Index of upwinding bulk of connections : numConn * numPhase.
vector< OCP_DBL > upblock_Rho
Mass density of phase from upblock: numConn * numPhase.
OCP_USI numBulk
Number of bulks (active grid cells).
void CalFluxFIMS(const Grid &myGrid, const Bulk &myBulk)
rho = (S1*rho1 + S2*rho2)/(S1+S2)
void CalAkd(const Bulk &myBulk)
Calculate the effective area used for flow.
void PrintConnectionInfo(const Grid &myGrid) const
Print information of connections on screen.
vector< USI > selfPtr
Self-pointer, the indices of the i-th bulk in neighbor[i]: numBulk.
void Setup(const Grid &myGrid)
It should be called after Grid and Bulk Setup.
vector< vector< OCP_USI > > neighbor
Neighboring information of each bulk: activeGridNum.
void SetupIsoT(const Grid &myGrid, const Bulk &myBulk)
Setup active connections.
vector< BulkPair > iteratorConn
All connections (pair of indices) between bulks: numConn.
vector< USI > neighborNum
Number of neighbors of the i-th bulk: numBulk, self-included.
Connection between two bulks (bId, eId); usually, indices bId > eId.
Physical information of each active reservoir bulk.
vector< OCP_DBL > mu
Viscosity of phase: numPhase*numBulk.
USI numPhase
Number of phase.
vector< OCP_DBL > S
Saturation of phase: numPhase*numBulk.
vector< OCP_DBL > rho
Mass density of phase: numPhase*numBulk.
vector< OCP_DBL > ntg
net to gross of bulk.
vector< OCP_DBL > xij
Nij / Nj: numPhase*numCom*numBulk.
vector< OCP_DBL > kr
Relative permeability of phase: numPhase*numBulk.
vector< OCP_DBL > depth
Depth of center of grid cells: activeGridNum.
vector< OCP_DBL > rockVp
pore volume = Vgrid * ntg * poro.
vector< OCP_DBL > Ni
Moles of component: numCom*numBulk.
vector< OCP_DBL > Pj
Pressure of phase: numPhase*numBulk.
vector< OCP_BOOL > phaseExist
Existence of phase: numPhase*numBulk.
vector< OCP_DBL > xi
Moles density of phase: numPhase*numBulk.
vector< OCP_DBL > vf
Total fluid volume: numBulk.
vector< OCP_DBL > rockKz
current rock permeability along the z direction.
vector< OCP_DBL > rockKx
current rock permeability along the x direction.
vector< OCP_DBL > rockKy
current rock permeability along the y direction.
vector< OCP_DBL > lNi
last Ni
USI numCom
Number of component.
Active cell indicator and its index among active cells.
OCP_BOOL IsAct() const
Return whether this cell is active or not.
OCP_USI GetId() const
Return the index of this cell among active cells.
Effective area of intersection surfaces with neighboring cells.
vector< OCP_USI > map_Act2All
Mapping from active grid to all grid: activeGridNum.
OCP_USI activeGridNum
Num of active grid.
USI GetNumDigitIJK() const
Return numDigutIJK.
vector< GB_Pair > map_All2Act
Mapping from grid to active all grid: numGrid.
OCP_USI numGrid
Number of all cells.
vector< vector< GPair > > gNeighbor
Neighboring information of grid.