fix hydrostatic correction for branched wells in IPR

This commit is contained in:
Tor Harald Sandve
2022-06-07 14:14:59 +02:00
parent 3adaa1b987
commit 46c8aa3306

View File

@@ -1227,14 +1227,20 @@ namespace Opm
std::fill(this->ipr_b_.begin(), this->ipr_b_.end(), 0.);
const int nseg = this->numberOfSegments();
double seg_bhp_press_diff = 0;
double ref_depth = this->ref_depth_;
const double ref_depth = this->ref_depth_;
std::vector<double> seg_dp(nseg, 0.0);
for (int seg = 0; seg < nseg; ++seg) {
// calculating the perforation rate for each perforation that belongs to this segment
const double segment_depth = this->segmentSet()[seg].depth();
const double dp = wellhelpers::computeHydrostaticCorrection(ref_depth, segment_depth, this->segment_densities_[seg].value(), this->gravity_);
ref_depth = segment_depth;
seg_bhp_press_diff += dp;
const int outlet_segment_index = this->segmentNumberToIndex(this->segmentSet()[seg].outletSegment());
const double segment_depth_outlet = seg == 0? ref_depth : this->segmentSet()[outlet_segment_index].depth();
double dp = wellhelpers::computeHydrostaticCorrection(segment_depth_outlet, segment_depth, this->segment_densities_[seg].value(), this->gravity_);
// we add the hydrostatic correction from the outlet segment
// in order to get the correction all the way to the bhp ref depth.
if (seg > 0) {
dp += seg_dp[outlet_segment_index];
}
seg_dp[seg] = dp;
for (const int perf : this->segment_perforations_[seg]) {
std::vector<Scalar> mob(this->num_components_, 0.0);
@@ -1262,7 +1268,7 @@ namespace Opm
}
// the pressure difference between the connection and BHP
const double h_perf = cell_perf_press_diff + perf_seg_press_diff + seg_bhp_press_diff;
const double h_perf = cell_perf_press_diff + perf_seg_press_diff + dp;
const double pressure_diff = pressure_cell - h_perf;
// do not take into consideration the crossflow here.