12 #ifndef __BULK_HEADER__
13 #define __BULK_HEADER__
39 const int BULK_SUCCESS = 0;
40 const int BULK_NEGATIVE_PRESSURE = -1;
41 const int BULK_NEGATIVE_TEMPERATURE = -2;
42 const int BULK_NEGATIVE_COMPONENTS_MOLES = -3;
43 const int BULK_OUTRANGED_VOLUME_ERROR = -4;
44 const int BULK_OUTRANGED_CFL = -5;
66 void InputParam(
const HLoss& loss);
68 OCP_BOOL IfHeatLoss()
const {
return ifHLoss; }
69 void CalHeatLoss(
const vector<USI>& location,
70 const vector<OCP_DBL>& T,
71 const vector<OCP_DBL>& lT,
72 const vector<OCP_DBL>& initT,
75 void ResetToLastTimeStep();
76 void UpdateLastTimeStep();
134 void SetupIsoT(
const Grid& myGrid);
136 void SetupT(
const Grid& myGrid);
163 void InitPTSw(
const USI& tabrow);
180 void AllocateRegion(
const Grid& myGrid);
182 void SetupBulkType(
const Grid& myGrid);
184 const vector<Mixture*>&
GetMixture()
const {
return flashCal; }
198 vector<vector<OCP_DBL>>
233 void AllocateGridRockIsoT(
const Grid& myGrid);
234 void AllocateGridRockT(
const Grid& myGrid);
288 return S[n * numPhase + phase2Index[
OIL]];
293 return S[n * numPhase + phase2Index[
GAS]];
298 return S[n * numPhase + phase2Index[
WATER]];
465 mutable vector<OCP_DBL>
cfl;
473 void AllocateError();
502 void ShowFIMBulk(
const OCP_BOOL& flag = OCP_FALSE)
const;
512 void Setup(
const OCP_USI& nb) { indicator.resize(nb, -1); }
513 void Init() { fill(indicator.begin(), indicator.end(), -1); }
514 void SetBulkType(
const OCP_USI& n,
const OCP_INT& flag) { indicator[n] = flag; }
515 OCP_BOOL IfFIMbulk(
const OCP_USI& n)
const {
return indicator[n] > 0; }
516 OCP_BOOL IfIMPECbulk(
const OCP_USI& n)
const {
return indicator[n] < 0; }
Operations about small dense mat.
FlowUnit class declaration.
Linear solver class declaration.
MixtureBO class declaration.
MixtureComp class declaration.
MixtureThermal class declaration.
Mixture class declaration.
Definition of build-in datatypes and consts.
unsigned int USI
Generic unsigned integer.
const USI GAS
Fluid type = gas.
double OCP_DBL
Double precision.
const USI WATER
Fluid type = water.
const USI OIL
Fluid type = oil.
unsigned int OCP_USI
Long unsigned integer.
unsigned int OCP_BOOL
OCP_BOOL in OCP.
Some Structure in OpenCAEPoro.
ParamReservoir class declaration.
Properties and operations on connections between bulks (active grids).
vector< OCP_INT > indicator
Physical information of each active reservoir bulk.
vector< OCP_DBL > mu
Viscosity of phase: numPhase*numBulk.
vector< USI > pVnumCom
num of variable components in the phase
vector< OCP_DBL > dNNR
Ni change between NR steps.
vector< OCP_DBL > lP
last P
USI GetPhaseNum() const
Return the number of phases.
vector< OCP_DBL > lS
last S
vector< OCP_DBL > lkt
last kt
vector< OCP_DBL > UfP
d Uf / d P: numbulk
vector< OCP_DBL > NRstep
NRstep for FIM.
vector< Rock * > rock
rock model
vector< OCP_DBL > Pc
Capillary pressure of phase: numPhase*numBulk.
vector< FlowUnit * > flow
Vector for capillary pressure, relative perm.
vector< OCP_DBL > vrP
d vr / d p, numbulk
vector< OCP_DBL > ldPcj_dS
last Pcj_dS
USI NTSFUN
num of SAT regions
vector< OCP_DBL > lNt
last Nt
USI numPhase
Number of phase.
vector< OCP_DBL > lvf
last vf
vector< OCP_DBL > T
Temperature: numBulk.
vector< OCP_DBL > S
Saturation of phase: numPhase*numBulk.
vector< USI > bLocation
Location of bulk: top, bottom, side.
vector< OCP_DBL > lporoT
last poroT.
vector< OCP_DBL > rho
Mass density of phase: numPhase*numBulk.
OCP_DBL GeteVmax() const
Return eVmax.
vector< OCP_DBL > kt
Coefficient of thermal diffusivity: activeGridNum.
vector< OCP_DBL > ktP
d kt / d P: numbulk
OCPRes res
Residual for all equations.
vector< OCP_DBL > dSec_dPri
d Secondary variable / d Primary variable.
OCP_DBL dSmax
Max change in saturation during the current time step.
vector< OCP_DBL > lxij
last xij
vector< OCP_DBL > rhoP
d Rho / d P: numPhase*numBulk.
vector< OCP_DBL > ntg
net to gross of bulk.
vector< OCP_DBL > dy
Size of cell in y-direction: activeGridNum.
vector< OCP_DBL > lrho
last rho
vector< USI > PVTNUM
Identify PVT region in black-oil model: numBulk.
vector< USI > lphaseNum
last phaseNum
vector< OCP_DBL > vfi
d vf / d Ni: numCom*numBulk.
vector< OCP_DBL > lHrT
Last HrT.
vector< OCP_DBL > lHx
last Hx
vector< USI > lpVnumCom
last pVnumCom
OCP_DBL maxCFL
max CFL number
vector< OCP_DBL > poro
rock porosity * ntg.
USI NTROCC
num of Rock regions
vector< OCP_DBL > xij
Nij / Nj: numPhase*numCom*numBulk.
vector< OCP_DBL > Ufi
d Uf / d Ni: numCom * numBulk
vector< OCP_DBL > lrockVp
Pore volume: numBulk.
vector< OCP_DBL > kr
Relative permeability of phase: numPhase*numBulk.
vector< USI > SATNUM
Identify SAT region: 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.
USI SATmode
Identify SAT mode.
OCP_DBL NRdPmax
Max pressure difference in an NR step.
vector< OCP_DBL > Pj
Pressure of phase: numPhase*numBulk.
vector< OCP_DBL > mux
d Muj / d xij: numPhase*numCom*numBulk.
vector< OCP_DBL > ePEC
error for fugacity balance equations, EoS only now
USI NTPVT
num of PVT regions
vector< OCP_DBL > rhox
d Rhoj / d xij: numPhase*numCom*numBulk.
vector< OCP_DBL > lHr
Last Hr: activeGridNum.
vector< OCP_DBL > lporoP
last poroP.
vector< OCP_DBL > lUfP
last UfP
OCP_USI index_maxNRdSSP
index of grid which has maxNRdSSP
vector< OCP_DBL > lrhoT
last rhoT
vector< OCP_DBL > lkr
last kr
vector< OCP_DBL > dSNR
saturation change between NR steps
vector< OCP_DBL > lvfi
last vfi
vector< OCP_DBL > lporo
last poro.
OCP_DBL maxNRdSSP
max difference between dSNR and dSNRP
vector< OCP_DBL > lvj
last vj
vector< OCP_DBL > vfT
d vf / d T, numBulk
vector< OCP_DBL > lHT
last HT
HeatLoss hLoss
Heat loss iterm.
vector< OCP_DBL > lvfT
last vfT
vector< OCP_DBL > lmuT
last muT
vector< OCP_DBL > Nt
Total moles of components in bulks: numBulk.
vector< OCP_DBL > muP
d Mu / d P: numPhase*numBulk.
vector< OCP_DBL > Hx
d Hj / d xij: numPhase * numCom * numbulk
vector< OCP_DBL > dz
Size of cell in z-direction: activeGridNum.
vector< OCP_DBL > xiT
d xij / d T, numPhase * numbulk
vector< OCP_DBL > poroT
d poro / d T.
vector< OCP_DBL > thconr
Rock ifThermal conductivity: activeGridNum.
vector< OCP_DBL > dKr_dS
d Krj / d Sk: numPhase * numPhase * bulk.
vector< OCP_DBL > lT
last T
vector< OCP_DBL > lUfT
last UfT
vector< OCP_DBL > UfT
d Uf / d T: numbulk
vector< Mixture * > flashCal
Flash calculation class.
vector< USI > phase2Index
Location of phase according to its name: numPhase.
OCP_DBL GetNRdPmax() const
Return NRdPmax.
vector< OCP_BOOL > phaseExist
Existence of phase: numPhase*numBulk.
vector< OCP_DBL > lktS
last ktS
vector< OCP_DBL > lPj
last Pj
OCP_DBL GetSOIL(const OCP_USI &n) const
Return oil saturation of the n-th bulk.
vector< OCPTable > initZi_Tab
Initial mole ratio of components vs. depth, table set.
vector< OCP_DBL > lUf
last Uf
vector< OCP_DBL > lktT
last ktT
vector< OCP_DBL > xiP
d xi / d P: numPhase*numBulk.
vector< OCP_DBL > rhoT
d rhoj / d T: numPhase * numbulk
vector< OCP_DBL > poroP
d poro / d P.
const vector< Mixture * > & GetMixture() const
Return flash.
vector< vector< OCP_DBL > > satcm
critical saturation when phase becomes mobile / immobile.
vector< OCP_DBL > lvrP
last vrp.
vector< OCP_DBL > lktP
last ktP
vector< OCP_DBL > vrT
dvr / dT: activeGridNum.
OCP_DBL GetMaxCFL() const
Return maxCFL.
vector< OCP_DBL > ldKr_dS
last dKr_dS
vector< OCP_DBL > Uf
Internal energy of fluid: numBulk.
vector< OCP_DBL > lUfi
last Ufi
vector< OCP_DBL > lrhoP
last rhoP
vector< OCP_DBL > xi
Moles density of phase: numPhase*numBulk.
OCP_DBL GetSWAT(const OCP_USI &n) const
Return water saturation of the n-th bulk.
vector< OCP_DBL > lxi
last xi
vector< OCP_DBL > lmux
last mux
vector< OCP_DBL > vf
Total fluid volume: numBulk.
vector< OCP_DBL > rockKz
current rock permeability along the z direction.
OCP_DBL NRdTmax
Max temperature difference in an NR step.
vector< USI > phaseNum
Num of hydrocarbon phase in each bulk.
ParamEQUIL EQUIL
Initial Equilibration.
OCP_DBL GetSGAS(const OCP_USI &n) const
Return gas saturation of the n-th bulk.
vector< USI > bRowSizedSdP
length of dSec_dPri in each bulk
vector< OCP_DBL > vfP
d vf / d P: numBulk.
OCP_DBL GetNRdNmax() const
Return NRdNmax.
OCP_DBL NRdNmax
Max Ni difference in an NR step.
vector< OCP_DBL > lxiT
last xiT
vector< OCPTable > initT_Tab
Initial temperature vs. depth, table set.
OCP_DBL dNmax
Max change in moles of component during the current time step.
vector< OCP_DBL > rockKx
current rock permeability along the x direction.
OCP_DBL NRdSmax
Max saturation difference in an NR step(Real)
vector< OCP_DBL > lres_n
last res_n
vector< OCP_DBL > lxix
last xix
OCP_DBL rsTemp
Reservoir temperature.
vector< OCP_DBL > lresPc
last lresPc;
OCP_DBL GetdSmax() const
Return dSmax.
vector< USI > bType
Indicate bulk type, 0: rock, 1: rock and fluid.
OCP_BOOL IfUseEoS() const
Return ifUseEoS.
USI PVTmodeB
Identify PVT mode in black-oil model.
vector< OCP_DBL > rockKy
current rock permeability along the y direction.
vector< OCP_DBL > dPNR
P change between NR steps.
vector< OCP_USI > wellBulkId
vector< OCP_DBL > vj
Volume of phase: numPhase*numBulk.
vector< OCP_DBL > lmuP
last muP
OCP_DBL dTmax
Max change in temperature during the current time step.
vector< OCP_DBL > ktT
d kt / d T: activeGridNum.
vector< OCP_DBL > lvrT
Last vrT.
vector< OCP_DBL > ktS
d kt / d S: numPhase * numbulk
vector< OCP_DBL > muT
d muj / d T: numPhase * numbulk
vector< OCP_DBL > lvfP
last vfP
vector< OCP_DBL > Pb
Bubble point pressure: numBulk.
vector< OCP_DBL > lrhox
last rhox
vector< OCP_BOOL > lphaseExist
last phaseExist
vector< OCP_DBL > Hr
Enthalpy of rock: activeGridNum.
vector< OCP_DBL > v
Volume of grids: activeGridNum.
USI numComH
Number of HydroCarbon.
vector< OCP_DBL > dSNRP
predicted saturation change between NR steps
vector< OCP_DBL > lxiP
last xiP
vector< OCP_BOOL > lpSderExist
last pSderExist
OCP_DBL GetdNmax() const
Return dNmax.
vector< OCP_DBL > resPc
a precalculated value
vector< OCP_DBL > HT
d Hj / d T: numPhase * numbulk
vector< OCP_DBL > lmu
last mu
vector< OCP_BOOL > pSderExist
Existence of derivative of phase saturation.
OCP_DBL GetdPmax() const
Return dPmax.
OCP_USI numBulk
Number of bulks (active grids).
vector< USI > NRphaseNum
phaseNum in NR step
vector< OCP_DBL > poroInit
initial rock porosity * ntg.
vector< OCP_DBL > thconp
Phase thermal conductivity: numPhase.
vector< OCP_DBL > ldSec_dPri
last dSec_dPri
vector< OCP_DBL > xix
d Xi_j / d xij: numPhase*numCom*numBulk.
OCP_DBL GetdTmax() const
Return dTmax.
OCP_USI GetBulkNum() const
Return the number of bulks.
vector< USI > ROCKNUM
index of Rock table for each bulk
USI GetComNum() const
Return the number of components.
vector< OCP_DBL > dx
Size of cell in x-direction: activeGridNum.
OCP_DBL GetP(const OCP_USI &n) const
Return pressure of the n-th bulk.
vector< OCP_DBL > H
Enthalpy of phase: numPhase*numBulk.
vector< OCP_DBL > dTNR
T change between NR steps.
vector< OCP_DBL > nj
moles number of phase: numPhase*numBulk.
vector< OCP_DBL > dPcj_dS
d Pcj / d Sk: numPhase * numPhase * bulk.
vector< OCP_DBL > HrT
dHr / dT: activeGridNum.
vector< OCP_DBL > initT
Initial temperature of each bulk: numBulk.
vector< OCP_DBL > res_n
residual for FIM_n
vector< USI > lbRowSizedSdP
last bRowSizedSdP
vector< OCP_DBL > xijNR
store the current NR step's xij in AIM
void OutMixtureIters() const
Output iterations in Mixture.
vector< OCP_DBL > vr
Volume of rock: activeGridNum.
vector< OCP_DBL > P
Pressure: numBulk.
vector< OCP_DBL > lNi
last Ni
vector< OCP_DBL > lnj
last nj
vector< OCP_DBL > cfl
CFL number for each bulk.
vector< OCP_DBL > lPc
last Pc
vector< OCP_DBL > lvr
Last vr: activeGridNum.
USI maxLendSdP
length of dSec_dPri.
USI numCom
Number of component.
void AddWellBulkId(const OCP_USI &n)
push back an element for wellBulkId
OCP_DBL dPmax
Max change in pressure during the current time step.
vector< OCP_DBL > lH
last H
vector< OCP_DBL > pT
dP / dT
OCP_DBL ubD
Thermal diffusivity of underburden rock.
OCP_DBL ubK
Thermal conductivity of underburden rock.
vector< OCP_DBL > p
Auxiliary variable.
OCP_DBL obC
Volumetric heat capacity of overburden rock.
OCP_DBL obD
Thermal diffusivity of overburden rock.
vector< OCP_DBL > lpT
last pT
OCP_DBL obK
Thermal conductivity of overburden rock.
vector< OCP_DBL > I
Auxiliary variable.
vector< OCP_DBL > lp
Auxiliary variable.
vector< OCP_DBL > lI
Auxiliary variable.
OCP_USI numBulk
Num of Bulk.
OCP_DBL ubC
Volumetric heat capacity of underburden rock.
IsoT_FIM is FIM (Fully Implicit Method).
IsoT_IMPEC is IMPEC (implicit pressure explict saturation) method.
Collect more detailed information of each time step.
Initial reservoir infomation for calculating initial equilibration.