From 954e5e769a9bd28faa8ed68c5f96de975a46c5f3 Mon Sep 17 00:00:00 2001 From: Kai Bao Date: Fri, 17 Apr 2020 00:36:13 +0200 Subject: [PATCH] addressing comments from OPM/opm-common#1695 --- opm/simulators/wells/BlackoilWellModel_impl.hpp | 3 ++- .../wells/WellStateFullyImplicitBlackoil.hpp | 14 +++++++++----- tests/test_ParallelRestart.cpp | 3 ++- tests/test_wellstatefullyimplicitblackoil.cpp | 6 ++++-- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/opm/simulators/wells/BlackoilWellModel_impl.hpp b/opm/simulators/wells/BlackoilWellModel_impl.hpp index 4c5250d8c..34ac1f22f 100644 --- a/opm/simulators/wells/BlackoilWellModel_impl.hpp +++ b/opm/simulators/wells/BlackoilWellModel_impl.hpp @@ -1664,7 +1664,8 @@ namespace Opm { const int segment_index = segment_set.segmentNumberToIndex(segment.first); // recovering segment rates and pressure from the restart values - state.segPress()[top_segment_index + segment_index] = segment.second.pressure; + const auto pres_idx = Opm::data::SegmentPressures::Value::Pressure; + state.segPress()[top_segment_index + segment_index] = segment.second.pressures[pres_idx]; const auto& segment_rates = segment.second.rates; for (int p = 0; p < np; ++p) { diff --git a/opm/simulators/wells/WellStateFullyImplicitBlackoil.hpp b/opm/simulators/wells/WellStateFullyImplicitBlackoil.hpp index 660a837b3..9e9ceadec 100644 --- a/opm/simulators/wells/WellStateFullyImplicitBlackoil.hpp +++ b/opm/simulators/wells/WellStateFullyImplicitBlackoil.hpp @@ -1122,11 +1122,15 @@ namespace Opm const auto* rate = &this->segRates()[seg_dof * this->numPhases()]; - seg_res.pressure = this->segPress()[seg_dof]; - seg_res.pressure_drop = this->segPressDrop()[seg_dof]; - seg_res.pressure_drop_hydrostatic = this->segPressDropHydroStatic()[seg_dof]; - seg_res.pressure_drop_friction = this->segPressDropFriction()[seg_dof]; - seg_res.pressure_drop_acceleration = this->segPressDropAcceleration()[seg_dof]; + { + using Value =::Opm::data::SegmentPressures::Value; + auto& segpress = seg_res.pressures; + segpress[Value::Pressure] = this->segPress()[seg_dof]; + segpress[Value::PDrop] = this->segPressDrop()[seg_dof]; + segpress[Value::PDropHydrostatic] = this->segPressDropHydroStatic()[seg_dof]; + segpress[Value::PDropFriction] = this->segPressDropFriction()[seg_dof]; + segpress[Value::PDropAccel] = this->segPressDropAcceleration()[seg_dof]; + } if (pu.phase_used[Water]) { seg_res.rates.set(data::Rates::opt::wat, diff --git a/tests/test_ParallelRestart.cpp b/tests/test_ParallelRestart.cpp index 5b627ff47..c4cfcf9c6 100644 --- a/tests/test_ParallelRestart.cpp +++ b/tests/test_ParallelRestart.cpp @@ -173,7 +173,8 @@ Opm::data::Segment getSegment() Opm::data::Segment seg1; seg1.rates = getRates(); seg1.segNumber = 1; - seg1.pressure = 2.0; + const auto pres_idx = Opm::data::SegmentPressures::Value::Pressure; + seg1.pressures[pres_idx] = 2.0; return seg1; } diff --git a/tests/test_wellstatefullyimplicitblackoil.cpp b/tests/test_wellstatefullyimplicitblackoil.cpp index 5e191b538..24e485d85 100644 --- a/tests/test_wellstatefullyimplicitblackoil.cpp +++ b/tests/test_wellstatefullyimplicitblackoil.cpp @@ -261,7 +261,8 @@ BOOST_AUTO_TEST_CASE(Pressure) const auto& xseg = xw.segments.at(1); BOOST_CHECK_EQUAL(xseg.segNumber, 1); - BOOST_CHECK_CLOSE(xseg.pressure, prod01_first ? 100.0 : 0.0, 1.0e-10); + const auto pres_idx = Opm::data::SegmentPressures::Value::Pressure; + BOOST_CHECK_CLOSE(xseg.pressures[pres_idx], prod01_first ? 100.0 : 0.0, 1.0e-10); } { @@ -276,7 +277,8 @@ BOOST_AUTO_TEST_CASE(Pressure) const auto& xseg = xw.segments.at(segID + 1); BOOST_CHECK_EQUAL(xseg.segNumber, segID + 1); - BOOST_CHECK_CLOSE(xseg.pressure, pressTop + 1.0*segID, 1.0e-10); + const auto pres_idx = Opm::data::SegmentPressures::Value::Pressure; + BOOST_CHECK_CLOSE(xseg.pressures[pres_idx], pressTop + 1.0*segID, 1.0e-10); } } }