161 if (kro < 0) kro = 0;
175 OCP_DBL kro = (Sg * krog + (Sw - Swco) * krow) / tmp;
224 const OCP_DBL kro = CalKro_Stone2(krow, krog, krw, krg);
262 OCP_DBL dKrodSg{0}, dKrodSw{0}, kro{0};
264 kro = CalKro_Stone2Der(krow, krog, krw, krg, dKrwdSw, dKrowdSw, dKrgdSg, dKrogdSg,
325 out_dkrodSw = dkrodSw;
326 out_dkrodSg = dkrodSg;
345 OCP_DBL kro = (Sg * krog + (Sw - Swco) * krow) / tmp;
346 dkroSg = (krog + Sg * dkrogSg - kro) / tmp;
347 dkroSw = (krow + (Sw - Swco) * dkrowSw - kro) / tmp;
351 void FlowUnit_ODGW01::Generate_SWPCWG()
359 for (
USI i = 0; i < n; i++) {
373 void FlowUnit_ODGW01_Miscible::SetupScale(
const OCP_USI& bId,
378 const OCP_DBL SwInit = scaleTerm->GetSwInit(bId);
379 if (SwInit <= Swco) {
388 (Pcowin / PcowInit * maxPcow - minPcow) / (maxPcow - minPcow));
417 OCP_DBL kro = CalKro_Stone2(krow, krog, krw, krg);
420 OCP_DBL krh = 0.5 * (krow + krgt);
423 kro =
Fk * kro + (1 -
Fk) * krh * So / (1 - Sw);
424 krg =
Fk * krg + (1 -
Fk) * krh * Sg / (1 - Sw);
435 pc_out[2] = -((-pc_out[2] - minPcow) * scaleTerm->
GetScaleVal(bId) + minPcow);
469 OCP_DBL dKrodSg{0}, dKrodSw{0}, kro{0};
470 kro = CalKro_Stone2Der(krow, krog, krw, krg, dKrwdSw, dKrowdSw, dKrgdSg,
471 dKrogdSg, dKrodSw, dKrodSg);
475 const OCP_DBL krh = 0.5 * (krow + krgt);
478 kro =
Fk * kro + (1 -
Fk) * krh * So / (1 - Sw);
479 krg =
Fk * krg + (1 -
Fk) * krh * Sg / (1 - Sw);
488 OCP_DBL dkrhdSw = 0.5 * (dKrowdSw - dkrgd1_Sw);
489 OCP_DBL temp = (1 -
Fk) / (1 - Sw) * (krh / (1 - Sw) + dkrhdSw);
491 dkrdS[0] = (1 -
Fk) * krh / (1 - Sw);
492 dkrdS[1] =
Fk * dKrodSg;
493 dkrdS[2] =
Fk * dKrodSw + temp * So;
495 dkrdS[4] =
Fk * dKrgdSg + (1 -
Fk) * krh / (1 - Sw);
496 dkrdS[5] = temp * Sg;
513 pc_out[2] = -((-pc_out[2] - minPcow) * scaleTerm->
GetScaleVal(bId) + minPcow);
559 OCP_DBL kro = CalKro_Default(Sg, Sw, krog, krow);
599 OCP_DBL kro = CalKro_Stone2Der(krow, krog, krw, krg, dKrwdSw, dKrowdSo, dKrgdSg,
624 dPcjdS[4] = dPcgodSg;
628 dPcjdS[8] = dPcwodSw;
644 dKrodSo = dkrowdSo * (krog /
kroMax + krg) + dkrogdSo * (krow /
kroMax + krw);
650 out_dkrodSo = dKrodSo;
663 OCP_DBL kro = (Sg * krog + (Sw - Swco) * krow) / tmp;
664 out_dkrodSo = (Sg * dkrogdSo + (Sw - Swco) * dkrowdSo) / tmp;
673 void FlowUnit_ODGW02::Generate_SWPCWG()
681 for (
USI i = 0; i < n; i++) {
FlowUnit class declaration.
const OCP_DBL TINY
Small constant.
unsigned int USI
Generic unsigned integer.
double OCP_DBL
Double precision.
unsigned int OCP_USI
Long unsigned integer.
#define OCP_ABORT(msg)
Abort if critical error happens.
OCP_DBL Fk
The relative permeability interpolation parameter.
void CalKrPcDeriv(const OCP_DBL *S_in, OCP_DBL *kr_out, OCP_DBL *pc_out, OCP_DBL *dkrdS, OCP_DBL *dPcjdS, const OCP_USI &bId) override
Calculate derivatives of relative permeability and capillary pressure.
OCP_DBL Fp
The capillary pressure interpolation parameter.
void CalKrPc(const OCP_DBL *S_in, OCP_DBL *kr_out, OCP_DBL *pc_out, const OCP_USI &bId) override
Calculate relative permeability and capillary pressure.
OCP_DBL GetPcowBySw(const OCP_DBL &sw) override
Pcow = Po - Pw.
OCPTable SGOF
saturation table about gas and oil.
virtual void CalKrPcDeriv(const OCP_DBL *S_in, OCP_DBL *kr_out, OCP_DBL *pc_out, OCP_DBL *dkrdS, OCP_DBL *dPcjdS, const OCP_USI &bId) override
Calculate derivatives of relative permeability and capillary pressure.
virtual void CalKrPc(const OCP_DBL *S_in, OCP_DBL *kr_out, OCP_DBL *pc_out, const OCP_USI &bId) override
Calculate relative permeability and capillary pressure.
OCPTable SWOF
saturation table about water and oil.
void CalKrPc(const OCP_DBL *S_in, OCP_DBL *kr_out, OCP_DBL *pc_out, const OCP_USI &bId) override
Calculate relative permeability and capillary pressure.
OCPTable SOF3
saturation table about oil.
OCPTable SWFN
saturation table about water.
void CalKrPcDeriv(const OCP_DBL *S_in, OCP_DBL *kr_out, OCP_DBL *pc_out, OCP_DBL *dkrdS, OCP_DBL *dPcjdS, const OCP_USI &bId) override
Calculate derivatives of relative permeability and capillary pressure.
OCPTable SGFN
saturation table about gas.
OCP_DBL kroMax
oil relative permeability in the presence of connate water only, used in stone2
vector< OCP_DBL > Scm
critical saturation when phase becomes mobile / immobile
OCPTable SGOF
saturation table about gas and oil.
void CalKrPcDeriv(const OCP_DBL *S_in, OCP_DBL *kr_out, OCP_DBL *pc_out, OCP_DBL *dkrdS, OCP_DBL *dPcjdS, const OCP_USI &bId) override
Calculate derivatives of relative permeability and capillary pressure.
void CalKrPc(const OCP_DBL *S_in, OCP_DBL *kr_out, OCP_DBL *pc_out, const OCP_USI &bId) override
Calculate relative permeability and capillary pressure.
OCPTable SWOF
saturation table about water and oil.
void CalKrPcDeriv(const OCP_DBL *S_in, OCP_DBL *kr_out, OCP_DBL *pc_out, OCP_DBL *dkrdS, OCP_DBL *dPcjdS, const OCP_USI &bId) override
Calculate derivatives of relative permeability and capillary pressure.
void CalKrPc(const OCP_DBL *S_in, OCP_DBL *kr_out, OCP_DBL *pc_out, const OCP_USI &bId) override
Calculate relative permeability and capillary pressure.
void CalKrPcDeriv(const OCP_DBL *S_in, OCP_DBL *kr_out, OCP_DBL *pc_out, OCP_DBL *dkrdS, OCP_DBL *dPcjdS, const OCP_USI &bId) override
Calculate derivatives of relative permeability and capillary pressure.
void CalKrPc(const OCP_DBL *S_in, OCP_DBL *kr_out, OCP_DBL *pc_out, const OCP_USI &bId) override
Calculate relative permeability and capillary pressure.
vector< OCP_DBL > data
container to store the values of interpolation.
vector< OCP_DBL > cdata
container to store the slopes of interpolation.
OCP_BOOL CalFkFp(const OCP_USI &n, OCP_DBL &fk, OCP_DBL &fp)
Calculate Fk, Fp and return if miscible.
USI Eval_All(const USI &j, const OCP_DBL &val, vector< OCP_DBL > &outdata, vector< OCP_DBL > &slope)
Careful: the memory outdata and slope have not be allocated before.
void SetRowCol()
Setup row nums and col nums of tables, initialize the bId.
void Setup(const vector< vector< OCP_DBL >> &src)
Setup tables from existing data of table.
vector< OCP_DBL > & GetCol(const USI &j)
return the jth column in table to modify or use.
OCP_INT GetRowZero(const USI &mycol) const
OCP_BOOL IsEmpty() const
judge if table is empty.
OCP_DBL Eval(const USI &j, const OCP_DBL &val, const USI &destj)
void PushCol(const vector< OCP_DBL > &v)
push v into the last column of table.
TableSet SOF3_T
Table set of SOF3.
TableSet SGOF_T
Table set of SGOF.
TableSet SGFN_T
Table set of SGFN.
TableSet SWOF_T
Table set of SWOF.
TableSet SWFN_T
Table set of SWFN.
OCP_DBL GetScaleVal(const OCP_USI &n) const
Return scaleVal.
OCP_BOOL IfScale() const
Return ifScale.
void AssignScaleValue(const OCP_USI &n, const OCP_DBL &v)
Assign value to scaleVal.
vector< vector< vector< OCP_DBL > > > data
All table with the same name.