diff --git a/src/finiteVolume/cfdTools/general/fieldSources/timeActivatedExplicitMulticomponentPointSource/timeActivatedExplicitMulticomponentPointSource.C b/src/finiteVolume/cfdTools/general/fieldSources/timeActivatedExplicitMulticomponentPointSource/timeActivatedExplicitMulticomponentPointSource.C index 1da8850dcff4d389bf329a776f04f55c855d9013..221b7949b4365c9bad6c6753e1cac6b831e579d5 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]; + } } } }