diff --git a/src/mesh/snappyHexMesh/refinementFeatures/refinementFeatures.C b/src/mesh/snappyHexMesh/refinementFeatures/refinementFeatures.C index 050d7215a9..6a3c996c9a 100644 --- a/src/mesh/snappyHexMesh/refinementFeatures/refinementFeatures.C +++ b/src/mesh/snappyHexMesh/refinementFeatures/refinementFeatures.C @@ -204,6 +204,14 @@ void Foam::refinementFeatures::read distances_[featI][j] = distLevels[j].first(); levels_[featI][j] = distLevels[j].second(); + if (levels_[featI][j] < 0) + { + FatalErrorInFunction + << "Feature " << featFileName + << " has illegal refinement level " << levels_[featI][j] + << exit(FatalError); + } + // Check in incremental order if (j > 0) { diff --git a/src/mesh/snappyHexMesh/refinementSurfaces/refinementSurfaces.C b/src/mesh/snappyHexMesh/refinementSurfaces/refinementSurfaces.C index f693ca674a..0726bd0a3a 100644 --- a/src/mesh/snappyHexMesh/refinementSurfaces/refinementSurfaces.C +++ b/src/mesh/snappyHexMesh/refinementSurfaces/refinementSurfaces.C @@ -207,6 +207,7 @@ Foam::refinementSurfaces::refinementSurfaces ( globalMinLevel[surfI] < 0 || globalMaxLevel[surfI] < globalMinLevel[surfI] + || globalMaxLevel[surfI] < 0 || globalLevelIncr[surfI] < 0 ) { diff --git a/src/mesh/snappyHexMesh/shellSurfaces/shellSurfaces.C b/src/mesh/snappyHexMesh/shellSurfaces/shellSurfaces.C index ea8c00447a..6713ba2d83 100644 --- a/src/mesh/snappyHexMesh/shellSurfaces/shellSurfaces.C +++ b/src/mesh/snappyHexMesh/shellSurfaces/shellSurfaces.C @@ -55,6 +55,8 @@ void Foam::shellSurfaces::setAndCheckLevels const List>& distLevels ) { + const searchableSurface& shell = allGeometry_[shells_[shellI]]; + if (modes_[shellI] != DISTANCE && distLevels.size() != 1) { FatalErrorInFunction @@ -73,6 +75,16 @@ void Foam::shellSurfaces::setAndCheckLevels distances_[shellI][j] = distLevels[j].first(); levels_[shellI][j] = distLevels[j].second(); + if (levels_[shellI][j] < -1) + { + FatalErrorInFunction + << "Shell " << shell.name() + << " has illegal refinement level " + << levels_[shellI][j] + << exit(FatalError); + } + + // Check in incremental order if (j > 0) { @@ -95,8 +107,6 @@ void Foam::shellSurfaces::setAndCheckLevels } } - const searchableSurface& shell = allGeometry_[shells_[shellI]]; - if (modes_[shellI] == DISTANCE) { Info<< "Refinement level according to distance to "