From e8003b39676580309192c8cb882cbc957497cffc Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Sun, 8 Nov 2015 22:20:11 +0000 Subject: [PATCH] Revert "meshRefinementBaffles: Correct faceZone orientation" This reverts commit 3ba163b5592aad68d4d6816ec053d4942679a23c. --- .../meshRefinement/meshRefinementBaffles.C | 159 ++++++++++++------ 1 file changed, 103 insertions(+), 56 deletions(-) diff --git a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementBaffles.C b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementBaffles.C index 5cdab910ac..d9ec65959c 100644 --- a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementBaffles.C +++ b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementBaffles.C @@ -51,6 +51,9 @@ License // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // +// Repatches external face or creates baffle for internal face +// with user specified patches (might be different for both sides). +// Returns label of added face. Foam::label Foam::meshRefinement::createBaffle ( const label faceI, @@ -128,6 +131,46 @@ Foam::label Foam::meshRefinement::createBaffle } +//// Check if we are a boundary face and normal of surface does +//// not align with test vector. In this case there'd probably be +//// a freestanding 'baffle' so we might as well not create it. +//// Note that since it is not a proper baffle we cannot detect it +//// afterwards so this code cannot be merged with the +//// filterDuplicateFaces code. +//bool Foam::meshRefinement::validBaffleTopology +//( +// const label faceI, +// const vector& n1, +// const vector& n2, +// const vector& testDir +//) const +//{ +// +// label patchI = mesh_.boundaryMesh().whichPatch(faceI); +// if (patchI == -1 || mesh_.boundaryMesh()[patchI].coupled()) +// { +// return true; +// } +// else if (mag(n1&n2) > cos(degToRad(30))) +// { +// // Both normals aligned. Check that test vector perpendicularish to +// // surface normal +// scalar magTestDir = mag(testDir); +// if (magTestDir > VSMALL) +// { +// if (mag(n1&(testDir/magTestDir)) < cos(degToRad(45))) +// { +// //Pout<< "** disabling baffling face " +// // << mesh_.faceCentres()[faceI] << endl; +// return false; +// } +// } +// } +// return true; +//} + + +// Determine patches for baffles on all intersected unnamed faces void Foam::meshRefinement::getBafflePatches ( const labelList& globalToMasterPatch, @@ -342,11 +385,11 @@ Foam::Map Foam::meshRefinement::getZoneBafflePatches } } } - return bafflePatch; } +// Create baffle for every face where ownPatch != -1 Foam::autoPtr Foam::meshRefinement::createBaffles ( const labelList& ownPatch, @@ -466,7 +509,6 @@ Foam::autoPtr Foam::meshRefinement::createBaffles } } } - // Pick up neighbour side of baffle (added faces) forAll(faceMap, faceI) { @@ -493,6 +535,7 @@ Foam::autoPtr Foam::meshRefinement::createBaffles void Foam::meshRefinement::checkZoneFaces() const { const faceZoneMesh& fZones = mesh_.faceZones(); + const polyBoundaryMesh& pbm = mesh_.boundaryMesh(); forAll(pbm, patchI) @@ -621,26 +664,27 @@ Foam::autoPtr Foam::meshRefinement::createZoneBaffles Info<< "Created " << nZoneFaces << " baffles in = " << mesh_.time().cpuTimeIncrement() << " s\n" << nl << endl; } - return map; } +// Extract those baffles (duplicate) faces that are on the edge of a baffle +// region. These are candidates for merging. +// Done by counting the number of baffles faces per mesh edge. If edge +// has 2 boundary faces and both are baffle faces it is the edge of a baffle +// region. Foam::List Foam::meshRefinement::freeStandingBaffles ( const List& couples, const scalar planarAngle ) const { - // Done by counting the number of baffles faces per mesh edge. If edge - // has 2 boundary faces and both are baffle faces it is the edge of a baffle - // region. - // All duplicate faces on edge of the patch are to be merged. // So we count for all edges of duplicate faces how many duplicate // faces use them. labelList nBafflesPerEdge(mesh_.nEdges(), 0); + // This algorithm is quite tricky. We don't want to use edgeFaces and // also want it to run in parallel so it is now an algorithm over // all (boundary) faces instead. @@ -654,8 +698,10 @@ Foam::List Foam::meshRefinement::freeStandingBaffles // So now any edge that is used by baffle faces only will have the // value 2*1000000+2*1. + const label baffleValue = 1000000; + // Count number of boundary faces per edge // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -683,9 +729,11 @@ Foam::List Foam::meshRefinement::freeStandingBaffles } } + DynamicList