Bugfix and simplification of cartesian mapping.

We already have the mapping available, and using the equilGrid() is only valid
on rank 0.
This commit is contained in:
Atgeirr Flø Rasmussen 2022-08-17 14:13:13 +02:00
parent 1ca731a388
commit c94ff12e4c

View File

@ -1235,12 +1235,6 @@ namespace Opm {
getMaxWellConnections() const getMaxWellConnections() const
{ {
std::vector<std::vector<int>> wells; std::vector<std::vector<int>> wells;
// Create cartesian to compressed mapping
const EquilGrid& equilGrid = ebosSimulator_.vanguard().equilGrid();
const auto& globalCell = equilGrid.globalCell();
auto cartMap = cartesianToCompressed(grid().size(0),
globalCell.data());
auto schedule_wells = schedule().getWellsatEnd(); auto schedule_wells = schedule().getWellsatEnd();
schedule_wells.erase(std::remove_if(schedule_wells.begin(), schedule_wells.end(), not_on_process_), schedule_wells.end()); schedule_wells.erase(std::remove_if(schedule_wells.begin(), schedule_wells.end(), not_on_process_), schedule_wells.end());
@ -1256,12 +1250,7 @@ namespace Opm {
for (const auto& connection: well.getConnections()) for (const auto& connection: well.getConnections())
{ {
const size_t i = size_t(connection.getI()); const int compressed_idx = compressedIndexForInterior(connection.global_index());
const size_t j = size_t(connection.getJ());
const size_t k = size_t(connection.getK());
const size_t index = this->eclState_.gridDims().getGlobalIndex(i, j, k);
int compressed_idx = cartMap[index];
if ( compressed_idx >= 0 ) // Ignore completions in inactive/remote cells. if ( compressed_idx >= 0 ) // Ignore completions in inactive/remote cells.
{ {
compressed_well_perforations.push_back(compressed_idx); compressed_well_perforations.push_back(compressed_idx);