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
This commit is contained in:
mattijs
2016-07-18 16:07:15 +01:00
parent 813a1d69fb
commit c4c60fad80
2 changed files with 17 additions and 12 deletions

View File

@ -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];

View File

@ -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);