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]; + } } }