mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: snappyHexMesh: express small regions. Fixes #2379
Extend selection of small cells to use absolute cell count
This commit is contained in:
@ -480,6 +480,8 @@ castellatedMeshControls
|
|||||||
// when generating meshes with faceZones as baffles or boundary
|
// when generating meshes with faceZones as baffles or boundary
|
||||||
// faces.
|
// faces.
|
||||||
//minCellFraction 0.001;
|
//minCellFraction 0.001;
|
||||||
|
// Optional: same but in absolute number of cells. Default is 0.
|
||||||
|
//nMinCells 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Settings for the snapping.
|
// Settings for the snapping.
|
||||||
|
|||||||
@ -95,6 +95,7 @@ Foam::refinementParameters::refinementParameters
|
|||||||
nErodeCellZone_(dict.getOrDefault<label>("nCellZoneErodeIter", 0)),
|
nErodeCellZone_(dict.getOrDefault<label>("nCellZoneErodeIter", 0)),
|
||||||
nFilterIter_(dict.getOrDefault<label>("nFilterIter", 2)),
|
nFilterIter_(dict.getOrDefault<label>("nFilterIter", 2)),
|
||||||
minCellFraction_(dict.getOrDefault<scalar>("minCellFraction", 0)),
|
minCellFraction_(dict.getOrDefault<scalar>("minCellFraction", 0)),
|
||||||
|
nMinCells_(dict.getOrDefault<label>("nMinCells", 0)),
|
||||||
dryRun_(dryRun)
|
dryRun_(dryRun)
|
||||||
{
|
{
|
||||||
point locationInMesh;
|
point locationInMesh;
|
||||||
|
|||||||
@ -115,6 +115,8 @@ class refinementParameters
|
|||||||
|
|
||||||
const scalar minCellFraction_;
|
const scalar minCellFraction_;
|
||||||
|
|
||||||
|
const label nMinCells_;
|
||||||
|
|
||||||
const bool dryRun_;
|
const bool dryRun_;
|
||||||
|
|
||||||
|
|
||||||
@ -244,6 +246,13 @@ public:
|
|||||||
return minCellFraction_;
|
return minCellFraction_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//- When are disconnected regions small. Absolute number of cells
|
||||||
|
// in a zone or background. Default 0.
|
||||||
|
label nMinCells() const
|
||||||
|
{
|
||||||
|
return nMinCells_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Other
|
// Other
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2015 OpenFOAM Foundation
|
Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
Copyright (C) 2015-2021 OpenCFD Ltd.
|
Copyright (C) 2015-2022 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -3209,21 +3209,22 @@ void Foam::snappyRefineDriver::deleteSmallRegions
|
|||||||
forAll(nCellsPerRegion, regioni)
|
forAll(nCellsPerRegion, regioni)
|
||||||
{
|
{
|
||||||
const label zonei = regionToZone[regioni];
|
const label zonei = regionToZone[regioni];
|
||||||
|
label& nRegionCells = nCellsPerRegion[regioni];
|
||||||
|
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
nCellsPerRegion[regioni]
|
nRegionCells < refineParams.minCellFraction()*nCellsPerZone[zonei]
|
||||||
< refineParams.minCellFraction()*nCellsPerZone[zonei]
|
|| nRegionCells < refineParams.nMinCells()
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Info<< "Deleting region " << regioni
|
Info<< "Deleting region " << regioni
|
||||||
<< " (size " << nCellsPerRegion[regioni]
|
<< " (size " << nRegionCells
|
||||||
<< ") of zone size " << nCellsPerZone[zonei]
|
<< ") of zone size " << nCellsPerZone[zonei]
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
// Mark region to be deleted. 0 size (= global) should never
|
// Mark region to be deleted. 0 size (= global) should never
|
||||||
// occur.
|
// occur.
|
||||||
nCellsPerRegion[regioni] = 0;
|
nRegionCells = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user