diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C index 7fcf53e935..afbf268980 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C +++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. + \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -56,11 +56,6 @@ scalar getMergeDistance(const polyMesh& mesh, const scalar mergeTol) { const boundBox& meshBb = mesh.bounds(); scalar mergeDist = mergeTol * meshBb.mag(); - scalar writeTol = std::pow - ( - scalar(10.0), - -scalar(IOstream::defaultPrecision()) - ); Info<< nl << "Overall mesh bounding box : " << meshBb << nl @@ -68,17 +63,27 @@ scalar getMergeDistance(const polyMesh& mesh, const scalar mergeTol) << "Absolute matching distance : " << mergeDist << nl << endl; - if (mesh.time().writeFormat() == IOstream::ASCII && mergeTol < writeTol) + // check writing tolerance + if (mesh.time().writeFormat() == IOstream::ASCII) { - FatalErrorIn("getMergeDistance(const polyMesh&, const scalar)") - << "Your current settings specify ASCII writing with " - << IOstream::defaultPrecision() << " digits precision." << endl - << "Your merging tolerance (" << mergeTol << ") is finer than this." - << endl - << "Please change your writeFormat to binary" - << " or increase the writePrecision" << endl - << "or adjust the merge tolerance (-mergeTol)." - << exit(FatalError); + const scalar writeTol = std::pow + ( + scalar(10.0), + -scalar(IOstream::defaultPrecision()) + ); + + if (mergeTol < writeTol) + { + FatalErrorIn("getMergeDistance(const polyMesh&, const dictionary&)") + << "Your current settings specify ASCII writing with " + << IOstream::defaultPrecision() << " digits precision." << nl + << "Your merging tolerance (" << mergeTol + << ") is finer than this." << nl + << "Change to binary writeFormat, " + << "or increase the writePrecision" << endl + << "or adjust the merge tolerance (mergeTol)." + << exit(FatalError); + } } return mergeDist; @@ -107,7 +112,7 @@ void writeMesh mesh.time().path()/meshRefiner.timeName() ); } - Info<< "Written mesh in = " + Info<< "Wrote mesh in = " << mesh.time().cpuTimeIncrement() << " s." << endl; } @@ -115,7 +120,11 @@ void writeMesh int main(int argc, char *argv[]) { - argList::addBoolOption("overwrite"); + argList::addBoolOption + ( + "overwrite", + "overwrite existing mesh files" + ); # include "setRootCase.H" # include "createTime.H" runTime.functionObjects().off(); @@ -126,7 +135,6 @@ int main(int argc, char *argv[]) const bool overwrite = args.optionFound("overwrite"); - // Check patches and faceZones are synchronised mesh.boundaryMesh().checkParallelSync(true); meshRefinement::checkCoupledFaceZones(mesh); @@ -173,7 +181,7 @@ int main(int argc, char *argv[]) // layer addition parameters const dictionary& layerDict = meshDict.subDict("addLayersControls"); - + // absolute merge distance const scalar mergeDist = getMergeDistance ( mesh, @@ -181,17 +189,16 @@ int main(int argc, char *argv[]) ); - // Debug // ~~~~~ - const label debug(readLabel(meshDict.lookup("debug"))); + const label debug = meshDict.lookupOrDefault