64 static const uint64_t event_mask = ScheduleEvents::WELL_STATUS_CHANGE + ScheduleEvents::PRODUCTION_UPDATE + ScheduleEvents::INJECTION_UPDATE;
66 static const int Water = BlackoilPhases::Aqua;
67 static const int Oil = BlackoilPhases::Liquid;
68 static const int Gas = BlackoilPhases::Vapour;
79 std::size_t size()
const
81 return this->wells_.size();
84 std::vector<std::string> wells()
const
86 return this->wells_.wells();
104 const int report_step,
109 void resize(
const std::vector<Well>&
wells_ecl,
113 const std::size_t numCells,
117 void setCurrentWellRates(
const std::string& wellName,
120 auto& [owner, rates] = this->well_rates.at(wellName);
125 const std::vector<Scalar>& currentWellRates(
const std::string& wellName)
const;
127 bool hasWellRates(
const std::string& wellName)
const
129 return this->well_rates.find(wellName) != this->well_rates.end();
132 void clearWellRates()
134 this->well_rates.clear();
137 void gatherVectorsOnRoot(
const std::vector<data::Connection>&
from_connections,
139 const Parallel::Communication& comm)
const;
145 void reportConnections(std::vector<data::Connection>&
connections,
147 std::size_t well_index,
154 static void calculateSegmentRates(
const std::vector<std::vector<int>>&
segment_inlets,
const
162 void communicateGroupRates(
const Parallel::Communication& comm);
164 void updateGlobalIsGrup(
const Parallel::Communication& comm);
166 bool isInjectionGrup(
const std::string& name)
const
168 return this->global_well_info.value().in_injecting_group(name);
171 bool isProductionGrup(
const std::string& name)
const
173 return this->global_well_info.value().in_producing_group(name);
176 bool isOpen(
const std::string& name)
const
178 return this->global_well_info.value().is_open(name);
181 Scalar getALQ(
const std::string& name)
const
183 return this->alq_state.get(name);
186 void setALQ(
const std::string& name, Scalar value)
188 this->alq_state.set(name, value);
191 int gliftGetDebugCounter()
193 return this->alq_state.get_debug_counter();
196 void gliftSetDebugCounter(
int value)
198 return this->alq_state.set_debug_counter(value);
201 int gliftUpdateDebugCounter()
203 return this->alq_state.update_debug_counter();
206 bool gliftCheckAlqOscillation(
const std::string &name)
const
208 return this->alq_state.oscillation(name);
211 int gliftGetAlqDecreaseCount(
const std::string &name)
213 return this->alq_state.get_decrement_count(name);
216 int gliftGetAlqIncreaseCount(
const std::string &name)
218 return this->alq_state.get_increment_count(name);
221 void gliftUpdateAlqIncreaseCount(
const std::string &name,
bool increase)
223 this->alq_state.update_count(name, increase);
226 void gliftTimeStepInit()
228 this->alq_state.reset_count();
235 void updateWellsDefaultALQ(
const Schedule& schedule,
236 const int report_step,
239 int wellNameToGlobalIdx(
const std::string& name)
241 return this->global_well_info.value().well_index(name);
244 std::string globalIdxToWellName(
const int index)
246 return this->global_well_info.value().well_name(index);
249 bool wellIsOwned(std::size_t well_index,
250 const std::string& wellName)
const;
252 bool wellIsOwned(
const std::string& wellName)
const;
254 void updateStatus(
int well_index,
WellStatus status);
256 void openWell(
int well_index);
257 void shutWell(
int well_index);
258 void stopWell(
int well_index);
263 return this->phase_usage_.num_phases;
268 return this->phase_usage_;
273 {
return this->wells_[well_index].surface_rates; }
274 const std::vector<Scalar>&
wellRates(std::size_t well_index)
const
275 {
return this->wells_[well_index].surface_rates; }
277 const std::string& name(std::size_t well_index)
const
279 return this->wells_.well_name(well_index);
282 std::optional<std::size_t> index(
const std::string& well_name)
const
284 return this->wells_.well_index(well_name);
289 return this->wells_[well_index];
294 return this->wells_[well_name];
299 return this->wells_[well_index];
304 return this->wells_[well_name];
309 return this->operator[](well_index);
314 return this->operator[](well_name);
319 return this->operator[](well_index);
324 return this->operator[](well_name);
327 bool has(
const std::string& well_name)
const
329 return this->wells_.has(well_name);
332 bool operator==(
const WellState&)
const;
334 template<
class Serializer>
342 std::size_t size = 0;
344 if (size != wells_.size()) {
345 OPM_THROW(std::runtime_error,
"Error deserializing WellState: size mismatch");
348 for (
auto&
w : wells_) {
354 PhaseUsage phase_usage_;
367 std::optional<GlobalWellInfo> global_well_info;
373 std::map<std::string, std::pair<bool, std::vector<Scalar>>> well_rates;
376 reportSegmentResults(
const int well_id,
393 void initSingleWell(
const std::vector<Scalar>&
cellPressures,
400 void initSingleProducer(
const Well& well,
402 Scalar pressure_first_connection,
406 void initSingleInjector(
const Well& well,
408 Scalar pressure_first_connection,
void init(const std::vector< Scalar > &cellPressures, const std::vector< Scalar > &cellTemperatures, const Schedule &schedule, const std::vector< Well > &wells_ecl, const std::vector< std::reference_wrapper< ParallelWellInfo< Scalar > > > ¶llel_well_info, const int report_step, const WellState *prevState, const std::vector< std::vector< PerforationData< Scalar > > > &well_perf_data, const SummaryState &summary_state)
Allocate and initialize if wells is non-null.
Definition WellState.cpp:259