From d0080fe487ea982373b132258a55fbdac08b378a Mon Sep 17 00:00:00 2001
From: andy <a.heather@opencfd.co.uk>
Date: Fri, 12 Jun 2009 16:34:42 +0100
Subject: [PATCH] parallel running mods

---
 ...tivatedExplicitMulticomponentPointSource.C | 30 +++++++++++++++++--
 1 file changed, 27 insertions(+), 3 deletions(-)

diff --git a/src/finiteVolume/cfdTools/general/fieldSources/timeActivatedExplicitMulticomponentPointSource/timeActivatedExplicitMulticomponentPointSource.C b/src/finiteVolume/cfdTools/general/fieldSources/timeActivatedExplicitMulticomponentPointSource/timeActivatedExplicitMulticomponentPointSource.C
index 1da8850dcff..221b7949b43 100644
--- a/src/finiteVolume/cfdTools/general/fieldSources/timeActivatedExplicitMulticomponentPointSource/timeActivatedExplicitMulticomponentPointSource.C
+++ b/src/finiteVolume/cfdTools/general/fieldSources/timeActivatedExplicitMulticomponentPointSource/timeActivatedExplicitMulticomponentPointSource.C
@@ -52,8 +52,24 @@ void Foam::timeActivatedExplicitMulticomponentPointSource::updateAddressing()
     forAll(pointSources_, sourceI)
     {
         const pointSourceProperties& psp = pointSources_[sourceI];
+        bool foundCell = false;
         label cid = mesh_.findCell(psp.location());
-        if (cid < 0)
+        if (cid >= 0)
+        {
+            foundCell = mesh_.pointInCell(psp.location(), cid);
+        }
+        reduce(foundCell, orOp<bool>());
+        if (!foundCell)
+        {
+            label cid = mesh_.findNearestCell(psp.location());
+            if (cid >= 0)
+            {
+                foundCell = mesh_.pointInCell(psp.location(), cid);
+            }
+        }
+        reduce(foundCell, orOp<bool>());
+
+        if (!foundCell)
         {
             FatalErrorIn
             (
@@ -180,7 +196,11 @@ Foam::timeActivatedExplicitMulticomponentPointSource::Su
                 )
                 {
                     const label cid = cellOwners_[sourceI];
-                    sourceField[cid] += dt*psp.fieldData()[i].second()/V[cid];
+                    if (cid >= 0)
+                    {
+                        sourceField[cid] +=
+                            dt*psp.fieldData()[i].second()/V[cid];
+                    }
                 }
             }
         }
@@ -235,7 +255,11 @@ Foam::timeActivatedExplicitMulticomponentPointSource::Su()
                 )
                 {
                     const label cid = cellOwners_[sourceI];
-                    sourceField[cid] += dt*psp.fieldData()[i].second()/V[cid];
+                    if (cid >= 0)
+                    {
+                        sourceField[cid] +=
+                            dt*psp.fieldData()[i].second()/V[cid];
+                    }
                 }
             }
         }
-- 
GitLab