From c48a203267c33f64c4e0416f7fbdacd6164f1b94 Mon Sep 17 00:00:00 2001 From: mattijs <mattijs> Date: Wed, 11 Nov 2015 12:54:08 +0000 Subject: [PATCH] BUG: procesorPolyPatch: fixed check on oppositeness, correct tolerance --- src/OpenFOAM/meshes/meshTools/matchPoints.C | 7 ++++--- .../constraint/processor/processorPolyPatch.C | 14 +++++++++----- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/OpenFOAM/meshes/meshTools/matchPoints.C b/src/OpenFOAM/meshes/meshTools/matchPoints.C index d309e8e501f..0afa4e3ae69 100644 --- a/src/OpenFOAM/meshes/meshTools/matchPoints.C +++ b/src/OpenFOAM/meshes/meshTools/matchPoints.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -187,9 +187,11 @@ bool Foam::matchPoints // Go through range of equal mag and find nearest vector. scalar minDistSqr = VGREAT; - scalar minDistNorm = 0; label minFaceI = -1; + // Valid candidate points should have opposite normal + const scalar minDistNorm = 0; + for ( label j = startI; @@ -220,7 +222,6 @@ bool Foam::matchPoints // Check that the normals point in equal and opposite directions if (distNorm < minDistNorm) { - minDistNorm = distNorm; minDistSqr = distSqr; minFaceI = faceI; } diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.C index 5b2a4332fdc..0ca20652c9c 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -913,7 +913,7 @@ bool Foam::processorPolyPatch::order faceMap ); - // Try using face point average for matching + // Fallback: try using face point average for matching if (!matchedAll) { const pointField& ppPoints = pp.points(); @@ -933,16 +933,20 @@ bool Foam::processorPolyPatch::order scalarField tols2 ( - calcFaceTol(pp, pp.points(), facePointAverages) + matchTolerance() + *calcFaceTol(pp, pp.points(), facePointAverages) ); + // Note that we do not use the faceNormals anymore for + // comparison. Since we're + // having problems with the face centres (e.g. due to extreme + // aspect ratios) we will probably also have problems with + // reliable normals calculation labelList faceMap2(faceMap.size(), -1); matchedAll = matchPoints ( facePointAverages, masterFacePointAverages, - pp.faceNormals(), - masterNormals, tols2, true, faceMap2 -- GitLab