OpenCAEPoro  v0.5.0
A simulator for multicomponent porous media flow
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
MixtureThermal_K01 Class Reference
Inheritance diagram for MixtureThermal_K01:
MixtureThermal Mixture

Public Member Functions

 MixtureThermal_K01 (const ParamReservoir &param, const USI &tarId)
 
void Flash (const OCP_DBL &Pin, const OCP_DBL &Tin, const OCP_DBL *Niin) override
 flash calculation with saturation of phases.
 
void InitFlashIMPEC (const OCP_DBL &Pin, const OCP_DBL &Pbbin, const OCP_DBL &Tin, const OCP_DBL *Sjin, const OCP_DBL &Vpore, const OCP_DBL *Ziin, const OCP_USI &bId) override
 flash calculation with saturation of phases.
 
void InitFlashFIM (const OCP_DBL &Pin, const OCP_DBL &Pbbin, const OCP_DBL &Tin, const OCP_DBL *Sjin, const OCP_DBL &Vpore, const OCP_DBL *Ziin, const OCP_USI &bId) override
 
void InitFlashFIMn (const OCP_DBL &Pin, const OCP_DBL &Pbbin, const OCP_DBL &Tin, const OCP_DBL *Sjin, const OCP_DBL &Vpore, const OCP_DBL *Ziin, const OCP_USI &bId) override
 
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) override
 Flash calculation with moles of components.
 
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) override
 Flash calculation with moles of components and Calculate the derivative.
 
void FlashFIMn (const OCP_DBL &Pin, const OCP_DBL &Tin, const OCP_DBL *Niin, const OCP_DBL *Sjin, const OCP_DBL *xijin, const OCP_DBL *njin, const USI *phaseExistin, const USI &lastNP, const OCP_USI &bId) override
 
OCP_DBL XiPhase (const OCP_DBL &Pin, const OCP_DBL &Tin, const OCP_DBL *Ziin, const USI &tarPhase) override
 
OCP_DBL RhoPhase (const OCP_DBL &Pin, const OCP_DBL &Pbb, const OCP_DBL &Tin, const OCP_DBL *Ziin, const USI &tarPhase) override
 return mass density of phase.
 
void CalProdWeight (const OCP_DBL &Pin, const OCP_DBL &Tin, const OCP_DBL *Niin, const vector< OCP_DBL > &prodPhase, vector< OCP_DBL > &prodWeight) override
 Calculate ProdWeight for PROD well.
 
void CalProdRate (const OCP_DBL &Pin, const OCP_DBL &Tin, const OCP_DBL *Niin, vector< OCP_DBL > &prodRate) override
 Calculate Production rate for PROD well.
 
void SetupWellOpt (WellOpt &wellopt, const vector< SolventINJ > &sols, const OCP_DBL &Psurf, const OCP_DBL &Tsurf) override
 
OCP_DBL CalInjWellEnthalpy (const OCP_DBL &Tin, const OCP_DBL *Ziin) override
 
- Public Member Functions inherited from MixtureThermal
void Allocate ()
 
void SetupOptionalFeatures (OptionalFeatures &optFeatures, const OCP_USI &numBulk) override
 
OCP_DBL GetErrorPEC () override
 
void OutMixtureIters () const override
 
- Public Member Functions inherited from Mixture
void Allocate ()
 Allocate memory for common variables for basic class.
 
USI GetMixtureType () const
 return type of mixture.
 
void CheckNi (const OCP_DBL *Ni)
 
const OCP_DBL & GetNt () const
 
const OCP_DBL & GetNi (const USI &i) const
 
const OCP_DBL & GetVf () const
 
const OCP_BOOL & GetPhaseExist (const USI &j) const
 
const OCP_DBL & GetS (const USI &j) const
 
const OCP_DBL & GetVj (const USI &j) const
 
const OCP_DBL & GetNj (const USI &j) const
 
const OCP_DBL & GetXij (const USI &j, const USI &i) const
 
const OCP_DBL & GetRho (const USI &j) const
 
const OCP_DBL & GetXi (const USI &j) const
 
const OCP_DBL & GetMu (const USI &j) const
 
const OCP_DBL & GetVfP () const
 
const OCP_DBL & GetVfT () const
 
const OCP_DBL & GetVfi (const USI &i) const
 
const OCP_DBL & GetRhoP (const USI &j) const
 
const OCP_DBL & GetRhoT (const USI &j) const
 
const OCP_DBL & GetXiP (const USI &j) const
 
const OCP_DBL & GetXiT (const USI &j) const
 
const OCP_DBL & GetMuP (const USI &j) const
 
const OCP_DBL & GetMuT (const USI &j) const
 
const OCP_DBL & GetRhoX (const USI &j, const USI &i) const
 
const OCP_DBL & GetXiX (const USI &j, const USI &i) const
 
