diff --git a/src/pe/utility/CreateWorld.cpp b/src/pe/utility/CreateWorld.cpp index a95db6201c0ea3878c9174b0c402fb65d2104f6e..3ede915c665701c38248f1a3e25d2b55552fca81 100644 --- a/src/pe/utility/CreateWorld.cpp +++ b/src/pe/utility/CreateWorld.cpp @@ -59,7 +59,8 @@ std::unique_ptr<SetupBlockForest> createSetupBlockForest(const math::AABB simula { WALBERLA_MPI_SECTION() { - MPIManager::instance()->useWorldComm(); + if (!MPIManager::instance()->rankValid()) + MPIManager::instance()->useWorldComm(); } if (isPeriodic[0] && blocks[0]<2) @@ -95,6 +96,12 @@ shared_ptr<BlockForest> createBlockForest(const math::AABB simulationDomain, const uint_t numberOfProcesses, const uint_t initialRefinementLevel) { + WALBERLA_MPI_SECTION() + { + if (!MPIManager::instance()->rankValid()) + MPIManager::instance()->useWorldComm(); + } + std::unique_ptr<SetupBlockForest> sforest( createSetupBlockForest( simulationDomain, blocks, isPeriodic, numberOfProcesses, initialRefinementLevel )); return shared_ptr< BlockForest >( new BlockForest( uint_c( MPIManager::instance()->rank() ), *sforest, false ) ); } @@ -127,6 +134,12 @@ shared_ptr<BlockForest> createBlockForest(const math::AABB simulationDomain, return shared_ptr<BlockForest>(); } + WALBERLA_MPI_SECTION() + { + if (!MPIManager::instance()->rankValid()) + MPIManager::instance()->useWorldComm(); + } + WALBERLA_LOG_INFO_ON_ROOT( "Production Run!" ); WALBERLA_LOG_INFO_ON_ROOT( "Creating the block structure: loading from file \'" << sbffile << "\' ..." ); return shared_ptr< BlockForest >( new BlockForest( uint_c( MPIManager::instance()->rank() ), sbffile.c_str(), true, false ) );