mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
pairPatchAgglomeration: Do not use the result agglomeratePatch if the return indicates it is not valid
Resolves bug-report http://www.openfoam.org/mantisbt/view.php?id=1157
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -147,6 +147,7 @@ void Foam::pairPatchAgglomeration::setEdgeWeights
|
||||
if (eFaces.size() == 2)
|
||||
{
|
||||
const edge edgeCommon = edge(eFaces[0], eFaces[1]);
|
||||
|
||||
if (facePairWeight_.found(edgeCommon))
|
||||
{
|
||||
facePairWeight_[edgeCommon] += edgeLength;
|
||||
@ -155,6 +156,7 @@ void Foam::pairPatchAgglomeration::setEdgeWeights
|
||||
{
|
||||
facePairWeight_.insert(edgeCommon, edgeLength);
|
||||
}
|
||||
|
||||
// If the fine 'pair' faces was featured edge so it is
|
||||
// the coarse 'pair'
|
||||
if (fineFeaturedFaces.found(edgeCommon))
|
||||
@ -366,7 +368,7 @@ bool Foam::pairPatchAgglomeration::agglomeratePatch
|
||||
void Foam::pairPatchAgglomeration:: agglomerate()
|
||||
{
|
||||
label nPairLevels = 0;
|
||||
label nCreatedLevels = 1; //0 level is the base patch
|
||||
label nCreatedLevels = 1; // 0 level is the base patch
|
||||
label nCoarseFaces = 0;
|
||||
label nCoarseFacesOld = 0;
|
||||
|
||||
@ -374,9 +376,9 @@ void Foam::pairPatchAgglomeration:: agglomerate()
|
||||
{
|
||||
const bPatch& patch = patchLevels_[nCreatedLevels - 1];
|
||||
tmp<labelField> finalAgglomPtr(new labelField(patch.size()));
|
||||
|
||||
bool agglomOK = false;
|
||||
while (!agglomOK)
|
||||
|
||||
do
|
||||
{
|
||||
finalAgglomPtr = agglomerateOneLevel
|
||||
(
|
||||
@ -386,34 +388,42 @@ void Foam::pairPatchAgglomeration:: agglomerate()
|
||||
|
||||
if (nCoarseFaces > 0)
|
||||
{
|
||||
agglomOK = agglomeratePatch
|
||||
if
|
||||
(
|
||||
patch,
|
||||
finalAgglomPtr,
|
||||
nCreatedLevels
|
||||
);
|
||||
|
||||
restrictAddressing_.set(nCreatedLevels, finalAgglomPtr);
|
||||
mapBaseToTopAgglom(nCreatedLevels);
|
||||
setEdgeWeights(nCreatedLevels);
|
||||
|
||||
if (nPairLevels % mergeLevels_)
|
||||
(
|
||||
agglomOK = agglomeratePatch
|
||||
(
|
||||
patch,
|
||||
finalAgglomPtr,
|
||||
nCreatedLevels
|
||||
)
|
||||
)
|
||||
)
|
||||
{
|
||||
combineLevels(nCreatedLevels);
|
||||
}
|
||||
else
|
||||
{
|
||||
nCreatedLevels++;
|
||||
}
|
||||
restrictAddressing_.set(nCreatedLevels, finalAgglomPtr);
|
||||
mapBaseToTopAgglom(nCreatedLevels);
|
||||
setEdgeWeights(nCreatedLevels);
|
||||
|
||||
nPairLevels++;
|
||||
if (nPairLevels % mergeLevels_)
|
||||
{
|
||||
combineLevels(nCreatedLevels);
|
||||
}
|
||||
else
|
||||
{
|
||||
nCreatedLevels++;
|
||||
}
|
||||
|
||||
nPairLevels++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
agglomOK = true;
|
||||
}
|
||||
|
||||
reduce(nCoarseFaces, sumOp<label>());
|
||||
}
|
||||
|
||||
} while (!agglomOK);
|
||||
|
||||
nFaces_[nCreatedLevels] = nCoarseFaces;
|
||||
|
||||
@ -456,7 +466,7 @@ Foam::tmp<Foam::labelField> Foam::pairPatchAgglomeration::agglomerateOneLevel
|
||||
label matchFaceNeibNo = -1;
|
||||
scalar maxFaceWeight = -GREAT;
|
||||
|
||||
// check faces to find ungrouped neighbour with largest face weight
|
||||
// Check faces to find ungrouped neighbour with largest face weight
|
||||
forAll(fFaces, i)
|
||||
{
|
||||
label faceNeig = fFaces[i];
|
||||
|
||||
Reference in New Issue
Block a user