diff --git a/src/mesh/snappyHexMesh/refinementFeatures/refinementFeatures.C b/src/mesh/snappyHexMesh/refinementFeatures/refinementFeatures.C index 050d7215a980ee88b2a00cb581d75f6bdac586f2..6a3c996c9adae5a16436595a4217ffd4eaab2f36 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 f693ca674a80c0e6d626713af444b7cf8aab5914..0726bd0a3a23b96b3144e6401a569f3c4715e4f6 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 ea8c00447a1443db1e231e73f939faf7f1949dff..6713ba2d83253dbaadf32828b9e5b601e1bbeabd 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<Tuple2<scalar, label>>& 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 "