From 70b3209bd6d650d519ad8c730ccd4032cb9495db Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 1 Oct 2013 09:23:29 +0100 Subject: [PATCH] ENH: autoHexMesh: handle patch face merging across boundary type --- .../autoHexMeshDriver/autoSnapDriver.C | 98 +++++++++++++++---- 1 file changed, 77 insertions(+), 21 deletions(-) diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C index 81fb2a36ca..de9622b09a 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C @@ -2225,6 +2225,42 @@ void Foam::autoSnapDriver::doSnap // Get the labels of added patches. labelList adaptPatchIDs(meshRefiner_.meshedPatches()); + + // faceZone handling + // ~~~~~~~~~~~~~~~~~ + // + // We convert all faceZones into baffles during snapping so we can use + // a standard mesh motion (except for the mesh checking which for baffles + // created from internal faces should check across the baffles). The state + // is stored in two variables: + // baffles : pairs of boundary faces + // duplicateFace : from mesh face to its baffle colleague (or -1 for + // normal faces) + // There are three types of faceZones according to the faceType property: + // + // internal + // -------- + // - baffles: contains all faces on faceZone so + // - mesh checks check across baffles + // - they get back merged into internal faces + // - duplicateFace: from face to duplicate face. Contains + // all faces on faceZone to prevents merging patch faces. + // + // baffle + // ------ + // - baffles: contains no faces on faceZone since need not be merged/checked + // across + // - duplicateFace: contains all faces on faceZone to prevent + // merging patch faces. + // + // boundary + // -------- + // - baffles: contains no faces on faceZone since need not be merged/checked + // across + // - duplicateFace: contains no faces on faceZone since both sides can + // merge faces independently. + + // Create baffles (pairs of faces that share the same points) // Baffles stored as owner and neighbour face that have been created. List baffles; @@ -2236,7 +2272,7 @@ void Foam::autoSnapDriver::doSnap ); // Maintain map from face to baffle face (-1 for non-baffle faces). Used - // later on to prevent patchface merging. + // later on to prevent patchface merging if faceType=baffle labelList duplicateFace(mesh.nFaces(), -1); forAll(baffles, i) @@ -2256,24 +2292,27 @@ void Foam::autoSnapDriver::doSnap // Determine which // - faces to remove from list of baffles (so not merge) // - points to duplicate + + // Per face if is on faceType 'baffle' or 'boundary' labelList filterFace(mesh.nFaces(), -1); label nFilterFaces = 0; + // Per point whether it need to be duplicated PackedBoolList duplicatePoint(mesh.nPoints()); label nDuplicatePoints = 0; forAll(surfZones, surfI) { const word& faceZoneName = surfZones[surfI].faceZoneName(); - const surfaceZonesInfo::faceZoneType& faceType = - surfZones[surfI].faceType(); - - if - ( - faceType == surfaceZonesInfo::BAFFLE - || faceType == surfaceZonesInfo::BOUNDARY - ) + if (faceZoneName.size()) { - if (faceZoneName.size()) + const surfaceZonesInfo::faceZoneType& faceType = + surfZones[surfI].faceType(); + + if + ( + faceType == surfaceZonesInfo::BAFFLE + || faceType == surfaceZonesInfo::BOUNDARY + ) { // Filter out all faces for this zone. label zoneI = fZones.findZoneID(faceZoneName); @@ -2290,6 +2329,10 @@ void Foam::autoSnapDriver::doSnap forAll(fZone, i) { label faceI = fZone[i]; + + // Allow combining patch faces across this face + duplicateFace[faceI] = -1; + const face& f = mesh.faces()[faceI]; forAll(f, fp) { @@ -2312,6 +2355,18 @@ void Foam::autoSnapDriver::doSnap } } + // Duplicate points only if all points agree + syncTools::syncPointList + ( + mesh, + duplicatePoint, + andEqOp(), // combine op + 0u // null value + ); + // Mark as duplicate (avoids combining patch faces) if one or both + syncTools::syncFaceList(mesh, duplicateFace, maxEqOp