mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-12-28 02:00:59 -06:00
Merge pull request #3835 from GitPaean/scaling_segment_pressure
using addition to update segment pressure when bhp is changed
This commit is contained in:
commit
6394c89f77
@ -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<int>& SegmentState::segment_number() const {
|
||||
|
@ -539,7 +539,7 @@ BOOST_AUTO_TEST_CASE(TESTSegmentState2) {
|
||||
segments.scale_pressure(bhp);
|
||||
|
||||
for (std::size_t i=0; i < segments.pressure.size(); i++)
|
||||
BOOST_CHECK_EQUAL(segments.pressure[i], 2*(i+1));
|
||||
BOOST_CHECK_EQUAL(segments.pressure[i], 1.+(i+1));
|
||||
|
||||
BOOST_CHECK_EQUAL( segments.size(), well.getSegments().size() );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user