diff --git a/opm/simulators/wells/SegmentState.cpp b/opm/simulators/wells/SegmentState.cpp index 06a59e677..ca815d2e0 100644 --- a/opm/simulators/wells/SegmentState.cpp +++ b/opm/simulators/wells/SegmentState.cpp @@ -60,15 +60,16 @@ std::size_t SegmentState::size() const { } -void SegmentState::scale_pressure(double bhp) { +void SegmentState::scale_pressure(const double bhp) { if (this->empty()) throw std::logic_error("Tried to pressure scale empty SegmentState"); - auto scale_factor = bhp / this->pressure[0]; + const auto pressure_change = bhp - this->pressure[0]; + std::transform(this->pressure.begin(), this->pressure.end(), this->pressure.begin(), - [scale_factor] (const double& p) { return p*scale_factor;}); + [pressure_change] (const double& p) { return p + pressure_change;}); } const std::vector& SegmentState::segment_number() const {