diff --git a/applications/ebos/eclbasegridmanager.hh b/applications/ebos/eclbasegridmanager.hh index c814ccde0..7e6491450 100644 --- a/applications/ebos/eclbasegridmanager.hh +++ b/applications/ebos/eclbasegridmanager.hh @@ -93,6 +93,11 @@ public: EclBaseGridManager(Simulator &simulator) : ParentType(simulator) { + int myRank = 0; +#if HAVE_MPI + MPI_Comm_rank(MPI_COMM_WORLD, &myRank); +#endif + std::string fileName = EWOMS_GET_PARAM(TypeTag, std::string, EclDeckFileName); // compute the base name of the input file name @@ -118,13 +123,16 @@ public: for (size_t i = 0; i < rawCaseName.size(); ++i) caseName_ += std::toupper(rawCaseName[i]); + if (myRank == 0) + std::cout << "Reading the deck file '" << fileName << "'" << std::endl; + Opm::ParserPtr parser(new Opm::Parser()); typedef std::pair ParseModePair; typedef std::vector ParseModePairs; ParseModePairs tmp; tmp.push_back(ParseModePair(Opm::ParseMode::PARSE_RANDOM_SLASH , Opm::InputError::IGNORE)); Opm::ParseMode parseMode(tmp); - std::cout << "Reading the deck file '" << fileName << "'" << std::endl; + deck_ = parser->parseFile(fileName , parseMode); eclState_.reset(new Opm::EclipseState(deck_, parseMode)); diff --git a/applications/ebos/eclcpgridmanager.hh b/applications/ebos/eclcpgridmanager.hh index 3390bc8a7..e2d35d86f 100644 --- a/applications/ebos/eclcpgridmanager.hh +++ b/applications/ebos/eclcpgridmanager.hh @@ -126,12 +126,21 @@ public: void loadBalance() { #if HAVE_MPI -#warning "Since Dune::CpGrid is buggy when load balancing, ebos currently disables parallelism" -#endif -#if 0 - // distribute the grid and switch to the distributed view - grid_->loadBalance(); - grid_->switchToDistributedView(); + int mpiRank = 0; + int mpiSize = 1; + MPI_Comm_rank(MPI_COMM_WORLD, &mpiRank); + MPI_Comm_size(MPI_COMM_WORLD, &mpiSize); + if (mpiRank == 0 && mpiSize > 1) { + // TODO: remove the two statements below as soon as Dune::CpGrid works + // correctly for the Norne deck! + std::cerr << "Since Dune::CpGrid is buggy when load balancing, " + << "ebos currently disables parallelism when using Dune::CpGrid.\n"; + std::abort(); + + // distribute the grid and switch to the distributed view. + grid_->loadBalance(); + grid_->switchToDistributedView(); + } #endif cartesianIndexMapper_ = new CartesianIndexMapper(*grid_);