From c4c60fad8036dfe02b3e67a7420afb896df9c18d Mon Sep 17 00:00:00 2001 From: mattijs <mattijs> Date: Mon, 18 Jul 2016 16:07:15 +0100 Subject: [PATCH] BUG: polyMesh::movePoints: clear cellTree since gets constructed using current geometry so will be out of date (w.r.t bounding box, subdivisions) when the mesh moves. Only when all cells stays in all the same boxes can you skip rebuilding it so this was not deemed worthwhile. Fixes #172 --- .../algorithms/indexedOctree/indexedOctree.C | 12 +----------- src/OpenFOAM/meshes/polyMesh/polyMesh.C | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.C b/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.C index 2480f2dc75f..ada7d06b5bc 100644 --- a/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.C +++ b/src/OpenFOAM/algorithms/indexedOctree/indexedOctree.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -2535,16 +2535,6 @@ Foam::labelBits Foam::indexedOctree<Type>::findNode const node& nod = nodes_[nodeI]; - if (debug) - { - if (!nod.bb_.contains(sample)) - { - FatalErrorInFunction - << "Cannot find " << sample << " in node " << nodeI - << abort(FatalError); - } - } - direction octant = nod.bb_.subOctant(sample); labelBits index = nod.subNodes_[octant]; diff --git a/src/OpenFOAM/meshes/polyMesh/polyMesh.C b/src/OpenFOAM/meshes/polyMesh/polyMesh.C index adaec0eb8e4..b8ada24283f 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMesh.C +++ b/src/OpenFOAM/meshes/polyMesh/polyMesh.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -1130,6 +1130,21 @@ Foam::tmp<Foam::scalarField> Foam::polyMesh::movePoints geometricD_ = Zero; solutionD_ = Zero; + // Reset cell tree - it gets built from mesh geometry so might have + // wrong boxes. It is correct as long as none of the cells leaves + // the boxes it is in which most likely is almost never the case except + // for tiny displacements. An alternative is to check the displacements + // to see if they are tiny - imagine a big windtunnel with a small rotating + // object. In this case the processors without the rotating object wouldn't + // have to clear any geometry. However your critical path still stays the + // same so no time would be gained (unless the decomposition gets weighted). + // Small benefit for lots of scope for problems so not done. + cellTreePtr_.clear(); + + // Note: tet-base decomposition does not get cleared. Ideally your face + // decomposition should not change during mesh motion ... + + meshObject::movePoints<polyMesh>(*this); meshObject::movePoints<pointMesh>(*this); -- GitLab