ENH: Add usage information for snappyHexMesh -overwrite option.

Make debug optional.

- minor wording changes in the messages
This commit is contained in:
Mark Olesen
2010-02-02 15:39:45 +01:00
parent b4e99e369b
commit a070321792
3 changed files with 45 additions and 43 deletions

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -56,11 +56,6 @@ scalar getMergeDistance(const polyMesh& mesh, const scalar mergeTol)
{ {
const boundBox& meshBb = mesh.bounds(); const boundBox& meshBb = mesh.bounds();
scalar mergeDist = mergeTol * meshBb.mag(); scalar mergeDist = mergeTol * meshBb.mag();
scalar writeTol = std::pow
(
scalar(10.0),
-scalar(IOstream::defaultPrecision())
);
Info<< nl Info<< nl
<< "Overall mesh bounding box : " << meshBb << nl << "Overall mesh bounding box : " << meshBb << nl
@ -68,17 +63,27 @@ scalar getMergeDistance(const polyMesh& mesh, const scalar mergeTol)
<< "Absolute matching distance : " << mergeDist << nl << "Absolute matching distance : " << mergeDist << nl
<< endl; << endl;
if (mesh.time().writeFormat() == IOstream::ASCII && mergeTol < writeTol) // check writing tolerance
if (mesh.time().writeFormat() == IOstream::ASCII)
{ {
FatalErrorIn("getMergeDistance(const polyMesh&, const scalar)") const scalar writeTol = std::pow
<< "Your current settings specify ASCII writing with " (
<< IOstream::defaultPrecision() << " digits precision." << endl scalar(10.0),
<< "Your merging tolerance (" << mergeTol << ") is finer than this." -scalar(IOstream::defaultPrecision())
<< endl );
<< "Please change your writeFormat to binary"
<< " or increase the writePrecision" << endl if (mergeTol < writeTol)
<< "or adjust the merge tolerance (-mergeTol)." {
<< exit(FatalError); 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; return mergeDist;
@ -107,7 +112,7 @@ void writeMesh
mesh.time().path()/meshRefiner.timeName() mesh.time().path()/meshRefiner.timeName()
); );
} }
Info<< "Written mesh in = " Info<< "Wrote mesh in = "
<< mesh.time().cpuTimeIncrement() << " s." << endl; << mesh.time().cpuTimeIncrement() << " s." << endl;
} }
@ -115,7 +120,11 @@ void writeMesh
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
argList::addBoolOption("overwrite"); argList::addBoolOption
(
"overwrite",
"overwrite existing mesh files"
);
# include "setRootCase.H" # include "setRootCase.H"
# include "createTime.H" # include "createTime.H"
runTime.functionObjects().off(); runTime.functionObjects().off();
@ -126,7 +135,6 @@ int main(int argc, char *argv[])
const bool overwrite = args.optionFound("overwrite"); const bool overwrite = args.optionFound("overwrite");
// Check patches and faceZones are synchronised // Check patches and faceZones are synchronised
mesh.boundaryMesh().checkParallelSync(true); mesh.boundaryMesh().checkParallelSync(true);
meshRefinement::checkCoupledFaceZones(mesh); meshRefinement::checkCoupledFaceZones(mesh);
@ -173,7 +181,7 @@ int main(int argc, char *argv[])
// layer addition parameters // layer addition parameters
const dictionary& layerDict = meshDict.subDict("addLayersControls"); const dictionary& layerDict = meshDict.subDict("addLayersControls");
// absolute merge distance
const scalar mergeDist = getMergeDistance const scalar mergeDist = getMergeDistance
( (
mesh, mesh,
@ -181,17 +189,16 @@ int main(int argc, char *argv[])
); );
// Debug // Debug
// ~~~~~ // ~~~~~
const label debug(readLabel(meshDict.lookup("debug"))); const label debug = meshDict.lookupOrDefault<label>("debug", 0);
if (debug > 0) if (debug > 0)
{ {
meshRefinement::debug = debug; meshRefinement::debug = debug;
autoRefineDriver::debug = debug; autoRefineDriver::debug = debug;
autoSnapDriver::debug = debug; autoSnapDriver::debug = debug;
autoLayerDriver::debug = debug; autoLayerDriver::debug = debug;
} }
@ -272,7 +279,7 @@ int main(int argc, char *argv[])
meshRefiner.write meshRefiner.write
( (
debug&meshRefinement::OBJINTERSECTIONS, debug & meshRefinement::OBJINTERSECTIONS,
mesh.time().path()/meshRefiner.timeName() mesh.time().path()/meshRefiner.timeName()
); );
@ -357,9 +364,9 @@ int main(int argc, char *argv[])
// Now do the real work -refinement -snapping -layers // Now do the real work -refinement -snapping -layers
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Switch wantRefine(meshDict.lookup("castellatedMesh")); const Switch wantRefine(meshDict.lookup("castellatedMesh"));
Switch wantSnap(meshDict.lookup("snap")); const Switch wantSnap(meshDict.lookup("snap"));
Switch wantLayers(meshDict.lookup("addLayers")); const Switch wantLayers(meshDict.lookup("addLayers"));
if (wantRefine) if (wantRefine)
{ {
@ -465,7 +472,7 @@ int main(int argc, char *argv[])
Info<< "End\n" << endl; Info<< "End\n" << endl;
return(0); return 0;
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -34,14 +34,9 @@ License
#include "meshTools.H" #include "meshTools.H"
#include "OFstream.H" #include "OFstream.H"
namespace Foam // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // defineTypeNameAndDebug(Foam::motionSmoother, 0);
defineTypeNameAndDebug(motionSmoother, 0);
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -738,7 +733,7 @@ Foam::tmp<Foam::scalarField> Foam::motionSmoother::movePoints
// Correct for 2-D motion // Correct for 2-D motion
if (twoDCorrector_.required()) if (twoDCorrector_.required())
{ {
Info<< "Correct-ing 2-D mesh motion"; Info<< "Correcting 2-D mesh motion";
if (mesh_.globalData().parallel()) if (mesh_.globalData().parallel())
{ {

View File

@ -459,16 +459,16 @@ void Foam::autoHexMeshDriver::writeMesh(const string& msg) const
mesh_.time().path()/meshRefiner.timeName() mesh_.time().path()/meshRefiner.timeName()
); );
} }
Info<< "Written mesh in = " Info<< "Wrote mesh in = "
<< mesh_.time().cpuTimeIncrement() << " s." << endl; << mesh_.time().cpuTimeIncrement() << " s." << endl;
} }
void Foam::autoHexMeshDriver::doMesh() void Foam::autoHexMeshDriver::doMesh()
{ {
Switch wantRefine(dict_.lookup("doRefine")); const Switch wantRefine(dict_.lookup("doRefine"));
Switch wantSnap(dict_.lookup("doSnap")); const Switch wantSnap(dict_.lookup("doSnap"));
Switch wantLayers(dict_.lookup("doLayers")); const Switch wantLayers(dict_.lookup("doLayers"));
Info<< "Do refinement : " << wantRefine << nl Info<< "Do refinement : " << wantRefine << nl
<< "Do snapping : " << wantSnap << nl << "Do snapping : " << wantSnap << nl