From f395aa435c66e0681fed8f442d5a30fcc0f870c5 Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@Germany>
Date: Thu, 13 Aug 2009 10:38:20 +0200
Subject: [PATCH] porousZone - abort in parallel if the cellZone cannot be
 found

- the previous check didn't catch bad cellZone names when running in
  parallel
---
 src/finiteVolume/cfdTools/general/porousMedia/porousZone.C | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/finiteVolume/cfdTools/general/porousMedia/porousZone.C b/src/finiteVolume/cfdTools/general/porousMedia/porousZone.C
index 34e85c2e272..3251e2541ee 100644
--- a/src/finiteVolume/cfdTools/general/porousMedia/porousZone.C
+++ b/src/finiteVolume/cfdTools/general/porousMedia/porousZone.C
@@ -81,7 +81,10 @@ Foam::porousZone::porousZone
 {
     Info<< "Creating porous zone: " << name_ << endl;
 
-    if (cellZoneID_ == -1 && !Pstream::parRun())
+    bool foundZone = (cellZoneID_ != -1);
+    reduce(foundZone, orOp<bool>());
+
+    if (!foundZone && Pstream::master())
     {
         FatalErrorIn
         (
@@ -91,6 +94,7 @@ Foam::porousZone::porousZone
             << exit(FatalError);
     }
 
+
     // porosity
     if (dict_.readIfPresent("porosity", porosity_))
     {
-- 
GitLab