diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C index fb177e101f..f1ce1aa996 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C +++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C @@ -137,8 +137,11 @@ autoPtr createRefinementSurfaces const scalar surfaceCellSize = readScalar(scsDict.lookup("surfaceCellSizeCoeff")); - globalMinLevel[surfI] = label(1.0/surfaceCellSize); - globalMaxLevel[surfI] = label(1.0/surfaceCellSize); + const label calculatedCellLevel = + round(::log(1.0/surfaceCellSize)/::log(2)); + + globalMinLevel[surfI] = calculatedCellLevel; + globalMaxLevel[surfI] = calculatedCellLevel; globalLevelIncr[surfI] = shapeDict.lookupOrDefault ( "gapLevelIncrement", @@ -319,8 +322,14 @@ autoPtr createRefinementSurfaces scsDict.lookup("surfaceCellSizeCoeff") ); - globalMinLevel[surfI] = label(1.0/surfaceCellSize); - globalMaxLevel[surfI] = label(1.0/surfaceCellSize); + const label calculatedCellLevel = + round + ( + ::log(1.0/surfaceCellSize)/::log(2) + ); + + globalMinLevel[surfI] = calculatedCellLevel; + globalMaxLevel[surfI] = calculatedCellLevel; globalLevelIncr[surfI] = shapeControlRegionDict.lookupOrDefault ( @@ -818,7 +827,8 @@ int main(int argc, char *argv[]) meshPtr().addFvPatches(patches); const scalar initialCellSize = ::pow(meshPtr().V()[0], 1.0/3.0); - const label initialRefLevels = ::sqrt(initialCellSize/defaultCellSize); + const label initialRefLevels = + ::log(initialCellSize/defaultCellSize)/::log(2); Info<< "Default cell size = " << defaultCellSize << endl; Info<< "Initial cell size = " << initialCellSize << endl; @@ -1518,12 +1528,14 @@ int main(int argc, char *argv[]) } } - fileName outFileName("simplifiedSurface.obj"); - - if (args.optionFound("outFile")) - { - outFileName = word(args.optionLookup("outFile")()); - } + fileName outFileName + ( + args.optionLookupOrDefault + ( + "outFile", + "constant/triSurface/simplifiedSurface.stl" + ) + ); extractSurface (