From d7e6886f4bce8882ab6a0929292d593334ba587c Mon Sep 17 00:00:00 2001 From: Markus Blatt Date: Thu, 24 Sep 2015 14:47:45 +0200 Subject: [PATCH] Return 0 as hydrostatic correction for unperforated cells. There might be wells without any perforations. It it happens to be the last well will supscript over the bounds. In other cases we actually return the correction for the next well. Not sure whether returning 0 makes any sense, though. --- opm/autodiff/BlackoilModelBase_impl.hpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/opm/autodiff/BlackoilModelBase_impl.hpp b/opm/autodiff/BlackoilModelBase_impl.hpp index c4dbf9f49..41a5e7424 100644 --- a/opm/autodiff/BlackoilModelBase_impl.hpp +++ b/opm/autodiff/BlackoilModelBase_impl.hpp @@ -1236,6 +1236,14 @@ namespace detail { inline double computeHydrostaticCorrection(const Wells& wells, const int w, double vfp_ref_depth, const ADB::V& well_perforation_densities, const double gravity) { + if ( wells.well_connpos[w] == wells.well_connpos[w+1] ) + { + // This is a well with no perforations. + // If this is the last well we would subscript over the + // bounds below. + // we assume well_perforation_densities to be 0 + return 0; + } const double well_ref_depth = wells.depth_ref[w]; const double dh = vfp_ref_depth - well_ref_depth; const int perf = wells.well_connpos[w];