Use well index for segment acceleration pressure loss

This commit is contained in:
Joakim Hove 2021-05-27 08:34:10 +02:00
parent 960de96d75
commit a1b45b06e4
3 changed files with 10 additions and 10 deletions

View File

@ -2043,8 +2043,7 @@ namespace Opm
const double sign = mass_rate < 0. ? 1.0 : - 1.0;
accelerationPressureLoss *= sign;
auto top_segment_index = well_state.topSegmentIndex(this->index_of_well_);
well_state.segPressDropAcceleration()[top_segment_index + seg] = accelerationPressureLoss.value();
well_state.segPressDropAcceleration(index_of_well_)[seg] = accelerationPressureLoss.value();
resWell_[seg][SPres] -= accelerationPressureLoss.value();
duneD_[seg][seg][SPres][SPres] -= accelerationPressureLoss.derivative(SPres + numEq);
@ -2707,9 +2706,10 @@ namespace Opm
auto seg_press_drop = well_state.segPressDrop(index_of_well_);
auto seg_press_friction = well_state.segPressDropFriction(index_of_well_);
auto seg_press_static = well_state.segPressDropHydroStatic(index_of_well_);
auto seg_press_accel = well_state.segPressDropAcceleration(index_of_well_);
seg_press_drop[seg] = seg_press_static[seg] +
seg_press_friction[seg] +
well_state.segPressDropAcceleration()[seg];
seg_press_accel[seg];
}
}

View File

@ -1151,8 +1151,6 @@ WellState::reportSegmentResults(const PhaseUsage& pu,
const int seg_no) const
{
auto seg_res = data::Segment{};
const auto seg_dof =
this->topSegmentIndex(well_id) + seg_ix;
{
using Value = data::SegmentPressures::Value;
auto& segpress = seg_res.pressures;
@ -1160,7 +1158,7 @@ WellState::reportSegmentResults(const PhaseUsage& pu,
segpress[Value::PDrop] = this->segPressDrop(well_id)[seg_ix];
segpress[Value::PDropHydrostatic] = this->segPressDropHydroStatic(well_id)[seg_ix];
segpress[Value::PDropFriction] = this->segPressDropFriction(well_id)[seg_ix];
segpress[Value::PDropAccel] = this->segPressDropAcceleration()[seg_dof];
segpress[Value::PDropAccel] = this->segPressDropAcceleration(well_id)[seg_ix];
}
const auto segment_rates = this->segRates(well_id);

View File

@ -253,14 +253,16 @@ public:
return &seg_pressdrop_hydorstatic_[top_segment_index];
}
std::vector<double>& segPressDropAcceleration()
double * segPressDropAcceleration(std::size_t well_index)
{
return seg_pressdrop_acceleration_;
const int top_segment_index = this->top_segment_index_[well_index];
return &seg_pressdrop_acceleration_[top_segment_index];
}
const std::vector<double>& segPressDropAcceleration() const
const double* segPressDropAcceleration(std::size_t well_index) const
{
return seg_pressdrop_acceleration_;
const int top_segment_index = this->top_segment_index_[well_index];
return &seg_pressdrop_acceleration_[top_segment_index];
}
int numSegment() const