mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: dynamicRefineFvMesh: select unrefine cells if not candidates for refinement
This commit is contained in:
@ -774,10 +774,11 @@ Foam::labelList Foam::dynamicRefineFvMesh::selectRefineCells
|
|||||||
calculateProtectedCells(unrefineableCell);
|
calculateProtectedCells(unrefineableCell);
|
||||||
|
|
||||||
// Count current selection
|
// 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
|
// Collect all cells
|
||||||
DynamicList<label> candidates(nCells());
|
DynamicList<label> candidates(nLocalCandidates);
|
||||||
|
|
||||||
if (nCandidates < nTotToRefine)
|
if (nCandidates < nTotToRefine)
|
||||||
{
|
{
|
||||||
@ -1264,15 +1265,13 @@ bool Foam::dynamicRefineFvMesh::update()
|
|||||||
const scalar upperRefineLevel =
|
const scalar upperRefineLevel =
|
||||||
readScalar(refineDict.lookup("upperRefineLevel"));
|
readScalar(refineDict.lookup("upperRefineLevel"));
|
||||||
const scalar unrefineLevel =
|
const scalar unrefineLevel =
|
||||||
readScalar(refineDict.lookup("unrefineLevel"));
|
readScalar(refineDict.lookupOrDefault("unrefineLevel", GREAT));
|
||||||
const label nBufferLayers =
|
const label nBufferLayers =
|
||||||
readLabel(refineDict.lookup("nBufferLayers"));
|
readLabel(refineDict.lookup("nBufferLayers"));
|
||||||
|
|
||||||
// Cells marked for refinement or otherwise protected from unrefinement.
|
// Cells marked for refinement or otherwise protected from unrefinement.
|
||||||
PackedBoolList refineCell(nCells());
|
PackedBoolList refineCell(nCells());
|
||||||
|
|
||||||
if (globalData().nTotalCells() < maxCells)
|
|
||||||
{
|
|
||||||
// Determine candidates for refinement (looking at field only)
|
// Determine candidates for refinement (looking at field only)
|
||||||
selectRefineCandidates
|
selectRefineCandidates
|
||||||
(
|
(
|
||||||
@ -1282,6 +1281,8 @@ bool Foam::dynamicRefineFvMesh::update()
|
|||||||
refineCell
|
refineCell
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (globalData().nTotalCells() < maxCells)
|
||||||
|
{
|
||||||
// Select subset of candidates. Take into account max allowable
|
// Select subset of candidates. Take into account max allowable
|
||||||
// cells, refinement level, protected cells.
|
// cells, refinement level, protected cells.
|
||||||
labelList cellsToRefine
|
labelList cellsToRefine
|
||||||
|
|||||||
@ -37,8 +37,6 @@ Description
|
|||||||
// Refine field inbetween lower..upper
|
// Refine field inbetween lower..upper
|
||||||
lowerRefineLevel 0.001;
|
lowerRefineLevel 0.001;
|
||||||
upperRefineLevel 0.999;
|
upperRefineLevel 0.999;
|
||||||
// If value < unrefineLevel unrefine
|
|
||||||
unrefineLevel 10;
|
|
||||||
// Have slower than 2:1 refinement
|
// Have slower than 2:1 refinement
|
||||||
nBufferLayers 1;
|
nBufferLayers 1;
|
||||||
// Refine cells only up to maxRefinement levels
|
// Refine cells only up to maxRefinement levels
|
||||||
|
|||||||
Reference in New Issue
Block a user