22#define OPM_BLACKOILWELLMODEL_GASLIFT_IMPL_HEADER_INCLUDED
23#define OPM_BLACKOILWELLMODEL_GASLIFT_IMPL_HEADER_INCLUDED
26#ifndef OPM_BLACKOILWELLMODEL_GASLIFT_HEADER_INCLUDED
28#include <opm/simulators/wells/BlackoilWellModelGasLift.hpp>
30#include <opm/common/TimingMacros.hpp>
31#include <opm/simulators/wells/GasLiftSingleWell.hpp>
32#include <opm/simulators/utils/DeferredLoggingErrorHelpers.hpp>
35#include <opm/simulators/utils/MPISerializer.hpp>
40template<
typename TypeTag>
42BlackoilWellModelGasLift<TypeTag>::
43maybeDoGasLiftOptimize(
const Simulator& simulator,
47 WellStateType& wellState,
52 const auto&
glo = simulator.vanguard().schedule().glo(simulator.episodeIndex());
91 simulator.vanguard().schedule(),
92 simulator.vanguard().summaryState(),
93 simulator.episodeIndex(),
94 simulator.model().newtonMethod().numIterations(),
98 simulator.vanguard().grid().comm(),
103 gasLiftOptimizationStage1(simulator,
113 this->gasLiftOptimizationStage2(simulator.vanguard().gridView().comm(),
114 simulator.vanguard().schedule(),
115 simulator.vanguard().summaryState(),
122 simulator.episodeIndex(),
125 if constexpr (glift_debug) {
126 std::vector<WellInterfaceGeneric<Scalar, IndexTraits>*>
wc;
129 std::back_inserter(
wc),
131 { return static_cast<WellInterfaceGeneric<Scalar, IndexTraits>*>(w.get()); });
132 this->gliftDebugShowALQ(
wc,
142template<
typename TypeTag>
144BlackoilWellModelGasLift<TypeTag>::
145gasLiftOptimizationStage1(
const Simulator& simulator,
147 WellStateType& wellState,
156 auto comm = simulator.vanguard().grid().comm();
186 if (comm.rank() == i) {
191 gasLiftOptimizationStage1SingleWell(well.get(),
221 if (comm.rank() == i) {
223 auto [oil_rate, gas_rate, water_rate, alq] =
group_info.getRates(
idx);
238 Parallel::MpiSerializer
ser(comm);
242 if (comm.rank() != i) {
251 if constexpr (glift_debug) {
253 if (comm.rank() == i) {
254 counter = wellState.gliftGetDebugCounter();
257 if (comm.rank() != i) {
258 wellState.gliftSetDebugCounter(
counter);
268template<
typename TypeTag>
270BlackoilWellModelGasLift<TypeTag>::
272 const Simulator& simulator,
273 WellStateType& wellState,
283 const auto&
summary_state = simulator.vanguard().summaryState();
284 auto glift = std::make_unique<GasLiftSingleWell<TypeTag>>(*well,
292 simulator.vanguard().gridView().comm(),
294 auto state =
glift->runOptimize(simulator.model().newtonMethod().numIterations());
303template<
typename TypeTag>
305BlackoilWellModelGasLift<TypeTag>::
306initGliftEclWellMap(
const std::vector<WellInterfacePtr>&
well_container,
310 ecl_well_map.try_emplace(well->name(), &well->wellEcl(), well->indexOfWell());
314template<
typename TypeTag>
316BlackoilWellModelGasLift<TypeTag>::
317updateWellPotentials(
const Simulator& simulator,
320 WellStateType& wellState,
324 const int np = wellState.numPhases();
326 auto exc_type = ExceptionType::NONE;
328 if (well->isInjector() || !well->wellEcl().predictionMode())
338 auto&
ws = wellState.well(well->indexOfWell());
339 for (
int p = 0;
p <
np; ++
p) {
352 if (
exc_type != ExceptionType::NONE) {
353 const std::string
msg =
"Updating well potentials after network balancing failed. Continue with current potentials";
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition blackoilbioeffectsmodules.hh:43
constexpr auto getPropValue()
get the value data member of a property
Definition propertysystem.hh:240