Improvement in refinement cell selection

Check whether the refinement level would exceed the maximum specified refinement
level only after the buffer layers have been considered.
This commit is contained in:
Vuko Vukcevic 2018-11-15 18:22:51 +01:00
parent 76db42b9ac
commit 70967af85c
3 changed files with 25 additions and 26 deletions

View file

@ -2028,11 +2028,7 @@ void Foam::polyhedralRefinement::setCellsToRefine
// Get cell index
const label& cellI = refinementCellCandidates[i];
if
(
roughCellCountAfterRefinement < maxCells_
&& cellLevel_[cellI] < maxRefinementLevel_
)
if (roughCellCountAfterRefinement < maxCells_)
{
// Mark cell for refinement
refineCell[cellI] = true;
@ -2049,6 +2045,15 @@ void Foam::polyhedralRefinement::setCellsToRefine
extendMarkedCellsAcrossFaces(refineCell);
}
// Remove all cells that would exceed the maximum refinement level
forAll (refineCell, cellI)
{
if (refineCell[cellI] && (cellLevel_[cellI] + 1 > maxRefinementLevel_))
{
refineCell[cellI] = false;
}
}
// Make sure that the refinement is face consistent (2:1 consistency) and
// point consistent (4:1 consistency) if necessary

View file

@ -2587,11 +2587,7 @@ void Foam::prismatic2DRefinement::setCellsToRefine
// Get cell index
const label& cellI = refinementCellCandidates[i];
if
(
roughCellCountAfterRefinement < maxCells_
&& cellLevel_[cellI] < maxRefinementLevel_
)
if (roughCellCountAfterRefinement < maxCells_)
{
// Mark cell for refinement
refineCell[cellI] = true;
@ -2608,6 +2604,15 @@ void Foam::prismatic2DRefinement::setCellsToRefine
extendMarkedCellsAcrossFaces(refineCell);
}
// Remove all cells that exceed the maximum refinement level
forAll (refineCell, cellI)
{
if (refineCell[cellI] && (cellLevel_[cellI] + 1 > maxRefinementLevel_))
{
refineCell[cellI] = false;
}
}
// Make sure that the refinement is face consistent (2:1 consistency) and
// point consistent (4:1 consistency) if necessary

View file

@ -111,19 +111,11 @@ void Foam::refinement::extendMarkedCellsAcrossFaces
const label& own = owner[faceI];
const label& nei = neighbour[faceI];
if (cellLevel_[own] < maxRefinementLevel_)
{
// Mark owner
// Mark owner and neighbour cells
markedCell[own] = true;
}
if (cellLevel_[nei] < maxRefinementLevel_)
{
// Mark neighbour
markedCell[nei] = true;
}
}
}
// Boundary faces
for (label faceI = nInternalFaces; faceI < nFaces; ++faceI)
@ -134,14 +126,11 @@ void Foam::refinement::extendMarkedCellsAcrossFaces
// exceeded
const label& own = owner[faceI];
if (cellLevel_[own] < maxRefinementLevel_)
{
// Mark owner
markedCell[own] = true;
}
}
}
}
void Foam::refinement::extendMarkedCellsAcrossPoints