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/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 15b2d1732..67e69417c 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,33 @@ 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; + } +} + +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 5b096bba3..96cd7e1bf 100644 --- a/opm/simulators/wells/WellInterfaceGeneric.hpp +++ b/opm/simulators/wells/WellInterfaceGeneric.hpp @@ -199,8 +199,13 @@ protected: bool getAllowCrossFlow() const; double wfoam_() const; + 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 ccea224ea..4db38dae7 100644 --- a/opm/simulators/wells/WellInterface_impl.hpp +++ b/opm/simulators/wells/WellInterface_impl.hpp @@ -96,16 +96,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;