From 97f76412ae55b14f84f2389c3f26588a5d481bab Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Tue, 10 Jan 2023 12:37:34 +0100 Subject: [PATCH 1/3] add missing WellPolymerProperties.hpp includes --- opm/simulators/utils/ParallelSerialization.cpp | 1 + opm/simulators/wells/WellInterface_impl.hpp | 1 + 2 files changed, 2 insertions(+) diff --git a/opm/simulators/utils/ParallelSerialization.cpp b/opm/simulators/utils/ParallelSerialization.cpp index f7a03f348..9117a9e12 100644 --- a/opm/simulators/utils/ParallelSerialization.cpp +++ b/opm/simulators/utils/ParallelSerialization.cpp @@ -50,6 +50,7 @@ #include #include #include +#include #include #include diff --git a/opm/simulators/wells/WellInterface_impl.hpp b/opm/simulators/wells/WellInterface_impl.hpp index ccea224ea..d7c175759 100644 --- a/opm/simulators/wells/WellInterface_impl.hpp +++ b/opm/simulators/wells/WellInterface_impl.hpp @@ -22,6 +22,7 @@ #include #include +#include #include #include #include From f860490c9f517f87c5225df24bacaad23ed1e415 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Thu, 12 Jan 2023 15:15:42 +0100 Subject: [PATCH 2/3] WellInterface: move code using WellPolymerProperties to compile unit --- opm/simulators/wells/WellInterfaceGeneric.cpp | 15 +++++++++++++++ opm/simulators/wells/WellInterfaceGeneric.hpp | 1 + opm/simulators/wells/WellInterface_impl.hpp | 11 +---------- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/opm/simulators/wells/WellInterfaceGeneric.cpp b/opm/simulators/wells/WellInterfaceGeneric.cpp index 15b2d1732..3ba22d617 100644 --- a/opm/simulators/wells/WellInterfaceGeneric.cpp +++ b/opm/simulators/wells/WellInterfaceGeneric.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -467,4 +468,18 @@ double WellInterfaceGeneric::wsalt_() const } } +double WellInterfaceGeneric::wpolymer_() const +{ + auto injectorType = this->well_ecl_.injectorType(); + + if (injectorType == InjectorType::WATER) { + WellPolymerProperties polymer = this->well_ecl_.getPolymerProperties(); + const double polymer_injection_concentration = polymer.m_polymerConcentration; + return polymer_injection_concentration; + } else { + // Not a water injection well => no polymer. + return 0.0; + } +} + } // namespace Opm diff --git a/opm/simulators/wells/WellInterfaceGeneric.hpp b/opm/simulators/wells/WellInterfaceGeneric.hpp index 5b096bba3..7922cbb8f 100644 --- a/opm/simulators/wells/WellInterfaceGeneric.hpp +++ b/opm/simulators/wells/WellInterfaceGeneric.hpp @@ -199,6 +199,7 @@ protected: bool getAllowCrossFlow() const; double wfoam_() const; + double wpolymer_() const; double wsalt_() const; // definition of the struct OperabilityStatus diff --git a/opm/simulators/wells/WellInterface_impl.hpp b/opm/simulators/wells/WellInterface_impl.hpp index d7c175759..eb76386d2 100644 --- a/opm/simulators/wells/WellInterface_impl.hpp +++ b/opm/simulators/wells/WellInterface_impl.hpp @@ -97,16 +97,7 @@ namespace Opm wpolymer() const { if constexpr (has_polymer) { - auto injectorType = this->well_ecl_.injectorType(); - - if (injectorType == InjectorType::WATER) { - WellPolymerProperties polymer = this->well_ecl_.getPolymerProperties(); - const double polymer_injection_concentration = polymer.m_polymerConcentration; - return polymer_injection_concentration; - } else { - // Not a water injection well => no polymer. - return 0.0; - } + return this->wpolymer_(); } return 0.0; From d011bb29aef80cc0c10b9eb28add04dab0d3ce3f Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Fri, 13 Jan 2023 13:02:02 +0100 Subject: [PATCH 3/3] StandardWell: move code using WellPolymerProperties to compile unit --- opm/simulators/wells/StandardWell_impl.hpp | 6 +++--- opm/simulators/wells/WellInterfaceGeneric.cpp | 15 +++++++++++++++ opm/simulators/wells/WellInterfaceGeneric.hpp | 4 ++++ opm/simulators/wells/WellInterface_impl.hpp | 1 - 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/opm/simulators/wells/StandardWell_impl.hpp b/opm/simulators/wells/StandardWell_impl.hpp index 59902b57d..469ef0aa3 100644 --- a/opm/simulators/wells/StandardWell_impl.hpp +++ b/opm/simulators/wells/StandardWell_impl.hpp @@ -2056,7 +2056,7 @@ namespace Opm DeferredLogger& deferred_logger) const { if constexpr (Base::has_polymermw) { - const int water_table_id = this->well_ecl_.getPolymerProperties().m_skprwattable; + const int water_table_id = this->polymerWaterTable_(); if (water_table_id <= 0) { OPM_DEFLOG_THROW(std::runtime_error, fmt::format("Unused SKPRWAT table id used for well {}", name()), @@ -2094,7 +2094,7 @@ namespace Opm if (poly_inj_conc == 0.) { return sign * pskinwater(throughput, water_velocity_abs, deferred_logger); } - const int polymer_table_id = this->well_ecl_.getPolymerProperties().m_skprpolytable; + const int polymer_table_id = this->polymerTable_(); if (polymer_table_id <= 0) { OPM_DEFLOG_THROW(std::runtime_error, fmt::format("Unavailable SKPRPOLY table id used for well {}", name()), @@ -2133,7 +2133,7 @@ namespace Opm DeferredLogger& deferred_logger) const { if constexpr (Base::has_polymermw) { - const int table_id = this->well_ecl_.getPolymerProperties().m_plymwinjtable; + const int table_id = this->polymerInjTable_(); const auto& table_func = PolymerModule::getPlymwinjTable(table_id); const EvalWell throughput_eval(this->primary_variables_.numWellEq() + Indices::numEq, throughput); EvalWell molecular_weight(this->primary_variables_.numWellEq() + Indices::numEq, 0.); diff --git a/opm/simulators/wells/WellInterfaceGeneric.cpp b/opm/simulators/wells/WellInterfaceGeneric.cpp index 3ba22d617..67e69417c 100644 --- a/opm/simulators/wells/WellInterfaceGeneric.cpp +++ b/opm/simulators/wells/WellInterfaceGeneric.cpp @@ -482,4 +482,19 @@ double WellInterfaceGeneric::wpolymer_() const } } +int WellInterfaceGeneric::polymerTable_() const +{ + return this->well_ecl_.getPolymerProperties().m_skprpolytable; +} + +int WellInterfaceGeneric::polymerWaterTable_() const +{ + return this->well_ecl_.getPolymerProperties().m_skprwattable; +} + +int WellInterfaceGeneric::polymerInjTable_() const +{ + return this->well_ecl_.getPolymerProperties().m_plymwinjtable; +} + } // namespace Opm diff --git a/opm/simulators/wells/WellInterfaceGeneric.hpp b/opm/simulators/wells/WellInterfaceGeneric.hpp index 7922cbb8f..96cd7e1bf 100644 --- a/opm/simulators/wells/WellInterfaceGeneric.hpp +++ b/opm/simulators/wells/WellInterfaceGeneric.hpp @@ -202,6 +202,10 @@ protected: double wpolymer_() const; double wsalt_() const; + int polymerTable_() const; + int polymerInjTable_() const; + int polymerWaterTable_() const; + // definition of the struct OperabilityStatus struct OperabilityStatus { bool isOperableAndSolvable() const { diff --git a/opm/simulators/wells/WellInterface_impl.hpp b/opm/simulators/wells/WellInterface_impl.hpp index eb76386d2..4db38dae7 100644 --- a/opm/simulators/wells/WellInterface_impl.hpp +++ b/opm/simulators/wells/WellInterface_impl.hpp @@ -22,7 +22,6 @@ #include #include -#include #include #include #include