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_DBLGetNt () const
 
const OCP_DBLGetNi (const USI &i) const
 
const OCP_DBLGetVf () const
 
const OCP_BOOLGetPhaseExist (const USI &j) const
 
const OCP_DBLGetS (const USI &j) const
 
const OCP_DBLGetVj (const USI &j) const
 
const OCP_DBLGetNj (const USI &j) const
 
const OCP_DBLGetXij (const USI &j, const USI &i) const
 
const OCP_DBLGetRho (const USI &j) const
 
const OCP_DBLGetXi (const USI &j) const
 
const OCP_DBLGetMu (const USI &j) const
 
const OCP_DBLGetVfP () const
 
const OCP_DBLGetVfT () const
 
const OCP_DBLGetVfi (const USI &i) const
 
const OCP_DBLGetRhoP (const USI &j) const
 
const OCP_DBLGetRhoT (const USI &j) const
 
const OCP_DBLGetXiP (const USI &j) const
 
const OCP_DBLGetXiT (const USI &j) const
 
const OCP_DBLGetMuP (const USI &j) const
 
const OCP_DBLGetMuT (const USI &j) const
 
const OCP_DBLGetRhoX (const USI &j, const USI &i) const
 
const OCP_DBLGetXiX (const USI &j, const USI &i) const
 
const OCP_DBLGetMuX (const USI &j, const USI &i) const
 
const OCP_BOOLGetPSderExist (const USI &j) const
 
const USIGetPVnumCom (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_DBLGetHx (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_DBLMWc
 Molecular Weight of components.
 
vector< OCP_DBLMWp
 Molecular Weight of phase.
 
vector< OCP_DBLTcrit
 Critical temperature of hydrocarbon components.
 
vector< OCP_DBLxi_ref
 
vector< OCP_DBLcp
 Component compressibility, 1/psi.
 
vector< OCP_DBLct1
 The first thermal expansion coefficient, 1/F.
 
vector< OCP_DBLct2
 The second thermal expansion coefficient, 1/F.
 
vector< OCP_DBLcpt
 
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_DBLcpl1
 
vector< OCP_DBLcpl2
 
vector< OCP_DBLcpl3
 
vector< OCP_DBLcpl4
 
vector< OCP_DBLcpg1
 
vector< OCP_DBLcpg2
 
vector< OCP_DBLcpg3
 
vector< OCP_DBLcpg4
 
vector< OCP_DBLhvapr
 Coefficients in the component gas enthalpy calculations, Btu/lbmol.
 
vector< OCP_DBLhvr
 Coefficients in the vaporization enthalpy calculations.
 
vector< OCP_DBLev
 Coefficients in the vaporization enthalpy calculations.
 
vector< OCP_DBLavisc
 Coefficients in water and oil viscosity correlation formulae.
 
vector< OCP_DBLbvisc
 Coefficients in water and oil viscosity correlation formulae.
 
vector< OCP_DBLavg
 Coefficients Ak in gas viscosity correlation formulae.
 
vector< OCP_DBLbvg
 Coefficients Bk in gas viscosity correlation formulae.
 
OCP_BOOL useViscTab
 If use viscosity to calculate viscosity.
 
OCPTable visc
 Viscosity-versus-temperature dependence.
 
vector< OCP_DBLdata
 
vector< OCP_DBLcdata
 
- 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_DBLNi
 moles of component: numCom
 
vector< OCP_BOOLphaseExist
 existence of phase: numPhase
 
vector< OCP_DBLS
 saturation of phase: numPhase
 
vector< OCP_DBLvj
 volume of phase: numPhase;
 
vector< OCP_DBLnj
 mole number of phase j
 
vector< OCP_DBLxij
 Nij / nj: numPhase*numCom.
 
vector< OCP_DBLrho
 mass density of phase: numPhase
 
vector< OCP_DBLxi
 molar density of phase: numPhase
 
vector< OCP_DBLmu
 viscosity of phase: numPhase
 
OCP_DBL vfP
 
OCP_DBL vfT
 d vf / dT
 
vector< OCP_DBLvfi
 
vector< OCP_DBLrhoP
 d rho / dP: numphase
 
vector< OCP_DBLrhoT
 d rho j / dT: numPhase
 
vector< OCP_DBLrhox
 d rho[j] / d x[i][j]: numphase * numCom
 
vector< OCP_DBLxiP
 d xi / dP: numphase
 
vector< OCP_DBLxiT
 d xi j / dT: numPhase
 
vector< OCP_DBLxix
 d xi[j] / d x[i][j]: numphase * numCom
 
vector< OCP_DBLmuP
 d mu / dP: numPhase
 
vector< OCP_DBLmuT
 d mu j / dT: numPhase
 
vector< OCP_DBLmux
 d mu[j] / d x[i][j]: numphase * numCom
 
vector< OCP_DBLdXsdXp
 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_DBLUfi
 dUf / dNi
 
vector< OCP_DBLH
 Enthalpy.
 
vector< OCP_DBLHT
 d Hj / d T
 
vector< OCP_DBLHx
 d Hj / d xij
 
vector< OCP_BOOLpSderExist
 Existence of derivative of phase saturation.
 
vector< USIpVnumCom
 num of variable components in the phase
 
vector< OCP_DBLres
 residual of a set of equations
 
OCP_DBL resPc
 a precalculated value
 
vector< OCP_DBLkeyDer
 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: