Skip to content
Snippets Groups Projects
Commit b1d62979 authored by Mark OLESEN's avatar Mark OLESEN
Browse files

BUG: UPstream::shutdown misbehaves with external initialisation (fixes #2808)

- freeCommmunicatorComponents needs an additional bounds check.
  When MPI is initialized outside of OpenFOAM, there are no
  UPstream communicator equivalents
parent 008d0156
No related branches found
No related tags found
No related merge requests found
...@@ -969,7 +969,17 @@ void Foam::UPstream::allocatePstreamCommunicator ...@@ -969,7 +969,17 @@ void Foam::UPstream::allocatePstreamCommunicator
void Foam::UPstream::freePstreamCommunicator(const label communicator) void Foam::UPstream::freePstreamCommunicator(const label communicator)
{ {
if (communicator != UPstream::worldComm) // Not touching the first communicator (WORLD)
// or anything out-of bounds.
//
// No UPstream communicator indices when MPI is initialized outside
// of OpenFOAM - thus needs a bounds check too!
if
(
communicator > 0
&& (communicator < PstreamGlobals::MPICommunicators_.size())
)
{ {
if (PstreamGlobals::MPICommunicators_[communicator] != MPI_COMM_NULL) if (PstreamGlobals::MPICommunicators_[communicator] != MPI_COMM_NULL)
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment