From 6f1102cb5d498459b966607e185b00b8b795e07d Mon Sep 17 00:00:00 2001 From: Martin Beaudoin Date: Wed, 28 May 2014 01:11:17 -0400 Subject: [PATCH 1/8] Add options for modifying the global controlDict values/switches from the command-line The following command-line options are available: -DebugSwitches key=value -DimensionedConstants key=value -InfoSwitches key=value -OptimisationSwitches key=value -Tolerances key=value In order to modify more than one key/value pair for a given category, you will need to specify a given option more than once. If an invalid/unknown key is specified, a complete list of valid keys for the application will be written at the console. Martin Beaudoin 05/2014 --- etc/controlDict | 2 +- src/Pstream/gamma/Pstream.C | 2 +- src/Pstream/mpi/Pstream.C | 2 +- .../fvPatchFields/fvPatchVectorNFields.C | 2 +- .../fvsPatchFields/fvsPatchVectorNFields.C | 2 +- .../autoHexMeshDriver/autoRefineDriver.C | 6 +- .../meshRefinement/meshRefinementBaffles.C | 14 +- .../meshRefinement/meshRefinementRefine.C | 16 +- .../dynamicTopoFvMeshCoupled.C | 43 ++- .../slidingInterface/coupleSlidingInterface.C | 17 +- .../slidingInterface/slidingInterface.C | 10 +- .../slidingInterface/slidingInterface.H | 17 +- .../slidingInterfaceProjectPoints.C | 55 ++- .../polyTopoChange/polyTopoChange.C | 2 +- .../mesquiteMotionSolver.C | 9 +- src/finiteArea/faMesh/faMesh.C | 10 +- src/finiteArea/faMesh/faMesh.H | 2 +- .../constraint/cyclic/cyclicFaPatch.C | 17 +- .../constraint/cyclic/cyclicFaPatch.H | 3 +- .../faPatchField/faPatchFields.C | 2 +- .../faePatchField/faePatchFields.C | 2 +- .../finiteArea/faSchemes/faSchemes.C | 2 +- .../cfdTools/general/adjustPhi/adjustPhi.C | 10 +- .../fvPatchField/fvPatchFields.C | 2 +- .../fvsPatchField/fvsPatchFields.C | 2 +- .../finiteVolume/fvSchemes/fvSchemes.C | 2 +- .../constraint/cyclic/cyclicFvPatch.C | 6 +- .../cellPointWeight/cellPointWeight.C | 2 +- src/foam/algorithms/MeshWave/FaceCellWave.C | 20 +- src/foam/algorithms/MeshWave/FaceCellWave.H | 8 +- .../octree/octree/octreeDataBoundBox.C | 7 +- .../octree/octree/octreeDataBoundBox.H | 3 +- src/foam/db/IOstreams/IOstreams.C | 7 +- src/foam/db/IOstreams/IOstreams/IOstream.H | 11 +- src/foam/db/IOstreams/Pstreams/Pstream.C | 13 +- src/foam/db/IOstreams/Pstreams/Pstream.H | 5 +- .../Pstreams/PstreamCombineReduceOps.H | 2 +- .../db/IOstreams/Pstreams/PstreamReduceOps.H | 4 +- .../IOstreams/Pstreams/combineGatherScatter.C | 12 +- .../db/IOstreams/Pstreams/gatherScatter.C | 4 +- .../db/IOstreams/Pstreams/gatherScatterList.C | 4 +- src/foam/db/IOstreams/Sstreams/OSstreamI.H | 2 +- src/foam/db/Time/TimeIO.C | 3 + .../includeEntry/includeEntry.C | 7 +- .../includeIfPresentEntry.C | 7 +- .../inputModeEntry/inputModeEntry.C | 7 +- .../functionEntries/removeEntry/removeEntry.C | 7 +- src/foam/db/error/messageStream.C | 2 +- .../functionObject/functionObject.C | 2 +- src/foam/db/regIOobject/regIOobject.C | 7 +- src/foam/db/regIOobject/regIOobject.H | 3 +- src/foam/db/regIOobject/regIOobjectRead.C | 4 +- src/foam/db/scalarRange/scalarRange.C | 2 +- src/foam/db/typeInfo/className.H | 15 +- src/foam/global/JobInfo/JobInfo.C | 8 +- src/foam/global/JobInfo/JobInfo.H | 3 +- src/foam/global/argList/argList.C | 72 +++- src/foam/global/argList/argList.H | 24 ++ .../global/controlSwitches/controlSwitches.C | 145 +++++++ .../global/controlSwitches/controlSwitches.H | 358 ++++++++++++++++++ .../global/controlSwitches/controlSwitchesI.H | 79 ++++ src/foam/global/controlSwitches/safe_bool.H | 100 +++++ src/foam/global/controlSwitches/safe_boolI.H | 79 ++++ src/foam/global/debug/debug.C | 326 +++++++++++++++- src/foam/global/debug/debug.H | 32 +- .../GGIInterpolation/GGIInterpolation.H | 15 +- .../GGIInterpolationPolygonIntersection.C | 8 +- .../GGIInterpolationQuickRejectTests.C | 34 +- .../GGIInterpolationWeights.C | 17 +- .../CalcPatchToPatchWeights.C | 6 +- .../PatchToPatchInterpolation.C | 17 +- .../PatchToPatchInterpolation.H | 5 +- .../BlockLduMatrix/BlockLduMatrix.C | 9 +- .../BlockLduMatrix/BlockLduMatrix.H | 3 +- src/foam/matrices/solution/solution.C | 2 +- src/foam/meshes/meshShapes/cell/cell.C | 2 +- .../polyMesh/globalMeshData/globalMeshData.C | 10 +- .../polyMesh/globalMeshData/globalMeshData.H | 3 +- .../basic/coupled/coupledPolyPatch.H | 2 +- .../constraint/cyclic/cyclicPolyPatch.C | 10 +- .../constraint/processor/processorPolyPatch.C | 4 +- .../polyPatches/polyPatch/polyPatch.C | 11 +- .../polyPatches/polyPatch/polyPatch.H | 4 +- .../PrimitivePatch/PrimitivePatch.C | 9 +- .../PrimitivePatch/PrimitivePatch.H | 3 +- .../PrimitivePatchProjectPoints.C | 2 +- src/foam/meshes/primitiveMesh/primitiveMesh.H | 13 +- .../primitiveMeshCheck/primitiveMeshCheck.C | 75 ++-- .../primitiveShapes/triangle/intersection.C | 16 +- .../primitiveShapes/triangle/intersection.H | 17 +- .../primitiveShapes/triangle/triangleI.H | 20 +- .../primitives/strings/fileName/fileName.C | 2 +- src/foam/primitives/strings/string/string.C | 2 +- src/foam/primitives/strings/word/word.C | 2 +- src/lagrangian/basic/Particle/Particle.H | 3 +- .../COxidationKineticDiffusionLimitedRate.C | 4 +- .../COxidationMurphyShaddix.C | 6 +- .../dieselSpray/parcel/setRelaxationTimes.C | 2 +- .../atomizationModel/LISA/LISA.C | 2 +- .../blobsSheetAtomization.C | 2 +- .../breakupModel/reitzDiwakar/reitzDiwakar.C | 2 +- .../parcels/Templates/DsmcParcel/DsmcParcel.H | 5 +- .../KinematicParcel/KinematicParcel.H | 5 +- .../ReactingMultiphaseParcel.C | 2 +- .../Templates/ReactingParcel/ReactingParcel.C | 8 +- .../LiquidEvaporation/LiquidEvaporation.C | 4 +- .../SingleKineticRateDevolatilisation.C | 2 +- src/lduSolvers/amg/amgPolicy/pamgPolicy.C | 8 +- src/lduSolvers/amg/amgPolicy/pamgPolicy.H | 3 +- .../surfaceIntersection/surfaceIntersection.C | 12 +- .../calculateMeshToMeshAddressing.C | 8 +- .../meshToMesh/calculateMeshToMeshWeights.C | 2 +- .../meshToMesh/meshToMesh.C | 6 +- .../meshToMesh/meshToMesh.H | 5 +- .../liquidMixture/liquidMixture.C | 2 +- .../radiationConstants/radiationConstants.C | 10 +- .../radiationConstants/radiationConstants.H | 1 + .../specie/specie/specie.C | 23 +- .../specie/specie/specie.H | 8 +- .../specie/specie/specieI.H | 2 +- .../specie/thermo/eConst/eConstThermoI.H | 2 +- .../thermo/hPolynomial/hPolynomialThermo.C | 4 +- .../specie/thermo/janaf/janafThermoI.H | 10 +- .../specie/thermo/specieThermo/specieThermo.C | 19 +- .../specie/thermo/specieThermo/specieThermo.H | 7 +- .../thermo/specieThermo/specieThermoI.H | 22 +- .../specie/transport/const/constTransportI.H | 4 +- .../polynomial/polynomialTransportI.H | 4 +- .../sutherland/sutherlandTransportI.H | 4 +- 129 files changed, 1779 insertions(+), 412 deletions(-) create mode 100644 src/foam/global/controlSwitches/controlSwitches.C create mode 100644 src/foam/global/controlSwitches/controlSwitches.H create mode 100644 src/foam/global/controlSwitches/controlSwitchesI.H create mode 100644 src/foam/global/controlSwitches/safe_bool.H create mode 100644 src/foam/global/controlSwitches/safe_boolI.H diff --git a/etc/controlDict b/etc/controlDict index b3ed77d82..bbcbea948 100644 --- a/etc/controlDict +++ b/etc/controlDict @@ -943,7 +943,7 @@ Tolerances slidingEdgeEndCutoffTol 0.0001; slidingEdgeCoPlanarTol 0.8; -// GGIAreaErrorTol 1e-8; + GGIAreaErrorTol 1e-8; } DimensionedConstants diff --git a/src/Pstream/gamma/Pstream.C b/src/Pstream/gamma/Pstream.C index f5f849421..9cee828e1 100644 --- a/src/Pstream/gamma/Pstream.C +++ b/src/Pstream/gamma/Pstream.C @@ -320,7 +320,7 @@ bool Pstream::init(int& argc, char**& argv) Info<< "GAMMA Pstream initialized with:" << nl << " floatTransfer : " << floatTransfer << nl - << " nProcsSimpleSum : " << nProcsSimpleSum << nl + << " nProcsSimpleSum : " << nProcsSimpleSum() << nl << " scheduledTransfer : " << Pstream::scheduledTransfer << nl << Foam::endl; diff --git a/src/Pstream/mpi/Pstream.C b/src/Pstream/mpi/Pstream.C index b7cddd6ec..1bb8ab404 100644 --- a/src/Pstream/mpi/Pstream.C +++ b/src/Pstream/mpi/Pstream.C @@ -154,7 +154,7 @@ void Foam::reduce(scalar& Value, const sumOp& bop) return; } - if (Pstream::nProcs() <= Pstream::nProcsSimpleSum) + if (Pstream::nProcs() <= Pstream::nProcsSimpleSum()) { if (Pstream::master()) { diff --git a/src/VectorN/finiteVolume/fields/fvPatchFields/fvPatchVectorNFields.C b/src/VectorN/finiteVolume/fields/fvPatchFields/fvPatchVectorNFields.C index 0bfb01b2c..e50138760 100644 --- a/src/VectorN/finiteVolume/fields/fvPatchFields/fvPatchVectorNFields.C +++ b/src/VectorN/finiteVolume/fields/fvPatchFields/fvPatchVectorNFields.C @@ -38,7 +38,7 @@ defineNamedTemplateTypeNameAndDebug(fvPatchTypeField, 0); \ template<> \ int fvPatchTypeField::disallowGenericFvPatchField \ ( \ - debug::debugSwitch("disallowGenericFvPatchField", 0) \ + debug::debugSwitchFromDict("disallowGenericFvPatchField", 0) \ ); \ defineTemplateRunTimeSelectionTable(fvPatchTypeField, patch); \ defineTemplateRunTimeSelectionTable(fvPatchTypeField, patchMapper); \ diff --git a/src/VectorN/finiteVolume/fields/fvsPatchFields/fvsPatchVectorNFields.C b/src/VectorN/finiteVolume/fields/fvsPatchFields/fvsPatchVectorNFields.C index 1c8c36503..108a80ca6 100644 --- a/src/VectorN/finiteVolume/fields/fvsPatchFields/fvsPatchVectorNFields.C +++ b/src/VectorN/finiteVolume/fields/fvsPatchFields/fvsPatchVectorNFields.C @@ -38,7 +38,7 @@ defineNamedTemplateTypeNameAndDebug(fvsPatchTypeField, 0); \ template<> \ int fvsPatchTypeField::disallowDefaultFvsPatchField \ ( \ - debug::debugSwitch("disallowDefaultFvsPatchField", 0) \ + debug::debugSwitchFromDict("disallowDefaultFvsPatchField", 0) \ ); \ defineTemplateRunTimeSelectionTable(fvsPatchTypeField, patch); \ defineTemplateRunTimeSelectionTable(fvsPatchTypeField, patchMapper); \ diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C b/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C index 4e0e6b5f2..139cb4710 100644 --- a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C +++ b/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C @@ -393,7 +393,7 @@ void Foam::autoRefineDriver::removeInsideCells { Pout<< "Writing subsetted mesh to time " << meshRefiner_.timeName() << '.' << endl; - meshRefiner_.write(debug, mesh.time().path()/meshRefiner_.timeName()); + meshRefiner_.write(debug(), mesh.time().path()/meshRefiner_.timeName()); Pout<< "Dumped mesh in = " << mesh.time().cpuTimeIncrement() << " s\n" << nl << endl; } @@ -645,7 +645,7 @@ void Foam::autoRefineDriver::zonify << meshRefiner_.timeName() << '.' << endl; meshRefiner_.write ( - debug, + debug(), mesh.time().path()/meshRefiner_.timeName() ); } @@ -735,7 +735,7 @@ void Foam::autoRefineDriver::splitAndMergeBaffles { Pout<< "Writing handleProblemCells mesh to time " << meshRefiner_.timeName() << '.' << endl; - meshRefiner_.write(debug, mesh.time().path()/meshRefiner_.timeName()); + meshRefiner_.write(debug(), mesh.time().path()/meshRefiner_.timeName()); } } diff --git a/src/autoMesh/autoHexMesh/meshRefinement/meshRefinementBaffles.C b/src/autoMesh/autoHexMesh/meshRefinement/meshRefinementBaffles.C index 65cc227d6..3a8f31ba7 100644 --- a/src/autoMesh/autoHexMesh/meshRefinement/meshRefinementBaffles.C +++ b/src/autoMesh/autoHexMesh/meshRefinement/meshRefinementBaffles.C @@ -229,7 +229,7 @@ void Foam::meshRefinement::getBafflePatches { autoPtr str; label vertI = 0; - if (debug&OBJINTERSECTIONS) + if (debug & OBJINTERSECTIONS) { str.reset ( @@ -1499,13 +1499,13 @@ void Foam::meshRefinement::baffleAndSplitMesh Info<< "Created baffles in = " << runTime.cpuTimeIncrement() << " s\n" << nl << endl; - printMeshInfo(debug, "After introducing baffles"); + printMeshInfo(debug(), "After introducing baffles"); if (debug) { Pout<< "Writing baffled mesh to time " << timeName() << endl; - write(debug, runTime.path()/"baffles"); + write(debug(), runTime.path()/"baffles"); Pout<< "Dumped debug data in = " << runTime.cpuTimeIncrement() << " s\n" << nl << endl; } @@ -1581,13 +1581,13 @@ void Foam::meshRefinement::baffleAndSplitMesh Info<< "Created baffles in = " << runTime.cpuTimeIncrement() << " s\n" << nl << endl; - printMeshInfo(debug, "After introducing baffles"); + printMeshInfo(debug(), "After introducing baffles"); if (debug) { Pout<< "Writing extra baffled mesh to time " << timeName() << endl; - write(debug, runTime.path()/"extraBaffles"); + write(debug(), runTime.path()/"extraBaffles"); Pout<< "Dumped debug data in = " << runTime.cpuTimeIncrement() << " s\n" << nl << endl; } @@ -1617,13 +1617,13 @@ void Foam::meshRefinement::baffleAndSplitMesh Info<< "Split mesh in = " << runTime.cpuTimeIncrement() << " s\n" << nl << endl; - printMeshInfo(debug, "After subsetting"); + printMeshInfo(debug(), "After subsetting"); if (debug) { Pout<< "Writing subsetted mesh to time " << timeName() << endl; - write(debug, runTime.path()/timeName()); + write(debug(), runTime.path()/timeName()); Pout<< "Dumped debug data in = " << runTime.cpuTimeIncrement() << " s\n" << nl << endl; } diff --git a/src/autoMesh/autoHexMesh/meshRefinement/meshRefinementRefine.C b/src/autoMesh/autoHexMesh/meshRefinement/meshRefinementRefine.C index 858020005..85d0996ed 100644 --- a/src/autoMesh/autoHexMesh/meshRefinement/meshRefinementRefine.C +++ b/src/autoMesh/autoHexMesh/meshRefinement/meshRefinementRefine.C @@ -1269,7 +1269,7 @@ Foam::meshRefinement::refineAndBalance << " mesh to time " << timeName() << endl; write ( - debug, + debug(), mesh_.time().path() /timeName() ); @@ -1282,7 +1282,7 @@ Foam::meshRefinement::refineAndBalance Info<< "Refined mesh in = " << mesh_.time().cpuTimeIncrement() << " s" << endl; - printMeshInfo(debug, "After refinement " + msg); + printMeshInfo(debug(), "After refinement " + msg); // Load balancing @@ -1324,7 +1324,7 @@ Foam::meshRefinement::refineAndBalance Info<< "Balanced mesh in = " << mesh_.time().cpuTimeIncrement() << " s" << endl; - printMeshInfo(debug, "After balancing " + msg); + printMeshInfo(debug(), "After balancing " + msg); if (debug) @@ -1333,7 +1333,7 @@ Foam::meshRefinement::refineAndBalance << " mesh to time " << timeName() << endl; write ( - debug, + debug(), mesh_.time().path()/timeName() ); Pout<< "Dumped debug data in = " @@ -1447,7 +1447,7 @@ Foam::meshRefinement::balanceAndRefine // Info<< endl; //} - printMeshInfo(debug, "After balancing " + msg); + printMeshInfo(debug(), "After balancing " + msg); if (debug) { @@ -1455,7 +1455,7 @@ Foam::meshRefinement::balanceAndRefine << " mesh to time " << timeName() << endl; write ( - debug, + debug(), mesh_.time().path()/timeName() ); Pout<< "Dumped debug data in = " @@ -1478,7 +1478,7 @@ Foam::meshRefinement::balanceAndRefine << " mesh to time " << timeName() << endl; write ( - debug, + debug(), mesh_.time().path() /timeName() ); @@ -1504,7 +1504,7 @@ Foam::meshRefinement::balanceAndRefine // Info<< endl; //} - printMeshInfo(debug, "After refinement " + msg); + printMeshInfo(debug(), "After refinement " + msg); return distMap; } diff --git a/src/dynamicMesh/dynamicFvMesh/dynamicTopoFvMesh/dynamicTopoFvMeshCoupled.C b/src/dynamicMesh/dynamicFvMesh/dynamicTopoFvMesh/dynamicTopoFvMeshCoupled.C index d5be28ff9..097b5df7e 100644 --- a/src/dynamicMesh/dynamicFvMesh/dynamicTopoFvMesh/dynamicTopoFvMeshCoupled.C +++ b/src/dynamicMesh/dynamicFvMesh/dynamicTopoFvMesh/dynamicTopoFvMeshCoupled.C @@ -56,6 +56,7 @@ Author #include "processorPolyPatch.H" #include "decompositionMethod.H" #include "mapDistributePolyMesh.H" +#include "controlSwitches.H" namespace Foam { @@ -4894,7 +4895,11 @@ bool dynamicTopoFvMesh::checkCoupledBoundaries(bool report) const bool sizeError = false, misMatchError = false; // Check if a geometric tolerance has been specified. - scalar gTol = debug::tolerances("processorMatchTol", 1e-4); + const Foam::debug::tolerancesSwitch gTol + ( + "processorMatchTol", + 1e-4 + ); // Maintain a list of master / neighbour anchors List mAnchors(boundary.size()); @@ -5053,7 +5058,7 @@ bool dynamicTopoFvMesh::checkCoupledBoundaries(bool report) const scalar rMagSf = mag(half1Areas[faceI]); scalar avSf = 0.5 * (fMagSf + rMagSf); - if (mag(fMagSf - rMagSf)/avSf > gTol) + if (mag(fMagSf - rMagSf)/avSf > gTol()) { misMatchError = true; @@ -5071,7 +5076,7 @@ bool dynamicTopoFvMesh::checkCoupledBoundaries(bool report) const Foam::max ( pTol, - gTol * mag(lP[lF[faceI][0]] - lC[faceI]) + gTol() * mag(lP[lF[faceI][0]] - lC[faceI]) ) ); } @@ -5217,7 +5222,7 @@ bool dynamicTopoFvMesh::checkCoupledBoundaries(bool report) const scalar nbrMagSf = mag(fAreas[pI][faceI]); scalar avSf = 0.5 * (magSf + nbrMagSf); - if (mag(magSf - nbrMagSf)/avSf > gTol) + if (mag(magSf - nbrMagSf)/avSf > gTol()) { misMatchError = true; @@ -5236,7 +5241,7 @@ bool dynamicTopoFvMesh::checkCoupledBoundaries(bool report) const Foam::max ( pTol, - gTol * + gTol() * mag ( myPoints[myFaces[faceI][0]] @@ -6116,10 +6121,14 @@ void dynamicTopoFvMesh::buildLocalCoupledMaps() // Check if a geometric tolerance has been specified. const boundBox& box = polyMesh::bounds(); - scalar relTol = debug::tolerances("patchFaceMatchTol", 1e-4); + const Foam::debug::tolerancesSwitch relTol + ( + "patchFaceMatchTol", + 1e-4 + ); // Compute tolerance - scalar tol = relTol * box.mag(); + scalar tol = relTol() * box.mag(); const polyBoundaryMesh& boundary = boundaryMesh(); @@ -6181,7 +6190,7 @@ void dynamicTopoFvMesh::buildLocalCoupledMaps() FatalErrorIn("void dynamicTopoFvMesh::buildLocalCoupledMaps()") << " Failed to match all points" << " within a tolerance of: " << tol << nl - << " relTol: " << relTol << nl + << " relTol: " << relTol() << nl << abort(FatalError); } @@ -6843,10 +6852,14 @@ void dynamicTopoFvMesh::buildProcessorCoupledMaps() const Map