View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0002235 | OpenFOAM | Patch | public | 2016-09-04 20:23 | 2016-09-04 21:18 |
Reporter | MattijsJ | Assigned To | henry | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Platform | GNU/Linux | OS | OpenSuSE | OS Version | 13.2 |
Product Version | dev | ||||
Fixed in Version | dev | ||||
Summary | 0002235: polyMesh::movePoints does not clear out cellTreePtr_ | ||||
Description | cellTreePtr_ should be cleared out whenever the mesh moves. There might be cases with a small motion where all cells might remain in the same node but that is extremely rare. 2) We can use the tree directly to search for the cell containing a point. There is no need to search for nearest first. Attached patch does both. | ||||
Steps To Reproduce | tutorials/multiphase/compressibleInterDyMFoam/ras/sloshingTank2D and set 'fixedLocations true' in the probes dictionary to enforce re-searching. | ||||
Tags | No tags attached. | ||||
|
polyMesh_findCell.patch (2,282 bytes)
diff --git a/src/OpenFOAM/meshes/polyMesh/polyMesh.C b/src/OpenFOAM/meshes/polyMesh/polyMesh.C index 9f1db29..532ed89 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMesh.C +++ b/src/OpenFOAM/meshes/polyMesh/polyMesh.C @@ -1109,6 +1109,9 @@ Foam::tmp<Foam::scalarField> Foam::polyMesh::movePoints faceZones_.movePoints(points_); cellZones_.movePoints(points_); + // Cell tree might become invalid + cellTreePtr_.clear(); + // Reset valid directions (could change with rotation) geometricD_ = Zero; solutionD_ = Zero; @@ -1211,60 +1214,13 @@ void Foam::polyMesh::findCellFacePt const indexedOctree<treeDataCell>& tree = cellTree(); - // Find nearest cell to the point - pointIndexHit info = tree.findNearest(p, sqr(GREAT)); + // Find point inside cell + celli = tree.findInside(p); - if (info.hit()) + if (celli != -1) { - label nearestCelli = tree.shapes().cellLabels()[info.index()]; - // Check the nearest cell to see if the point is inside. - findTetFacePt(nearestCelli, p, tetFacei, tetPti); - - if (tetFacei != -1) - { - // Point was in the nearest cell - - celli = nearestCelli; - - return; - } - else - { - // Check the other possible cells that the point may be in - - labelList testCells = tree.findIndices(p); - - forAll(testCells, pCI) - { - label testCelli = tree.shapes().cellLabels()[testCells[pCI]]; - - if (testCelli == nearestCelli) - { - // Don't retest the nearest cell - - continue; - } - - // Check the test cell to see if the point is inside. - findTetFacePt(testCelli, p, tetFacei, tetPti); - - if (tetFacei != -1) - { - // Point was in the test cell - - celli = testCelli; - - return; - } - } - } - } - else - { - FatalErrorInFunction - << "Did not find nearest cell in search tree." - << abort(FatalError); + findTetFacePt(celli, p, tetFacei, tetPti); } } |
|
Resolved by commit fec5c063f5ce3691bf6bc37e87f5d97d5a45df69 |
Date Modified | Username | Field | Change |
---|---|---|---|
2016-09-04 20:23 | MattijsJ | New Issue | |
2016-09-04 20:23 | MattijsJ | File Added: polyMesh_findCell.patch | |
2016-09-04 21:18 | henry | Note Added: 0006823 | |
2016-09-04 21:18 | henry | Status | new => resolved |
2016-09-04 21:18 | henry | Fixed in Version | => dev |
2016-09-04 21:18 | henry | Resolution | open => fixed |
2016-09-04 21:18 | henry | Assigned To | => henry |