From 1fb68c59e23359bfb0384006dff68929daff82df Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Mon, 31 May 2021 13:21:31 +0200 Subject: [PATCH] changed: move fluidsystem-only dependent method to WellInterfaceFluidSystem --- opm/simulators/wells/WellInterface.hpp | 2 -- .../wells/WellInterfaceFluidSystem.cpp | 17 +++++++++++++++ .../wells/WellInterfaceFluidSystem.hpp | 2 ++ opm/simulators/wells/WellInterface_impl.hpp | 21 ++----------------- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/opm/simulators/wells/WellInterface.hpp b/opm/simulators/wells/WellInterface.hpp index 26127ba4d..680cd0099 100644 --- a/opm/simulators/wells/WellInterface.hpp +++ b/opm/simulators/wells/WellInterface.hpp @@ -294,8 +294,6 @@ protected: int flowPhaseToEbosCompIdx( const int phaseIdx ) const; - int flowPhaseToEbosPhaseIdx( const int phaseIdx ) const; - int ebosCompIdxToFlowCompIdx( const unsigned compIdx ) const; double wpolymer() const; diff --git a/opm/simulators/wells/WellInterfaceFluidSystem.cpp b/opm/simulators/wells/WellInterfaceFluidSystem.cpp index 1391ef203..eaff72ad6 100644 --- a/opm/simulators/wells/WellInterfaceFluidSystem.cpp +++ b/opm/simulators/wells/WellInterfaceFluidSystem.cpp @@ -899,6 +899,23 @@ checkMaxRatioLimitWell(const WellState& well_state, return (well_ratio > max_ratio_limit); } +template +int +WellInterfaceFluidSystem:: +flowPhaseToEbosPhaseIdx(const int phaseIdx) const +{ + const auto& pu = this->phaseUsage(); + if (FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx) && pu.phase_pos[Water] == phaseIdx) + return FluidSystem::waterPhaseIdx; + if (FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx) && pu.phase_pos[Oil] == phaseIdx) + return FluidSystem::oilPhaseIdx; + if (FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx) && pu.phase_pos[Gas] == phaseIdx) + return FluidSystem::gasPhaseIdx; + + // for other phases return the index + return phaseIdx; +} + template class WellInterfaceFluidSystem>; template class WellInterfaceFluidSystem>; diff --git a/opm/simulators/wells/WellInterfaceFluidSystem.hpp b/opm/simulators/wells/WellInterfaceFluidSystem.hpp index 72be56e8c..ada2b8e6b 100644 --- a/opm/simulators/wells/WellInterfaceFluidSystem.hpp +++ b/opm/simulators/wells/WellInterfaceFluidSystem.hpp @@ -50,6 +50,8 @@ public: WellTestState& wellTestState, DeferredLogger& deferred_logger) const; + int flowPhaseToEbosPhaseIdx(const int phaseIdx) const; + protected: using RateConverterType = RateConverter:: SurfaceToReservoirVoidage>; diff --git a/opm/simulators/wells/WellInterface_impl.hpp b/opm/simulators/wells/WellInterface_impl.hpp index 66f3596da..1d9e96bb4 100644 --- a/opm/simulators/wells/WellInterface_impl.hpp +++ b/opm/simulators/wells/WellInterface_impl.hpp @@ -91,23 +91,6 @@ namespace Opm return phaseIdx; } - template - int - WellInterface:: - flowPhaseToEbosPhaseIdx( const int phaseIdx ) const - { - const auto& pu = this->phaseUsage(); - if (FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx) && pu.phase_pos[Water] == phaseIdx) - return FluidSystem::waterPhaseIdx; - if (FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx) && pu.phase_pos[Oil] == phaseIdx) - return FluidSystem::oilPhaseIdx; - if (FluidSystem::phaseIsActive(FluidSystem::gasPhaseIdx) && pu.phase_pos[Gas] == phaseIdx) - return FluidSystem::gasPhaseIdx; - - // for other phases return the index - return phaseIdx; - } - template int WellInterface:: @@ -1008,11 +991,11 @@ namespace Opm const double well_tw_fraction = this->well_index_[perf] / total_tw; double total_mobility = 0.0; for (int p = 0; p < np; ++p) { - int ebosPhaseIdx = flowPhaseToEbosPhaseIdx(p); + int ebosPhaseIdx = this->flowPhaseToEbosPhaseIdx(p); total_mobility += fs.invB(ebosPhaseIdx).value() * intQuants.mobility(ebosPhaseIdx).value(); } for (int p = 0; p < np; ++p) { - int ebosPhaseIdx = flowPhaseToEbosPhaseIdx(p); + int ebosPhaseIdx = this->flowPhaseToEbosPhaseIdx(p); scaling_factor[p] += well_tw_fraction * fs.invB(ebosPhaseIdx).value() * intQuants.mobility(ebosPhaseIdx).value() / total_mobility; } }