12 #ifndef __MIXTURE_HEADER__
13 #define __MIXTURE_HEADER__
43 phaseExist.resize(numPhase);
48 xij.resize(numPhase * numCom);
53 rhoP.resize(numPhase);
56 rhox.resize(numPhase * numCom);
57 xix.resize(numPhase * numCom);
58 mux.resize(numPhase * numCom);
59 dXsdXp.resize((numCom + 1) * (numPhase + numPhase * numCom));
61 pSderExist.resize(numPhase);
62 pVnumCom.resize(numPhase);
66 res.resize(numPhase + numPhase * numCom +
77 virtual void InitFlashIMPEC(
const OCP_DBL& Pin,
84 virtual void InitFlashFIM(
const OCP_DBL& Pin,
91 virtual void InitFlashFIMn(
const OCP_DBL& Pin,
113 virtual void FlashFIMn(
const OCP_DBL& Pin,
119 const USI* phaseExistin,
130 const USI& tarPhase) = 0;
141 const USI& tarPhase) = 0;
147 const vector<SolventINJ>& sols,
154 const vector<OCP_DBL>& prodPhase,
155 vector<OCP_DBL>& prodWeight) = 0;
160 vector<OCP_DBL>& prodRate) = 0;
169 for (
USI i = 0; i < numCom; i++) {
171 cout <<
"Ni[" << i <<
"] = " << Ni[i] << endl;
179 virtual OCP_DBL GetErrorPEC() = 0;
180 virtual void OutMixtureIters()
const = 0;
183 const OCP_DBL& GetNt()
const {
return Nt; }
184 const OCP_DBL& GetNi(
const USI& i)
const {
return Ni[i]; }
185 const OCP_DBL& GetVf()
const {
return vf; }
186 const OCP_BOOL& GetPhaseExist(
const USI& j)
const {
return phaseExist[j]; }
187 const OCP_DBL& GetS(
const USI& j)
const {
return S[j]; }
188 const OCP_DBL& GetVj(
const USI& j)
const {
return vj[j]; }
189 const OCP_DBL& GetNj(
const USI& j)
const {
return nj[j]; }
192 return xij[j * numCom + i];
194 const OCP_DBL& GetRho(
const USI& j)
const {
return rho[j]; }
195 const OCP_DBL& GetXi(
const USI& j)
const {
return xi[j]; }
196 const OCP_DBL& GetMu(
const USI& j)
const {
return mu[j]; }
197 const OCP_DBL& GetVfP()
const {
return vfP; }
198 const OCP_DBL& GetVfT()
const {
return vfT; }
199 const OCP_DBL& GetVfi(
const USI& i)
const {
return vfi[i]; }
200 const OCP_DBL& GetRhoP(
const USI& j)
const {
return rhoP[j]; }
201 const OCP_DBL& GetRhoT(
const USI& j)
const {
return rhoT[j]; }
202 const OCP_DBL& GetXiP(
const USI& j)
const {
return xiP[j]; }
203 const OCP_DBL& GetXiT(
const USI& j)
const {
return xiT[j]; }
204 const OCP_DBL& GetMuP(
const USI& j)
const {
return muP[j]; }
205 const OCP_DBL& GetMuT(
const USI& j)
const {
return muT[j]; }
208 return rhox[j * numCom + i];
212 return xix[j * numCom + i];
216 return mux[j * numCom + i];
218 const OCP_BOOL& GetPSderExist(
const USI& j)
const {
return pSderExist[j]; }
219 const USI& GetPVnumCom(
const USI& j)
const {
return pVnumCom[j]; }
220 const vector<OCP_DBL>& GetDXsDXp()
const {
return dXsdXp; }
221 const vector<OCP_DBL>& GetRes()
const {
return res; }
222 const OCP_DBL GetResPc()
const {
return resPc; }
223 const OCP_DBL GetUf()
const {
return Uf; }
224 const OCP_DBL GetUfP()
const {
return UfP; }
225 const OCP_DBL GetUfT()
const {
return UfT; }
226 const OCP_DBL GetUfi(
const USI& i)
const {
return Ufi[i]; }
227 const OCP_DBL GetH(
const USI& j)
const {
return H[j]; }
228 const OCP_DBL GetHT(
const USI& j)
const {
return HT[j]; }
231 return Hx[j * numCom + i];
235 void SetBulkId(
const OCP_USI& n) { bulkId = n; }
Definition of build-in datatypes and consts.
unsigned int USI
Generic unsigned integer.
double OCP_DBL
Double precision.
unsigned int OCP_USI
Long unsigned integer.
unsigned int OCP_BOOL
OCP_BOOL in OCP.
OptionalFeatures class declaration.
ParamReservoir class declaration.
#define OCP_ABORT(msg)
Abort if critical error happens.
WellOpt class declaration.
OCP_DBL Psurf
well reference pressure
OCP_DBL Tsurf
well reference temperature
Physical information of each active reservoir bulk.
virtual void CalProdRate(const OCP_DBL &Pin, const OCP_DBL &Tin, const OCP_DBL *Niin, vector< OCP_DBL > &prodRate)=0
Calculate Production rate for PROD well.
USI GetMixtureType() const
return type of mixture.
OCP_DBL resPc
a precalculated value
virtual void FlashFIM(const OCP_DBL &Pin, const OCP_DBL &Tin, const OCP_DBL *Niin, const OCP_DBL *Sjin, const USI &lastNP, const OCP_DBL *xijin, const OCP_USI &bId)=0
Flash calculation with moles of components and Calculate the derivative.
vector< OCP_DBL > rhoP
d rho / dP: numphase
virtual OCP_DBL XiPhase(const OCP_DBL &Pin, const OCP_DBL &Tin, const OCP_DBL *Ziin, const USI &tarPhase)=0
return mass density of phase
virtual OCP_DBL RhoPhase(const OCP_DBL &Pin, const OCP_DBL &Pbb, const OCP_DBL &Tin, const OCP_DBL *Ziin, const USI &tarPhase)=0
return mass density of phase
vector< OCP_DBL > muT
d mu j / dT: numPhase
USI numCom
num of components.
vector< OCP_DBL > dXsdXp
derivatives of second variables wrt. primary variables
vector< OCP_DBL > rho
mass density of phase: numPhase
vector< OCP_DBL > mu
viscosity of phase: numPhase
vector< OCP_DBL > Ufi
dUf / dNi
virtual void SetupWellOpt(WellOpt &opt, const vector< SolventINJ > &sols, const OCP_DBL &Psurf, const OCP_DBL &Tsurf)=0
OCP_DBL P
pressure when flash calculation.
vector< OCP_BOOL > pSderExist
Existence of derivative of phase saturation.
USI numPhase
num of phases.
vector< OCP_DBL > xix
d xi[j] / d x[i][j]: numphase * numCom
vector< OCP_DBL > vj
volume of phase: numPhase;
OCP_USI bulkId
index of current bulk
vector< OCP_DBL > rhox
d rho[j] / d x[i][j]: numphase * numCom
OCP_DBL T
temperature when flash calculation.
vector< OCP_DBL > Hx
d Hj / d xij
vector< OCP_DBL > S
saturation of phase: numPhase
virtual void CalProdWeight(const OCP_DBL &Pin, const OCP_DBL &Tin, const OCP_DBL *Niin, const vector< OCP_DBL > &prodPhase, vector< OCP_DBL > &prodWeight)=0
Calculate ProdWeight for PROD well.
vector< OCP_DBL > xij
Nij / nj: numPhase*numCom.
vector< OCP_DBL > H
Enthalpy.
OCP_DBL Nt
Total moles of Components.
vector< OCP_DBL > xiT
d xi j / dT: numPhase
vector< OCP_DBL > nj
mole number of phase j
vector< OCP_DBL > Ni
moles of component: numCom
void CheckNi(const OCP_DBL *Ni)
vector< OCP_DBL > HT
d Hj / d T
OCP_DBL Uf
Internal energy of fluid.
vector< OCP_BOOL > phaseExist
existence of phase: numPhase
vector< OCP_DBL > rhoT
d rho j / dT: numPhase
virtual void FlashIMPEC(const OCP_DBL &Pin, const OCP_DBL &Tin, const OCP_DBL *Niin, const USI &lastNP, const OCP_DBL *xijin, const OCP_USI &bId)=0
Flash calculation with moles of components.
vector< OCP_DBL > keyDer
d (xij*xi/mu) / dP or dNk
vector< OCP_DBL > xiP
d xi / dP: numphase
OCP_DBL vf
volume of total fluids.
vector< USI > pVnumCom
num of variable components in the phase
vector< OCP_DBL > muP
d mu / dP: numPhase
virtual void Flash(const OCP_DBL &Pin, const OCP_DBL &Tin, const OCP_DBL *Niin)=0
flash calculation with saturation of phases.
vector< OCP_DBL > mux
d mu[j] / d x[i][j]: numphase * numCom
vector< OCP_DBL > res
residual of a set of equations
void Allocate()
Allocate memory for common variables for basic class.
vector< OCP_DBL > xi
molar density of phase: numPhase