mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #3134 from GitPaean/using_pinched_grid_numerical_aquifers
Using pinched grid for numerical aquifers
This commit is contained in:
commit
763503d13c
@ -181,9 +181,6 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
void createGrids_()
|
void createGrids_()
|
||||||
{
|
{
|
||||||
const auto& gridProps = this->eclState().get3DProperties();
|
|
||||||
const std::vector<double>& porv = gridProps.getDoubleGridProperty("PORV").getData();
|
|
||||||
|
|
||||||
// we use separate grid objects: one for the calculation of the initial condition
|
// 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
|
// via EQUIL and one for the actual simulation. The reason is that the EQUIL code
|
||||||
// cannot cope with arbitrary Dune grids and is also allergic to distributed
|
// cannot cope with arbitrary Dune grids and is also allergic to distributed
|
||||||
@ -194,10 +191,10 @@ protected:
|
|||||||
/////
|
/////
|
||||||
equilGrid_ = new EquilGrid();
|
equilGrid_ = new EquilGrid();
|
||||||
equilGrid_->processEclipseFormat(&(this->eclState().getInputGrid()),
|
equilGrid_->processEclipseFormat(&(this->eclState().getInputGrid()),
|
||||||
|
&(this->eclState()),
|
||||||
/*isPeriodic=*/false,
|
/*isPeriodic=*/false,
|
||||||
/*flipNormals=*/false,
|
/*flipNormals=*/false,
|
||||||
/*clipZ=*/false,
|
/*clipZ=*/false);
|
||||||
porv);
|
|
||||||
|
|
||||||
cartesianCellId_ = equilGrid_->globalCell();
|
cartesianCellId_ = equilGrid_->globalCell();
|
||||||
|
|
||||||
|
@ -37,6 +37,8 @@
|
|||||||
#include <opm/simulators/utils/PropsCentroidsDataHandle.hpp>
|
#include <opm/simulators/utils/PropsCentroidsDataHandle.hpp>
|
||||||
#include <opm/simulators/utils/ParallelSerialization.hpp>
|
#include <opm/simulators/utils/ParallelSerialization.hpp>
|
||||||
|
|
||||||
|
#include <ebos/eclmpiserializer.hh>
|
||||||
|
|
||||||
#include <dune/grid/common/mcmgmapper.hh>
|
#include <dune/grid/common/mcmgmapper.hh>
|
||||||
|
|
||||||
#include <dune/common/version.hh>
|
#include <dune/common/version.hh>
|
||||||
@ -342,27 +344,23 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
void createGrids_()
|
void createGrids_()
|
||||||
{
|
{
|
||||||
const EclipseGrid * input_grid = nullptr;
|
const EclipseGrid* input_grid = nullptr;
|
||||||
std::vector<double> global_porv;
|
std::vector<double> global_porv;
|
||||||
std::unordered_map<size_t, double> aquifer_cell_volumes;
|
|
||||||
// At this stage the ParallelEclipseState instance is still in global
|
// At this stage the ParallelEclipseState instance is still in global
|
||||||
// view; on rank 0 we have undistributed data for the entire grid, on
|
// view; on rank 0 we have undistributed data for the entire grid, on
|
||||||
// the other ranks the EclipseState is empty.
|
// the other ranks the EclipseState is empty.
|
||||||
if (mpiRank == 0) {
|
if (mpiRank == 0) {
|
||||||
input_grid = &this->eclState().getInputGrid();
|
input_grid = &this->eclState().getInputGrid();
|
||||||
global_porv = this->eclState().fieldProps().porv(true);
|
global_porv = this->eclState().fieldProps().porv(true);
|
||||||
aquifer_cell_volumes = this->eclState().aquifer().numericalAquifers().aquiferCellVolumes();
|
|
||||||
OpmLog::info("\nProcessing grid");
|
OpmLog::info("\nProcessing grid");
|
||||||
}
|
}
|
||||||
|
|
||||||
grid_.reset(new Dune::CpGrid());
|
grid_.reset(new Dune::CpGrid());
|
||||||
const auto& removed_cells = grid_->processEclipseFormat(input_grid,
|
const auto& removed_cells = grid_->processEclipseFormat(input_grid,
|
||||||
|
&this->eclState(),
|
||||||
/*isPeriodic=*/false,
|
/*isPeriodic=*/false,
|
||||||
/*flipNormals=*/false,
|
/*flipNormals=*/false,
|
||||||
/*clipZ=*/false,
|
/*clipZ=*/false);
|
||||||
global_porv,
|
|
||||||
this->eclState().getInputNNC(),
|
|
||||||
aquifer_cell_volumes);
|
|
||||||
|
|
||||||
if (mpiRank == 0) {
|
if (mpiRank == 0) {
|
||||||
const auto& active_porv = this->eclState().fieldProps().porv(false);
|
const auto& active_porv = this->eclState().fieldProps().porv(false);
|
||||||
@ -373,7 +371,7 @@ protected:
|
|||||||
|
|
||||||
double removed_pore_volume = 0;
|
double removed_pore_volume = 0;
|
||||||
for (const auto& global_index : removed_cells)
|
for (const auto& global_index : removed_cells)
|
||||||
removed_pore_volume += active_porv[ input_grid->activeIndex(global_index) ];
|
removed_pore_volume += active_porv[ this->eclState().getInputGrid().activeIndex(global_index) ];
|
||||||
|
|
||||||
if (removed_pore_volume > 0) {
|
if (removed_pore_volume > 0) {
|
||||||
removed_pore_volume = unit_system.from_si( UnitSystem::measure::volume, removed_pore_volume );
|
removed_pore_volume = unit_system.from_si( UnitSystem::measure::volume, removed_pore_volume );
|
||||||
@ -385,6 +383,23 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#if HAVE_MPI
|
||||||
|
{
|
||||||
|
const bool has_numerical_aquifer = this->eclState().aquifer().hasNumericalAquifer();
|
||||||
|
int mpiSize = 1;
|
||||||
|
MPI_Comm_size(MPI_COMM_WORLD, &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
|
||||||
|
if (has_numerical_aquifer && mpiSize > 1) {
|
||||||
|
auto nnc_input = this->eclState().getInputNNC();
|
||||||
|
Opm::EclMpiSerializer ser(Dune::MPIHelper::getCollectiveCommunication());
|
||||||
|
ser.broadcast(nnc_input);
|
||||||
|
if (mpiRank > 0) {
|
||||||
|
this->eclState().setInputNNC(nnc_input);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// we use separate grid objects: one for the calculation of the initial condition
|
// 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
|
// via EQUIL and one for the actual simulation. The reason is that the EQUIL code
|
||||||
|
@ -72,11 +72,10 @@ BOOST_AUTO_TEST_CASE(diagnosis)
|
|||||||
typedef Dune::CpGrid Grid;
|
typedef Dune::CpGrid Grid;
|
||||||
Grid grid = Grid();
|
Grid grid = Grid();
|
||||||
grid.processEclipseFormat(&eclState.getInputGrid(),
|
grid.processEclipseFormat(&eclState.getInputGrid(),
|
||||||
/*isPeriodic=*/false,
|
&eclState,
|
||||||
/*flipNormals=*/false,
|
/*isPeriodic=*/false,
|
||||||
/*clipZ=*/false,
|
/*flipNormals=*/false,
|
||||||
eclState.fieldProps().porv(true),
|
/*clipZ=*/false);
|
||||||
eclState.getInputNNC());
|
|
||||||
|
|
||||||
typedef Dune::CartesianIndexMapper<Grid> CartesianIndexMapper;
|
typedef Dune::CartesianIndexMapper<Grid> CartesianIndexMapper;
|
||||||
CartesianIndexMapper cartesianIndexMapper = CartesianIndexMapper(grid);
|
CartesianIndexMapper cartesianIndexMapper = CartesianIndexMapper(grid);
|
||||||
|
Loading…
Reference in New Issue
Block a user