adding computeConnectionPressureDelta to StandardWell

it is also copied from WellDensitySegmented while only handle one
Standard Well.
This commit is contained in:
Kai Bao 2017-06-23 16:32:43 +02:00
parent 9514e44d13
commit 0f997a537a
4 changed files with 49 additions and 0 deletions

View File

@ -179,6 +179,8 @@ namespace Opm
using WellInterface<TypeTag>::active_;
using WellInterface<TypeTag>::phase_usage_;
using WellInterface<TypeTag>::first_perf_;
using WellInterface<TypeTag>::ref_depth_;
using WellInterface<TypeTag>::perf_depth_;
// densities of the fluid in each perforation
std::vector<double> perf_densities_;
@ -227,6 +229,8 @@ namespace Opm
const std::vector<double>& rsmax_perf,
const std::vector<double>& rvmax_perf,
const std::vector<double>& surf_dens_perf);
void computeConnectionPressureDelta();
};
}

View File

@ -1622,4 +1622,44 @@ namespace Opm
}
}
template<typename TypeTag>
void
StandardWell<TypeTag>::
computeConnectionPressureDelta()
{
// Algorithm:
// We'll assume the perforations are given in order from top to
// bottom for each well. By top and bottom we do not necessarily
// mean in a geometric sense (depth), but in a topological sense:
// the 'top' perforation is nearest to the surface topologically.
// Our goal is to compute a pressure delta for each perforation.
// 1. Compute pressure differences between perforations.
// dp_perf will contain the pressure difference between a
// perforation and the one above it, except for the first
// perforation for each well, for which it will be the
// difference to the reference (bhp) depth.
const int nperf = numberOfPerforations();
perf_pressure_diffs_.resize(nperf, 0.0);
for (int perf = 0; perf < nperf; ++perf) {
const double z_above = perf == 0 ? ref_depth_ : perf_depth_[perf - 1];
const double dz = perf_depth_[perf] - z_above;
perf_pressure_diffs_[perf] = dz * perf_densities_[perf] * gravity_;
}
// 2. Compute pressure differences to the reference point (bhp) by
// accumulating the already computed adjacent pressure
// differences, storing the result in dp_perf.
// This accumulation must be done per well.
const auto beg = perf_pressure_diffs_.begin();
const auto end = perf_pressure_diffs_.end();
std::partial_sum(beg, end, beg);
}
}

View File

@ -180,6 +180,9 @@ namespace Opm
// depth for each perforation
std::vector<double> perf_depth_;
// reference depth for the BHP
int ref_depth_;
double well_efficiency_factor_;
// cell index for each well perforation

View File

@ -60,6 +60,8 @@ namespace Opm
well_controls_ = wells->ctrls[index_well];
ref_depth_ = wells->depth_ref[index_well];
// perforations related
{
const int perf_index_begin = wells->well_connpos[index_well];