From 412e561cd8b50819d8b4a4aad16fe985a1d8c040 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Tue, 8 Nov 2022 07:09:51 +0100 Subject: [PATCH] move updateWellStateFromPrimaryVariablesPolyMW to StandardWellPrimaryVariables --- opm/simulators/wells/StandardWellEval.cpp | 17 ----------------- opm/simulators/wells/StandardWellEval.hpp | 2 -- .../wells/StandardWellPrimaryVariables.cpp | 17 +++++++++++++++++ .../wells/StandardWellPrimaryVariables.hpp | 4 ++++ opm/simulators/wells/StandardWell_impl.hpp | 2 +- 5 files changed, 22 insertions(+), 20 deletions(-) diff --git a/opm/simulators/wells/StandardWellEval.cpp b/opm/simulators/wells/StandardWellEval.cpp index 3f0af3950..9ac4d5dda 100644 --- a/opm/simulators/wells/StandardWellEval.cpp +++ b/opm/simulators/wells/StandardWellEval.cpp @@ -557,23 +557,6 @@ updateWellStateFromPrimaryVariables(WellState& well_state, well_state, deferred_logger); } -template -void -StandardWellEval:: -updateWellStateFromPrimaryVariablesPolyMW(WellState& well_state) const -{ - if (baseif_.isInjector()) { - auto& ws = well_state.well(baseif_.indexOfWell()); - auto& perf_data = ws.perf_data; - auto& perf_water_velocity = perf_data.water_velocity; - auto& perf_skin_pressure = perf_data.skin_pressure; - for (int perf = 0; perf < baseif_.numPerfs(); ++perf) { - perf_water_velocity[perf] = primary_variables_.value_[Bhp + 1 + perf]; - perf_skin_pressure[perf] = primary_variables_.value_[Bhp + 1 + baseif_.numPerfs() + perf]; - } - } -} - template void StandardWellEval:: diff --git a/opm/simulators/wells/StandardWellEval.hpp b/opm/simulators/wells/StandardWellEval.hpp index 10e4fa73a..0d0f21900 100644 --- a/opm/simulators/wells/StandardWellEval.hpp +++ b/opm/simulators/wells/StandardWellEval.hpp @@ -134,8 +134,6 @@ protected: const double dFLimit, const double dBHPLimit) const; - void updateWellStateFromPrimaryVariablesPolyMW(WellState& well_state) const; - mutable PrimaryVariables primary_variables_; //!< Primary variables for well // the saturations in the well bore under surface conditions at the beginning of the time step diff --git a/opm/simulators/wells/StandardWellPrimaryVariables.cpp b/opm/simulators/wells/StandardWellPrimaryVariables.cpp index 7f75916e0..b82d7777b 100644 --- a/opm/simulators/wells/StandardWellPrimaryVariables.cpp +++ b/opm/simulators/wells/StandardWellPrimaryVariables.cpp @@ -33,6 +33,7 @@ #include #include +#include namespace Opm { @@ -78,6 +79,22 @@ updatePolyMW(const BVectorWell& dwells) } } +template +void StandardWellPrimaryVariables:: +copyToWellStatePolyMW(WellState& well_state) const +{ + if (well_.isInjector()) { + auto& ws = well_state.well(well_.indexOfWell()); + auto& perf_data = ws.perf_data; + auto& perf_water_velocity = perf_data.water_velocity; + auto& perf_skin_pressure = perf_data.skin_pressure; + for (int perf = 0; perf < well_.numPerfs(); ++perf) { + perf_water_velocity[perf] = value_[Bhp + 1 + perf]; + perf_skin_pressure[perf] = value_[Bhp + 1 + well_.numPerfs() + perf]; + } + } +} + #define INSTANCE(...) \ template class StandardWellPrimaryVariables,__VA_ARGS__,double>; diff --git a/opm/simulators/wells/StandardWellPrimaryVariables.hpp b/opm/simulators/wells/StandardWellPrimaryVariables.hpp index dcf69d4c9..4f237a2b8 100644 --- a/opm/simulators/wells/StandardWellPrimaryVariables.hpp +++ b/opm/simulators/wells/StandardWellPrimaryVariables.hpp @@ -33,6 +33,7 @@ namespace Opm { template class WellInterfaceIndices; +class WellState; //! \brief Class holding primary variables for StandardWell. template @@ -109,6 +110,9 @@ public: //! \brief Update polymer molecular weight values from solution vector. void updatePolyMW(const BVectorWell& dwells); + //! \brief Copy values to well state. + void copyToWellStatePolyMW(WellState& well_state) const; + private: const WellInterfaceIndices& well_; //!< Reference to well interface diff --git a/opm/simulators/wells/StandardWell_impl.hpp b/opm/simulators/wells/StandardWell_impl.hpp index dcf3933ac..ebbbbb2c3 100644 --- a/opm/simulators/wells/StandardWell_impl.hpp +++ b/opm/simulators/wells/StandardWell_impl.hpp @@ -995,7 +995,7 @@ namespace Opm // other primary variables related to polymer injectivity study if constexpr (Base::has_polymermw) { - this->updateWellStateFromPrimaryVariablesPolyMW(well_state); + this->primary_variables_.copyToWellStatePolyMW(well_state); } }