addressing comments from OPM/opm-common#1695

This commit is contained in:
Kai Bao 2020-04-17 00:36:13 +02:00
parent 251c09a288
commit 954e5e769a
4 changed files with 17 additions and 9 deletions

View File

@ -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) {

View File

@ -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,

View File

@ -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;
}

View File

@ -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);
}
}
}