From 351181f3558a5dc0d2ebef962ac7cf3b0e10355f Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Tue, 10 Jan 2023 12:37:34 +0100 Subject: [PATCH 1/4] add missing WellSegments.hpp includes --- opm/simulators/utils/ParallelSerialization.cpp | 1 + opm/simulators/wells/BlackoilWellModelRestart.cpp | 1 + opm/simulators/wells/MultisegmentWellEquations.cpp | 2 ++ opm/simulators/wells/MultisegmentWellEval.cpp | 2 ++ opm/simulators/wells/MultisegmentWellGeneric.cpp | 1 + opm/simulators/wells/MultisegmentWellPrimaryVariables.cpp | 2 ++ opm/simulators/wells/MultisegmentWellSegments.cpp | 1 + opm/simulators/wells/WellState.cpp | 1 + tests/test_ParallelSerialization.cpp | 1 + tests/test_wellstate.cpp | 1 + 10 files changed, 13 insertions(+) diff --git a/opm/simulators/utils/ParallelSerialization.cpp b/opm/simulators/utils/ParallelSerialization.cpp index 2962af16b..3e8a42b3c 100644 --- a/opm/simulators/utils/ParallelSerialization.cpp +++ b/opm/simulators/utils/ParallelSerialization.cpp @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include diff --git a/opm/simulators/wells/BlackoilWellModelRestart.cpp b/opm/simulators/wells/BlackoilWellModelRestart.cpp index 03b84f53b..e6a3cc45a 100644 --- a/opm/simulators/wells/BlackoilWellModelRestart.cpp +++ b/opm/simulators/wells/BlackoilWellModelRestart.cpp @@ -24,6 +24,7 @@ #include #include +#include #include diff --git a/opm/simulators/wells/MultisegmentWellEquations.cpp b/opm/simulators/wells/MultisegmentWellEquations.cpp index e73c2ea41..bf9d14b35 100644 --- a/opm/simulators/wells/MultisegmentWellEquations.cpp +++ b/opm/simulators/wells/MultisegmentWellEquations.cpp @@ -26,6 +26,8 @@ #include +#include + #include #include #include diff --git a/opm/simulators/wells/MultisegmentWellEval.cpp b/opm/simulators/wells/MultisegmentWellEval.cpp index efc70b50c..ea3966a89 100644 --- a/opm/simulators/wells/MultisegmentWellEval.cpp +++ b/opm/simulators/wells/MultisegmentWellEval.cpp @@ -22,6 +22,8 @@ #include +#include + #include #include diff --git a/opm/simulators/wells/MultisegmentWellGeneric.cpp b/opm/simulators/wells/MultisegmentWellGeneric.cpp index d1432c50c..532317144 100644 --- a/opm/simulators/wells/MultisegmentWellGeneric.cpp +++ b/opm/simulators/wells/MultisegmentWellGeneric.cpp @@ -24,6 +24,7 @@ #include #include +#include #include #include diff --git a/opm/simulators/wells/MultisegmentWellPrimaryVariables.cpp b/opm/simulators/wells/MultisegmentWellPrimaryVariables.cpp index 981a19115..10b00cc5f 100644 --- a/opm/simulators/wells/MultisegmentWellPrimaryVariables.cpp +++ b/opm/simulators/wells/MultisegmentWellPrimaryVariables.cpp @@ -22,6 +22,8 @@ #include #include +#include + #include #include diff --git a/opm/simulators/wells/MultisegmentWellSegments.cpp b/opm/simulators/wells/MultisegmentWellSegments.cpp index e420f5f4c..a12098d3e 100644 --- a/opm/simulators/wells/MultisegmentWellSegments.cpp +++ b/opm/simulators/wells/MultisegmentWellSegments.cpp @@ -23,6 +23,7 @@ #include +#include #include #include diff --git a/opm/simulators/wells/WellState.cpp b/opm/simulators/wells/WellState.cpp index ffb75ae0c..7180e482e 100644 --- a/opm/simulators/wells/WellState.cpp +++ b/opm/simulators/wells/WellState.cpp @@ -23,6 +23,7 @@ #include #include +#include #include #include diff --git a/tests/test_ParallelSerialization.cpp b/tests/test_ParallelSerialization.cpp index 016a6a545..3d575f574 100644 --- a/tests/test_ParallelSerialization.cpp +++ b/tests/test_ParallelSerialization.cpp @@ -72,6 +72,7 @@ #include #include #include +#include #include #include #include diff --git a/tests/test_wellstate.cpp b/tests/test_wellstate.cpp index 5cc16a34b..3c6718a15 100644 --- a/tests/test_wellstate.cpp +++ b/tests/test_wellstate.cpp @@ -41,6 +41,7 @@ #include #include #include +#include #include #include #include From 61d485cbe5a28b4f233f7d41a0ce4b166fb492c7 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Thu, 12 Jan 2023 14:12:45 +0100 Subject: [PATCH 2/4] remove unimplemented prototypes --- opm/simulators/wells/MultisegmentWell.hpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/opm/simulators/wells/MultisegmentWell.hpp b/opm/simulators/wells/MultisegmentWell.hpp index a65aba9d3..390c64c16 100644 --- a/opm/simulators/wells/MultisegmentWell.hpp +++ b/opm/simulators/wells/MultisegmentWell.hpp @@ -165,11 +165,6 @@ namespace Opm // regularize msw equation bool regularize_; - // components of the pressure drop to be included - WellSegments::CompPressureDrop compPressureDrop() const; - // multi-phase flow model - WellSegments::MultiPhaseModel multiphaseModel() const; - // the intial amount of fluids in each segment under surface condition std::vector > segment_fluid_initial_; From 1bf36dfc0831f9912d967622f8c7e8429361d799 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Thu, 12 Jan 2023 14:23:22 +0100 Subject: [PATCH 3/4] MultisegmentWell: move code using WellSegments to compile unit --- .../wells/MultisegmentWellGeneric.cpp | 21 +++++++++++++++++++ .../wells/MultisegmentWellGeneric.hpp | 4 ++++ .../wells/MultisegmentWell_impl.hpp | 14 +++---------- 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/opm/simulators/wells/MultisegmentWellGeneric.cpp b/opm/simulators/wells/MultisegmentWellGeneric.cpp index 532317144..2a1497a84 100644 --- a/opm/simulators/wells/MultisegmentWellGeneric.cpp +++ b/opm/simulators/wells/MultisegmentWellGeneric.cpp @@ -182,6 +182,27 @@ accelerationalPressureLossConsidered() const return (segmentSet().compPressureDrop() == WellSegments::CompPressureDrop::HFA); } + +template +double +MultisegmentWellGeneric::getSegmentDp(const int seg, + const double density, + const std::vector& seg_dp) const +{ + const double segment_depth = this->segmentSet()[seg].depth(); + const int outlet_segment_index = this->segmentNumberToIndex(this->segmentSet()[seg].outletSegment()); + const double segment_depth_outlet = seg == 0 ? baseif_.refDepth() : this->segmentSet()[outlet_segment_index].depth(); + double dp = wellhelpers::computeHydrostaticCorrection(segment_depth_outlet, segment_depth, + density, baseif_.gravity()); + // we add the hydrostatic correction from the outlet segment + // in order to get the correction all the way to the bhp ref depth. + if (seg > 0) { + dp += seg_dp[outlet_segment_index]; + } + + return dp; +} + template class MultisegmentWellGeneric; } // namespace Opm diff --git a/opm/simulators/wells/MultisegmentWellGeneric.hpp b/opm/simulators/wells/MultisegmentWellGeneric.hpp index 39c31a480..68f449a76 100644 --- a/opm/simulators/wells/MultisegmentWellGeneric.hpp +++ b/opm/simulators/wells/MultisegmentWellGeneric.hpp @@ -72,6 +72,10 @@ protected: bool accelerationalPressureLossConsidered() const; bool frictionalPressureLossConsidered() const; + double getSegmentDp(const int seg, + const double density, + const std::vector& seg_dp) const; + const WellInterfaceGeneric& baseif_; }; diff --git a/opm/simulators/wells/MultisegmentWell_impl.hpp b/opm/simulators/wells/MultisegmentWell_impl.hpp index c5226d487..6c63ed729 100644 --- a/opm/simulators/wells/MultisegmentWell_impl.hpp +++ b/opm/simulators/wells/MultisegmentWell_impl.hpp @@ -1246,20 +1246,12 @@ namespace Opm std::fill(this->ipr_b_.begin(), this->ipr_b_.end(), 0.); const int nseg = this->numberOfSegments(); - const double ref_depth = this->ref_depth_; std::vector seg_dp(nseg, 0.0); for (int seg = 0; seg < nseg; ++seg) { // calculating the perforation rate for each perforation that belongs to this segment - const double segment_depth = this->segmentSet()[seg].depth(); - const int outlet_segment_index = this->segmentNumberToIndex(this->segmentSet()[seg].outletSegment()); - const double segment_depth_outlet = seg == 0? ref_depth : this->segmentSet()[outlet_segment_index].depth(); - double dp = wellhelpers::computeHydrostaticCorrection(segment_depth_outlet, segment_depth, - this->segments_.density(seg).value(), this->gravity_); - // we add the hydrostatic correction from the outlet segment - // in order to get the correction all the way to the bhp ref depth. - if (seg > 0) { - dp += seg_dp[outlet_segment_index]; - } + const double dp = this->getSegmentDp(seg, + this->segments_.density(seg).value(), + seg_dp); seg_dp[seg] = dp; for (const int perf : this->segments_.perforations()[seg]) { std::vector mob(this->num_components_, 0.0); From 0c91d6f6c13ec2f1f7fdbc0eba1aacbf60279612 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Thu, 12 Jan 2023 14:26:00 +0100 Subject: [PATCH 4/4] MultisegmentWellGeneric.hpp: forward WellSegments --- opm/simulators/wells/MultisegmentWellGeneric.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/opm/simulators/wells/MultisegmentWellGeneric.hpp b/opm/simulators/wells/MultisegmentWellGeneric.hpp index 68f449a76..273b48bd6 100644 --- a/opm/simulators/wells/MultisegmentWellGeneric.hpp +++ b/opm/simulators/wells/MultisegmentWellGeneric.hpp @@ -22,8 +22,6 @@ #ifndef OPM_MULTISEGMENTWELL_GENERIC_HEADER_INCLUDED #define OPM_MULTISEGMENTWELL_GENERIC_HEADER_INCLUDED -#include - #include #include #include @@ -35,6 +33,8 @@ namespace Opm class DeferredLogger; class SummaryState; class WellInterfaceGeneric; +enum class WellSegmentCompPressureDrop; +class WellSegments; class WellState; template @@ -61,7 +61,7 @@ protected: void scaleSegmentPressuresWithBhp(WellState& well_state) const; // components of the pressure drop to be included - WellSegments::CompPressureDrop compPressureDrop() const; + WellSegmentCompPressureDrop compPressureDrop() const; /// Detect oscillation or stagnation based on the residual measure history void detectOscillations(const std::vector& measure_history,