Only filter in filterConnections_ on root process.

When filterConnections_ is called the grid is not load
balanced, yet. Currently that means that grid() will also return the
unbalanced grid and all processes will see the whole global grid.

We will change semantics of the unbalanced grid soon: Only the root
process will see the whole grid and the others will see an empty
partition of it. Hence filtering on this partition will remove all
connections on all wells in the schedule for non-root processes and
produce wrong results.

For non-root process the filtering needs to be done on the load
balanced grid. This is accomplished by this commit.
This commit is contained in:
Markus Blatt 2019-11-14 23:41:17 +01:00
parent 2a5c93356c
commit bc98b20118

View File

@ -196,6 +196,15 @@ public:
grid_->switchToDistributedView();
cartesianIndexMapper_.reset();
if ( ! equilGrid_ )
{
// for processes that do not hold the global grid we filter here using the local grid.
// If we would filter in filterConnection_ our partition would be empty and the connections of all
// wells would be removed.
const auto eclipseGrid = Opm::UgGridHelpers::createEclipseGrid(grid(), this->eclState().getInputGrid());
this->schedule().filterConnections(eclipseGrid);
}
}
#endif
@ -275,18 +284,15 @@ protected:
// removing some connection located in inactive grid cells
void filterConnections_()
{
// We only filter if we hold the global grid. Otherwise the filtering
// is done after load balancing as in the future the other processes
// will hold an empty partition for the global grid and hence filtering
// here would remove all well connections.
if (equilGrid_)
{
const auto eclipseGrid = Opm::UgGridHelpers::createEclipseGrid(equilGrid(), this->eclState().getInputGrid());
this->schedule().filterConnections(eclipseGrid);
}
else
{
// for the other processes we filter using the local grid since there
// are models with connections specified to inactive cells
const auto eclipseGrid = Opm::UgGridHelpers::createEclipseGrid(grid(), this->eclState().getInputGrid());
this->schedule().filterConnections(eclipseGrid);
}
}
std::unique_ptr<Grid> grid_;