Update to dynamicPolyRefinementFvMesh
Only one topo change iteration per time step. This is handled withing dynamicPolyRefinementFvMesh class instead of polyhedralRefinement (is a polyMeshModifier) in order to skip the unnecessary cell/point selection step as well.
This commit is contained in:
parent
819568c8d1
commit
6c693cb8d4
2 changed files with 12 additions and 0 deletions
|
@ -86,6 +86,8 @@ Foam::dynamicPolyRefinementFvMesh::dynamicPolyRefinementFvMesh
|
|||
).subDict(typeName + "Coeffs")
|
||||
),
|
||||
refineInterval_(readLabel(refinementDict_.lookup("refineInterval"))),
|
||||
curTimeIndex_(-1),
|
||||
|
||||
refinementSelectionPtr_(refinementSelection::New(*this, refinementDict_))
|
||||
{
|
||||
// Add the topology modifier engine
|
||||
|
@ -127,12 +129,18 @@ bool Foam::dynamicPolyRefinementFvMesh::update()
|
|||
// Performing refinement/unrefinement when:
|
||||
// 1. We are at the first time step
|
||||
// 2. Time step is a multiplier of specified refineInterval
|
||||
// 3. Only once per time step
|
||||
if
|
||||
(
|
||||
time().timeIndex() > 0
|
||||
&& time().timeIndex() % refineInterval_ == 0
|
||||
&& curTimeIndex_ < time().timeIndex()
|
||||
)
|
||||
{
|
||||
// Update current time index to skip multiple topo changes per single
|
||||
// time step
|
||||
curTimeIndex_ = time().timeIndex();
|
||||
|
||||
// Get reference to polyhedralRefinement polyMeshModifier
|
||||
polyhedralRefinement& polyRefModifier =
|
||||
refCast<polyhedralRefinement>(topoChanger_[0]);
|
||||
|
|
|
@ -65,6 +65,10 @@ class dynamicPolyRefinementFvMesh
|
|||
//- Refinement interval
|
||||
label refineInterval_;
|
||||
|
||||
//- Current time index (helper variable to skip multiple topo changes in
|
||||
// a single time step)
|
||||
label curTimeIndex_;
|
||||
|
||||
//- Refinement selection algorithm that has two jobs:
|
||||
// 1. Selects cells to refine from all cells
|
||||
// 2. Selects split points that are ok to refine based on given set of
|
||||
|
|
Reference in a new issue