From 3e71574d8afd4686dedd5153527dd484a7d36467 Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 5 Apr 2011 11:56:57 +0100 Subject: [PATCH] ENH: snappyHexMesh: initial feature-line support --- .../generation/snappyHexMesh/snappyHexMesh.C | 26 +- .../snappyHexMesh/snappyHexMeshDict | 8 +- src/mesh/autoMesh/Make/files | 2 + .../autoHexMeshDriver/autoLayerDriver.C | 638 +---- .../autoHexMeshDriver/autoLayerDriver.H | 40 - .../autoHexMeshDriver/autoRefineDriver.C | 101 +- .../autoHexMeshDriver/autoRefineDriver.H | 15 +- .../autoHexMeshDriver/autoSnapDriver.C | 188 +- .../autoHexMeshDriver/autoSnapDriver.H | 197 +- .../autoHexMeshDriver/autoSnapDriverFeature.C | 2146 +++++++++++++++++ .../snapParameters/snapParameters.C | 15 +- .../snapParameters/snapParameters.H | 15 +- .../meshRefinement/meshRefinement.C | 55 +- .../meshRefinement/meshRefinement.H | 72 +- .../meshRefinement/meshRefinementBaffles.C | 34 +- .../meshRefinement/meshRefinementMerge.C | 895 ++++++- .../meshRefinementProblemCells.C | 14 +- .../meshRefinement/meshRefinementRefine.C | 56 +- .../refinementFeatures/refinementFeatures.C | 233 ++ .../refinementFeatures/refinementFeatures.H | 139 ++ 20 files changed, 3835 insertions(+), 1054 deletions(-) create mode 100644 src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriverFeature.C create mode 100644 src/mesh/autoMesh/autoHexMesh/refinementFeatures/refinementFeatures.C create mode 100644 src/mesh/autoMesh/autoHexMesh/refinementFeatures/refinementFeatures.H diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C index 5691f01034..5b36e99301 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C +++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -37,6 +37,7 @@ Description #include "autoLayerDriver.H" #include "searchableSurfaces.H" #include "refinementSurfaces.H" +#include "refinementFeatures.H" #include "shellSurfaces.H" #include "decompositionMethod.H" #include "fvMeshDistribute.H" @@ -250,6 +251,20 @@ int main(int argc, char *argv[]) << mesh.time().cpuTimeIncrement() << " s" << nl << endl; + // Read feature meshes + // ~~~~~~~~~~~~~~~~~~~ + + Info<< "Reading features." << endl; + refinementFeatures features + ( + mesh, + refineDict.lookup("features") + ); + Info<< "Read features in = " + << mesh.time().cpuTimeIncrement() << " s" << nl << endl; + + + // Refinement engine // ~~~~~~~~~~~~~~~~~ @@ -265,6 +280,7 @@ int main(int argc, char *argv[]) mergeDist, // tolerance used in sorting coordinates overwrite, // overwrite mesh files? surfaces, // for surface intersection refinement + features, // for feature edges/point based refinement shells // for volume (inside/outside) refinement ); Info<< "Calculated surface intersections in = " @@ -429,13 +445,19 @@ int main(int argc, char *argv[]) // Snap parameters snapParameters snapParams(snapDict); + // Temporary hack to get access to resolveFeatureAngle + scalar curvature; + { + refinementParameters refineParams(refineDict); + curvature = refineParams.curvature(); + } if (!overwrite) { const_cast(mesh.time())++; } - snapDriver.doSnap(snapDict, motionDict, snapParams); + snapDriver.doSnap(snapDict, motionDict, curvature, snapParams); writeMesh ( diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict index 8ee2c4b74c..da7a8ac63c 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict +++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict @@ -217,10 +217,10 @@ snapControls // to surface nSmoothPatch 3; - //- Relative distance for points to be attracted by surface feature point - // or edge. True distance is this factor times local - // maximum edge length. - tolerance 4.0; + //- Maximum relative distance for points to be attracted by surface. + // True distance is this factor times local maximum edge length. + // Note: changed(corrected) w.r.t 17x! (17x used 2* tolerance) + tolerance 2.0; //- Number of mesh displacement relaxation iterations. nSolveIter 30; diff --git a/src/mesh/autoMesh/Make/files b/src/mesh/autoMesh/Make/files index ec877c5f94..66cb3c6202 100644 --- a/src/mesh/autoMesh/Make/files +++ b/src/mesh/autoMesh/Make/files @@ -4,6 +4,7 @@ autoHexMeshDriver = $(autoHexMesh)/autoHexMeshDriver $(autoHexMeshDriver)/autoLayerDriver.C $(autoHexMeshDriver)/autoLayerDriverShrink.C $(autoHexMeshDriver)/autoSnapDriver.C +$(autoHexMeshDriver)/autoSnapDriverFeature.C $(autoHexMeshDriver)/autoRefineDriver.C $(autoHexMeshDriver)/layerParameters/layerParameters.C @@ -16,6 +17,7 @@ $(autoHexMesh)/meshRefinement/meshRefinement.C $(autoHexMesh)/meshRefinement/meshRefinementMerge.C $(autoHexMesh)/meshRefinement/meshRefinementProblemCells.C $(autoHexMesh)/meshRefinement/meshRefinementRefine.C +$(autoHexMesh)/refinementFeatures/refinementFeatures.C $(autoHexMesh)/refinementSurfaces/refinementSurfaces.C $(autoHexMesh)/shellSurfaces/shellSurfaces.C $(autoHexMesh)/trackedParticle/trackedParticle.C diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C index ca38821229..cdaa9f83c7 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C @@ -59,622 +59,6 @@ defineTypeNameAndDebug(autoLayerDriver, 0); // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -Foam::label Foam::autoLayerDriver::mergePatchFacesUndo -( - const scalar minCos, - const scalar concaveCos, - const dictionary& motionDict -) -{ - fvMesh& mesh = meshRefiner_.mesh(); - - // Patch face merging engine - combineFaces faceCombiner(mesh, true); - - // Pick up all candidate cells on boundary - labelHashSet boundaryCells(mesh.nFaces()-mesh.nInternalFaces()); - - { - labelList patchIDs(meshRefiner_.meshedPatches()); - - const polyBoundaryMesh& patches = mesh.boundaryMesh(); - - forAll(patchIDs, i) - { - label patchI = patchIDs[i]; - - const polyPatch& patch = patches[patchI]; - - if (!patch.coupled()) - { - forAll(patch, i) - { - boundaryCells.insert(mesh.faceOwner()[patch.start()+i]); - } - } - } - } - - // Get all sets of faces that can be merged - labelListList allFaceSets - ( - faceCombiner.getMergeSets - ( - minCos, - concaveCos, - boundaryCells - ) - ); - - label nFaceSets = returnReduce(allFaceSets.size(), sumOp