22 template<
typename TypeTag>
23 GasLiftSingleWell<TypeTag>::
24 GasLiftSingleWell(
const StdWell &std_well,
25 const Simulator &ebos_simulator,
26 const SummaryState &summary_state,
27 DeferredLogger &deferred_logger,
28 WellState &well_state,
29 const GroupState &group_state,
30 GasLiftGroupInfo &group_info,
31 GLiftSyncGroups &sync_groups
35 : GasLiftSingleWellGeneric(
42 ebos_simulator.vanguard().schedule(),
43 ebos_simulator.episodeIndex(),
46 , ebos_simulator_{ebos_simulator}
49 const auto& gl_well = *gl_well_;
50 if(useFixedAlq_(gl_well)) {
51 updateWellStateAlqFixedValue_(gl_well);
52 this->optimize_ =
false;
55 setAlqMaxRate_(gl_well);
56 this->optimize_ =
true;
59 const auto& pu = std_well_.phaseUsage();
60 this->oil_pos_ = pu.phase_pos[Oil];
61 this->gas_pos_ = pu.phase_pos[Gas];
62 this->water_pos_ = pu.phase_pos[Water];
67 this->orig_alq_ = this->well_state_.getALQ(this->well_name_);
69 setAlqMinRate_(gl_well);
73 this->alpha_w_ = gl_well.weight_factor();
74 if (this->alpha_w_ <= 0 ) {
75 displayWarning_(
"Nonpositive value for alpha_w ignored");
85 this->alpha_g_ = gl_well.inc_weight_factor();
89 this->max_iterations_ = 1000;
97 template<
typename TypeTag>
99 GasLiftSingleWell<TypeTag>::
101 double bhp, std::vector<double> &potentials,
bool debug_output)
const
105 std::fill(potentials.begin(), potentials.end(), 0.0);
106 this->std_well_.computeWellRatesWithBhp(
107 this->ebos_simulator_, bhp, potentials, this->deferred_logger_);
109 const std::string msg = fmt::format(
"computed well potentials given bhp {}, "
110 "oil: {}, gas: {}, water: {}", bhp,
111 -potentials[this->oil_pos_], -potentials[this->gas_pos_],
112 -potentials[this->water_pos_]);
113 displayDebugMessage_(msg);
117 template<
typename TypeTag>
118 std::optional<double>
119 GasLiftSingleWell<TypeTag>::
120 computeBhpAtThpLimit_(
double alq)
const
122 auto bhp_at_thp_limit = this->std_well_.computeBhpAtThpLimitProdWithAlq(
123 this->ebos_simulator_,
124 this->summary_state_,
125 this->deferred_logger_,
127 if (bhp_at_thp_limit) {
128 if (*bhp_at_thp_limit < this->controls_.bhp_limit) {
129 const std::string msg = fmt::format(
130 "Computed bhp ({}) from thp limit is below bhp limit ({}), (ALQ = {})."
131 " Using bhp limit instead",
132 *bhp_at_thp_limit, this->controls_.bhp_limit, alq);
133 displayDebugMessage_(msg);
134 bhp_at_thp_limit = this->controls_.bhp_limit;
139 const std::string msg = fmt::format(
140 "Failed in getting converged bhp potential from thp limit (ALQ = {})", alq);
141 displayDebugMessage_(msg);
143 return bhp_at_thp_limit;
146 template<
typename TypeTag>
148 GasLiftSingleWell<TypeTag>::
149 setAlqMaxRate_(
const GasLiftOpt::Well &well)
151 auto& max_alq_optional = well.max_rate();
152 if (max_alq_optional) {
155 this->max_alq_ = *max_alq_optional;
161 const auto& table = std_well_.vfp_properties_->getProd()->getTable(
162 this->controls_.vfp_table_number);
163 const auto& alq_values = table.getALQAxis();
166 this->max_alq_ = alq_values.back();
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: BlackoilPhases.hpp:26