diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C index 67a9c3a944..7b4d8577c4 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C +++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C @@ -1075,6 +1075,26 @@ int main(int argc, char *argv[]) << mesh.time().cpuTimeIncrement() << " s" << nl << endl; + // Optionally read limit shells + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + const dictionary limitDict(refineDict.subOrEmptyDict("limitRegions")); + + if (!limitDict.empty()) + { + Info<< "Reading limit shells." << endl; + } + + shellSurfaces limitShells(allGeometry, limitDict); + + if (!limitDict.empty()) + { + Info<< "Read refinement shells in = " + << mesh.time().cpuTimeIncrement() << " s" << nl << endl; + } + + + // Read feature meshes // ~~~~~~~~~~~~~~~~~~~ @@ -1105,7 +1125,8 @@ int main(int argc, char *argv[]) overwrite, // overwrite mesh files? surfaces, // for surface intersection refinement features, // for feature edges/point based refinement - shells // for volume (inside/outside) refinement + shells, // for volume (inside/outside) refinement + limitShells // limit of volume refinement ); Info<< "Calculated surface intersections in = " << mesh.time().cpuTimeIncrement() << " s" << nl << endl; diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict index 9b759b5ca4..6b40b2ab5e 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict +++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict @@ -95,10 +95,10 @@ castellatedMeshControls // actually be a lot less. maxGlobalCells 2000000; - // The surface refinement loop might spend lots of iterations refining just a - // few cells. This setting will cause refinement to stop if <= minimumRefine - // are selected for refinement. Note: it will at least do one iteration - // (unless the number of cells to refine is 0) + // The surface refinement loop might spend lots of iterations refining just + // a few cells. This setting will cause refinement to stop if + // <= minimumRefine cells are selected for refinement. Note: it will + // at least do one iteration (unless the number of cells to refine is 0) minRefinementCells 0; // Allow a certain level of imbalance during refining @@ -244,11 +244,27 @@ castellatedMeshControls } //sphere.stl //{ - // mode distance; - // levels ((1.0 5) (2.0 3)); + // mode inside; + // levels ((1.0 4)); + // // Optional override of uniform refinement level such + // // that in small gaps we're getting more cells. + // // The specification is + // // - numGapCells : minimum number of cells in the gap + // // - minLevel : min refinement level at which to kick in + // // - maxLevel : upper refinement level + // // All three settings can be overridden on a surface by + // // surface basis in the refinementSurfaces section. + // gapLevel ( ); //} } + + // Limit refinement in geometric region + limitRegions + { + } + + // Mesh selection // ~~~~~~~~~~~~~~ diff --git a/src/Allwmake b/src/Allwmake index c0ea041c37..d70cb03fc2 100755 --- a/src/Allwmake +++ b/src/Allwmake @@ -59,6 +59,8 @@ parallel/Allwmake $targetType $* wmake $targetType ODE wmake $targetType randomProcesses +wmake $targetType fvMotionSolver + transportModels/Allwmake $targetType $* thermophysicalModels/Allwmake $targetType $* TurbulenceModels/Allwmake $targetType $* @@ -69,7 +71,6 @@ mesh/Allwmake $targetType $* renumber/Allwmake $targetType $* fvAgglomerationMethods/Allwmake $targetType $* -wmake $targetType fvMotionSolver wmake $targetType engine wmake $targetType fvOptions wmake $targetType regionCoupled diff --git a/src/OpenFOAM/algorithms/indexedOctree/volumeType.H b/src/OpenFOAM/algorithms/indexedOctree/volumeType.H index 7bdfc043e6..3d845c414b 100644 --- a/src/OpenFOAM/algorithms/indexedOctree/volumeType.H +++ b/src/OpenFOAM/algorithms/indexedOctree/volumeType.H @@ -2,8 +2,8 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation - \\/ M anipulation | + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation + \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -95,6 +95,12 @@ public: t_(t) {} + //- Construct from integer + explicit volumeType(const int t) + : + t_(static_cast(t)) + {} + // Member Functions diff --git a/src/mesh/autoMesh/Make/files b/src/mesh/autoMesh/Make/files index 081d70afbd..29001bafb7 100644 --- a/src/mesh/autoMesh/Make/files +++ b/src/mesh/autoMesh/Make/files @@ -15,6 +15,7 @@ $(autoHexMesh)/meshRefinement/meshRefinement.C $(autoHexMesh)/meshRefinement/meshRefinementMerge.C $(autoHexMesh)/meshRefinement/meshRefinementProblemCells.C $(autoHexMesh)/meshRefinement/meshRefinementRefine.C +$(autoHexMesh)/meshRefinement/meshRefinementGapRefine.C $(autoHexMesh)/meshRefinement/patchFaceOrientation.C $(autoHexMesh)/refinementFeatures/refinementFeatures.C diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C index be908b76bb..bda68a1708 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C @@ -105,7 +105,10 @@ Foam::label Foam::autoRefineDriver::featureEdgeRefine false, // internalRefinement false, // surfaceRefinement false, // curvatureRefinement + false, // smallFeatureRefinement false, // gapRefinement + false, // bigGapRefinement + false, // spreadGapSize refineParams.maxGlobalCells(), refineParams.maxLocalCells() ) @@ -179,6 +182,128 @@ Foam::label Foam::autoRefineDriver::featureEdgeRefine } +Foam::label Foam::autoRefineDriver::smallFeatureRefine +( + const refinementParameters& refineParams, + const label maxIter +) +{ + const fvMesh& mesh = meshRefiner_.mesh(); + + + label iter = 0; + + // See if any surface has an extendedGapLevel + labelList surfaceMaxLevel(meshRefiner_.surfaces().maxGapLevel()); + labelList shellMaxLevel(meshRefiner_.shells().maxGapLevel()); + + if (max(surfaceMaxLevel) == 0 && max(shellMaxLevel) == 0) + { + return iter; + } + + for (; iter < maxIter; iter++) + { + Info<< nl + << "Small surface feature refinement iteration " << iter << nl + << "--------------------------------------------" << nl + << endl; + + + // Determine cells to refine + // ~~~~~~~~~~~~~~~~~~~~~~~~~ + + labelList candidateCells + ( + meshRefiner_.refineCandidates + ( + refineParams.locationsInMesh(), + refineParams.curvature(), + refineParams.planarAngle(), + + false, // featureRefinement + false, // featureDistanceRefinement + false, // internalRefinement + false, // surfaceRefinement + false, // curvatureRefinement + true, // smallFeatureRefinement + false, // gapRefinement + false, // bigGapRefinement + false, // spreadGapSize + refineParams.maxGlobalCells(), + refineParams.maxLocalCells() + ) + ); + + labelList cellsToRefine + ( + meshRefiner_.meshCutter().consistentRefinement + ( + candidateCells, + true + ) + ); + Info<< "Determined cells to refine in = " + << mesh.time().cpuTimeIncrement() << " s" << endl; + + + label nCellsToRefine = cellsToRefine.size(); + reduce(nCellsToRefine, sumOp