diff --git a/opm/simulators/wells/BlackoilWellModel.hpp b/opm/simulators/wells/BlackoilWellModel.hpp index af610bfb9..d385e6ac4 100644 --- a/opm/simulators/wells/BlackoilWellModel.hpp +++ b/opm/simulators/wells/BlackoilWellModel.hpp @@ -281,6 +281,8 @@ namespace Opm { std::vector well_container_; // map from logically cartesian cell indices to compressed ones + // cells not in the interior are not mapped. This deactivates + // these for distributed wells and make the distribution non-overlapping. std::vector cartesian_to_compressed_; std::vector is_cell_perforated_; diff --git a/opm/simulators/wells/BlackoilWellModel_impl.hpp b/opm/simulators/wells/BlackoilWellModel_impl.hpp index f662db354..e83047706 100644 --- a/opm/simulators/wells/BlackoilWellModel_impl.hpp +++ b/opm/simulators/wells/BlackoilWellModel_impl.hpp @@ -1606,8 +1606,15 @@ namespace Opm { { cartesian_to_compressed_.resize(number_of_cartesian_cells, -1); if (global_cell) { + auto elemIt = ebosSimulator_.gridView().template begin(); for (unsigned i = 0; i < local_num_cells_; ++i) { - cartesian_to_compressed_[global_cell[i]] = i; + // Skip perforations in the overlap/ghost for distributed wells. + if (elemIt->partitionType() == Dune::InteriorEntity) + { + assert(ebosSimulator_.gridView().indexSet().index(*elemIt) == static_cast(i)); + cartesian_to_compressed_[global_cell[i]] = i; + } + ++elemIt; } } else {