Commit a6330ebb authored by Henry's avatar Henry
Browse files

Coupled patches: Improved match tolerance handling

parent d9c65914
......@@ -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;
}
......
......@@ -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
......
......@@ -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);
}
......
......@@ -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);
}
......
......@@ -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())
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment