From aa7be71de3ca740e0cd8e52de875be38ec52e33d Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 5 Mar 2009 13:11:28 +0000 Subject: [PATCH 01/16] problem cell deletion --- .../snappyHexMesh/snappyHexMeshDict | 12 +- .../autoHexMeshDriver/autoSnapDriver.C | 49 +- .../autoHexMeshDriver/autoSnapDriver.H | 3 - .../meshRefinement/meshRefinement.H | 17 + .../meshRefinement/meshRefinementBaffles.C | 2 + .../meshRefinementProblemCells.C | 727 +++++++++++------- 6 files changed, 486 insertions(+), 324 deletions(-) diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict index 58f324160e..dd523164ea 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict +++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict @@ -131,6 +131,12 @@ castellatedMeshControls level (3 3); } } + + // Optional angle to detect small-large cell situation perpendicular + // to the surface. Is the angle of face w.r.t the local surface + // normal. Use on flat(ish) surfaces only. Otherwise + // leave out or set to negative number. + //perpendicularAngle 10; } } @@ -317,9 +323,9 @@ meshQualityControls minTriangleTwist -1; //- if >0 : preserve single cells with all points on the surface if the - // resulting volume after snapping is larger than minVolFraction times old - // volume. If <0 : delete always. - minVolFraction 0.1; + // resulting volume after snapping (approximation) is larger than + // minVolFraction times old volume. If <0 : delete always. + minVolFraction 0.5; // Advanced diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C b/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C index 0c6655862c..30c5839cc4 100644 --- a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C +++ b/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C @@ -58,35 +58,6 @@ defineTypeNameAndDebug(autoSnapDriver, 0); // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -void Foam::autoSnapDriver::getZonedSurfaces -( - labelList& zonedSurfaces, - labelList& unzonedSurfaces -) const -{ // Surfaces with zone information - const wordList& faceZoneNames = meshRefiner_.surfaces().faceZoneNames(); - - zonedSurfaces.setSize(faceZoneNames.size()); - label zonedI = 0; - unzonedSurfaces.setSize(faceZoneNames.size()); - label unzonedI = 0; - - forAll(faceZoneNames, surfI) - { - if (faceZoneNames[surfI].size()) - { - zonedSurfaces[zonedI++] = surfI; - } - else - { - unzonedSurfaces[unzonedI++] = surfI; - } - } - zonedSurfaces.setSize(zonedI); - unzonedSurfaces.setSize(unzonedI); -} - - // Get faces to repatch. Returns map from face to patch. Foam::Map Foam::autoSnapDriver::getZoneBafflePatches ( @@ -711,9 +682,7 @@ Foam::autoPtr Foam::autoSnapDriver::createZoneBaffles List& baffles ) { - labelList zonedSurfaces; - labelList unzonedSurfaces; - getZonedSurfaces(zonedSurfaces, unzonedSurfaces); + labelList zonedSurfaces = meshRefiner_.surfaces().getNamedSurfaces(); autoPtr map; @@ -798,9 +767,7 @@ Foam::autoPtr Foam::autoSnapDriver::mergeZoneBaffles const List& baffles ) { - labelList zonedSurfaces; - labelList unzonedSurfaces; - getZonedSurfaces(zonedSurfaces, unzonedSurfaces); + labelList zonedSurfaces = meshRefiner_.surfaces().getNamedSurfaces(); autoPtr map; @@ -1048,9 +1015,10 @@ Foam::vectorField Foam::autoSnapDriver::calcNearestSurface labelList snapSurf(localPoints.size(), -1); // Divide surfaces into zoned and unzoned - labelList zonedSurfaces; - labelList unzonedSurfaces; - getZonedSurfaces(zonedSurfaces, unzonedSurfaces); + labelList zonedSurfaces = + meshRefiner_.surfaces().getNamedSurfaces(); + labelList unzonedSurfaces = + meshRefiner_.surfaces().getUnnamedSurfaces(); // 1. All points to non-interface surfaces @@ -1368,9 +1336,8 @@ Foam::autoPtr Foam::autoSnapDriver::repatchToSurface indirectPrimitivePatch& pp = ppPtr(); // Divide surfaces into zoned and unzoned - labelList zonedSurfaces; - labelList unzonedSurfaces; - getZonedSurfaces(zonedSurfaces, unzonedSurfaces); + labelList zonedSurfaces = meshRefiner_.surfaces().getNamedSurfaces(); + labelList unzonedSurfaces = meshRefiner_.surfaces().getUnnamedSurfaces(); // Faces that do not move diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.H b/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.H index b2d0f28911..5d9b2bc357 100644 --- a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.H +++ b/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.H @@ -84,9 +84,6 @@ class autoSnapDriver // Snapping - //- Split surfaces into non-zoned and zones ones - void getZonedSurfaces(labelList&, labelList&) const; - //- Get faces to repatch. Returns map from face to patch. Map