12 #ifndef __MIXTURECOMP_HEADER__
13 #define __MIXTURECOMP_HEADER__
110 COMP(
const vector<string>& comp);
129 OCP_DBL GetErrorPEC()
override {
return ePEC; }
130 void OutMixtureIters()
const override;
175 Dcopy(NC, &zi[0], Ziin);
181 Dcopy(numCom, &Ni[0], Niin);
183 for (
USI i = 0; i < NC; i++) zi[i] = Ni[i] / Nh;
188 void InitFlashIMPEC(
const OCP_DBL& Pin,
196 void InitFlashFIM(
const OCP_DBL& Pin,
204 void InitFlashFIMn(
const OCP_DBL& Pin,
215 void FlashIMPEC(
const OCP_DBL& Pin,
224 void FlashFIM(
const OCP_DBL& Pin,
232 void FlashFIMn(
const OCP_DBL& Pin,
238 const USI* phaseExistin,
246 const USI& tarPhase)
override;
253 const USI& tarPhase)
override;
256 void SetupWellOpt(
WellOpt& opt,
257 const vector<SolventINJ>& sols,
259 const OCP_DBL& Tsurf)
override;
260 void CalProdWeight(
const OCP_DBL& Pin,
263 const vector<OCP_DBL>& prodPhase,
264 vector<OCP_DBL>& prodWeight)
override;
266 void CalProdRate(
const OCP_DBL& Pin,
269 vector<OCP_DBL>& prodRate)
override;
273 OCP_ABORT(
"Can not be used in Compositional Model!");
280 vector<string> Cname;
286 vector<OCP_DBL> OmegaA;
287 vector<OCP_DBL> OmegaB;
288 vector<OCP_DBL> Vshift;
291 vector<OCP_DBL> Vcvis;
292 vector<OCP_DBL> Zcvis;
293 vector<OCP_DBL> LBCcoef;
306 vector<OCP_DBL> Plist;
307 vector<OCP_DBL> Tlist;
308 vector<OCP_DBL> Ytlist;
313 vector<OCP_DBL> data;
315 vector<OCP_DBL> cdata;
327 void CalAjBj(
OCP_DBL& AjT,
OCP_DBL& BjT,
const vector<OCP_DBL>& xj)
const;
333 const OCP_BOOL& NTflag = OCP_FALSE)
const;
337 for (
auto z : Ztmp) cout << z <<
"\t";
347 mutable vector<OCP_DBL> Ztmp;
350 OCP_DBL delta1 = 2.41421356237;
351 OCP_DBL delta2 = -0.41421356237;
359 void AllocatePhase();
361 CalFugPhi(vector<OCP_DBL>& phiT, vector<OCP_DBL>& fugT,
const vector<OCP_DBL>& xj);
367 void CalSaturation();
381 vector<vector<OCP_DBL>>
383 vector<vector<OCP_DBL>> phi;
385 vector<vector<OCP_DBL>>
387 vector<vector<OCP_DBL>>
389 vector<vector<OCP_DBL>> ln;
393 vector<OCP_DBL> rhoC;
395 vector<USI> phaseLabel;
400 void AllocateMethod();
401 void PhaseEquilibrium();
408 void AssembleJmatSTA();
411 void SplitSSM(
const OCP_BOOL& flag);
412 void SplitSSM2(
const OCP_BOOL& flag);
413 void SplitSSM3(
const OCP_BOOL& flag);
414 void RachfordRice2();
415 void RachfordRice2P();
416 void RachfordRice3();
421 void CalFugNAll(
const OCP_BOOL& Znflag = OCP_TRUE);
423 void AssembleJmatSP();
429 vector<vector<OCP_DBL>> Kw;
430 vector<vector<OCP_DBL>> Ks;
433 vector<OCP_DBL> phiSta;
434 vector<OCP_DBL> fugSta;
440 vector<OCP_DBL> resSTA;
441 vector<OCP_DBL> JmatSTA;
442 vector<vector<OCP_DBL>> fugX;
448 vector<OCP_DBL> resRR;
450 vector<OCP_DBL> lresSP;
451 vector<OCP_DBL> resSP;
452 vector<OCP_DBL> JmatSP;
453 vector<vector<OCP_DBL>>
457 vector<vector<OCP_DBL>> Zn;
459 vector<OCP_INT> pivot;
460 vector<OCP_DBL> JmatWork;
467 void AllocateOthers();
468 void IdentifyPhase();
475 void CalFugPAll(
const OCP_BOOL& Zpflag = OCP_TRUE);
477 void CalVjpVfpVfx_partial();
478 void CalXiPNX_partial();
479 void CalRhoPX_partial();
480 void CalMuPX_partial();
481 void CalMuPXLBC_partial();
482 void CalXiRhoMuPN_pfullx();
483 void CaldXsdXpAPI04();
486 void CalRhoPNX_full();
488 void CalXiPNX_full01();
489 void CalRhoPNX_full01();
490 void CalMuPX_full01();
491 void CalMuPXLBC_full01();
492 void CalVfiVfp_full01();
493 void AssembleMatVfiVfp_full01();
494 void AssembleRhsVfiVfp_full01();
496 void CaldXsdXpAPI01();
498 void CalXiPNX_full02();
499 void CalVfiVfp_full02();
500 void AssembleMatVfiVfp_full02();
501 void AssembleRhsVfiVfp_full02();
502 void CaldXsdXpAPI02();
503 void CaldXsdXpAPI02p();
505 void CalVjpVfpVfn_partial();
506 void CalXiPn_partial();
507 void CalRhoPn_partial();
508 void CalMuPn_partial();
509 void CalMuPnLBC_partial();
510 void CalXiRhoMuPN_pfullxn(
const OCP_BOOL& xflag = OCP_TRUE);
512 void CaldXsdXpAPI03();
514 void CalVfiVfp_full03();
522 vector<vector<OCP_DBL>>
526 vector<OCP_DBL> sqrtMWi;
527 vector<vector<OCP_DBL>> fugP;
530 vector<OCP_DBL> JmatTmp;
531 vector<OCP_DBL> JmatDer;
534 vector<OCP_DBL> rhsDer;
537 vector<vector<OCP_DBL>>
539 vector<OCP_DBL> xixC;
540 vector<OCP_DBL> xiPC;
541 vector<OCP_DBL> xiNC;
544 vector<OCP_DBL> rhoN;
552 const OCP_USI& numBulk)
override;
564 void AssembleSkipMatSTA();
566 void CalSkipForNextStep();
568 void CalFtypeIMPEC() { ftype = skipSta->CalFtypeIMPEC(P, T, Nh, Ni, bulkId); }
572 ftype = skipSta->CalFtypeFIM(P, T, Nh, Ni, Sjin, lNP, bulkId);
595 void CalSurfaceTension();
Operations about small dense mat.
double Dnorm1(const int &N, double *x)
Computes the L1-norm of a vector.
void Dcopy(const int &N, double *dst, const double *src)
Calculate the minimal eigenvalue for symmetric matrix with mkl lapack.
OCP_DBL signD(const OCP_DBL &d)
Return the sign of double di.
Mixture class declaration.
unsigned int USI
Generic unsigned integer.
double OCP_DBL
Double precision.
const OCP_DBL RHOW_STD
Water density at surface cond: lb/ft3.
unsigned int OCP_USI
Long unsigned integer.
unsigned int OCP_BOOL
OCP_BOOL in OCP.
unsigned long long OCP_ULL
Long long unsigned integer.
OCPTable class declaration.
#define OCP_ABORT(msg)
Abort if critical error happens.
OCP_DBL MW
Molecular Weight.
OCP_DBL OmegaA
Param A of Components.
OCP_DBL VcMW
Critical Volume / MW.
OCP_DBL acf
Acentric Factor.
OCP_DBL Tc
Critical Temperature.
OCP_DBL OmegaB
Param B of Components.
OCP_DBL Vshift
shift volume
OCP_DBL Pc
Critical Pressure.
string name
Name of components.
ComponentParam contains information of components.
void CalFtypeIMPEC()
Calculate Flash type for IMPEC.
void CalFtypeFIM(const OCP_DBL *Sjin)
Calculate Flash type for FIM.
vector< OCP_DBL > parachor
Parachor params of hydrocarbon components.
vector< OCP_SIN > skipMatSTA
OCP_BOOL flagSkip
If ture, then skipping could be try,.
vector< OCP_DBL > phiN
d ln phi[i][j] / d n[k][j]
Miscible * misTerm
Miscible term pointing to OptionalFeature.
SkipStaAnaly * skipSta
Skip analysis Term pointing to OptionalFeature.
vector< OCP_SIN > eigenWork
work space for computing eigenvalues with ssyevd_
vector< OCP_SIN > eigenSkip
eigen values of matrix for skipping Skip Stability Analysis.
OCP_DBL surTen
Surface tension between hydrocarbons phases.
Params for NR in Phase Split.
OCP_BOOL conflag
convergence flag, if converges, conflag = OCP_TRUE
Params for NR in Phase Stability Analysis.
OCP_BOOL conflag
convergence flag, if converges, conflag = OCP_TRUE
ComponentParam comsParam
information for components
Type_A_r< OCP_DBL > density
Density of oil, water, gas in standard conditions.
Type_A_r< OCP_DBL > gravity
Gravity of oil, water, gas in standard conditions.
TableSet PVTW_T
Table set of PVTW.
Param for Solving Rachford-Rice Equations.
Params for SSM in Phase Split.
OCP_BOOL conflag
convergence flag, if converges, conflag = OCP_TRUE
Params for SSM in Phase Stability Analysis.
USI curIt
current Iterations
OCP_BOOL conflag
convergence flag, if converges, conflag = OCP_TRUE
vector< vector< vector< OCP_DBL > > > data
All table with the same name.
OCP_BOOL activity
If OCP_FALSE, this param is not given.
vector< T > data
Data of param.