From 4df94af7f06de8290c8e7f65151ebdfc90ea8564 Mon Sep 17 00:00:00 2001 From: Markus Blatt Date: Tue, 18 Mar 2025 22:24:41 +0100 Subject: [PATCH] Allow preparing injector containers of PerfData after construction. Needed to be able to switch producers to injectors during ACTIONX. --- opm/simulators/wells/PerfData.cpp | 14 ++++++++++---- opm/simulators/wells/PerfData.hpp | 5 +++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/opm/simulators/wells/PerfData.cpp b/opm/simulators/wells/PerfData.cpp index d8d776c82b..76e91abd6b 100644 --- a/opm/simulators/wells/PerfData.cpp +++ b/opm/simulators/wells/PerfData.cpp @@ -51,13 +51,19 @@ PerfData::PerfData(const std::size_t num_perf, , ecl_index(num_perf) { if (injector) { - this->water_throughput.resize(num_perf); - this->skin_pressure.resize(num_perf); - this->water_velocity.resize(num_perf); - this->filtrate_data.resize(num_perf); + prepareInjectorContainers(); } } +template +void PerfData::prepareInjectorContainers() +{ + auto num_perf = pressure.size(); + this->water_throughput.resize(num_perf); + this->skin_pressure.resize(num_perf); + this->water_velocity.resize(num_perf); + this->filtrate_data.resize(num_perf); +} template PerfData PerfData::serializationTestObject() { diff --git a/opm/simulators/wells/PerfData.hpp b/opm/simulators/wells/PerfData.hpp index 1c00251077..c3b99d3938 100644 --- a/opm/simulators/wells/PerfData.hpp +++ b/opm/simulators/wells/PerfData.hpp @@ -48,6 +48,11 @@ public: bool empty() const; bool try_assign(const PerfData& other); + /// \brief Make containers valid for injectors + /// + /// Needed if a producer is switched to an injector, + void prepareInjectorContainers(); + template void serializeOp(Serializer& serializer) {