From d2d976bda83edf28869a89fae44ab25ac2d9099c Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 9 Jun 2022 11:32:49 +0100 Subject: [PATCH] BUG: (un)refinement: combine topochange+motion. Fixes #2492 Explicitly unset the mesh.moving flag whilst doing the topo change. --- .../dynamicRefineFvMesh/dynamicRefineFvMesh.C | 13 +++++++++++++ .../interFoam/laminar/oscillatingBox/Allrun | 3 +++ 2 files changed, 16 insertions(+) diff --git a/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C b/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C index 0d81586ced..fcfc39d271 100644 --- a/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C +++ b/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C @@ -458,6 +458,12 @@ Foam::dynamicRefineFvMesh::refine // Create mesh (with inflation), return map from old to new mesh. //autoPtr map = meshMod.changeMesh(*this, true); + + // Clear moving flag. This is currently required since geometry calculation + // might get triggered when doing processor patches. + // (TBD: should be in changeMesh if no inflation?) + moving(false); + // Create mesh (no inflation), return map from old to new mesh. autoPtr map = meshMod.changeMesh(*this, false); Info<< "Refined from " @@ -575,6 +581,12 @@ Foam::dynamicRefineFvMesh::unrefine // Change mesh and generate map. //autoPtr map = meshMod.changeMesh(*this, true); + + // Clear moving flag. This is currently required since geometry calculation + // might get triggered when doing processor patches. + // (TBD: should be in changeMesh if no inflation?) + moving(false); + // Create mesh (no inflation), return map from old to new mesh. autoPtr map = meshMod.changeMesh(*this, false); Info<< "Unrefined from " @@ -1475,6 +1487,7 @@ bool Foam::dynamicRefineFvMesh::updateTopology() bool Foam::dynamicRefineFvMesh::update() { bool hasChanged = updateTopology(); + // Do any mesh motion (resets mesh.moving() if it does any mesh motion) hasChanged = dynamicMotionSolverListFvMesh::update() && hasChanged; return hasChanged; diff --git a/tutorials/multiphase/interFoam/laminar/oscillatingBox/Allrun b/tutorials/multiphase/interFoam/laminar/oscillatingBox/Allrun index e8c824c04e..9ed9dd30da 100755 --- a/tutorials/multiphase/interFoam/laminar/oscillatingBox/Allrun +++ b/tutorials/multiphase/interFoam/laminar/oscillatingBox/Allrun @@ -10,4 +10,7 @@ cd "${0%/*}" || exit # Run from this directory runApplication decomposePar runParallel $(getApplication) +runApplication reconstructParMesh +runApplication reconstructPar + #------------------------------------------------------------------------------