const OCP_DBL & GetMuX (const USI &j, const USI &i) const
 
const OCP_BOOL & GetPSderExist (const USI &j) const
 
const USI & GetPVnumCom (const USI &j) const
 
const vector< OCP_DBL > & GetDXsDXp () const
 
const vector< OCP_DBL > & GetRes () const
 
const OCP_DBL GetResPc () const
 
const OCP_DBL GetUf () const
 
const OCP_DBL GetUfP () const
 
const OCP_DBL GetUfT () const
 
const OCP_DBL GetUfi (const USI &i) const
 
const OCP_DBL GetH (const USI &j) const
 
const OCP_DBL GetHT (const USI &j) const
 
const OCP_DBL & GetHx (const USI &j, const USI &i) const
 

Protected Member Functions

void CalEnthalpy ()
 
- Protected Member Functions inherited from Mixture
void SetBulkId (const OCP_USI &n)
 

Protected Attributes

OCP_DBL Pref {PRESSURE_STD}
 Reference pressure.
 
OCP_DBL Tref {TEMPERATURE_STD}
 Reference temperature.
 
vector< OCP_DBL > MWc
 Molecular Weight of components.
 
vector< OCP_DBL > MWp
 Molecular Weight of phase.
 
vector< OCP_DBL > Tcrit
 Critical temperature of hydrocarbon components.
 
vector< OCP_DBL > xi_ref
 
vector< OCP_DBL > cp
 Component compressibility, 1/psi.
 
vector< OCP_DBL > ct1
 The first thermal expansion coefficient, 1/F.
 
vector< OCP_DBL > ct2
 The second thermal expansion coefficient, 1/F.
 
vector< OCP_DBL > cpt
 
OCP_BOOL liquid_based {OCP_TRUE}
 Calculated enthalpy of fluid based liquid.
 
OCP_BOOL gas_based {OCP_FALSE}
 Calculated enthalpy of fluid based gas.
 
OCP_BOOL simple_hvap {OCP_FALSE}
 
vector< OCP_DBL > cpl1
 
vector< OCP_DBL > cpl2
 
vector< OCP_DBL > cpl3
 
vector< OCP_DBL > cpl4
 
vector< OCP_DBL > cpg1
 
vector< OCP_DBL > cpg2
 
vector< OCP_DBL > cpg3
 
vector< OCP_DBL > cpg4
 
vector< OCP_DBL > hvapr
 Coefficients in the component gas enthalpy calculations, Btu/lbmol.
 
vector< OCP_DBL > hvr
 Coefficients in the vaporization enthalpy calculations.
 
vector< OCP_DBL > ev
 Coefficients in the vaporization enthalpy calculations.
 
vector< OCP_DBL > avisc
 Coefficients in water and oil viscosity correlation formulae.
 
vector< OCP_DBL > bvisc
 Coefficients in water and oil viscosity correlation formulae.
 
vector< OCP_DBL > avg
 Coefficients Ak in gas viscosity correlation formulae.
 
vector< OCP_DBL > bvg
 Coefficients Bk in gas viscosity correlation formulae.
 
OCP_BOOL useViscTab
 If use viscosity to calculate viscosity.
 
OCPTable visc
 Viscosity-versus-temperature dependence.
 
vector< OCP_DBL > data
 
vector< OCP_DBL > cdata
 
- Protected Attributes inherited from Mixture
USI mixtureType
 
OCP_USI bulkId
 index of current bulk
 
USI numPhase
 num of phases.
 
USI numCom
 num of components.
 
OCP_DBL P
 pressure when flash calculation.
 
OCP_DBL T
 temperature when flash calculation.
 
OCP_DBL vf
 volume of total fluids.
 
OCP_DBL Nt
 Total moles of Components.
 
vector< OCP_DBL > Ni
 moles of component: numCom
 
vector< OCP_BOOL > phaseExist
 existence of phase: numPhase
 
vector< OCP_DBL > S
 saturation of phase: numPhase
 
vector< OCP_DBL > vj
 volume of phase: numPhase;
 
vector< OCP_DBL > nj
 mole number of phase j
 
vector< OCP_DBL > xij
 Nij / nj: numPhase*numCom.
 
vector< OCP_DBL > rho
 mass density of phase: numPhase
 
vector< OCP_DBL > xi
 molar density of phase: numPhase
 
vector< OCP_DBL > mu
 viscosity of phase: numPhase
 
OCP_DBL vfP
 
OCP_DBL vfT
 d vf / dT
 
vector< OCP_DBL > vfi
 
vector< OCP_DBL > rhoP
 d rho / dP: numphase
 
vector< OCP_DBL > rhoT
 d rho j / dT: numPhase
 
vector< OCP_DBL > rhox
 d rho[j] / d x[i][j]: numphase * numCom
 
