OpenCAEPoro  0.2.0 Sep/22/2022
A simulator for multicomponent porous media flow
AllWells.cpp
Go to the documentation of this file.
1 
12 #include "AllWells.hpp"
13 
14 
16 // General
18 
19 void AllWells::InputParam(const ParamWell& paramWell)
20 {
22 
23  USI len = paramWell.solSet.size();
24  solvents.resize(len);
25  for (USI i = 0; i < len; i++) {
26  solvents[i] = paramWell.solSet[i];
27  }
28 
29  numWell = paramWell.well.size();
30  wells.resize(numWell);
31  USI t = paramWell.criticalTime.size();
32  vector<USI> wellCriticalTime;
33  for (USI w = 0; w < numWell; w++) {
34  wells[w].name = paramWell.well[w].name;
35  wells[w].group = paramWell.well[w].group;
36  wells[w].depth = paramWell.well[w].depth;
37  wells[w].I = paramWell.well[w].I - 1;
38  wells[w].J = paramWell.well[w].J - 1;
39  wells[w].InputPerfo(paramWell.well[w]);
40 
41  // opt
42  wells[w].optSet.resize(t);
43  USI n = paramWell.well[w].optParam.size();
44  wellCriticalTime.clear();
45  wellCriticalTime.resize(n + 1);
46  for (USI i = 0; i < n; i++) {
47  wellCriticalTime[i] = paramWell.well[w].optParam[i].d;
48  }
49  wellCriticalTime.back() = t;
50  for (USI i = 0; i < n; i++) {
51  for (USI d = wellCriticalTime[i]; d < wellCriticalTime[i + 1]; d++) {
52  wells[w].optSet[d] = WellOpt(paramWell.well[w].optParam[i].opt);
53  }
54  }
55  }
56 }
57 
58 void AllWells::Setup(const Grid& myGrid, const Bulk& myBulk)
59 {
61 
62  SetupWell(myGrid, myBulk);
63  SetupMixture(myBulk);
64 }
65 
66 void AllWells::SetupWell(const Grid& myGrid, const Bulk& myBulk)
67 {
69 
70  for (USI w = 0; w < numWell; w++) {
71  wells[w].Setup(myGrid, myBulk, solvents);
72  }
73 }
74 
75 
76 void AllWells::SetupWellGroup(const Bulk& myBulk)
77 {
78  wellGroup.clear();
79  // Field Group, contain all wells
80  wellGroup.push_back(WellGroup("Field"));
81  for (USI w = 0; w < numWell; w++) {
82  wellGroup[0].wId.push_back(w);
83  if (wells[w].WellType() == INJ)
84  wellGroup[0].wIdINJ.push_back(w);
85  else
86  wellGroup[0].wIdPROD.push_back(w);
87  }
88 
89  // other subgroups
90  USI glen = 1;
91  USI g = 1;
92  for (USI w = 0; w < numWell; w++) {
93  for (g = 1; g < glen; g++) {
94  if (wells[w].group == wellGroup[g].name) {
95  // existing group
96  wellGroup[g].wId.push_back(w);
97  if (wells[w].WellType() == INJ)
98  wellGroup[g].wIdINJ.push_back(w);
99  else
100  wellGroup[g].wIdPROD.push_back(w);
101  break;
102  }
103  }
104  if (g == glen && wells[w].group != "Field") {
105  // new group
106  wellGroup.push_back(WellGroup(wells[w].group));
107  wellGroup[glen].wId.push_back(w);
108  if (wells[w].WellType() == INJ) wellGroup[glen].wIdINJ.push_back(w);
109  else wellGroup[glen].wIdPROD.push_back(w);
110  glen++;
111  }
112  }
113 
114  numGroup = wellGroup.size();
115  // relation between wellGroup should be completed if "node groups" exist
116 
117  // control of group should be update according to input file
118 
119  // for test
120  if (false) {
121  wellGroup[0].reInj = true;
122  wellGroup[0].saleRate = 1500;
123  wellGroup[0].injPhase = GAS;
124  wellGroup[0].prodGroup = 0;
125  }
126  wellGroup[0].zi.resize(myBulk.GetComNum());
127  CalReInjFluid(myBulk);
128 
129 }
130 
131 
132 void AllWells::SetupMixture(const Bulk& myBulk)
133 {
134  OCP_FUNCNAME;
135 
136  flashCal = myBulk.GetMixture();
137 }
138 
139 void AllWells::SetupWellBulk(Bulk& myBulk) const
140 {
141  myBulk.ClearWellBulkId();
142  for (USI w = 0; w < numWell; w++) {
143  if (wells[w].WellState()) {
144  wells[w].SetupWellBulk(myBulk);
145  }
146  }
147 }
148 
150 {
151  OCP_FUNCNAME;
152  wellChange = false;
153  USI wId = 0;
154  for (USI w = 0; w < numWell; w++) {
155  wells[w].opt = wells[w].optSet[i];
156  if (wells[w].WellState()) {
157  wells[w].wEId = wId;
158  wId++;
159  }
160  if (i > 0 && wells[w].opt != wells[w].optSet[i - 1])
161  wellChange = true;
162  }
163 }
164 
165 void AllWells::InitBHP(const Bulk& myBulk)
166 {
167  OCP_FUNCNAME;
168 
169  for (USI w = 0; w < numWell; w++) {
170  wells[w].InitBHP(myBulk);
171  }
172 }
173 
174 void AllWells::PrepareWell(const Bulk& myBulk)
175 {
176  OCP_FUNCNAME;
177 
178  for (USI w = 0; w < numWell; w++) {
179  if (wells[w].WellState()) {
180 
181  wells[w].CalTrans(myBulk);
182  wells[w].CalFlux(myBulk, true);
183  wells[w].CalProdWeight(myBulk);
184  wells[w].CaldG(myBulk);
185  // test
186  // wells[w].SmoothdG();
187  wells[w].CheckOptMode(myBulk);
188  }
189  }
190 }
191 
192 void AllWells::CalTrans(const Bulk& myBulk)
193 {
194  OCP_FUNCNAME;
195 
196  for (USI w = 0; w < numWell; w++) {
197  if (wells[w].WellState()) {
198  wells[w].CalTrans(myBulk);
199  }
200  }
201 }
202 
203 void AllWells::CalFlux(const Bulk& myBulk)
204 {
205  OCP_FUNCNAME;
206 
207  for (USI w = 0; w < numWell; w++) {
208  if (wells[w].WellState()) {
209  wells[w].CalFlux(myBulk, false);
210  }
211  }
212 }
213 
214 void AllWells::CalProdWeight(const Bulk& myBulk)
215 {
216  OCP_FUNCNAME;
217 
218  for (USI w = 0; w < numWell; w++) {
219  if (wells[w].WellState()) {
220  wells[w].CalProdWeight(myBulk);
221  }
222  }
223 }
224 
225 void AllWells::CaldG(const Bulk& myBulk)
226 {
227  OCP_FUNCNAME;
228 
229  for (USI w = 0; w < numWell; w++) {
230  if (wells[w].WellState()) {
231  wells[w].CaldG(myBulk);
232  }
233  }
234 }
235 
236 void AllWells::CalIPRT(const Bulk& myBulk, OCP_DBL dt)
237 {
238  OCP_FUNCNAME;
239 
240  FGIR = 0;
241  FWIR = 0;
242  FOPR = 0;
243  FGPR = 0;
244  FWPR = 0;
245  for (USI w = 0; w < numWell; w++) {
246  wells[w].WGIR = 0;
247  wells[w].WWIR = 0;
248  wells[w].WOPR = 0;
249  wells[w].WGPR = 0;
250  wells[w].WWPR = 0;
251 
252  if (wells[w].WellState()) {
253  if (wells[w].WellType() == PROD) {
254  wells[w].CalProdQj(myBulk, dt);
255  } else {
256  wells[w].CalInjQi(myBulk, dt);
257  }
258  }
259  FGIR += wells[w].WGIR;
260  FWIR += wells[w].WWIR;
261  FOPR += wells[w].WOPR;
262  FGPR += wells[w].WGPR;
263  FWPR += wells[w].WWPR;
264  }
265  FGIT += FGIR * dt;
266  FWIT += FWIR * dt;
267  FOPT += FOPR * dt;
268  FGPt += FGPR * dt;
269  FWPT += FWPR * dt;
270 }
271 
272 
273 void AllWells::CalReInjFluid(const Bulk& myBulk)
274 {
275  for (auto& wG : wellGroup) {
276  if (wG.reInj) {
277  const USI nc = myBulk.GetComNum();
278  // const USI np = myBulk.GetPhaseNum();
279  fill(wG.zi.begin(), wG.zi.end(), 0.0);
280  for (auto& prod : wellGroup[wG.prodGroup].wIdPROD) {
281  Daxpy(nc, 1.0, &wells[prod].qi_lbmol[0], &wG.zi[0]);
282  }
283  OCP_DBL qt = Dnorm1(nc, &wG.zi[0]);
284  if (fabs(qt) < 1E-8) {
285  // Recalculate zi
286  fill(wG.zi.begin(), wG.zi.end(), 0.0);
287  for (auto& prod : wellGroup[wG.prodGroup].wIdPROD) {
288  wells[prod].CalReInjFluid(myBulk, wG.zi);
289  }
290  qt = Dnorm1(nc, &wG.zi[0]);
291  }
292  flashCal[0]->Flash(PRESSURE_STD, TEMPERATURE_STD, &wG.zi[0], 0, 0, 0);
293  Dcopy(nc, &wG.zi[0], &flashCal[0]->xij[wG.injPhase * nc]);
294  wG.xi = flashCal[0]->xi[wG.injPhase];
295  wG.factor = wG.xi * flashCal[0]->v[wG.injPhase] / qt;
296  // assign to every open injection well in wG
297  for (auto& w : wG.wIdINJ) {
298  if (wells[w].WellState()) {
299  wells[w].opt.reInj = true;
300  wells[w].opt.connWell = wG.wIdPROD;
301  wells[w].opt.injPhase = wG.injPhase;
302  wells[w].opt.zi = wG.zi;
303  wells[w].opt.xiINJ = wG.xi;
304  wells[w].opt.factor = wG.factor;
305  wells[w].opt.maxRate = -wG.saleRate * wG.xi * 1000; // Mscf -> ft3 -> lbmol
306  }
307  }
308  //for (USI i = 0; i < nc; i++) {
309  // cout << scientific << wG.zi[i] << " ";
310  //}
311  //cout << "xi: " << wG.xi << " Factor: " << wG.factor;
312  //cout << endl;
313  }
314  }
315 }
316 
317 
318 void AllWells::AllocateMat(LinearSystem& myLS, const USI& bulknum) const
319 {
320  OCP_FUNCNAME;
321 
322  USI maxNum = (GetMaxWellPerNum() + 1) * numWell;
323  for (USI w = 0; w < numWell; w++) {
324  wells[w].AllocateMat(myLS);
325  myLS.EnlargeRowCap(bulknum + w, maxNum);
326  }
327 }
328 
329 void AllWells::ResetBHP()
330 {
331  for (auto& w : wells) {
332  if (w.WellState()) {
333  w.BHP = w.lBHP;
334  w.SetBHP();
335  // w.dG = w.ldG;
336  }
337  }
338 }
339 
341 {
342  OCP_FUNCNAME;
343 
344  // 0 : All correct
345  // 1 : negative P, cut the timestep and resolve
346  // 2.1 : change well mode to BHP, resolve
347  // 2.2 : crossflow happens, then close corresponding perf, resolve
348  bool flag2 = false;
349  bool flag3 = false;
350 
351  for (USI w = 0; w < numWell; w++) {
352  if (wells[w].WellState()) {
353 
354  OCP_INT flag = wells[w].CheckP(myBulk);
355 //#ifdef _DEBUG
356  // wells[w].ShowPerfStatus();
357 //#endif // _DEBUG
358  switch (flag) {
359  case 1:
360  return 1;
361  case 2:
362  flag2 = true;
363  break;
364  case 3:
365  flag3 = true;
366  break;
367  default:
368  break;
369  }
370  }
371  }
372 
373  if (flag2 || flag3) return 2;
374 
375  return 0;
376 }
377 
378 // return the index of Specified well name
379 USI AllWells::GetIndex(const string& name) const
380 {
381  OCP_FUNCNAME;
382 
383  for (USI w = 0; w < numWell; w++) {
384  if (wells[w].name == name) {
385  return w;
386  }
387  }
388  OCP_ABORT("Well name not found!");
389 }
390 
392 {
393  USI numPerf = 0;
394  for (USI w = 0; w < numWell; w++) {
395  numPerf += wells[w].numPerf;
396  }
397  return numPerf;
398 }
399 
401 {
402  OCP_FUNCNAME;
403 
404  USI m = 0;
405  for (USI w = 0; w < numWell; w++) {
406  m = max(m, wells[w].numPerf);
407  }
408  return m;
409 }
410 
411 void AllWells::CalMaxBHPChange()
412 {
413  dPmax = 0;
414  for (USI w = 0; w < numWell; w++) {
415  if (wells[w].WellState()) {
416  dPmax = max(dPmax, fabs(wells[w].BHP - wells[w].lBHP));
417  }
418  }
419 }
420 
421 OCP_DBL AllWells::CalWellQT()
422 {
423  QT = 0;
424  for (USI w = 0; w < numWell; w++) {
425  if (wells[w].WellState()) {
426  for (auto& q : wells[w].qi_lbmol) {
427  QT += q;
428  }
429  }
430  }
431  return QT;
432 }
433 
435 // IMPEC
437 
438 
439 void AllWells::CalCFL(const Bulk& myBulk, const OCP_DBL& dt) const
440 {
441  OCP_FUNCNAME;
442 
443  for (USI w = 0; w < numWell; w++) {
444  if (wells[w].WellState()) {
445  wells[w].CalCFL(myBulk, dt);
446  }
447  }
448 }
449 
451 {
452  OCP_FUNCNAME;
453 
454  for (USI w = 0; w < numWell; w++) {
455  if (wells[w].WellState()) {
456  wells[w].MassConserveIMPEC(myBulk, dt);
457  }
458  }
459 }
460 
461 void AllWells::AssemblaMatIMPEC(LinearSystem& myLS, const Bulk& myBulk,
462  const OCP_DBL& dt) const
463 {
464  OCP_FUNCNAME;
465 
466  for (USI w = 0; w < numWell; w++) {
467  if (wells[w].WellState()) {
468  switch (wells[w].WellType()) {
469  case INJ:
470  wells[w].AssembleMatINJ_IMPEC(myBulk, myLS, dt);
471  break;
472  case PROD:
473  wells[w].AssembleMatPROD_IMPEC(myBulk, myLS, dt);
474  break;
475  default:
476  OCP_ABORT("Wrong well type");
477  }
478  }
479  }
480 
481  // for Reinjection
482  for (auto& wG : wellGroup) {
483  if (wG.reInj) {
484  for (auto& prod : wellGroup[wG.prodGroup].wIdPROD) {
485  if (wells[prod].WellState()) {
486  wells[prod].AssembleMatReinjection_IMPEC(myBulk, myLS, dt, wells, wG.wIdINJ);
487  }
488  }
489  }
490  }
491 
492 }
493 
494 void AllWells::GetSolIMPEC(const vector<OCP_DBL>& u, const OCP_USI& bId)
495 {
496  OCP_FUNCNAME;
497 
498  USI wId = 0;
499  for (USI w = 0; w < numWell; w++) {
500  if (wells[w].WellState()) {
501  wells[w].BHP = u[bId + wId];
502  wells[w].UpdatePerfP();
503  wId++;
504  }
505  }
506 }
507 
509 // FIM
511 
512 void AllWells::AssemblaMatFIM(LinearSystem& myLS, const Bulk& myBulk,
513  const OCP_DBL& dt) const
514 {
515  OCP_FUNCNAME;
516 
517  for (USI w = 0; w < numWell; w++) {
518  if (wells[w].WellState()) {
519 
520  switch (wells[w].WellType()) {
521  case INJ:
522  wells[w].AssembleMatINJ_FIM(myBulk, myLS, dt);
523  break;
524  case PROD:
525  wells[w].AssembleMatPROD_FIM(myBulk, myLS, dt);
526  break;
527  default:
528  OCP_ABORT("Wrong well type");
529  }
530  }
531  }
532 
533  // for Reinjection
534  for (auto& wG : wellGroup) {
535  if (wG.reInj) {
536  for (auto& prod : wellGroup[wG.prodGroup].wIdPROD) {
537  if (wells[prod].WellState()) {
538  wells[prod].AssembleMatReinjection_FIM(myBulk, myLS, dt, wells, wG.wIdINJ);
539  }
540  }
541  }
542  }
543 }
544 
545 void AllWells::GetSolFIM(const vector<OCP_DBL>& u, const OCP_USI& bId, const USI& len)
546 {
547  OCP_FUNCNAME;
548 
549  USI wId = 0;
550  for (USI w = 0; w < numWell; w++) {
551  if (wells[w].WellState()) {
552  wells[w].BHP += u[(bId + wId) * len];
553  wells[w].UpdatePerfP();
554  wId++;
555  }
556  }
557 }
558 
559 void AllWells::GetSol01FIM(const vector<OCP_DBL>& u, const OCP_USI& bId,
560  const USI& len, const OCP_DBL& alpha)
561 {
562  USI wId = 0;
563  for (USI w = 0; w < numWell; w++) {
564  if (wells[w].WellState()) {
565  wells[w].BHP += u[(bId + wId) * len] * alpha;
566  wells[w].UpdatePerfP();
567  wId++;
568  }
569  }
570 }
571 
572 void AllWells::CalResFIM(ResFIM& resFIM, const Bulk& myBulk, const OCP_DBL& dt) const
573 {
574  OCP_FUNCNAME;
575 
576  USI wId = 0;
577  for (USI w = 0; w < numWell; w++) {
578  if (wells[w].WellState()) {
579  wells[w].CalResFIM(resFIM, myBulk, dt, wId, wells);
580  wId++;
581  }
582  }
583 
584  // cout << "Well " << resFIM.maxRelRes_v;
585 }
586 
587 void AllWells::ShowRes(const vector<OCP_DBL>& res, const Bulk& myBulk) const
588 {
589  USI wId = 0;
590  for (USI w = 0; w < numWell; w++) {
591  if (wells[w].WellState()) {
592  cout << endl;
593  wells[w].ShowRes(wId, res, myBulk);
594  wId++;
595  }
596  }
597  cout << endl;
598 }
599 
600 
602 // AFIM(new)
604 
605 
607  const OCP_DBL& dt) const
608 {
609  OCP_FUNCNAME;
610 
611  for (USI w = 0; w < numWell; w++) {
612  if (wells[w].WellState()) {
613 
614  switch (wells[w].WellType()) {
615  case INJ:
616  wells[w].AssembleMatINJ_FIM_new(myBulk, myLS, dt);
617  break;
618  case PROD:
619  wells[w].AssembleMatPROD_FIM_new(myBulk, myLS, dt);
620  break;
621  default:
622  OCP_ABORT("Wrong well type");
623  }
624  }
625  }
626 }
627 
628 
629 void AllWells::AssemblaMatFIM_new_n(LinearSystem& myLS, const Bulk& myBulk,
630  const OCP_DBL& dt) const
631 {
632  OCP_FUNCNAME;
633 
634  for (USI w = 0; w < numWell; w++) {
635  if (wells[w].WellState()) {
636 
637  switch (wells[w].WellType()) {
638  case INJ:
639  wells[w].AssembleMatINJ_FIM_new_n(myBulk, myLS, dt);
640  break;
641  case PROD:
642  wells[w].AssembleMatPROD_FIM_new_n(myBulk, myLS, dt);
643  break;
644  default:
645  OCP_ABORT("Wrong well type");
646  }
647  }
648  }
649 }
650 
651 
652 
654 // AIMt
656 
657 void AllWells::AssemblaMatAIMt(LinearSystem& myLS, const Bulk& myBulk,
658  const OCP_DBL& dt) const
659 {
660  for (USI w = 0; w < numWell; w++) {
661  if (wells[w].WellState()) {
662 
663  switch (wells[w].WellType()) {
664  case INJ:
665  wells[w].AssembleMatINJ_AIMt(myBulk, myLS, dt);
666  break;
667  case PROD:
668  wells[w].AssembleMatPROD_AIMt(myBulk, myLS, dt);
669  break;
670  default:
671  OCP_ABORT("Wrong well type");
672  }
673  }
674  }
675 }
676 
677 void AllWells::CalResAIMt(ResFIM& resFIM, const Bulk& myBulk, const OCP_DBL& dt) const
678 {
679  OCP_FUNCNAME;
680 
681  USI wId = 0;
682  for (USI w = 0; w < numWell; w++) {
683  if (wells[w].WellState()) {
684  wells[w].CalResAIMt(resFIM, myBulk, dt, wId, wells);
685  wId++;
686  }
687  }
688 
689  // cout << "Well " << resFIM.maxRelRes_v;
690 }
691 
692 void AllWells::GetSolAIMt(const vector<OCP_DBL>& u, const OCP_USI& bId, const USI& len)
693 {
694  OCP_FUNCNAME;
695 
696  USI wId = 0;
697  for (USI w = 0; w < numWell; w++) {
698  if (wells[w].WellState()) {
699  wells[w].BHP += u[(bId + wId) * len];
700  wells[w].UpdatePerfP();
701  wId++;
702  }
703  }
704 }
705 
706 void AllWells::AssemblaMatAIMs(LinearSystem& myLS, const Bulk& myBulk,
707  const OCP_DBL& dt) const
708 {
709  for (USI w = 0; w < numWell; w++) {
710  if (wells[w].WellState()) {
711 
712  switch (wells[w].WellType()) {
713  case INJ:
714  wells[w].AssembleMatINJ_AIMs(myBulk, myLS, dt);
715  break;
716  case PROD:
717  wells[w].AssembleMatPROD_AIMs(myBulk, myLS, dt);
718  break;
719  default:
720  OCP_ABORT("Wrong well type");
721  }
722  }
723  }
724 }
725 
726 /*----------------------------------------------------------------------------*/
727 /* Brief Change History of This File */
728 /*----------------------------------------------------------------------------*/
729 /* Author Date Actions */
730 /*----------------------------------------------------------------------------*/
731 /* Shizhe Li Oct/01/2021 Create file */
732 /* Chensong Zhang Oct/15/2021 Format file */
733 /*----------------------------------------------------------------------------*/
AllWells class declaration.
void Daxpy(const int &n, const double &alpha, const double *x, double *y)
Constant times a vector plus a vector.
Definition: DenseMat.cpp:69
double Dnorm1(const int &N, double *x)
Computes the L1-norm of a vector.
Definition: DenseMat.cpp:50
void Dcopy(const int &N, double *dst, const double *src)
Calculate the minimal eigenvalue for sysmetric matrix with mkl lapack.
Definition: DenseMat.cpp:37
unsigned int USI
Generic unsigned integer.
Definition: OCPConst.hpp:22
const USI GAS
Fluid type = gas.
Definition: OCPConst.hpp:83
double OCP_DBL
Double precision.
Definition: OCPConst.hpp:26
unsigned int OCP_USI
Long unsigned integer.
Definition: OCPConst.hpp:24
const USI PROD
Well type = producer.
Definition: OCPConst.hpp:108
const OCP_DBL TEMPERATURE_STD
Standard temperature.
Definition: OCPConst.hpp:56
int OCP_INT
Long integer.
Definition: OCPConst.hpp:25
const USI INJ
Well type = injector.
Definition: OCPConst.hpp:107
const OCP_DBL PRESSURE_STD
14.6959 psia = 1 atm
Definition: OCPConst.hpp:55
#define OCP_FUNCNAME
Print Function Name.
Definition: UtilError.hpp:73
#define OCP_ABORT(msg)
Abort if critical error happens.
Definition: UtilError.hpp:47
void ShowRes(const vector< OCP_DBL > &res, const Bulk &myBulk) const
Show Res.
Definition: AllWells.cpp:587
void CalResAIMt(ResFIM &resFIM, const Bulk &myBulk, const OCP_DBL &dt) const
Calculate Resiual and relative Resiual for local FIM.
Definition: AllWells.cpp:677
void CalFlux(const Bulk &myBulk)
Calculate volume flow rate and moles flow rate of each perforation.
Definition: AllWells.cpp:203
void CalTrans(const Bulk &myBulk)
Calculate Transmissibility of Wells.
Definition: AllWells.cpp:192
void AllocateMat(LinearSystem &myLS, const USI &bulknum) const
Calculate memory for Matrix.
Definition: AllWells.cpp:318
USI GetMaxWellPerNum() const
Calculate mamimum num of perforations of all Wells.
Definition: AllWells.cpp:400
void AssemblaMatFIM(LinearSystem &myLS, const Bulk &myBulk, const OCP_DBL &dt) const
Assemble matrix, parts related to well are included for FIM.
Definition: AllWells.cpp:512
void SetupWell(const Grid &myGrid, const Bulk &myBulk)
complete the information of well according to Grid and Bulk.
Definition: AllWells.cpp:66
void AssemblaMatAIMt(LinearSystem &myLS, const Bulk &myBulk, const OCP_DBL &dt) const
Assemble matrix, parts related to well are included for AIMt.
Definition: AllWells.cpp:657
void AssemblaMatIMPEC(LinearSystem &myLS, const Bulk &myBulk, const OCP_DBL &dt) const
Assemble matrix, parts related to well are included for IMPEC.
Definition: AllWells.cpp:461
void MassConserveIMPEC(Bulk &myBulk, OCP_DBL dt)
Update moles of components in Bulks which connects to well.
Definition: AllWells.cpp:450
OCP_INT CheckP(const Bulk &myBulk)
Check if unreasonable well pressure or perforation pressure occurs.
Definition: AllWells.cpp:340
void CaldG(const Bulk &myBulk)
Calculate dG.
Definition: AllWells.cpp:225
void ApplyControl(const USI &i)
Apply the operation mode at the ith critical time.
Definition: AllWells.cpp:149
void SetupMixture(const Bulk &myBulk)
get the mixture from bulk -— usless now
Definition: AllWells.cpp:132
void AssemblaMatFIM_new(LinearSystem &myLS, const Bulk &myBulk, const OCP_DBL &dt) const
Assemble matrix, parts related to well are included for FIM.
Definition: AllWells.cpp:606
USI GetWellPerfNum() const
Return the num of perforations of all wells.
Definition: AllWells.cpp:391
void CalIPRT(const Bulk &myBulk, OCP_DBL dt)
Calculate Injection rate, total Injection, Production rate, total Production.
Definition: AllWells.cpp:236
void SetupWellBulk(Bulk &myBulk) const
Setup bulks which are penetrated by wells.
Definition: AllWells.cpp:139
void GetSolAIMt(const vector< OCP_DBL > &u, const OCP_USI &bId, const USI &len)
Get solution from solver class after linear system is solved for local FIM.
Definition: AllWells.cpp:692
void GetSolFIM(const vector< OCP_DBL > &u, const OCP_USI &bId, const USI &len)
Get solution from solver class after linear system is solved for FIM.
Definition: AllWells.cpp:545
void GetSolIMPEC(const vector< OCP_DBL > &u, const OCP_USI &bId)
Update Well P and Perforation P after linear system is solved for IMPEC.
Definition: AllWells.cpp:494
void InitBHP(const Bulk &myBulk)
Set the initial well pressure.
Definition: AllWells.cpp:165
void SetupWellGroup(const Bulk &myBulk)
Setup information of wellGroup.
Definition: AllWells.cpp:76
void CalProdWeight(const Bulk &myBulk)
Calculate Prodweight.
Definition: AllWells.cpp:214
USI GetIndex(const string &name) const
Return the index of specified well.
Definition: AllWells.cpp:379
void Setup(const Grid &myGrid, const Bulk &myBulk)
Setup well in allWells.
Definition: AllWells.cpp:58
void PrepareWell(const Bulk &myBulk)
Calculate well properties at the beginning of each time step.
Definition: AllWells.cpp:174
void CalResFIM(ResFIM &resFIM, const Bulk &myBulk, const OCP_DBL &dt) const
Calculate Resiual and relative Resiual for FIM.
Definition: AllWells.cpp:572
void CalReInjFluid(const Bulk &myBulk)
Calculate Reinjection fluid.
Definition: AllWells.cpp:273
void InputParam(const ParamWell &paramWell)
Input param from ParamWell.
Definition: AllWells.cpp:19
void CalCFL(const Bulk &myBulk, const OCP_DBL &dt) const
Calculate the CFL number for each perforation and return the maximum one.
Definition: AllWells.cpp:439
void AssemblaMatAIMs(LinearSystem &myLS, const Bulk &myBulk, const OCP_DBL &dt) const
Assemble matrix, parts related to well are included for AIMt.
Definition: AllWells.cpp:706
Physical information of each active reservoir bulk.
Definition: Bulk.hpp:58
const vector< Mixture * > & GetMixture() const
Return flash results (it has not been used by far).
Definition: Bulk.hpp:153
USI GetComNum() const
Return the number of components.
Definition: Bulk.hpp:147
Basic information of computational grid, including the rock properties.
Definition: Grid.hpp:76
Linear solvers for discrete systems.
void EnlargeRowCap(const OCP_USI &row, const USI &n)
Enlarge row capacity.
vector< Solvent > solSet
Sets of Solvent.
Definition: ParamWell.hpp:105
vector< OCP_DBL > criticalTime
Records the critical time given by users.
Definition: ParamWell.hpp:104
vector< WellParam > well
Contains all the information of wells.
Definition: ParamWell.hpp:103
Definition: Well.hpp:49