From a6330ebb4cc5975e1fc2f253b9538f6ce54eede0 Mon Sep 17 00:00:00 2001 From: Henry <Henry> Date: Sat, 6 Aug 2011 21:32:22 +0100 Subject: [PATCH] Coupled patches: Improved match tolerance handling --- .../polyPatches/basic/coupled/coupledPolyPatch.C | 3 +-- .../polyPatches/basic/coupled/coupledPolyPatch.H | 1 - .../polyPatches/constraint/cyclic/cyclicPolyPatch.C | 6 +++--- .../constraint/oldCyclic/oldCyclicPolyPatch.C | 2 +- .../constraint/processor/processorPolyPatch.C | 12 ++++++++---- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.C index 545ce686b8d..706ab83cf52 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.C @@ -145,7 +145,6 @@ Foam::pointField Foam::coupledPolyPatch::getAnchorPoints Foam::scalarField Foam::coupledPolyPatch::calcFaceTol ( - const scalar matchTol, const UList<face>& faces, const pointField& points, const pointField& faceCentres @@ -173,7 +172,7 @@ Foam::scalarField Foam::coupledPolyPatch::calcFaceTol maxLenSqr = max(maxLenSqr, magSqr(pt - cc)); maxCmpt = max(maxCmpt, cmptMax(cmptMag(pt))); } - tols[faceI] = max(SMALL*maxCmpt, matchTol*Foam::sqrt(maxLenSqr)); + tols[faceI] = max(SMALL*maxCmpt, Foam::sqrt(maxLenSqr)); } return tols; } diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.H index 58cb8e66fa2..86ad3497686 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.H +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/basic/coupled/coupledPolyPatch.H @@ -160,7 +160,6 @@ protected: // from face centre to any of the face vertices. static scalarField calcFaceTol ( - const scalar matchTol, const UList<face>& faces, const pointField& points, const pointField& faceCentres diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C index 51f0887b5ec..868a9f8b686 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C @@ -304,9 +304,9 @@ void Foam::cyclicPolyPatch::calcTransforms { scalarField half0Tols ( - calcFaceTol + matchTolerance() + *calcFaceTol ( - matchTolerance(), half0, half0.points(), static_cast<const pointField&>(half0Ctrs) @@ -562,7 +562,7 @@ void Foam::cyclicPolyPatch::getCentresAndAnchors // Calculate typical distance per face - tols = calcFaceTol(matchTolerance(), pp1, pp1.points(), half1Ctrs); + tols = matchTolerance()*calcFaceTol(pp1, pp1.points(), half1Ctrs); } diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/oldCyclic/oldCyclicPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/oldCyclic/oldCyclicPolyPatch.C index 7081ca79889..e10ae88a07e 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/oldCyclic/oldCyclicPolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/oldCyclic/oldCyclicPolyPatch.C @@ -444,7 +444,7 @@ void Foam::oldCyclicPolyPatch::getCentresAndAnchors // Calculate typical distance per face - tols = calcFaceTol(matchTolerance(), half1Faces, pp.points(), half1Ctrs); + tols = matchTolerance()*calcFaceTol(half1Faces, pp.points(), half1Ctrs); } diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.C index d1da5a64460..6ea10d25df1 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.C @@ -179,6 +179,10 @@ void Foam::processorPolyPatch::calcGeometry(PstreamBuffers& pBufs) // Neighbour normals vectorField nbrFaceNormals(neighbFaceAreas_.size()); + // Face match tolerances + scalarField tols = + calcFaceTol(*this, points(), faceCentres()); + // Calculate normals from areas and check forAll(faceNormals, facei) { @@ -194,7 +198,7 @@ void Foam::processorPolyPatch::calcGeometry(PstreamBuffers& pBufs) faceNormals[facei] = point(1, 0, 0); nbrFaceNormals[facei] = faceNormals[facei]; } - else if (mag(magSf - nbrMagSf)/avSf > matchTolerance()) + else if (mag(magSf - nbrMagSf) > matchTolerance()*sqr(tols[facei])) { fileName nm ( @@ -238,7 +242,7 @@ void Foam::processorPolyPatch::calcGeometry(PstreamBuffers& pBufs) << "patch:" << name() << " my area:" << magSf << " neighbour area:" << nbrMagSf - << " matching tolerance:" << matchTolerance() + << " matching tolerance:" << matchTolerance()*sqr(tols[facei]) << endl << "Mesh face:" << start()+facei << " vertices:" @@ -264,7 +268,7 @@ void Foam::processorPolyPatch::calcGeometry(PstreamBuffers& pBufs) neighbFaceCentres_, faceNormals, nbrFaceNormals, - calcFaceTol(matchTolerance(), *this, points(), faceCentres()), + matchTolerance()*tols, matchTolerance() ); } @@ -569,7 +573,7 @@ bool Foam::processorPolyPatch::order // Calculate typical distance from face centre scalarField tols ( - calcFaceTol(matchTolerance(), pp, pp.points(), pp.faceCentres()) + matchTolerance()*calcFaceTol(pp, pp.points(), pp.faceCentres()) ); if (debug || masterCtrs.size() != pp.size()) -- GitLab