vector< OCP_DBL > xiP
 d xi / dP: numphase
 
vector< OCP_DBL > xiT
 d xi j / dT: numPhase
 
vector< OCP_DBL > xix
 d xi[j] / d x[i][j]: numphase * numCom
 
vector< OCP_DBL > muP
 d mu / dP: numPhase
 
vector< OCP_DBL > muT
 d mu j / dT: numPhase
 
vector< OCP_DBL > mux
 d mu[j] / d x[i][j]: numphase * numCom
 
vector< OCP_DBL > dXsdXp
 derivatives of second variables wrt. primary variables
 
OCP_DBL Uf
 Internal energy of fluid.
 
OCP_DBL UfP
 dUf / dP
 
OCP_DBL UfT
 dUf / dT
 
vector< OCP_DBL > Ufi
 dUf / dNi
 
vector< OCP_DBL > H
 Enthalpy.
 
vector< OCP_DBL > HT
 d Hj / d T
 
vector< OCP_DBL > Hx
 d Hj / d xij
 
vector< OCP_BOOL > pSderExist
 Existence of derivative of phase saturation.
 
vector< USI > pVnumCom
 num of variable components in the phase
 
vector< OCP_DBL > res
 residual of a set of equations
 
OCP_DBL resPc
 a precalculated value
 
vector< OCP_DBL > keyDer
 d (xij*xi/mu) / dP or dNk
 

Detailed Description

Definition at line 65 of file MixtureThermal.hpp.

Member Function Documentation

◆ SetupWellOpt()

void MixtureThermal_K01::SetupWellOpt ( WellOpt &  opt,
const vector< SolventINJ > &  sols,
const OCP_DBL &  Psurf,
const OCP_DBL &  Tsurf 
)
overridevirtual

Setup injZi, injProdPhase and factorINJ for INJ well Setup prodPhaseWeight for PROD well

Implements Mixture.

Definition at line 566 of file MixtureThermal_k.cpp.

570 {
571  const USI wellType = opt.WellType();
572  if (wellType == INJ) {
573  const string fluidName = opt.InjFluidType();
574  vector<OCP_DBL> tmpZi(numCom, 0);
575  if (fluidName == "WAT") {
576  tmpZi.back() = 1;
577  opt.SetInjProdPhase(WATER);
578  // lbmol / ft3 -> lbmol / bbl for
579  // injfluid Use flash in Bulk in surface condition
580  OCP_DBL tmp = CONV1 * XiPhase(Psurf, Tsurf, &tmpZi[0], WATER);
581  opt.SetInjFactor(tmp);
582  } else {
583  OCP_ABORT("WRONG Fluid Type!");
584  }
585  opt.SetInjZi(tmpZi);
586  } else if (wellType == PROD) {
587  vector<OCP_DBL> tmpWght(numPhase, 0);
588  switch (opt.OptMode()) {
589  case ORATE_MODE:
590  tmpWght[0] = 1;
591  break;
592  case WRATE_MODE:
593  tmpWght[1] = 1;
594  break;
595  case LRATE_MODE:
596  tmpWght[0] = 1;
597  tmpWght[1] = 1;
598  break;
599  default:
600  OCP_ABORT("WRONG optMode");
601  break;
602  }
603  opt.SetProdPhaseWeight(tmpWght);
604  } else {
605  OCP_ABORT("Wrong Well Type!");
606  }
607 }
unsigned int USI
Generic unsigned integer.
Definition: OCPConst.hpp:23
double OCP_DBL
Double precision.
Definition: OCPConst.hpp:27
const OCP_DBL CONV1
1 bbl = CONV1 ft3
Definition: OCPConst.hpp:63
const USI LRATE_MODE
Well option = fixed fluid rate???
Definition: OCPConst.hpp:134
const USI WRATE_MODE
Well option = fixed water rate.
Definition: OCPConst.hpp:133
const USI WATER
Fluid type = water.
Definition: OCPConst.hpp:93
const USI ORATE_MODE
Well option = fixed oil rate.
Definition: OCPConst.hpp:131
const USI PROD
Well type = producer.
Definition: OCPConst.hpp:123
const USI INJ
Well type = injector.
Definition: OCPConst.hpp:122
#define OCP_ABORT(msg)
Abort if critical error happens.
Definition: UtilError.hpp:47
OCP_DBL XiPhase(const OCP_DBL &Pin, const OCP_DBL &Tin, const OCP_DBL *Ziin, const USI &tarPhase) override
USI numCom
num of components.
Definition: Mixture.hpp:242
USI numPhase
num of phases.
Definition: Mixture.hpp:241

References CONV1, INJ, LRATE_MODE, Mixture::numCom, Mixture::numPhase, OCP_ABORT, ORATE_MODE, PROD, WATER, WRATE_MODE, and XiPhase().

◆ XiPhase()

