From a9f25c19dc618e4d8b87bec7e1d22430652095c0 Mon Sep 17 00:00:00 2001 From: mattijs Date: Mon, 14 Feb 2011 14:52:51 +0000 Subject: [PATCH] ENH: extrudeMesh,snappyHexMesh: extrude across non-manifold boundaries --- ReleaseNotes-dev | 8 + .../extrude/extrudeMesh/extrudeMesh.C | 180 +++++++- .../polyTopoChange/addPatchCellLayer.C | 423 +++++++++++++----- .../polyTopoChange/addPatchCellLayer.H | 73 ++- .../autoHexMeshDriver/autoLayerDriver.C | 198 +++++--- .../autoHexMeshDriver/autoLayerDriver.H | 12 +- .../meshRefinement/meshRefinement.C | 108 +++-- .../meshRefinement/meshRefinement.H | 13 +- .../refinementSurfaces/refinementSurfaces.C | 78 +++- .../refinementSurfaces/refinementSurfaces.H | 15 +- 10 files changed, 847 insertions(+), 261 deletions(-) diff --git a/ReleaseNotes-dev b/ReleaseNotes-dev index 227041536f..230a116826 100644 --- a/ReleaseNotes-dev +++ b/ReleaseNotes-dev @@ -104,6 +104,11 @@ taking film into account + Parallel aware *** *New* ptscotch decomposition method +*** *Updated* scotch decomposition method to run in parallel by doing + decomposition on the master. Unfortunately scotch and ptscotch cannot + be linked in to the same executable. +*** *Updated* simple decomposition method to run in parallel by doing + decomposition on the master. *** *Updated* decomposePar maps polyPatches instead of recreating them so polyPatches holding data can map the data. *** *Updated* particle tracking algorithm @@ -183,6 +188,9 @@ e.g. pitzDailyDirectMapped tutorial. + =setSet=: allows time range (e.g. 0:100) in combination with -batch argument to execute the commands for multiple times. + + =extrudeMesh=: + - option to add extrusion to existing mesh. + - works in parallel * Post-processing + =paraFoam=, =foamToVTK=: full support for polyhedral cell type in recent Paraview versions. diff --git a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C index 8a7296eca0..5804d962c8 100644 --- a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C +++ b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C @@ -43,6 +43,7 @@ Description #include "addPatchCellLayer.H" #include "fvMesh.H" #include "MeshedSurfaces.H" +#include "globalIndex.H" #include "extrudedMesh.H" #include "extrudeModel.H" @@ -261,6 +262,12 @@ int main(int argc, char *argv[]) sourceCasePath.expand(); fileName sourceRootDir = sourceCasePath.path(); fileName sourceCaseDir = sourceCasePath.name(); + if (Pstream::parRun()) + { + sourceCaseDir = + sourceCaseDir + /"processor" + Foam::name(Pstream::myProcNo()); + } wordList sourcePatches; dict.lookup("sourcePatches") >> sourcePatches; @@ -279,54 +286,173 @@ int main(int argc, char *argv[]) sourceRootDir, sourceCaseDir ); + #include "createMesh.H" const polyBoundaryMesh& patches = mesh.boundaryMesh(); - // Topo change container. Either copy an existing mesh or start - // with empty storage (number of patches only needed for checking) - autoPtr meshMod - ( - ( - mode == MESH - ? new polyTopoChange(mesh) - : new polyTopoChange(patches.size()) - ) - ); - // Extrusion engine. Either adding to existing mesh or // creating separate mesh. addPatchCellLayer layerExtrude(mesh, (mode == MESH)); + const labelList meshFaces(patchFaces(patches, sourcePatches)); indirectPrimitivePatch extrudePatch ( IndirectList ( mesh.faces(), - patchFaces(patches, sourcePatches) + meshFaces ), mesh.points() ); + // Determine extrudePatch normal + pointField extrudePatchPointNormals + ( + PatchTools::pointNormals //calcNormals + ( + mesh, + extrudePatch, + meshFaces + ) + ); + + + // Precalculate mesh edges for pp.edges. + const labelList meshEdges + ( + extrudePatch.meshEdges + ( + mesh.edges(), + mesh.pointEdges() + ) + ); + + // Global face indices engine + const globalIndex globalFaces(mesh.nFaces()); + + // Determine extrudePatch.edgeFaces in global numbering (so across + // coupled patches) + labelListList edgeGlobalFaces + ( + addPatchCellLayer::globalEdgeFaces + ( + mesh, + globalFaces, + extrudePatch + ) + ); + + + // Determine what patches boundary edges need to get extruded into. + // This might actually cause edge-connected processors to become + // face-connected so might need to introduce new processor boundaries. + // Calculates: + // - per pp.edge the patch to extrude into + // - any additional processor boundaries (patchToNbrProc = map from + // new patchID to neighbour processor) + // - number of new patches (nPatches) + + labelList sidePatchID; + label nPatches; + Map