ENH: dynamicRefineFvMesh: select unrefine cells if not candidates for refinement

This commit is contained in:
mattijs
2014-02-06 11:46:55 +00:00
parent 8fc0e1c7f8
commit a91dbb0586
2 changed files with 13 additions and 14 deletions

View File

@ -774,10 +774,11 @@ Foam::labelList Foam::dynamicRefineFvMesh::selectRefineCells
calculateProtectedCells(unrefineableCell);
// Count current selection
label nCandidates = returnReduce(count(candidateCell, 1), sumOp<label>());
label nLocalCandidates = count(candidateCell, 1);
label nCandidates = returnReduce(nLocalCandidates, sumOp<label>());
// Collect all cells
DynamicList<label> candidates(nCells());
DynamicList<label> candidates(nLocalCandidates);
if (nCandidates < nTotToRefine)
{
@ -1264,24 +1265,24 @@ bool Foam::dynamicRefineFvMesh::update()
const scalar upperRefineLevel =
readScalar(refineDict.lookup("upperRefineLevel"));
const scalar unrefineLevel =
readScalar(refineDict.lookup("unrefineLevel"));
readScalar(refineDict.lookupOrDefault("unrefineLevel", GREAT));
const label nBufferLayers =
readLabel(refineDict.lookup("nBufferLayers"));
// Cells marked for refinement or otherwise protected from unrefinement.
PackedBoolList refineCell(nCells());
// Determine candidates for refinement (looking at field only)
selectRefineCandidates
(
lowerRefineLevel,
upperRefineLevel,
vFld,
refineCell
);
if (globalData().nTotalCells() < maxCells)
{
// Determine candidates for refinement (looking at field only)
selectRefineCandidates
(
lowerRefineLevel,
upperRefineLevel,
vFld,
refineCell
);
// Select subset of candidates. Take into account max allowable
// cells, refinement level, protected cells.
labelList cellsToRefine

View File

@ -37,8 +37,6 @@ Description
// Refine field inbetween lower..upper
lowerRefineLevel 0.001;
upperRefineLevel 0.999;
// If value < unrefineLevel unrefine
unrefineLevel 10;
// Have slower than 2:1 refinement
nBufferLayers 1;
// Refine cells only up to maxRefinement levels