From 5b528d6f44e06f911bd5c947d7166016555d0099 Mon Sep 17 00:00:00 2001 From: Markus Blatt Date: Tue, 18 Mar 2025 22:22:33 +0100 Subject: [PATCH] Allow insertion entry into ALQState for a well. Needed when switching an injector to a producer. --- opm/simulators/wells/ALQState.cpp | 6 ++++++ opm/simulators/wells/ALQState.hpp | 1 + opm/simulators/wells/WellState.hpp | 4 ++++ 3 files changed, 11 insertions(+) diff --git a/opm/simulators/wells/ALQState.cpp b/opm/simulators/wells/ALQState.cpp index 50921fe439..7037c67116 100644 --- a/opm/simulators/wells/ALQState.cpp +++ b/opm/simulators/wells/ALQState.cpp @@ -41,6 +41,12 @@ ALQState ALQState::serializationTestObject() return result; } +template +void ALQState::insert(const std::string& wname) +{ + this->current_alq_.emplace(wname, 0.0); +} + template Scalar ALQState::get(const std::string& wname) const { diff --git a/opm/simulators/wells/ALQState.hpp b/opm/simulators/wells/ALQState.hpp index 111e4397ed..404d5118de 100644 --- a/opm/simulators/wells/ALQState.hpp +++ b/opm/simulators/wells/ALQState.hpp @@ -37,6 +37,7 @@ public: Scalar get(const std::string& wname) const; void update_default(const std::string& wname, Scalar value); + void insert(const std::string& wname); void set(const std::string& wname, Scalar value); bool oscillation(const std::string& wname) const; void update_count(const std::string& wname, bool increase); diff --git a/opm/simulators/wells/WellState.hpp b/opm/simulators/wells/WellState.hpp index 4310995d49..bba0872c8e 100644 --- a/opm/simulators/wells/WellState.hpp +++ b/opm/simulators/wells/WellState.hpp @@ -277,6 +277,10 @@ public: void shutWell(int well_index); void stopWell(int well_index); + void switchToProducer(const std::string& name) { + alq_state.insert(name); + } + /// The number of phases present. int numPhases() const {