OpenCAEPoro  v0.5.0
A simulator for multicomponent porous media flow
WellOpt.cpp
Go to the documentation of this file.
1 
12 // OpenCAEPoro header files
13 #include "WellOpt.hpp"
14 
16 {
17  if (optParam.type == "INJ") {
18  type = INJ;
19  } else if (optParam.type == "PROD") {
20  type = PROD;
21  } else {
22  OCP_ABORT("Wrong well type!");
23  }
24 
25  if (type == INJ) {
26  fluidType = optParam.fluidType;
27  if (fluidType == "WAT" || fluidType == "WATER") {
28  fluidType = "WAT";
29  }
30  }
31 
32  if (optParam.state == "OPEN") {
33  state = OPEN;
34  } else if (optParam.state == "CLOSE") {
35  state = CLOSE;
36  } else {
37  OCP_ABORT("Wrong state type!");
38  }
39 
40  if (optParam.optMode == "RATE") {
41  optMode = RATE_MODE;
42  } else if (optParam.optMode == "ORAT") {
43  optMode = ORATE_MODE;
44  } else if (optParam.optMode == "GRAT") {
45  optMode = GRATE_MODE;
46  } else if (optParam.optMode == "WRAT") {
47  optMode = WRATE_MODE;
48  } else if (optParam.optMode == "LRAT") {
49  optMode = LRATE_MODE;
50  } else if (optParam.optMode == "BHP") {
51  optMode = BHP_MODE;
52  } else {
53  OCP_ABORT("Wrong well option mode!");
54  }
55 
56  initOptMode = optMode;
57  maxRate = optParam.maxRate;
58  maxBHP = optParam.maxBHP;
59  minBHP = optParam.minBHP;
60  injTemp = optParam.injTemp;
61 }
62 
64 {
65  if (this->type != opt.type) return OCP_TRUE;
66  if (this->state != opt.state) return OCP_TRUE;
67  if (this->optMode != opt.optMode) return OCP_TRUE;
68  if (this->initOptMode != opt.initOptMode) return OCP_TRUE;
69  if (fabs(this->maxRate - opt.maxRate) > TINY) return OCP_TRUE;
70  if (fabs(this->maxBHP - opt.maxBHP) > TINY) return OCP_TRUE;
71  if (fabs(this->minBHP - opt.minBHP) > TINY) return OCP_TRUE;
72  for (USI i = 0; i < injZi.size(); i++) {
73  if (fabs(injZi[i] - opt.injZi[i]) > TINY) return OCP_TRUE;
74  }
75  for (USI i = 0; i < this->prodPhaseWeight.size(); i++) {
76  if (fabs(this->prodPhaseWeight[i] - opt.prodPhaseWeight[i]) > TINY)
77  return OCP_TRUE;
78  }
79  if (this->injProdPhase != opt.injProdPhase) return OCP_TRUE;
80  if (fabs(this->injTemp - opt.injTemp) > TINY) return OCP_TRUE;
81  return OCP_FALSE;
82 }
83 
84 /*----------------------------------------------------------------------------*/
85 /* Brief Change History of This File */
86 /*----------------------------------------------------------------------------*/
87 /* Author Date Actions */
88 /*----------------------------------------------------------------------------*/
89 /* Shizhe Li NOV/22/2022 Create file */
90 /*----------------------------------------------------------------------------*/
const OCP_DBL TINY
Small constant.
Definition: OCPConst.hpp:38
unsigned int USI
Generic unsigned integer.
Definition: OCPConst.hpp:23
const USI LRATE_MODE
Well option = fixed fluid rate???
Definition: OCPConst.hpp:134
const USI WRATE_MODE
Well option = fixed water rate.
Definition: OCPConst.hpp:133
const OCP_BOOL OPEN
Well type = open.
Definition: OCPConst.hpp:126
const USI ORATE_MODE
Well option = fixed oil rate.
Definition: OCPConst.hpp:131
const USI RATE_MODE
Well option = fixed total rate???
Definition: OCPConst.hpp:130
const USI PROD
Well type = producer.
Definition: OCPConst.hpp:123
const USI INJ
Well type = injector.
Definition: OCPConst.hpp:122
const OCP_BOOL CLOSE
Well type = closed.
Definition: OCPConst.hpp:127
const USI BHP_MODE
Well option = fixed bottom-hole-pressure.
Definition: OCPConst.hpp:135
unsigned int OCP_BOOL
OCP_BOOL in OCP.
Definition: OCPConst.hpp:29
const USI GRATE_MODE
Well option = fixed gas rate.
Definition: OCPConst.hpp:132
#define OCP_ABORT(msg)
Abort if critical error happens.
Definition: UtilError.hpp:47
WellOpt class declaration.
OCP_DBL maxBHP
Maximum allowable pressure in the injection well.
Definition: ParamWell.hpp:39
string type
Type of well, injection or production?
Definition: ParamWell.hpp:33
string fluidType
Type of fluid into the injection well. (injection well only)
Definition: ParamWell.hpp:34
OCP_DBL injTemp
Temperature of injected fluid.
Definition: ParamWell.hpp:41
OCP_DBL maxRate
Maximum allowable flow rate into/out the well.
Definition: ParamWell.hpp:38
string optMode
Mode of well, Rate or BHP?
Definition: ParamWell.hpp:36
OCP_DBL minBHP
Minimum allowable pressure in the production well.
Definition: ParamWell.hpp:40
string state
State of well, open or close?
Definition: ParamWell.hpp:35
WellOpt()=default
Default constructor.
OCP_BOOL operator!=(const WellOpt &Opt) const
overload inequality
Definition: WellOpt.cpp:63