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 // Get cell index
const label& cellI = refinementCellCandidates[i]; const label& cellI = refinementCellCandidates[i];
if if (roughCellCountAfterRefinement < maxCells_)
(
roughCellCountAfterRefinement < maxCells_
&& cellLevel_[cellI] < maxRefinementLevel_
)
{ {
// Mark cell for refinement // Mark cell for refinement
refineCell[cellI] = true; refineCell[cellI] = true;
@ -2049,6 +2045,15 @@ void Foam::polyhedralRefinement::setCellsToRefine
extendMarkedCellsAcrossFaces(refineCell); 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 // Make sure that the refinement is face consistent (2:1 consistency) and
// point consistent (4:1 consistency) if necessary // point consistent (4:1 consistency) if necessary

View file

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

View file

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