12 #ifndef __BULK_HEADER__
13 #define __BULK_HEADER__
82 void InitSjPcBo(
const USI& tabrow);
84 void InitSjPcComp(
const USI& tabrow,
const Grid& myGrid);
86 void InitFlash(
const bool& flag =
false);
89 void InitFlashDer_n();
100 void FlashDerivBLKOIL();
101 void FlashDerivBLKOIL_n();
103 void FlashDerivCOMP();
104 void FlashDerivCOMP_n();
108 void PassFlashValue(
const OCP_USI& n);
109 void PassFlashValueAIMc(
const OCP_USI& n);
111 void PassFlashValueDeriv(
const OCP_USI& n);
112 void PassFlashValueDeriv_n(
const OCP_USI& n);
128 void CheckSetup()
const;
130 void CheckInitVpore()
const;
132 void CheckVpore()
const;
138 bool CheckVe(
const OCP_DBL& Vlim)
const;
140 void CheckSat()
const;
151 USI GetMixMode()
const;
153 const vector<Mixture*>&
GetMixture()
const {
return flashCal; }
159 return S[n * numPhase + phase2Index[
OIL]];
164 return S[n * numPhase + phase2Index[
GAS]];
169 return S[n * numPhase + phase2Index[
WATER]];
181 void ResetphaseNum() { phaseNum = lphaseNum; }
183 void ResetminEigenSkip() { minEigenSkip = lminEigenSkip; }
185 void ResetflagSkip() { flagSkip = lflagSkip; }
187 void ResetziSkip() { ziSkip = lziSkip; }
189 void ResetPSkip() { PSkip = lPSkip; }
191 void ResetKs() { Ks = lKs; }
206 void CalSomeInfo(
const Grid& myGrid)
const;
210 void ClearWellBulkId() { wellBulkId.clear(); }
225 vector<OCP_DBL> initZi;
226 vector<OCPTable> initZi_T;
228 vector<OCP_DBL> SwatInit;
229 bool SwatInitExist{
false};
230 vector<OCP_DBL> ScaleValuePcow;
231 bool ScalePcow{
false};
237 vector<Mixture*> flashCal;
241 vector<FlowUnit*> flow;
242 vector<vector<OCP_DBL>> satcm;
245 vector<USI> phaseNum;
246 vector<USI> lphaseNum;
247 vector<USI> NRphaseNum;
249 vector<OCP_SIN> minEigenSkip;
250 vector<bool> flagSkip;
251 vector<OCP_DBL> ziSkip;
252 vector<OCP_DBL> PSkip;
253 vector<OCP_SIN> lminEigenSkip;
254 vector<bool> lflagSkip;
255 vector<OCP_DBL> lziSkip;
256 vector<OCP_DBL> lPSkip;
286 vector<bool> phaseExist;
313 vector<bool> lphaseExist;
316 vector<OCP_DBL> lrho;
318 vector<OCP_DBL> lxij;
325 vector<OCP_DBL> lvfi;
326 vector<OCP_DBL> lvfp;
327 vector<OCP_DBL> lrockVp;
329 vector<OCP_DBL> surTen;
333 vector<OCP_DBL> lsurTen;
341 vector<OCP_DBL> depth;
343 vector<OCP_DBL> rockVpInit;
344 vector<OCP_DBL> rockVp;
348 vector<OCP_DBL> rockKxInit;
349 vector<OCP_DBL> rockKx;
350 vector<OCP_DBL> rockKyInit;
351 vector<OCP_DBL> rockKy;
352 vector<OCP_DBL> rockKzInit;
353 vector<OCP_DBL> rockKz;
358 vector<USI> index2Phase;
360 vector<USI> phase2Index;
375 vector<OCP_DBL> ePEC;
376 mutable vector<OCP_DBL> eN;
377 mutable vector<OCP_DBL> eV;
385 void AllocateAuxIMPEC();
387 void GetSolIMPEC(
const vector<OCP_DBL>& u);
393 void UpdateLastStepIMPEC();
396 mutable vector<OCP_DBL> cfl;
404 void AllocateAuxFIM();
406 void GetSolFIM(
const vector<OCP_DBL>& u,
const OCP_DBL& dPmaxlim,
408 void GetSolFIM_n(
const vector<OCP_DBL>& u,
const OCP_DBL& dPmaxlim,
411 void GetSol01FIM(
const vector<OCP_DBL>& u);
415 void ShowRes(
const vector<OCP_DBL>& res)
const;
419 void UpdateLastStepFIM();
428 void CorrectNi(
const vector<OCP_DBL>& res);
435 vector<OCP_DBL> rhoP;
438 vector<OCP_DBL> rhox;
439 vector<OCP_DBL> dPcj_dS;
440 vector<OCP_DBL> dKr_dS;
441 vector<OCP_DBL> dSec_dPri;
442 vector<OCP_DBL> res_n;
443 vector<OCP_DBL> resPc;
445 vector<OCP_USI> dSdPindex;
446 vector<OCP_USI> resIndex;
449 vector<USI> pEnumCom;
452 vector<OCP_DBL> lmuP;
453 vector<OCP_DBL> lxiP;
454 vector<OCP_DBL> lrhoP;
455 vector<OCP_DBL> lmux;
456 vector<OCP_DBL> lxix;
457 vector<OCP_DBL> lrhox;
458 vector<OCP_DBL> ldPcj_dS;
459 vector<OCP_DBL> ldKr_dS;
460 vector<OCP_DBL> ldSec_dPri;
461 vector<OCP_DBL> lres_n;
462 vector<OCP_DBL> lresPc;
463 vector<OCP_USI> ldSdPindex;
464 vector<OCP_USI> lresIndex;
465 vector<USI> lpEnumCom;
468 vector<OCP_DBL> dSNR;
469 vector<OCP_DBL> dSNRP;
470 vector<OCP_DBL> dNNR;
471 vector<OCP_DBL> dPNR;
482 vector<OCP_DBL> NRstep;
486 void OutputInfo(
const OCP_USI& n)
const;
487 OCP_ULL GetSSMSTAiters()
const {
return flashCal[0]->GetSSMSTAiters(); }
488 OCP_ULL GetNRSTAiters()
const {
return flashCal[0]->GetNRSTAiters(); }
489 OCP_ULL GetSSMSPiters()
const {
return flashCal[0]->GetSSMSPiters(); }
490 OCP_ULL GetNRSPiters()
const {
return flashCal[0]->GetNRSPiters(); }
491 OCP_ULL GetRRiters()
const {
return flashCal[0]->GetRRiters(); }
492 OCP_ULL GetSSMSTAcounts()
const {
return flashCal[0]->GetSSMSTAcounts(); }
493 OCP_ULL GetNRSTAcounts()
const {
return flashCal[0]->GetNRSTAcounts(); }
494 OCP_ULL GetSSMSPcounts()
const {
return flashCal[0]->GetSSMSPcounts(); }
495 OCP_ULL GetNRSPcounts()
const {
return flashCal[0]->GetNRSPcounts(); }
496 OCP_ULL GetRRcounts()
const {
return flashCal[0]->GetRRcounts(); }
505 void AllocateAuxAIM(
const OCP_DBL& ratio);
506 OCP_USI GetMaxFIMBulk()
const {
return maxNumFIMBulk; }
508 void FlashDerivAIM(
const bool& IfAIMs);
509 void PassFlashValueDerivAIM(
const OCP_USI& n);
511 void CalKrPcDerivAIM(
const bool& IfAIMs);
515 void GetSolAIMt(
const vector<OCP_DBL>& u,
const OCP_DBL& dPmaxlim,
520 void GetSolAIMs(
const vector<OCP_DBL>& u,
const OCP_DBL& dPmaxlim,
522 void UpdateLastStepAIM();
524 void ShowFIMBulk(
const bool& flag =
false)
const;
526 bool CheckNiFIMBulk()
const;
536 void AllocateAuxAIMc();
540 void FlashBLKOILAIMc();
542 void FlashCOMPAIMc();
545 void FlashBLKOILAIMc01();
546 void FlashCOMPAIMc01();
549 void FlashDerivAIMc();
551 void FlashDerivBLKOILAIMc();
553 void FlashDerivCOMPAIMc();
557 void CalKrPcDerivAIMc();
558 void GetSolAIMc(
const vector<OCP_DBL>& u,
const OCP_DBL& dPmaxlim,
560 void GetSolAIMc01(
const vector<OCP_DBL>& u,
const OCP_DBL& dPmaxlim,
565 vector<OCP_USI> wellBulkId;
566 vector<OCP_INT> map_Bulk2FIM;
567 vector<OCP_USI> FIMBulk;
570 vector<OCP_DBL> FIMNi;
Operations about small dense mat.
double Dnorm1(const int &N, double *x)
Computes the L1-norm of a vector.
FlowUnit class declaration.
Linear solver class declaration.
MixtureBO class declaration.
MixtureComp class declaration.
Mixture class declaration.
Definition of build-in datatypes and consts.
unsigned int USI
Generic unsigned integer.
const USI GAS
Fluid type = gas.
double OCP_DBL
Double precision.
const USI WATER
Fluid type = water.
const USI OIL
Fluid type = oil.
unsigned int OCP_USI
Long unsigned integer.
unsigned long long OCP_ULL
Long long unsigned integer.
Some Structure in OpenCAEPoro.
ParamReservoir class declaration.
Properties and operations on connections between bulks (active grids).
Physical information of each active reservoir bulk.
USI GetPhaseNum() const
Return the number of phases.
void AllocateWellBulkId(const USI &n)
Allocate memory for WellbulkId.
void ResetPj()
Reset Pj to the ones of the last time step.
void ResetNi()
Reset Ni to the ones of the last time step.
void ResetVp()
Reset Vp to the ones of the last time step.
OCP_DBL GetdVmax() const
Return dVmax.
void ResetNt()
Reset Nt to the ones of the last time step.
void SetCFL2Zero() const
Initialize the CFL number.
OCP_DBL GetSOIL(const OCP_USI &n) const
Return oil saturation of the n-th bulk.
const vector< Mixture * > & GetMixture() const
Return flash results (it has not been used by far).
OCP_DBL GetSWAT(const OCP_USI &n) const
Return water saturation of the n-th bulk.
OCP_DBL GetSGAS(const OCP_USI &n) const
Return gas saturation of the n-th bulk.
OCP_DBL GetdSmax() const
Return dSmax.
void ResetP()
Reset P to the ones of the last time step.
void ResetKr()
Reset Kr to the ones of the last time step.
OCP_DBL GetdNmax() const
Return dNmax.
OCP_DBL GetdPmax() const
Return dPmax.
OCP_USI GetBulkNum() const
Return the number of bulks.
USI GetComNum() const
Return the number of components.
OCP_DBL GetP(const OCP_USI &n) const
Return pressure of the n-th bulk.
Collect more detailed information of each time step.
Basic information of computational grid, including the rock properties.
void Setup(Reservoir &rs, LinearSystem &myLS, const OCPControl &ctrl)
Setup AIMc.
perform AIM in time, that is, local FIM will be performed after global IMPEC performs
OCP_FIM is FIM (Fully Implicit Method).
ResFIM resFIM
Resiual for FIM.
OCP_IMPEC is IMPEC (implict pressure explict saturation) method.
Initial reservoir infomation for calculating initial equilibration.