blockMeshMerge: Increased merge tolerance

Resolves bug-report https://bugs.openfoam.org/view.php?id=3233
This commit is contained in:
Henry Weller
2019-05-30 16:34:07 +01:00
parent 76a8284120
commit fa12851880

View File

@ -56,9 +56,7 @@ void Foam::blockMesh::calcMergeInfo()
} }
// set unused to -1 // set unused to -1
mergeList_.setSize(nPoints_); mergeList_.setSize(nPoints_, -1);
mergeList_ = -1;
const pointField& blockPoints = topology().points(); const pointField& blockPoints = topology().points();
const cellList& blockCells = topology().cells(); const cellList& blockCells = topology().cells();
@ -113,8 +111,11 @@ void Foam::blockMesh::calcMergeInfo()
// Collated points detected by initially taking a constant factor of // Collated points detected by initially taking a constant factor of
// the size of the block. // the size of the block.
boundBox bb(blockCells[blockPlabel].points(blockFaces, blockPoints)); const boundBox bb
const scalar mergeSqrDist = magSqr(20*small*bb.span()); (
blockCells[blockPlabel].points(blockFaces, blockPoints)
);
const scalar mergeSqrDist = magSqr(50*small*bb.span());
// This is an N^2 algorithm // This is an N^2 algorithm
@ -548,35 +549,29 @@ void Foam::blockMesh::calcMergeInfo()
} }
// Sort merge list to return new point label (in new shorter list) // Sort merge list and count number of unique points
// given old point label label nUniqPoints = 0;
label newPointLabel = 0;
forAll(mergeList_, pointLabel) forAll(mergeList_, pointi)
{ {
if (mergeList_[pointLabel] > pointLabel) if (mergeList_[pointi] > pointi)
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Merge list contains point index out of range" << "Merge list contains point index out of range"
<< exit(FatalError); << exit(FatalError);
} }
if if (mergeList_[pointi] == -1 || mergeList_[pointi] == pointi)
(
mergeList_[pointLabel] == -1
|| mergeList_[pointLabel] == pointLabel
)
{ {
mergeList_[pointLabel] = newPointLabel; mergeList_[pointi] = nUniqPoints++;
newPointLabel++;
} }
else else
{ {
mergeList_[pointLabel] = mergeList_[mergeList_[pointLabel]]; mergeList_[pointi] = mergeList_[mergeList_[pointi]];
} }
} }
nPoints_ = newPointLabel; nPoints_ = nUniqPoints;
} }