OCP_DBL MixtureThermal_K01::XiPhase ( const OCP_DBL &  Pin,
const OCP_DBL &  Tin,
const OCP_DBL *  Ziin,
const USI &  tarPhase 
)
overridevirtual

Return molar density of phase, it's used to calculate the molar density of injection fluids in injection wells.

Implements Mixture.

Definition at line 454 of file MixtureThermal_k.cpp.

458 {
459  P = Pin;
460  T = Tin + CONV5;
461  const OCP_DBL dP = P - Pref;
462  const OCP_DBL dT = T - Tref;
463 
464  if (tarPhase == WATER) {
465  // inj fluid is water
466  OCP_DBL xiw = xi_ref[1] * exp(cp[1] * dP - ct1[1] * dT -
467  ct2[1] * pow(dT, 2) / 2 + cpt[1] * dP * dT);
468  return xiw;
469  } else {
470  OCP_ABORT("Wrong tarPhase!");
471  }
472 }
const OCP_DBL CONV5
0 F = CONV5 R
Definition: OCPConst.hpp:67
vector< OCP_DBL > cpt
vector< OCP_DBL > ct1
The first thermal expansion coefficient, 1/F.
OCP_DBL Tref
Reference temperature.
vector< OCP_DBL > ct2
The second thermal expansion coefficient, 1/F.
OCP_DBL Pref
Reference pressure.
vector< OCP_DBL > xi_ref
vector< OCP_DBL > cp
Component compressibility, 1/psi.
OCP_DBL P
pressure when flash calculation.
Definition: Mixture.hpp:243
OCP_DBL T
temperature when flash calculation.
Definition: Mixture.hpp:244

References CONV5, cp, cpt, ct1, ct2, OCP_ABORT, Mixture::P, Pref, Mixture::T, Tref, WATER, and xi_ref.

Member Data Documentation

◆ cdata

vector<OCP_DBL> MixtureThermal_K01::cdata
protected

Auxiliary variables used to calculate viscosity with interpolating tab

Definition at line 200 of file MixtureThermal.hpp.

◆ cpg1

vector<OCP_DBL> MixtureThermal_K01::cpg1
protected

Coefficients in the component liquid enthalpy calculations, Btu/lbmol/F

Definition at line 178 of file MixtureThermal.hpp.

◆ cpg2

vector<OCP_DBL> MixtureThermal_K01::cpg2
protected

Coefficients in the component liquid enthalpy calculations, Btu/lbmol/F^2

Definition at line 180 of file MixtureThermal.hpp.

◆ cpg3

vector<OCP_DBL> MixtureThermal_K01::cpg3
protected

Coefficients in the component liquid enthalpy calculations, Btu/lbmol/F^3

Definition at line 182 of file MixtureThermal.hpp.

◆ cpg4

vector<OCP_DBL> MixtureThermal_K01::cpg4
protected

Coefficients in the component liquid enthalpy calculations, Btu/lbmol/F^4

Definition at line 184 of file MixtureThermal.hpp.

◆ cpl1

vector<OCP_DBL> MixtureThermal_K01::cpl1
protected

Coefficients in the component liquid enthalpy calculations, Btu/lbmol/F

Definition at line 170 of file MixtureThermal.hpp.

◆ cpl2

vector<OCP_DBL> MixtureThermal_K01::cpl2
protected

Coefficients in the component liquid enthalpy calculations, Btu/lbmol/F^2

Definition at line 172 of file MixtureThermal.hpp.

◆ cpl3

vector<OCP_DBL> MixtureThermal_K01::cpl3
protected

Coefficients in the component liquid enthalpy calculations, Btu/lbmol/F^3

Definition at line 174 of file MixtureThermal.hpp.

◆ cpl4

vector<OCP_DBL> MixtureThermal_K01::cpl4
protected

Coefficients in the component liquid enthalpy calculations, Btu/lbmol/F^4

Definition at line 176 of file MixtureThermal.hpp.

◆ cpt

vector<OCP_DBL> MixtureThermal_K01::cpt
protected

The coefficient of density dependence on temperature and pressure, 1/psi-F

Definition at line 164 of file MixtureThermal.hpp.

◆ data

vector<OCP_DBL> MixtureThermal_K01::data
protected

Auxiliary variables used to calculate viscosity with interpolating tab

Definition at line 198 of file MixtureThermal.hpp.

◆ simple_hvap

OCP_BOOL MixtureThermal_K01::simple_hvap {OCP_FALSE}
protected

Calculated enthalpy of fluid with simple enthalpy of evaporation

Definition at line 168 of file MixtureThermal.hpp.

◆ xi_ref

vector<OCP_DBL> MixtureThermal_K01::xi_ref
protected

Component molar density at reference temperature and reference pressure, lb/ft3

Definition at line 159 of file MixtureThermal.hpp.


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