diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict index bf257a8ff55b8cfa687a2c9400cace03604bdc89..46d570e206f665b9857b4eade8a268a6e4944287 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict +++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict @@ -101,8 +101,11 @@ castellatedMeshControls // 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 cells are selected for refinement. Note: it will + // at least do one iteration unless + // a: the number of cells to refine is 0 + // b: minRefinementCells = -1. This is a special value indicating + // no refinement. minRefinementCells 0; // Allow a certain level of imbalance during refining diff --git a/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyRefineDriver.C b/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyRefineDriver.C index 1040094bb1410ec2faaf2ff2e2de4f29e3375032..956fb4366f93421c3b194b585fdeeb117c2e9f3d 100644 --- a/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyRefineDriver.C +++ b/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyRefineDriver.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -80,6 +80,13 @@ Foam::label Foam::snappyRefineDriver::featureEdgeRefine const label minRefine ) { + if (refineParams.minRefineCells() == -1) + { + // Special setting to be able to restart shm on meshes with inconsistent + // cellLevel/pointLevel + return 0; + } + addProfiling(edge, "snappyHexMesh::refine::edge"); const fvMesh& mesh = meshRefiner_.mesh(); @@ -190,6 +197,13 @@ Foam::label Foam::snappyRefineDriver::smallFeatureRefine const label maxIter ) { + if (refineParams.minRefineCells() == -1) + { + // Special setting to be able to restart shm on meshes with inconsistent + // cellLevel/pointLevel + return 0; + } + addProfiling(feature, "snappyHexMesh::refine::smallFeature"); const fvMesh& mesh = meshRefiner_.mesh(); @@ -313,6 +327,13 @@ Foam::label Foam::snappyRefineDriver::surfaceOnlyRefine const label maxIter ) { + if (refineParams.minRefineCells() == -1) + { + // Special setting to be able to restart shm on meshes with inconsistent + // cellLevel/pointLevel + return 0; + } + addProfiling(surface, "snappyHexMesh::refine::surface"); const fvMesh& mesh = meshRefiner_.mesh(); @@ -437,6 +458,13 @@ Foam::label Foam::snappyRefineDriver::gapOnlyRefine const label maxIter ) { + if (refineParams.minRefineCells() == -1) + { + // Special setting to be able to restart shm on meshes with inconsistent + // cellLevel/pointLevel + return 0; + } + const fvMesh& mesh = meshRefiner_.mesh(); // Determine the maximum refinement level over all surfaces. This @@ -669,6 +697,13 @@ Foam::label Foam::snappyRefineDriver::bigGapOnlyRefine const label maxIter ) { + if (refineParams.minRefineCells() == -1) + { + // Special setting to be able to restart shm on meshes with inconsistent + // cellLevel/pointLevel + return 0; + } + const fvMesh& mesh = meshRefiner_.mesh(); label iter = 0; @@ -811,6 +846,13 @@ Foam::label Foam::snappyRefineDriver::danglingCellRefine const label maxIter ) { + if (refineParams.minRefineCells() == -1) + { + // Special setting to be able to restart shm on meshes with inconsistent + // cellLevel/pointLevel + return 0; + } + addProfiling(dangling, "snappyHexMesh::refine::danglingCell"); const fvMesh& mesh = meshRefiner_.mesh(); @@ -957,6 +999,13 @@ Foam::label Foam::snappyRefineDriver::refinementInterfaceRefine const label maxIter ) { + if (refineParams.minRefineCells() == -1) + { + // Special setting to be able to restart shm on meshes with inconsistent + // cellLevel/pointLevel + return 0; + } + addProfiling(interface, "snappyHexMesh::refine::transition"); const fvMesh& mesh = meshRefiner_.mesh(); @@ -1348,6 +1397,13 @@ Foam::label Foam::snappyRefineDriver::shellRefine const label maxIter ) { + if (refineParams.minRefineCells() == -1) + { + // Special setting to be able to restart shm on meshes with inconsistent + // cellLevel/pointLevel + return 0; + } + addProfiling(shell, "snappyHexMesh::refine::shell"); const fvMesh& mesh = meshRefiner_.mesh();