OpenCAEPoro  v0.5.0
A simulator for multicomponent porous media flow
PhasePermeability.cpp
Go to the documentation of this file.
1 
12 #include "PhasePermeability.hpp"
13 
15 // Miscible For Compositional Model
17 
18 void Miscible::InputParam(const Miscstr& misterm)
19 {
20  const USI len = misterm.surTenRef.size();
21  if (len > 0) {
22  ifUseMiscible = OCP_TRUE;
23  surTenRef = misterm.surTenRef[0];
24  surTenPc = 1;
25  if (len > 2) {
26  surTenPc = misterm.surTenRef[2] / surTenRef;
27  }
28  Fkexp = 0.25;
29  }
30 }
31 
32 void Miscible::Setup(const OCP_USI& numBulk)
33 {
34  if (!ifSetup) {
35  ifSetup = OCP_TRUE;
36 
37  surTen.resize(numBulk);
38  Fk.resize(numBulk);
39  Fp.resize(numBulk);
40 
41  // Last time step
42  lsurTen.resize(numBulk);
43  }
44 }
45 
47 {
48  if (surTen[n] >= surTenRef || surTen[n] <= TINY) {
49  Fk[n] = 1;
50  Fp[n] = 1;
51  return OCP_FALSE; // InMiscible
52  } else {
53  Fk[n] = fk = min(1.0, pow(surTen[n] / surTenRef, Fkexp));
54  Fp[n] = fp = min(surTenPc, surTen[n] / surTenRef);
55  return OCP_TRUE; // Miscible
56  }
57 }
58 
60 // Scale The Water-Oil Capillary Pressure Curves (From SWATINIT)
62 
63 void ScalePcow::Setup(const Grid& myGrid)
64 {
65  if (!ifSetup) {
66  ifSetup = OCP_TRUE;
67 
68  if (myGrid.SwatInit.size() > 0) {
69  ifScale = OCP_TRUE;
70  scaleVal.resize(myGrid.activeGridNum, 1.0);
71  swatInit.resize(myGrid.activeGridNum);
72 
73  for (OCP_USI bIda = 0; bIda < myGrid.activeGridNum; bIda++) {
74  OCP_USI bId = myGrid.map_Act2All[bIda];
75  swatInit[bIda] = myGrid.SwatInit[bId];
76  }
77  }
78  }
79 }
80 
81 /*----------------------------------------------------------------------------*/
82 /* Brief Change History of This File */
83 /*----------------------------------------------------------------------------*/
84 /* Author Date Actions */
85 /*----------------------------------------------------------------------------*/
86 /* Shizhe Li Dec/26/2022 Create file */
87 /*----------------------------------------------------------------------------*/
const OCP_DBL TINY
Small constant.
Definition: OCPConst.hpp:38
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
unsigned int OCP_BOOL
OCP_BOOL in OCP.
Definition: OCPConst.hpp:29
PhasePermeability class declaration.
Definition: Grid.hpp:89
vector< OCP_USI > map_Act2All
Mapping from active grid to all grid: activeGridNum.
Definition: Grid.hpp:192
OCP_USI activeGridNum
Num of active grid.
Definition: Grid.hpp:190
vector< OCP_DBL > SwatInit
Initial water saturation.
Definition: Grid.hpp:184
OCP_BOOL CalFkFp(const OCP_USI &n, OCP_DBL &fk, OCP_DBL &fp)
Calculate Fk, Fp and return if miscible.
OCP_BOOL ifUseMiscible
Miscible treatment of hydrocarbons, only used in compositional Model.
OCP_BOOL ifSetup
void InputParam(const Miscstr &misterm)
Input param from input file.
OCP_DBL surTenRef
The reference surface tension - flow is immiscible when the surface tension.
vector< OCP_DBL > Fp
The capillary pressure interpolation parameter.
vector< OCP_DBL > surTen
Surface tensions between hydrocarbon phases.
vector< OCP_DBL > lsurTen
last surTen.
OCP_DBL Fkexp
Exponent set used to calculate Fk.
void Setup(const OCP_USI &numBulk)
Allocate memory for Miscible term.
OCP_DBL surTenPc
Maximum surface tension for capillary pressure / surTenRef.
vector< OCP_DBL > Fk
The relative permeability interpolation parameter.
OCP_BOOL ifSetup
Only one setup is needed.
OCP_BOOL ifScale
If true, then Scale will be used.
vector< OCP_DBL > scaleVal
Scale values for Pcow, it will be calculated from swatInit.
vector< OCP_DBL > swatInit
Initial water distribution.
void Setup(const Grid &myGrid)
Setup ScalePcow term.