diff --git a/applications/utilities/mesh/generation/extrudeToRegionMesh/createShellMesh.C b/applications/utilities/mesh/generation/extrudeToRegionMesh/createShellMesh.C index da1fc43066..df998941ef 100644 --- a/applications/utilities/mesh/generation/extrudeToRegionMesh/createShellMesh.C +++ b/applications/utilities/mesh/generation/extrudeToRegionMesh/createShellMesh.C @@ -189,8 +189,8 @@ Foam::createShellMesh::createShellMesh void Foam::createShellMesh::setRefinement ( const pointField& thickness, - const labelList& extrudeMasterPatchID, - const labelList& extrudeSlavePatchID, + const labelList& topPatchID, + const labelList& bottomPatchID, const labelListList& extrudeEdgePatches, polyTopoChange& meshMod ) @@ -205,14 +205,14 @@ void Foam::createShellMesh::setRefinement if ( - extrudeMasterPatchID.size() != patch_.size() - && extrudeSlavePatchID.size() != patch_.size() + topPatchID.size() != patch_.size() + && bottomPatchID.size() != patch_.size() ) { FatalErrorIn("createShellMesh::setRefinement(..)") << "nFaces:" << patch_.size() - << " extrudeMasterPatchID:" << extrudeMasterPatchID.size() - << " extrudeSlavePatchID:" << extrudeSlavePatchID.size() + << " topPatchID:" << topPatchID.size() + << " bottomPatchID:" << bottomPatchID.size() << exit(FatalError); } @@ -302,11 +302,9 @@ void Foam::createShellMesh::setRefinement } - // Add face on patch' master side - //labelList masterFaces(patch_.localFaces().size()); + // Add face on bottom side forAll(patch_.localFaces(), faceI) { - //masterFaces[faceI] = meshMod.addFace ( patch_.localFaces()[faceI].reverseFace(),// vertices @@ -316,14 +314,14 @@ void Foam::createShellMesh::setRefinement -1, // masterEdgeID faceToFaceMap.size(), // masterFaceID : current faceI true, // flipFaceFlux - extrudeMasterPatchID[faceI],// patchID + bottomPatchID[faceI],// patchID -1, // zoneID false // zoneFlip ); - faceToFaceMap.append(faceI+1); // points to unflipped original face + faceToFaceMap.append(-faceI-1); // points to flipped original face faceToEdgeMap.append(-1); - //Pout<< "Added master face " + //Pout<< "Added bottom face " // << patch_.localFaces()[faceI].reverseFace() // << " own " << addedCells[faceI] // << " at " << patch_.faceCentres()[faceI] @@ -331,8 +329,7 @@ void Foam::createShellMesh::setRefinement } - // Add face on patch' slave side - //labelList slaveFaces(patch_.localFaces().size()); + // Add face on top forAll(patch_.localFaces(), faceI) { // Get face in original ordering @@ -346,7 +343,6 @@ void Foam::createShellMesh::setRefinement newF[fp] = addedPoints[region]; } - //slaveFaces[faceI] = meshMod.addFace ( newF, // vertices @@ -356,14 +352,14 @@ void Foam::createShellMesh::setRefinement -1, // masterEdgeID faceToFaceMap.size(), // masterFaceID : current faceI false, // flipFaceFlux - extrudeSlavePatchID[faceI], // patchID + topPatchID[faceI], // patchID -1, // zoneID false // zoneFlip ); - faceToFaceMap.append(-faceI-1); + faceToFaceMap.append(faceI+1); // unflipped faceToEdgeMap.append(-1); - //Pout<< "Added slave face " << newF + //Pout<< "Added top face " << newF // << " own " << addedCells[faceI] // << " at " << patch_.faceCentres()[faceI] // << endl; diff --git a/applications/utilities/mesh/generation/extrudeToRegionMesh/createShellMesh.H b/applications/utilities/mesh/generation/extrudeToRegionMesh/createShellMesh.H index 7823f11459..1f9187fe4d 100644 --- a/applications/utilities/mesh/generation/extrudeToRegionMesh/createShellMesh.H +++ b/applications/utilities/mesh/generation/extrudeToRegionMesh/createShellMesh.H @@ -31,6 +31,10 @@ Description SourceFiles createShellMesh.C + Extrudes into thickness direction. + - bottom faces originate from reversed original faces (have turning index) + - top faces originate from original faces (no turning index) + \*---------------------------------------------------------------------------*/ #ifndef createShellMesh_H @@ -59,9 +63,6 @@ class createShellMesh //- Reference to patch to extrude const primitiveFacePatch& patch_; -// //- Non-manifold edges on patch -// const PackedBoolList& nonManifoldEdge_; - //- Per point on face the region const faceList& pointRegions_; @@ -99,7 +100,6 @@ public: createShellMesh ( const primitiveFacePatch& patch, -// const PackedBoolList& nonManifoldEdge, const faceList& pointRegions, const labelList& regionPoints ); @@ -117,10 +117,10 @@ public: } //- From region face to patch face. Contains turning index: - // > 0 : face originating from master side - // (owner side for unflipped face) - // < 0 : (bottom) face originating from slave side - // (neighbour side for unflipped face) + // > 0 : face in same orientation as patch face. face will + // be in top patch + // < 0 : face in opposite orientation as patch face. face will + // be in bottom patch // = 0 : for all side faces const labelList& faceToFaceMap() const { @@ -155,8 +155,8 @@ public: void setRefinement ( const pointField& thickness, - const labelList& extrudeMasterPatchID, - const labelList& extrudeSlavePatchID, + const labelList& topPatchID, + const labelList& bottomPatchID, const labelListList& extrudeEdgePatches, polyTopoChange& meshMod ); diff --git a/applications/utilities/mesh/generation/extrudeToRegionMesh/extrudeToRegionMesh.C b/applications/utilities/mesh/generation/extrudeToRegionMesh/extrudeToRegionMesh.C index 1c81c07650..f6949fda61 100644 --- a/applications/utilities/mesh/generation/extrudeToRegionMesh/extrudeToRegionMesh.C +++ b/applications/utilities/mesh/generation/extrudeToRegionMesh/extrudeToRegionMesh.C @@ -37,6 +37,73 @@ Description if flipMap is false) - not parallel + +Internal face extrusion +----------------------- + + +-------------+ + | | + | | + +---AAAAAAA---+ + | | + | | + +-------------+ + + AAA=faceZone to extrude. + + +For the case of no flipMap the extrusion starts at owner and extrudes +into the space of the neighbour: + + +CCCCCCC+ + | | <= extruded mesh + +BBBBBBB+ + + +-------------+ + | | + | (neighbour) | + |___CCCCCCC___| <= original mesh (with 'baffles' added) + | BBBBBBB | + |(owner side) | + | | + +-------------+ + + BBB=directMapped between owner on original mesh and new extrusion. + (zero offset) + CCC=directMapped between neighbour on original mesh and new extrusion + (offset due to the thickness of the extruded mesh) + +For the case of flipMap the extrusion is the other way around: from the +neighbour side into the owner side. + + +Boundary face extrusion +----------------------- + + +--AAAAAAA--+ + | | + | | + +-----------+ + + AAA=faceZone to extrude. E.g. slave side is owner side (no flipmap) + +becomes + + +CCCCCCC+ + | | <= extruded mesh + +BBBBBBB+ + + +--BBBBBBB--+ + | | <= original mesh + | | + +-----------+ + + BBB=directMapped between original mesh and new extrusion + CCC=polypatch + + + + Usage - extrudeToRegionMesh @@ -467,6 +534,30 @@ void reorderPatches } +// Remove zero-sized patches +void deleteEmptyPatches(fvMesh& mesh) +{ + const polyBoundaryMesh& patches = mesh.boundaryMesh(); + + labelList oldToNew(patches.size()); + label usedI = 0; + label notUsedI = patches.size(); + forAll(patches, patchI) + { + if (returnReduce(patches[patchI].size(), sumOp