From 15380fd3709a171d104ebd573c67187bc14ab045 Mon Sep 17 00:00:00 2001 From: Kai Bao Date: Thu, 21 Apr 2016 18:03:16 +0200 Subject: [PATCH] moving variableWellStateIndices to StandardWells Probably it is the time to introduce SeqQs and SeqP for the multi-segment wells. --- opm/autodiff/BlackoilModelBase.hpp | 3 --- opm/autodiff/BlackoilModelBase_impl.hpp | 20 +------------------ opm/autodiff/BlackoilMultiSegmentModel.hpp | 2 +- .../BlackoilMultiSegmentModel_impl.hpp | 2 +- opm/autodiff/StandardWells.hpp | 2 ++ opm/autodiff/StandardWells_impl.hpp | 18 +++++++++++++++++ 6 files changed, 23 insertions(+), 24 deletions(-) diff --git a/opm/autodiff/BlackoilModelBase.hpp b/opm/autodiff/BlackoilModelBase.hpp index 23d3437ad..301b637ed 100644 --- a/opm/autodiff/BlackoilModelBase.hpp +++ b/opm/autodiff/BlackoilModelBase.hpp @@ -363,9 +363,6 @@ namespace Opm { std::vector variableStateIndices() const; - std::vector - variableWellStateIndices() const; - SolutionState variableStateExtractVars(const ReservoirState& x, const std::vector& indices, diff --git a/opm/autodiff/BlackoilModelBase_impl.hpp b/opm/autodiff/BlackoilModelBase_impl.hpp index 0765a0f0e..97a495c06 100644 --- a/opm/autodiff/BlackoilModelBase_impl.hpp +++ b/opm/autodiff/BlackoilModelBase_impl.hpp @@ -612,24 +612,6 @@ namespace detail { - template - std::vector - BlackoilModelBase:: - variableWellStateIndices() const - { - // Black oil model standard is 5 equation. - // For the pure well solve, only the well equations are picked. - std::vector indices(5, -1); - int next = 0; - indices[Qs] = next++; - indices[Bhp] = next++; - assert(next == 2); - return indices; - } - - - - template typename BlackoilModelBase::SolutionState @@ -1092,7 +1074,7 @@ namespace detail { V aliveWells; const int np = wells().number_of_phases; std::vector cq_s(np, ADB::null()); - std::vector indices = variableWellStateIndices(); + std::vector indices = asImpl().stdWells().variableWellStateIndices(); SolutionState state0 = state; WellState well_state0 = well_state; asImpl().makeConstantState(state0); diff --git a/opm/autodiff/BlackoilMultiSegmentModel.hpp b/opm/autodiff/BlackoilMultiSegmentModel.hpp index 3ff7094b2..76dd8befd 100644 --- a/opm/autodiff/BlackoilMultiSegmentModel.hpp +++ b/opm/autodiff/BlackoilMultiSegmentModel.hpp @@ -223,7 +223,7 @@ namespace Opm { using Base::convergenceReduction; using Base::maxResidualAllowed; using Base::variableState; - using Base::variableWellStateIndices; + // using Base::variableWellStateIndices; using Base::asImpl; const std::vector& wellsMultiSegment() const { return wells_multisegment_; } diff --git a/opm/autodiff/BlackoilMultiSegmentModel_impl.hpp b/opm/autodiff/BlackoilMultiSegmentModel_impl.hpp index c87c2c7ac..3741d4a15 100644 --- a/opm/autodiff/BlackoilMultiSegmentModel_impl.hpp +++ b/opm/autodiff/BlackoilMultiSegmentModel_impl.hpp @@ -1559,7 +1559,7 @@ namespace Opm { V aliveWells; const int np = wells().number_of_phases; std::vector cq_s(np, ADB::null()); - std::vector indices = variableWellStateIndices(); + std::vector indices = stdWells().variableWellStateIndices(); SolutionState state0 = state; WellState well_state0 = well_state; makeConstantState(state0); diff --git a/opm/autodiff/StandardWells.hpp b/opm/autodiff/StandardWells.hpp index 0f894a242..0e41ef5fa 100644 --- a/opm/autodiff/StandardWells.hpp +++ b/opm/autodiff/StandardWells.hpp @@ -185,6 +185,8 @@ namespace Opm { int& next) const; + std::vector + variableWellStateIndices() const; protected: bool wells_active_; diff --git a/opm/autodiff/StandardWells_impl.hpp b/opm/autodiff/StandardWells_impl.hpp index 44a2afb73..24fc8f8a6 100644 --- a/opm/autodiff/StandardWells_impl.hpp +++ b/opm/autodiff/StandardWells_impl.hpp @@ -1130,4 +1130,22 @@ namespace Opm indices[Bhp] = next++; } + + + + + std::vector + StandardWells::variableWellStateIndices() const + { + // Black oil model standard is 5 equation. + // For the pure well solve, only the well equations are picked. + std::vector indices(5, -1); + int next = 0; + + variableStateWellIndices(indices, next); + + assert(next == 2); + return indices; + } + }