From 01aebe4bf9b36f47e8c345906a75b2b90ab7d4d9 Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Thu, 25 May 2017 14:40:47 +0100 Subject: [PATCH] Bugfix: empty wedge patch in parallel. Zeljko Tukovic --- .../constraint/wedge/WedgePointPatchField.C | 36 ++++++++++--------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/src/foam/fields/PointPatchFieldTemplates/constraint/wedge/WedgePointPatchField.C b/src/foam/fields/PointPatchFieldTemplates/constraint/wedge/WedgePointPatchField.C index b26ead887..8ce27f8ed 100644 --- a/src/foam/fields/PointPatchFieldTemplates/constraint/wedge/WedgePointPatchField.C +++ b/src/foam/fields/PointPatchFieldTemplates/constraint/wedge/WedgePointPatchField.C @@ -202,23 +202,27 @@ WedgePointPatchField const Pstream::commsTypes commsType ) { - // In order to ensure that the wedge patch is always flat, take the - // normal vector from the first point - const vector& nHat = this->patch().pointNormals()[0]; - - tmp > tvalues = - transform(I - nHat*nHat, this->patchInternalField()); - const Field& values = tvalues(); - - // Get internal field to insert values into - Field& iF = const_cast&>(this->internalField()); - - // Get addressing - const labelList& meshPoints = this->patch().meshPoints(); - - forAll (meshPoints, pointI) + // ZT, 26/02/2017: Size of the patch could be zero in parallel runs + if (!this->patch().meshPoints().empty()) { - iF[meshPoints[pointI]] = values[pointI]; + // In order to ensure that the wedge patch is always flat, take the + // normal vector from the first point + const vector& nHat = this->patch().pointNormals()[0]; + + tmp > tvalues = + transform(I - nHat*nHat, this->patchInternalField()); + const Field& values = tvalues(); + + // Get internal field to insert values into + Field& iF = const_cast&>(this->internalField()); + + // Get addressing + const labelList& meshPoints = this->patch().meshPoints(); + + forAll (meshPoints, pointI) + { + iF[meshPoints[pointI]] = values[pointI]; + } } }