BUG: dynamicRefineFvMesh: stricter checking of non-refinable cells

This commit is contained in:
mattijs
2014-02-05 10:45:07 +00:00
parent cb52bb3165
commit 3541dad6d4
2 changed files with 89 additions and 2 deletions

View File

@ -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-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -945,6 +945,56 @@ void Foam::dynamicRefineFvMesh::extendMarkedCells
}
void Foam::dynamicRefineFvMesh::checkEightAnchorPoints
(
PackedBoolList& protectedCell,
label& nProtected
) const
{
const labelList& cellLevel = meshCutter_.cellLevel();
const labelList& pointLevel = meshCutter_.pointLevel();
labelList nAnchorPoints(nCells(), 0);
forAll(pointLevel, pointI)
{
const labelList& pCells = pointCells(pointI);
forAll(pCells, pCellI)
{
label cellI = pCells[pCellI];
if (pointLevel[pointI] <= cellLevel[cellI])
{
// Check if cell has already 8 anchor points -> protect cell
if (nAnchorPoints[cellI] == 8)
{
if (protectedCell.set(cellI, true))
{
nProtected++;
}
}
if (!protectedCell[cellI])
{
nAnchorPoints[cellI]++;
}
}
}
}
forAll(protectedCell, cellI)
{
if (!protectedCell[cellI] && nAnchorPoints[cellI] != 8)
{
protectedCell.set(cellI, true);
nProtected++;
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::dynamicRefineFvMesh::dynamicRefineFvMesh(const IOobject& io)
@ -1067,6 +1117,37 @@ Foam::dynamicRefineFvMesh::dynamicRefineFvMesh(const IOobject& io)
nProtected++;
}
}
// Also protect any cells that are less than hex
forAll(cells(), cellI)
{
const cell& cFaces = cells()[cellI];
if (cFaces.size() < 6)
{
if (protectedCell_.set(cellI, 1))
{
nProtected++;
}
}
else
{
forAll(cFaces, cFaceI)
{
if (faces()[cFaces[cFaceI]].size() < 4)
{
if (protectedCell_.set(cellI, 1))
{
nProtected++;
}
break;
}
}
}
}
// Check cells for 8 corner points
checkEightAnchorPoints(protectedCell_, nProtected);
}
if (returnReduce(nProtected, sumOp<label>()) == 0)

View File

@ -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-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -179,6 +179,12 @@ protected:
//- Extend markedCell with cell-face-cell.
void extendMarkedCells(PackedBoolList& markedCell) const;
//- Check all cells have 8 anchor points
void checkEightAnchorPoints
(
PackedBoolList& protectedCell,
label& nProtected
) const;
private: