mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #3572 from bska/prune-deactivated-anconn
Prune Analytic Aquifer Connections to Deactivated Cells
This commit is contained in:
@@ -222,16 +222,18 @@ void EclGenericCpGridVanguard<ElementMapper,GridView,Scalar>::doCreateGrids_(Ecl
|
||||
}
|
||||
|
||||
#if HAVE_MPI
|
||||
grid_.reset(new Dune::CpGrid(EclGenericVanguard::comm()));
|
||||
this->grid_ = std::make_unique<Dune::CpGrid>(EclGenericVanguard::comm());
|
||||
#else
|
||||
grid_.reset(new Dune::CpGrid());
|
||||
this->grid_ = std::make_unique<Dune::CpGrid>();
|
||||
#endif
|
||||
|
||||
const auto& removed_cells = grid_->processEclipseFormat(input_grid,
|
||||
&eclState,
|
||||
/*isPeriodic=*/false,
|
||||
/*flipNormals=*/false,
|
||||
/*clipZ=*/false);
|
||||
// Note: removed_cells is guaranteed to be empty on ranks other than 0.
|
||||
auto removed_cells =
|
||||
this->grid_->processEclipseFormat(input_grid,
|
||||
&eclState,
|
||||
/*isPeriodic=*/false,
|
||||
/*flipNormals=*/false,
|
||||
/*clipZ=*/false);
|
||||
|
||||
if (mpiRank == 0) {
|
||||
const auto& active_porv = eclState.fieldProps().porv(false);
|
||||
@@ -252,7 +254,6 @@ void EclGenericCpGridVanguard<ElementMapper,GridView,Scalar>::doCreateGrids_(Ecl
|
||||
volume_unit,
|
||||
100 * removed_pore_volume / total_pore_volume));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
cartesianIndexMapper_ = std::make_unique<CartesianIndexMapper>(*grid_);
|
||||
@@ -262,8 +263,10 @@ void EclGenericCpGridVanguard<ElementMapper,GridView,Scalar>::doCreateGrids_(Ecl
|
||||
const bool has_numerical_aquifer = eclState.aquifer().hasNumericalAquifer();
|
||||
int mpiSize = 1;
|
||||
MPI_Comm_size(grid_->comm(), &mpiSize);
|
||||
// when there is numerical aquifers, new NNC are generated during grid processing
|
||||
// we need to pass the NNC from root process to other processes
|
||||
|
||||
// when there is numerical aquifers, new NNC are generated during
|
||||
// grid processing we need to pass the NNC from root process to
|
||||
// other processes
|
||||
if (has_numerical_aquifer && mpiSize > 1) {
|
||||
auto nnc_input = eclState.getInputNNC();
|
||||
EclMpiSerializer ser(grid_->comm());
|
||||
@@ -275,12 +278,14 @@ void EclGenericCpGridVanguard<ElementMapper,GridView,Scalar>::doCreateGrids_(Ecl
|
||||
}
|
||||
#endif
|
||||
|
||||
// we use separate grid objects: one for the calculation of the initial condition
|
||||
// via EQUIL and one for the actual simulation. The reason is that the EQUIL code
|
||||
// is allergic to distributed grids and the simulation grid is distributed before
|
||||
// the initial condition is calculated.
|
||||
// After loadbalance grid_ will contain a global and distribute view.
|
||||
// equilGrid_being a shallow copy only the global view.
|
||||
// We use separate grid objects: one for the calculation of the initial
|
||||
// condition via EQUIL and one for the actual simulation. The reason is
|
||||
// that the EQUIL code is allergic to distributed grids and the
|
||||
// simulation grid is distributed before the initial condition is
|
||||
// calculated.
|
||||
//
|
||||
// After loadbalance, grid_ will contain a global and distribute view.
|
||||
// equilGrid_ being a shallow copy only the global view.
|
||||
if (mpiRank == 0)
|
||||
{
|
||||
equilGrid_.reset(new Dune::CpGrid(*grid_));
|
||||
@@ -290,6 +295,22 @@ void EclGenericCpGridVanguard<ElementMapper,GridView,Scalar>::doCreateGrids_(Ecl
|
||||
auto &field_props = eclState.fieldProps();
|
||||
const_cast<FieldPropsManager&>(field_props).reset_actnum(actnum);
|
||||
}
|
||||
|
||||
{
|
||||
auto size = removed_cells.size();
|
||||
|
||||
this->grid_->comm().broadcast(&size, 1, 0);
|
||||
|
||||
if (mpiRank != 0) {
|
||||
removed_cells.resize(size);
|
||||
}
|
||||
|
||||
this->grid_->comm().broadcast(removed_cells.data(), size, 0);
|
||||
}
|
||||
|
||||
// Inform the aquifer object that we might have removed/deactivated
|
||||
// cells as part of minimum pore-volume threshold processing.
|
||||
eclState.pruneDeactivatedAquiferConnections(removed_cells);
|
||||
}
|
||||
|
||||
template<class ElementMapper, class GridView, class Scalar>
|
||||
|
||||
Reference in New Issue
Block a user