diff --git a/src/dynamicMesh/topoChangerFvMesh/dynamicPolyRefinementFvMesh/dynamicPolyRefinementFvMesh.C b/src/dynamicMesh/topoChangerFvMesh/dynamicPolyRefinementFvMesh/dynamicPolyRefinementFvMesh.C index 9d5c1a65e..c48a74a10 100644 --- a/src/dynamicMesh/topoChangerFvMesh/dynamicPolyRefinementFvMesh/dynamicPolyRefinementFvMesh.C +++ b/src/dynamicMesh/topoChangerFvMesh/dynamicPolyRefinementFvMesh/dynamicPolyRefinementFvMesh.C @@ -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(topoChanger_[0]); diff --git a/src/dynamicMesh/topoChangerFvMesh/dynamicPolyRefinementFvMesh/dynamicPolyRefinementFvMesh.H b/src/dynamicMesh/topoChangerFvMesh/dynamicPolyRefinementFvMesh/dynamicPolyRefinementFvMesh.H index 21c7511bf..8ff1d53fd 100644 --- a/src/dynamicMesh/topoChangerFvMesh/dynamicPolyRefinementFvMesh/dynamicPolyRefinementFvMesh.H +++ b/src/dynamicMesh/topoChangerFvMesh/dynamicPolyRefinementFvMesh/dynamicPolyRefinementFvMesh.H @@ -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