12 #ifndef __MIXTURECOMP_HEADER__
13 #define __MIXTURECOMP_HEADER__
112 COMP(
const vector<string>& comp);
131 OCP_DBL GetErrorPEC()
override {
return ePEC; }
132 OCP_ULL GetSSMSTAiters()
override {
return SSMSTAiters; }
133 OCP_ULL GetNRSTAiters()
override {
return NRSTAiters; }
134 OCP_ULL GetSSMSPiters()
override {
return SSMSPiters; }
135 OCP_ULL GetNRSPiters()
override {
return NRSPiters; }
136 OCP_ULL GetRRiters()
override {
return RRiters; }
137 OCP_ULL GetSSMSTAcounts()
override {
return SSMSTAcounts; }
138 OCP_ULL GetNRSTAcounts()
override {
return NRSTAcounts; }
139 OCP_ULL GetSSMSPcounts()
override {
return SSMSPcounts; }
140 OCP_ULL GetNRSPcounts()
override {
return NRSPcounts; }
141 OCP_ULL GetRRcounts()
override {
return RRcounts; }
190 const OCP_DBL* lastKs)
override;
194 const OCP_DBL* lastKs)
override;
197 const OCP_DBL* njin,
const USI& ftype,
const USI* phaseExistin,
198 const USI& lastNP,
const OCP_DBL* lastKs)
override;
206 const OCP_DBL* Ziin)
override ;
208 void setZi(
const OCP_DBL* Ziin) {
Dcopy(NC, &zi[0], Ziin); }
209 void setZi() {
for (
USI i = 0; i < NC; i++) zi[i] = Ni[i] / Nh; }
210 void setNi(
const OCP_DBL* Niin) {
Dcopy(numCom, &Ni[0], Niin); }
212 USI GetFtype()
override {
return ftype; }
213 void CalSurfaceTension();
214 OCP_DBL GetSurTen()
override {
return surTen; }
219 vector<string> Cname;
225 vector<OCP_DBL> OmegaA;
226 vector<OCP_DBL> OmegaB;
227 vector<OCP_DBL> Vshift;
228 vector<OCP_DBL> Parachor;
232 vector<OCP_DBL> Vcvis;
233 vector<OCP_DBL> Zcvis;
234 vector<OCP_DBL> LBCcoef;
253 vector<OCP_DBL> Plist;
254 vector<OCP_DBL> Tlist;
255 vector<OCP_DBL> Ytlist;
261 vector<OCP_DBL> data;
263 vector<OCP_DBL> cdata;
275 void CalAjBj(
OCP_DBL& AjT,
OCP_DBL& BjT,
const vector<OCP_DBL>& xj)
const;
279 const bool& NTflag =
false)
const;
283 for (
auto z : Ztmp) cout << z <<
"\t";
293 mutable vector<OCP_DBL> Ztmp;
296 OCP_DBL delta1 = 2.41421356237;
297 OCP_DBL delta2 = -0.41421356237;
305 void AllocatePhase();
306 void CalFugPhi(vector<OCP_DBL>& phiT, vector<OCP_DBL>& fugT,
307 const vector<OCP_DBL>& xj);
313 void CalSaturation();
326 vector<vector<OCP_DBL>> x;
327 vector<vector<OCP_DBL>> phi;
328 vector<vector<OCP_DBL>> fug;
329 vector<vector<OCP_DBL>> n;
330 vector<vector<OCP_DBL>> ln;
332 vector<OCP_DBL> rhoC;
334 vector<USI> phaseLabel;
339 void AllocateMethod();
340 void PhaseEquilibrium();
343 bool StableSSM(
const USI& Id);
344 bool StableSSM01(
const USI& Id);
345 bool StableNR(
const USI& Id);
347 void AssembleJmatSTA();
350 void SplitSSM(
const bool& flag);
351 void SplitSSM2(
const bool& flag);
352 void SplitSSM3(
const bool& flag);
353 void RachfordRice2();
354 void RachfordRice2P();
355 void RachfordRice3();
360 void CalFugNAll(
const bool& Znflag =
true);
362 void AssembleJmatSP();
365 void AssembleSkipMatSTA();
369 OCP_SIN GetMinEigenSkip()
override {
return eigenSkip[0]; }
370 bool GetFlagSkip()
override {
return flagSkip; }
375 vector<vector<OCP_DBL>> Kw;
376 vector<vector<OCP_DBL>> Ks;
379 vector<OCP_DBL> phiSta;
380 vector<OCP_DBL> fugSta;
386 vector<OCP_DBL> resSTA;
387 vector<OCP_DBL> JmatSTA;
388 vector<vector<OCP_DBL>> fugX;
394 vector<OCP_DBL> phiN;
395 vector<OCP_SIN> skipMatSTA;
396 vector<OCP_SIN> eigenSkip;
397 vector<OCP_SIN> eigenWork;
401 vector<OCP_DBL> resRR;
403 vector<OCP_DBL> lresSP;
404 vector<OCP_DBL> resSP;
405 vector<OCP_DBL> JmatSP;
406 vector<vector<OCP_DBL>>
410 vector<vector<OCP_DBL>> Zn;
412 vector<OCP_INT> pivot;
413 vector<OCP_DBL> JmatWork;
420 void AllocateOthers();
421 void IdentifyPhase();
428 void CalFugPAll(
const bool& Zpflag =
true);
431 void CalVjpVfpVfx_partial();
432 void CalXiPNX_partial();
433 void CalRhoPX_partial();
434 void CalMuPX_partial();
435 void CalMuPXLBC_partial();
436 void CalXiRhoMuPN_pfullx();
437 void CaldXsdXpAPI04();
440 void CalRhoPNX_full();
442 void CalXiPNX_full01();
443 void CalRhoPNX_full01();
444 void CalMuPX_full01();
445 void CalMuPXLBC_full01();
446 void CalVfiVfp_full01();
447 void AssembleMatVfiVfp_full01();
448 void AssembleRhsVfiVfp_full01();
450 void CaldXsdXpAPI01();
452 void CalXiPNX_full02();
453 void CalVfiVfp_full02();
454 void AssembleMatVfiVfp_full02();
455 void AssembleRhsVfiVfp_full02();
456 void CaldXsdXpAPI02();
457 void CaldXsdXpAPI02p();
459 void CalVjpVfpVfn_partial();
460 void CalXiPn_partial();
461 void CalRhoPn_partial();
462 void CalMuPn_partial();
463 void CalMuPnLBC_partial();
464 void CalXiRhoMuPN_pfullxn(
const bool& xflag =
true);
466 void CaldXsdXpAPI03();
468 void CalVfiVfp_full03();
476 vector<vector<OCP_DBL>>
480 vector<OCP_DBL> sqrtMWi;
481 vector<vector<OCP_DBL>> fugP;
484 vector<OCP_DBL> JmatTmp;
485 vector<OCP_DBL> JmatDer;
488 vector<OCP_DBL> rhsDer;
489 vector<OCP_DBL> xixC;
490 vector<OCP_DBL> xiPC;
491 vector<OCP_DBL> xiNC;
Operations about small dense mat.
void Dcopy(const int &N, double *dst, const double *src)
Calculate the minimal eigenvalue for sysmetric matrix with mkl lapack.
OCP_DBL signD(const OCP_DBL &d)
Return the sign of double di.
Mixture class declaration.
const USI EOS_PVTW
Mixture model = equation-of-state.
unsigned int USI
Generic unsigned integer.
double OCP_DBL
Double precision.
const OCP_DBL GRAVITY_FACTOR
0.00694444 ft2 psi / lb
float OCP_SIN
Single precision.
const OCP_DBL RHOW_STD
Water density in lb / ft3.
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.
EoSParam contains the params for Compositional Model and functions to read them.
OCP_DBL GammaPhaseG(const OCP_DBL &Pin) override
return gamma of gas phase, gamma equals to mass density times gravity factor.
OCP_DBL GammaPhaseO(const OCP_DBL &Pin, const OCP_DBL &Pbbin) override
return gamma of oil phase, gamma equals to mass density times gravity factor.
Params for NR in Phase Split.
bool conflag
convergence flag, if converges, conflag = true
Params for NR in Phase Stability Analysis.
bool conflag
convergence flag, if converges, conflag = true
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.
EoSparam EoSp
Initial component composition, used in compositional models.
Param for Solving Rachford-Rice Equations.
Params for SSM in Phase Split.
bool conflag
convergence flag, if converges, conflag = true
Params for SSM in Phase Stability Analysis.
USI curIt
current Iterations
bool conflag
convergence flag, if converges, conflag = true
vector< vector< vector< OCP_DBL > > > data
All table with the same name.
vector< T > data
Data of param.
bool activity
If false, this param is not given.