From 4e98d8b99e41a33288e66d7b69b99b6f4bc3eacb Mon Sep 17 00:00:00 2001 From: graham Date: Tue, 12 Jan 2010 14:11:06 +0000 Subject: [PATCH] Adding check of mesh after initial point merge (which gets rid of zero area faces). The intention is that if checkMesh returns a non zero number of bad faces, then no amount of collapsing and backtracking can satisfy the criteria (as long as the value of mergeClosenessCoeff is appropriate - a more rigorous zero area face collapse may be appropriate) and the mesher will halt (or at least not filter at all). The mesh quality criteria and the surface conformation controls can be altered and the internalDelaunayVertices read in to try again, or more cell size resolution can be applied in areas where problems are occuring. --- .../conformalVoronoiMeshCalcDualMesh.C | 48 +++++++++++++------ 1 file changed, 33 insertions(+), 15 deletions(-) diff --git a/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C b/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C index 0c44cb3fc5..ae11b0ce39 100644 --- a/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C +++ b/src/mesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshCalcDualMesh.C @@ -109,29 +109,48 @@ void Foam::conformalVoronoiMesh::calcDualMesh points.setSize(dualVertI); - // Merge close points + // No-risk face filtering to get rid of zero area faces and + // establish if the mesh can be produced at all to the + // specified criteria Info<< nl << " Merging close points" << endl; mergeCloseDualVertices(points); - // Smooth the surface of the mesh + label nInitialBadQualityFaces = checkPolyMeshQuality(points); - Info<< nl << " Smoothing surface" << endl; - - smoothSurface(points); - - // Collapse faces throughout the mesh - - Info<< nl << " Collapsing unnecessary faces" << endl; + Info<< "Initial check before face collapse, found " + << nInitialBadQualityFaces << " bad quality faces" + << endl; HashSet > deferredCollapseFaces; - collapseFaces(points, deferredCollapseFaces); + if (nInitialBadQualityFaces == 0) + { + // Risky and undo-able face filtering to reduce the face count + // as much as possible staying within the specified criteria - label nBadQualityFaces = checkPolyMeshQuality(points); + Info<< nl << " Smoothing surface" << endl; - Info<< "Found " << nBadQualityFaces << " bad quality faces" << endl; + smoothSurface(points); + + Info<< nl << " Collapsing unnecessary faces" << endl; + + collapseFaces(points, deferredCollapseFaces); + + label nBadQualityFaces = checkPolyMeshQuality(points); + + Info<< "Found " << nBadQualityFaces << " bad quality faces" << endl; + } + else + { + Info<< "A mesh could not be produced to satisfy the specified quality " + << "criteria. The quality and the surface conformation controls " + << "can be altered and the internalDelaunayVertices read in to try " + << "again, or more cell size resolution and motion iterations can " + << "be applied in areas where problems are occurring." + << endl; + } // Final dual face and owner neighbour construction @@ -148,7 +167,7 @@ void Foam::conformalVoronoiMesh::calcDualMesh false ); - deferredCollapseFaceSet(owner, neighbour, deferredCollapseFaces); + // deferredCollapseFaceSet(owner, neighbour, deferredCollapseFaces); removeUnusedCells(owner, neighbour); @@ -372,8 +391,7 @@ void Foam::conformalVoronoiMesh::mergeCloseDualVertices(const pointField& pts) if (nPtsMerged > 0) { - Info<< " Merged " << nPtsMerged << " points " - << "closenessTolerance HARDCODED " << endl; + Info<< " Merged " << nPtsMerged << " points " << endl; } reindexDualVertices(dualPtIndexMap);