diff --git a/opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp b/opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp index 08e552c41..4362b991d 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp @@ -565,7 +565,9 @@ public: bool segmented_density_calculation() const { return true; } double alq_value() const; double temperature() const; + bool hasInjected( ) const; bool hasProduced( ) const; + bool updateHasInjected( ); bool updateHasProduced(); bool cmp_structure(const Well& other) const; bool operator==(const Well& data) const; @@ -595,6 +597,7 @@ public: serializer(efficiency_factor); serializer(solvent_fraction); serializer(has_produced); + serializer(has_injected); serializer(prediction_mode); serializer(productivity_index); serializer(econ_limits); @@ -632,6 +635,7 @@ private: double efficiency_factor; double solvent_fraction; bool has_produced = false; + bool has_injected = false; bool prediction_mode = true; std::optional productivity_index{ std::nullopt }; diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/KeywordHandlers.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/KeywordHandlers.cpp index 91e53dbb5..2cb5461ab 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/KeywordHandlers.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/KeywordHandlers.cpp @@ -953,6 +953,9 @@ namespace { if (well2->updatePrediction(true)) update_well = true; + if (well2->updateHasInjected()) + update_well = true; + if (update_well) { this->updateWell(well2, handlerContext.currentStep); m_events.addEvent( ScheduleEvents::INJECTION_UPDATE , handlerContext.currentStep ); @@ -1012,6 +1015,9 @@ namespace { if (well2->updatePrediction(false)) update_well = true; + if (well2->updateHasInjected()) + update_well = true; + if (update_well) { this->updateWell(well2, handlerContext.currentStep); m_events.addEvent( ScheduleEvents::INJECTION_UPDATE , handlerContext.currentStep ); diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp index d8152e305..0fb82e734 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp @@ -510,6 +510,17 @@ bool Well::updateHasProduced() { return false; } +bool Well::updateHasInjected() { + if (this->wtype.injector() && this->status == Status::OPEN) { + if (this->has_injected) + return false; + + this->has_injected= true; + return true; + } + return false; +} + bool Well::updateProduction(std::shared_ptr production_arg) { if (!this->wtype.producer()) this->switchToProducer( ); @@ -1142,6 +1153,10 @@ bool Well::hasProduced( ) const { return this->has_produced; } +bool Well::hasInjected( ) const { + return this->has_injected; +} + bool Well::updatePrediction(bool prediction_mode_arg) { if (this->prediction_mode != prediction_mode_arg) {