27 perf[p].kh = well.kh[p];
36 OCP_ABORT(
"Wrong direction of perforations!");
54 if (!
opt.state)
continue;
71 perf[pp].multiplier = 1;
101 if (
perf[p].WI > 0) {
109 switch (
perf[p].direction) {
115 ro = 0.28 * pow((dy * dy * pow(1 / ky_kz, 0.5) +
116 dz * dz * pow(ky_kz, 0.5)),
118 ro /= (pow(ky_kz, 0.25) + pow(1 / ky_kz, 0.25));
120 if (
perf[p].kh < 0) {
121 perf[p].kh = (dx * pow(kykz, 0.5));
130 ro = 0.28 * pow((dz * dz * pow(1 / kz_kx, 0.5) +
131 dx * dx * pow(kz_kx, 0.5)),
133 ro /= (pow(kz_kx, 0.25) + pow(1 / kz_kx, 0.25));
135 if (
perf[p].kh < 0) {
136 perf[p].kh = (dy * pow(kzkx, 0.5));
145 ro = 0.28 * pow((dx * dx * pow(1 / kx_ky, 0.5) +
146 dy * dy * pow(kx_ky, 0.5)),
148 ro /= (pow(kx_ky, 0.25) + pow(1 / kx_ky, 0.25));
150 if (
perf[p].kh < 0) {
151 perf[p].kh = (dz * pow(kxky, 0.5));
156 OCP_ABORT(
"Wrong direction of perforations!");
159 (log(ro /
perf[p].radius) +
perf[p].skinFactor);
170 perf[p].transINJ = 0;
176 perf[p].transj[j] = 0;
179 perf[p].transj[j] = temp * myBulk.
kr[id] / myBulk.
mu[id];
180 perf[p].transINJ +=
perf[p].transj[j];
194 perf[p].transj[j] = 0;
197 perf[p].transj[j] = temp * myBulk.
kr[id] / myBulk.
mu[id];
218 perf[p].qt_ft3 =
perf[p].transINJ * dP;
237 fill(
perf[p].qj_ft3.begin(),
perf[p].qj_ft3.end(), 0.0);
244 perf[p].qj_ft3[j] =
perf[p].transj[j] * dP;
245 perf[p].qt_ft3 +=
perf[p].qj_ft3[j];
251 perf[p].qi_lbmol[i] +=
perf[p].qj_ft3[j] * xi * xij;
280 qj +=
perf[p].transINJ * xi * dP;
295 vector<OCP_DBL> tmpQi_lbmol(
numCom, 0);
309 tmpQi_lbmol[i] += myBulk.
xij[
id *
numCom + i] * temp;
316 qj += tmpQj[j] *
opt.prodPhaseWeight[j];
331 if (
opt.fluidType ==
"WAT") {
374 vector<OCP_DBL> dGperf(
numPerf, 0);
381 if (seg_num == 0)
continue;
382 seg_len = (
perf[0].depth -
depth) / seg_num;
385 if (seg_num == 0)
continue;
386 seg_len = (
perf[p].depth -
perf[p - 1].depth) / seg_num;
394 for (
USI i = 0; i < seg_num; i++) {
395 Ptmp -= myBulk.
flashCal[pvtnum]->RhoPhase(
396 Ptmp, 0,
opt.injTemp,
opt.injZi.data(),
opt.injProdPhase) *
399 dGperf[p] = Pperf - Ptmp;
403 dG[p] =
dG[p - 1] + dGperf[p];
410 if (seg_num == 0)
continue;
414 if (seg_num == 0)
continue;
415 seg_len = (
perf[p + 1].depth -
perf[p].depth) / seg_num;
423 for (
USI i = 0; i < seg_num; i++) {
424 Ptmp += myBulk.
flashCal[pvtnum]->RhoPhase(
425 Ptmp, 0,
opt.injTemp,
opt.injZi.data(),
opt.injProdPhase) *
428 dGperf[p] = Ptmp - Pperf;
432 dG[p] =
dG[p + 1] + dGperf[p];
445 vector<OCP_DBL> dGperf(
numPerf, 0);
446 vector<OCP_DBL> tmpNi(
numCom, 0);
454 if (seg_num == 0)
continue;
455 seg_len = (
perf[0].depth -
depth) / seg_num;
458 if (seg_num == 0)
continue;
459 seg_len = (
perf[p].depth -
perf[p - 1].depth) / seg_num;
471 tmpNi[k] += (myBulk.
P[n] -
perf[p].P) *
perf[p].transj[j] *
472 myBulk.
xi[n_np_j] * myBulk.
xij[n_np_j *
numCom + k];
478 tmpNi[i] = myBulk.
Ni[n *
numCom + i];
483 for (
USI i = 0; i < seg_num; i++) {
485 myBulk.
flashCal[pvtnum]->Flash(Ptmp, myBulk.
T[n], tmpNi.data());
487 if (myBulk.
flashCal[pvtnum]->phaseExist[j]) {
488 rhotmp = myBulk.
flashCal[pvtnum]->rho[j];
489 qtacc += myBulk.
flashCal[pvtnum]->vj[j];
490 rhoacc += myBulk.
flashCal[pvtnum]->vj[j] * rhotmp;
495 dGperf[p] = Pperf - Ptmp;
499 dG[p] =
dG[p - 1] + dGperf[p];
506 if (seg_num == 0)
continue;
510 if (seg_num == 0)
continue;
511 seg_len = (
perf[p + 1].depth -
perf[p].depth) / seg_num;
523 tmpNi[k] += (myBulk.
P[n] -
perf[p].P) *
perf[p].transj[j] *
524 myBulk.
xi[n_np_j] * myBulk.
xij[n_np_j *
numCom + k];
530 tmpNi[i] = myBulk.
Ni[n *
numCom + i];
535 for (
USI i = 0; i < seg_num; i++) {
537 myBulk.
flashCal[pvtnum]->Flash(Ptmp, myBulk.
T[n], tmpNi.data());
539 if (myBulk.
flashCal[pvtnum]->phaseExist[j]) {
540 rhotmp = myBulk.
flashCal[pvtnum]->rho[j];
541 qtacc += myBulk.
flashCal[pvtnum]->vj[j];
542 rhoacc += myBulk.
flashCal[pvtnum]->vj[j] * rhotmp;
547 dGperf[p] = Ptmp - Pperf;
551 dG[p] =
dG[p + 1] + dGperf[p];
564 vector<OCP_DBL> dGperf(
numPerf, 0);
565 vector<OCP_DBL> tmpNi(
numCom, 0);
573 if (seg_num == 0)
continue;
574 seg_len = (
perf[0].depth -
depth) / seg_num;
577 if (seg_num == 0)
continue;
578 seg_len = (
perf[p].depth -
perf[p - 1].depth) / seg_num;
585 fill(tmpNi.begin(), tmpNi.end(), 0.0);
590 tmpNi[k] += (
perf[p].transj[j] > 0) * myBulk.
xi[
id] *
597 tmpNi[i] = myBulk.
Ni[n *
numCom + i];
602 for (
USI i = 0; i < seg_num; i++) {
604 myBulk.
flashCal[pvtnum]->Flash(Ptmp, myBulk.
T[n], tmpNi.data());
606 if (myBulk.
flashCal[pvtnum]->phaseExist[j]) {
607 rhotmp = myBulk.
flashCal[pvtnum]->rho[j];
608 qtacc += myBulk.
flashCal[pvtnum]->vj[j];
609 rhoacc += myBulk.
flashCal[pvtnum]->vj[j] * rhotmp;
614 dGperf[p] = Pperf - Ptmp;
618 dG[p] =
dG[p - 1] + dGperf[p];
625 if (seg_num == 0)
continue;
629 if (seg_num == 0)
continue;
630 seg_len = (
perf[p + 1].depth -
perf[p].depth) / seg_num;
637 fill(tmpNi.begin(), tmpNi.end(), 0.0);
642 tmpNi[k] += (
perf[p].transj[j] > 0) * myBulk.
xi[
id] *
649 tmpNi[i] = myBulk.
Ni[n *
numCom + i];
654 for (
USI i = 0; i < seg_num; i++) {
656 myBulk.
flashCal[pvtnum]->Flash(Ptmp, myBulk.
T[n], tmpNi.data());
658 if (myBulk.
flashCal[pvtnum]->phaseExist[j]) {
659 rhotmp = myBulk.
flashCal[pvtnum]->rho[j];
660 qtacc += myBulk.
flashCal[pvtnum]->vj[j];
661 rhoacc += myBulk.
flashCal[pvtnum]->vj[j] * rhotmp;
666 dGperf[p] = Ptmp - Pperf;
670 dG[p] =
dG[p + 1] + dGperf[p];
683 vector<OCP_DBL> tmpNi(
numCom, 0);
684 vector<OCP_DBL> dGperf(
numPerf, 0);
708 if (seg_num == 0)
continue;
709 seg_len = (
perf[0].depth -
depth) / seg_num;
712 if (seg_num == 0)
continue;
713 seg_len = (
perf[p].depth -
perf[p - 1].depth) / seg_num;
730 tmpNi[i] +=
perf[p].qi_lbmol[i];
734 for (
auto& v : tmpNi) {
738 for (
USI k = 0; k < seg_num; k++) {
739 myBulk.
flashCal[pvtnum]->Flash(Ptmp, myBulk.
T[n], tmpNi.data());
741 if (myBulk.
flashCal[pvtnum]->phaseExist[j]) {
742 rhotmp = myBulk.
flashCal[pvtnum]->rho[j];
743 qtacc += myBulk.
flashCal[pvtnum]->vj[j] / seg_num;
744 rhoacc += myBulk.
flashCal[pvtnum]->vj[j] * rhotmp *
747 if (rhotmp <= 0 || !isfinite(rhotmp)) {
748 OCP_ABORT(
"Wrong rho " + to_string(rhotmp));
753 Ptmp -= rhoacc / qtacc * seg_len;
755 dGperf[p] = Pperf - Ptmp;
759 dG[p] =
dG[p - 1] + dGperf[p];
779 if (seg_num == 0)
continue;
783 if (seg_num == 0)
continue;
784 seg_len = (
perf[p + 1].depth -
perf[p].depth) / seg_num;
793 fill(tmpNi.begin(), tmpNi.end(), 0.0);
796 tmpNi[i] +=
perf[p1].qi_lbmol[i];
801 for (
auto& v : tmpNi) {
805 for (
USI k = 0; k < seg_num; k++) {
806 myBulk.
flashCal[pvtnum]->Flash(Ptmp, myBulk.
T[n], tmpNi.data());
808 if (myBulk.
flashCal[pvtnum]->phaseExist[j]) {
809 rhotmp = myBulk.
flashCal[pvtnum]->rho[j];
810 qtacc += myBulk.
flashCal[pvtnum]->vj[j] / seg_num;
811 rhoacc += myBulk.
flashCal[pvtnum]->vj[j] * rhotmp *
815 Ptmp += rhoacc / qtacc * seg_len;
817 dGperf[p] = Ptmp - Pperf;
821 dG[p] =
dG[p + 1] + dGperf[p];
836 for (
USI i = 0; i < myBulk.
numCom; i++) {
838 if (
qi_lbmol[i] < 0) flag = OCP_FALSE;
840 if (qt >
TINY && flag) {
844 vector<OCP_DBL> tmpNi(
numCom, 0);
852 tmpNi[k] +=
perf[p].transj[j] * myBulk.
xi[id] *
902 if (
opt.reInjPhase ==
GAS)
923 if (
opt.reInjPhase ==
GAS)
930 opt.optMode =
opt.initOptMode;
938 if (q >
opt.maxRate) {
939 opt.optMode =
opt.initOptMode;
957 cout <<
"### WARNING: Well " <<
name <<
" BHP = " <<
bhp << endl;
958 return WELL_NEGATIVE_PRESSURE;
963 cout <<
"### WARNING: Well " <<
name <<
" Perf[" << p
964 <<
"].P = " <<
perf[p].P << endl;
966 return WELL_NEGATIVE_PRESSURE;
973 cout <<
"### WARNING: Well " <<
name <<
" switch to BHPMode" << endl;
977 return WELL_SWITCH_TO_BHPMODE;
982 cout <<
"### WARNING: Well " <<
name <<
" switch to BHPMode" << endl;
986 return WELL_SWITCH_TO_BHPMODE;
1002 k =
perf[p].location;
1005 cout << std::left << std::setw(12) <<
name <<
" "
1006 <<
"Well P = " <<
perf[p].P <<
", "
1007 <<
"Bulk P = " << minP << endl;
1009 perf[p].multiplier = 0;
1014 perf[p].multiplier = 1;
1019 k =
perf[p].location;
1021 cout << std::left << std::setw(12) <<
name <<
" "
1022 <<
"Well P = " <<
perf[p].P <<
", "
1023 <<
"Bulk P = " << myBulk.
P[k] << endl;
1025 perf[p].multiplier = 0;
1030 perf[p].multiplier = 1;
1047 perf.back().multiplier = 1;
1048 cout <<
"### WARNING: All perfs of " <<
name
1049 <<
" are closed! Open the last perf!\n";
1062 return WELL_CROSSFLOW;
1065 return WELL_SUCCESS;
1073 cout <<
"----------------------------" << endl;
1074 cout <<
name <<
": " <<
opt.optMode <<
" " << setprecision(3) <<
bhp << endl;
1079 cout << setw(3) << p <<
" " <<
perf[p].state <<
" " << setw(6)
1080 <<
perf[p].location <<
" " << setw(2) <<
perf[p].I + 1 <<
" " << setw(2)
1081 <<
perf[p].J + 1 <<
" " << setw(2) <<
perf[p].K + 1 <<
" " << setw(10)
1082 << setprecision(6) <<
perf[p].WI <<
" "
1083 << setprecision(3) <<
perf[p].radius <<
" "
1084 << setw(8) << setprecision(4) <<
perf[p].kh <<
" "
1085 << setw(8) << setprecision(2) <<
perf[p].depth <<
" "
1086 << setprecision(3) <<
perf[p].P <<
" "
1087 << setw(10) << setprecision(3) << myBulk.
P[n] <<
" "
1088 << setw(6) << setprecision(3) <<
dG[p] <<
" "
1089 << setw(8) <<
perf[p].qi_lbmol[myBulk.
numCom - 1] <<
" " << setw(6)
1090 << setprecision(6) << myBulk.
S[n * myBulk.
numPhase + 0] <<
" " << setw(6)
1091 << setprecision(6) << myBulk.
S[n * myBulk.
numPhase + 1] <<
" " << setw(6)
1092 << setprecision(6) << myBulk.
S[n * myBulk.
numPhase + 2] << endl;
1099 const vector<Well>& allWell,
1100 const vector<USI>& injId)
const
1103 vector<OCP_USI> tarId;
1104 for (
auto& w : injId) {
1106 tarId.push_back(allWell[w].
wOId + myBulk.
numBulk);
1109 USI tlen = tarId.size();
1112 const OCP_DBL factor = allWell[injId[0]].opt.reInjFactor * dt;
1119 n =
perf[p].location;
1125 tmp =
perf[p].transj[j] * myBulk.
xi[bId];
1127 rhsw += tmp * (myBulk.
Pc[bId] -
dG[p]);
1131 for (
USI t = 0; t < tlen; t++) {
1138 for (
USI t = 0; t < tlen; t++) {
1139 myLS.
AddRhs(tarId[t], rhsw);
1148 const vector<Well>& allWell,
1149 const vector<USI>& injId)
const
1152 vector<OCP_USI> tarId;
1153 for (
auto& w : injId) {
1155 tarId.push_back(allWell[w].
wOId + myBulk.
numBulk);
1158 USI tlen = tarId.size();
1161 const OCP_DBL factor = allWell[injId[0]].opt.reInjFactor;
1166 const USI bsize = ncol * ncol;
1167 const USI bsize2 = ncol * ncol2;
1169 OCP_DBL xij, xi, mu, muP, xiP, dP, transIJ, tmp;
1172 vector<OCP_DBL> bmat(bsize, 0);
1173 vector<OCP_DBL> bmat2(bsize, 0);
1174 vector<OCP_DBL> tmpMat(bsize, 0);
1175 vector<OCP_DBL> dQdXpB(bsize, 0);
1176 vector<OCP_DBL> dQdXpW(bsize, 0);
1177 vector<OCP_DBL> dQdXsB(bsize2, 0);
1181 fill(dQdXpB.begin(), dQdXpB.end(), 0.0);
1182 fill(dQdXpW.begin(), dQdXpW.end(), 0.0);
1183 fill(dQdXsB.begin(), dQdXsB.end(), 0.0);
1189 dP = myBulk.
Pj[n_np_j] -
bhp -
dG[p];
1190 xi = myBulk.
xi[n_np_j];
1191 mu = myBulk.
mu[n_np_j];
1192 muP = myBulk.
muP[n_np_j];
1193 xiP = myBulk.
xiP[n_np_j];
1198 transIJ =
perf[p].transj[j] * xi * xij;
1199 dQdXpB[(i + 1) * ncol] += transIJ * (1 - dP * muP / mu) +
1200 dP *
perf[p].transj[j] * xij * xiP;
1201 dQdXpW[(i + 1) * ncol] += -transIJ;
1205 tmp =
CONV1 *
perf[p].WI *
perf[p].multiplier * dP / mu * xi *
1209 dQdXsB[(i + 1) * ncol2 + k] += tmp;
1213 tmp = dP *
perf[p].transj[j] * xij *
1215 xi / mu * myBulk.
mux[n_np_j *
numCom + k]);
1217 tmp +=
perf[p].transj[j] * xi * dP;
1226 tmpMat[0] += dQdXpW[(i + 1) * ncol] * factor;
1231 DaABpbC(ncol, ncol, ncol2, 1, dQdXsB.data(), &myBulk.
dSec_dPri[n * bsize2],
1233 fill(bmat2.begin(), bmat2.end(), 0.0);
1236 Daxpy(ncol, -factor, bmat.data() + (i + 1) * ncol, bmat2.data());
1240 for (
USI t = 0; t < tlen; t++) {
1245 for (
USI t = 0; t < tlen; t++) {
1254 mypol.numPoints =
numPerf + 1;
1255 mypol.Points.resize(mypol.numPoints);
1267 mypol.Points[p + 1] = tmpP;
1271 mypol.Points[0] = mypol.Points[1];
1272 mypol.Points[0].z /= 2;
void DaABpbC(const int &m, const int &n, const int &k, const double &alpha, const double *A, const double *B, const double &beta, double *C)
Computes C' = alpha B'A' + beta C', all matrices are column-major.
void Daxpy(const int &n, const double &alpha, const double *x, double *y)
Constant times a vector plus a vector.
double Dnorm1(const int &N, double *x)
Computes the L1-norm of a vector.
const USI X_DIRECTION
x-direction
const OCP_DBL TINY
Small constant.
unsigned int USI
Generic unsigned integer.
const USI GAS
Fluid type = gas.
double OCP_DBL
Double precision.
const OCP_DBL CONV1
1 bbl = CONV1 ft3
const OCP_DBL GRAVITY_FACTOR
0.00694444 ft2 psi / lb
const USI WATER
Fluid type = water.
const OCP_BOOL OPEN
Well type = open.
const USI Y_DIRECTION
y-direction
const USI RATE_MODE
Well option = fixed total rate???
unsigned int OCP_USI
Long unsigned integer.
const USI Z_DIRECTION
z-direction
const USI PROD
Well type = producer.
const USI INJ
Well type = injector.
const OCP_BOOL CLOSE
Well type = closed.
const USI BHP_MODE
Well option = fixed bottom-hole-pressure.
unsigned int OCP_BOOL
OCP_BOOL in OCP.
const OCP_DBL CONV2
Darcy constant in field unit.
#define OCP_FUNCNAME
Print Function Name.
#define OCP_WARNING(msg)
Log warning messages.
#define OCP_ABORT(msg)
Abort if critical error happens.
Physical information of each active reservoir bulk.
vector< OCP_DBL > mu
Viscosity of phase: numPhase*numBulk.
vector< OCP_DBL > Pc
Capillary pressure of phase: numPhase*numBulk.
USI numPhase
Number of phase.
vector< OCP_DBL > T
Temperature: numBulk.
vector< OCP_DBL > S
Saturation of phase: numPhase*numBulk.
OCP_BOOL oil
If OCP_TRUE, oil phase could exist.
vector< OCP_DBL > dSec_dPri
d Secondary variable / d Primary variable.
vector< OCP_DBL > ntg
net to gross of bulk.
vector< OCP_DBL > dy
Size of cell in y-direction: activeGridNum.
vector< USI > PVTNUM
Identify PVT region in black-oil model: numBulk.
OCP_BOOL gas
If OCP_TRUE, gas phase could exist.
vector< OCP_DBL > xij
Nij / Nj: numPhase*numCom*numBulk.
vector< OCP_DBL > kr
Relative permeability of phase: numPhase*numBulk.
vector< OCP_DBL > depth
Depth of center of grid cells: activeGridNum.
vector< OCP_DBL > Ni
Moles of component: numCom*numBulk.
vector< OCP_DBL > Pj
Pressure of phase: numPhase*numBulk.
vector< OCP_DBL > mux
d Muj / d xij: numPhase*numCom*numBulk.
OCP_BOOL ifThermal
Id OCP_TRUE, ifThermal model will be used.
vector< OCP_DBL > muP
d Mu / d P: numPhase*numBulk.
vector< OCP_DBL > dz
Size of cell in z-direction: activeGridNum.
vector< OCP_DBL > dKr_dS
d Krj / d Sk: numPhase * numPhase * bulk.
vector< Mixture * > flashCal
Flash calculation class.
vector< OCP_BOOL > phaseExist
Existence of phase: numPhase*numBulk.
vector< OCP_DBL > xiP
d xi / d P: numPhase*numBulk.
vector< OCP_DBL > xi
Moles density of phase: numPhase*numBulk.
vector< OCP_DBL > rockKz
current rock permeability along the z direction.
vector< OCP_DBL > rockKx
current rock permeability along the x direction.
OCP_DBL rsTemp
Reservoir temperature.
vector< OCP_DBL > rockKy
current rock permeability along the y direction.
OCP_BOOL water
If OCP_TRUE, water phase could exist.
OCP_USI numBulk
Number of bulks (active grids).
vector< OCP_DBL > xix
d Xi_j / d xij: numPhase*numCom*numBulk.
vector< OCP_DBL > dx
Size of cell in x-direction: activeGridNum.
vector< OCP_DBL > dPcj_dS
d Pcj / d Sk: numPhase * numPhase * bulk.
vector< OCP_DBL > P
Pressure: numBulk.
USI numCom
Number of component.
vector< OCP_USI > map_Act2All
Mapping from active grid to all grid: activeGridNum.
USI nx
Number of cells in x-direction.
vector< OCPpolyhedron > polyhedronGrid
Coordinates of grid points.
vector< GB_Pair > map_All2Flu
Mapping from all grid to fluid grid: numGrid.
USI ny
Number of cells in y-direction.
vector< GB_Pair > map_All2Act
Mapping from grid to active all grid: numGrid.
Linear solvers for discrete systems.
void AddRhs(const OCP_USI &n, const OCP_DBL &v)
Add a value at b[n].
void NewOffDiag(const OCP_USI &bId, const OCP_USI &eId, const OCP_DBL &v)
Push back a off-diagonal value.
Record the initial grid information, all of grids are contained.
vector< string > direction
Direction of perforations.
vector< OCP_DBL > diameter
Diameter of perforations.
vector< OCP_DBL > skinFactor
Skin factor.
vector< USI > I_perf
I-index of perforation in grid.
vector< OCP_DBL > WI
Transmissibility connection factor.
vector< USI > J_perf
J-index of perforation in grid.
vector< USI > K_perf
K-index of perforation in grid.
OCP_DBL CalInjRateMaxBHP(const Bulk &myBulk)
calculate flow rate of moles of phases for injection well with maxBHP.
USI numPerf
num of perforations belonging to this well.
OCP_DBL WOPT
well total oil production.
void AssembleMatReinjection_IMPEC(const Bulk &myBulk, LinearSystem &myLS, const OCP_DBL &dt, const vector< Well > &allWell, const vector< USI > &injId) const
OCP_DBL numPhase
num of phases
OCP_DBL WWIT
well total water injection.
void CalProddG01(const Bulk &myBulk)
Calculate pressure difference between well and perforations for Production.
vector< OCP_DBL > prodWeight
maybe only a num is needed
void CheckOptMode(const Bulk &myBulk)
Check if well operation mode would be changed.
OCP_INT CheckP(const Bulk &myBulk)
Check if abnormal Pressure occurs.
vector< OCP_DBL > prodRate
flow rate of volume of phase outflowing
void CalInjdG(const Bulk &myBulk)
Calculate pressure difference between well and perforations for Injection.
void CalProdQj(const Bulk &myBulk, const OCP_DBL &dt)
void CalProddG02(const Bulk &myBulk)
Calculate pressure difference between well and perforations for Production.
OCP_DBL depth
reference depth of well.
void CalReInjFluid(const Bulk &myBulk, vector< OCP_DBL > &myZi)
Calculate the contribution of production well to reinjection defaulted.
void CalFlux(const Bulk &myBulk, const OCP_BOOL ReCalXi=OCP_FALSE)
Calculate the flux for each perforations.
void InputPerfo(const WellParam &well)
Input the param of perforations.
WellOpt opt
well control parameters, contains current control parameters.
OCP_DBL WGPR
well gas production rate.
OCP_DBL WGIR
well gas injection rate.
OCP_DBL WWPT
well total water production.
OCP_DBL numCom
num of components
OCP_DBL WWIR
well water injection rate.
void CalTrans(const Bulk &myBulk)
Calculate transmissibility for each phase in perforations.
OCP_DBL bhp
Well pressure in reference depth.
OCP_BOOL IsOpen() const
Return the state of the well, Open or Close.
void CalProddG(const Bulk &myBulk)
Calculate pressure difference between well and perforations for Production.
OCP_DBL Tsurf
Well surface Temperature, F.
void CaldG(const Bulk &myBulk)
Calculate pressure difference between well and perforations.
OCP_DBL WOPR
well oil production rate.
OCP_DBL WGPT
well total gas production.
OCP_DBL WGIT
well total gas injection.
void CorrectBHP()
Correct BHP if opt mode is BHPMode.
vector< OCP_DBL > ldG
Last dG.
OCP_INT CheckCrossFlow(const Bulk &myBulk)
Check if cross flow happens.
void CalWI_Peaceman(const Bulk &myBulk)
Calculate Well Index with Peaceman model.
OCP_DBL CalProdRateMinBHP(const Bulk &myBulk)
calculate flow rate of moles of phases for production well with minBHP.
void Setup(const Grid &gd, const Bulk &bk, const vector< SolventINJ > &sols)
Setup the well after Grid and Bulk finish setup.
void CalInjQj(const Bulk &myBulk, const OCP_DBL &dt)
void AssembleMatReinjection_FIM(const Bulk &myBulk, LinearSystem &myLS, const OCP_DBL &dt, const vector< Well > &allWell, const vector< USI > &injId) const
void ShowPerfStatus(const Bulk &myBulk) const
Display operation mode of well and state of perforations.
vector< Mixture * > flashCal
from bulks's flashCal
OCP_DBL Psurf
Well surface Pressure, psia.
vector< OCP_DBL > qi_lbmol
flow rate of moles of component inflowing/outflowing
void CalProdWeight(const Bulk &myBulk) const
Calculate the production weight.
OCP_DBL WWPR
well water production rate.
vector< OCP_DBL > dG
difference of pressure between well and perforation: numPerf.
vector< Perforation > perf
information of perforation belonging to this well.