diff --git a/applications/solvers/combustion/PDRFoam/Make/options b/applications/solvers/combustion/PDRFoam/Make/options index e765e61574..9f019439a7 100644 --- a/applications/solvers/combustion/PDRFoam/Make/options +++ b/applications/solvers/combustion/PDRFoam/Make/options @@ -9,8 +9,7 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/combustion/lnInclude \ - -I$(LIB_SRC)/turbulenceModels \ - -I$(LIB_SRC)/turbulenceModels/compressible/RAS/lnInclude \ + -I$(LIB_SRC)/turbulenceModels/RAS/compressible/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/laminarFlameSpeed/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ diff --git a/applications/solvers/combustion/PDRFoam/PDRModels/XiEqModels/basicXiSubXiEq/basicXiSubXiEq.H b/applications/solvers/combustion/PDRFoam/PDRModels/XiEqModels/basicXiSubXiEq/basicXiSubXiEq.H index 04cc2a83ca..335012c868 100644 --- a/applications/solvers/combustion/PDRFoam/PDRModels/XiEqModels/basicXiSubXiEq/basicXiSubXiEq.H +++ b/applications/solvers/combustion/PDRFoam/PDRModels/XiEqModels/basicXiSubXiEq/basicXiSubXiEq.H @@ -23,7 +23,7 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Class - basicSubGrid + Foam::XiEqModels::basicSubGrid Description Basic sub-grid obstacle flame-wrinking enhancement factor model. diff --git a/applications/solvers/combustion/PDRFoam/PDRModels/XiGModels/basicXiSubG/basicXiSubG.H b/applications/solvers/combustion/PDRFoam/PDRModels/XiGModels/basicXiSubG/basicXiSubG.H index a455fd28b4..d844dca34e 100644 --- a/applications/solvers/combustion/PDRFoam/PDRModels/XiGModels/basicXiSubG/basicXiSubG.H +++ b/applications/solvers/combustion/PDRFoam/PDRModels/XiGModels/basicXiSubG/basicXiSubG.H @@ -23,7 +23,7 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Class - basicSubGrid + Foam::XiGModel::basicSubGrid Description diff --git a/applications/solvers/combustion/PDRFoam/PDRModels/dragModels/PDRDragModel/PDRDragModel.H b/applications/solvers/combustion/PDRFoam/PDRModels/dragModels/PDRDragModel/PDRDragModel.H index 3448d1166c..7177fca847 100644 --- a/applications/solvers/combustion/PDRFoam/PDRModels/dragModels/PDRDragModel/PDRDragModel.H +++ b/applications/solvers/combustion/PDRFoam/PDRModels/dragModels/PDRDragModel/PDRDragModel.H @@ -23,7 +23,7 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Class - PDRDragModel + Foam::PDRDragModel Description Base-class for sub-grid obstacle drag models. diff --git a/applications/solvers/combustion/PDRFoam/PDRModels/dragModels/basic/basic.H b/applications/solvers/combustion/PDRFoam/PDRModels/dragModels/basic/basic.H index 05ec433919..889cd57fd6 100644 --- a/applications/solvers/combustion/PDRFoam/PDRModels/dragModels/basic/basic.H +++ b/applications/solvers/combustion/PDRFoam/PDRModels/dragModels/basic/basic.H @@ -23,7 +23,7 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Class - basic + Foam::PDRDragModels::basic Description Basic sub-grid obstacle drag model. diff --git a/applications/solvers/combustion/PDRFoam/PDRModels/turbulence/PDRkEpsilon/PDRkEpsilon.H b/applications/solvers/combustion/PDRFoam/PDRModels/turbulence/PDRkEpsilon/PDRkEpsilon.H index b35ef9151e..b370c0b035 100644 --- a/applications/solvers/combustion/PDRFoam/PDRModels/turbulence/PDRkEpsilon/PDRkEpsilon.H +++ b/applications/solvers/combustion/PDRFoam/PDRModels/turbulence/PDRkEpsilon/PDRkEpsilon.H @@ -23,7 +23,7 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Class - PDRkEpsilon + Foam::compressible::RASModels::PDRkEpsilon Description Standard k-epsilon turbulence model with additional source terms diff --git a/applications/solvers/combustion/PDRFoam/XiModels/XiEqModels/Gulder/Gulder.H b/applications/solvers/combustion/PDRFoam/XiModels/XiEqModels/Gulder/Gulder.H index d8bc58b170..c361e81946 100644 --- a/applications/solvers/combustion/PDRFoam/XiModels/XiEqModels/Gulder/Gulder.H +++ b/applications/solvers/combustion/PDRFoam/XiModels/XiEqModels/Gulder/Gulder.H @@ -23,7 +23,7 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Class - Gulder + Foam::XiEqModels::Gulder Description Simple Gulder model for XiEq based on Gulders correlation diff --git a/applications/solvers/combustion/PDRFoam/XiModels/XiEqModels/SCOPEBlendXiEq/SCOPEBlendXiEq.H b/applications/solvers/combustion/PDRFoam/XiModels/XiEqModels/SCOPEBlendXiEq/SCOPEBlendXiEq.H index b9a45ffb63..589060895c 100644 --- a/applications/solvers/combustion/PDRFoam/XiModels/XiEqModels/SCOPEBlendXiEq/SCOPEBlendXiEq.H +++ b/applications/solvers/combustion/PDRFoam/XiModels/XiEqModels/SCOPEBlendXiEq/SCOPEBlendXiEq.H @@ -23,10 +23,10 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Class - SCOPEBlend + Foam::XiEqModels::SCOPEBlend Description - + SourceFiles SCOPEBlend.C diff --git a/applications/solvers/combustion/PDRFoam/XiModels/XiEqModels/SCOPEXiEq/SCOPEXiEq.H b/applications/solvers/combustion/PDRFoam/XiModels/XiEqModels/SCOPEXiEq/SCOPEXiEq.H index b2b2b35edf..e8c4dea23c 100644 --- a/applications/solvers/combustion/PDRFoam/XiModels/XiEqModels/SCOPEXiEq/SCOPEXiEq.H +++ b/applications/solvers/combustion/PDRFoam/XiModels/XiEqModels/SCOPEXiEq/SCOPEXiEq.H @@ -23,7 +23,7 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Class - SCOPEXiEq + Foam::XiEqModel::SCOPEXiEq Description Simple SCOPEXiEq model for XiEq based on SCOPEXiEqs correlation diff --git a/applications/solvers/combustion/PDRFoam/XiModels/XiEqModels/XiEqModel/XiEqModel.H b/applications/solvers/combustion/PDRFoam/XiModels/XiEqModels/XiEqModel/XiEqModel.H index 2c35877f5e..9cbdcbe3da 100644 --- a/applications/solvers/combustion/PDRFoam/XiModels/XiEqModels/XiEqModel/XiEqModel.H +++ b/applications/solvers/combustion/PDRFoam/XiModels/XiEqModels/XiEqModel/XiEqModel.H @@ -23,7 +23,7 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Class - XiEqModel + Foam::XiEqModel Description Base-class for all XiEq models used by the b-XiEq combustion model. diff --git a/applications/solvers/combustion/PDRFoam/XiModels/XiEqModels/instabilityXiEq/instabilityXiEq.H b/applications/solvers/combustion/PDRFoam/XiModels/XiEqModels/instabilityXiEq/instabilityXiEq.H index 455635dc08..b57cda5e28 100644 --- a/applications/solvers/combustion/PDRFoam/XiModels/XiEqModels/instabilityXiEq/instabilityXiEq.H +++ b/applications/solvers/combustion/PDRFoam/XiModels/XiEqModels/instabilityXiEq/instabilityXiEq.H @@ -23,10 +23,10 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Class - instability + Foam::XiEqModels::instability Description - + SourceFiles instability.C diff --git a/applications/solvers/combustion/PDRFoam/XiModels/XiGModels/KTS/KTS.H b/applications/solvers/combustion/PDRFoam/XiModels/XiGModels/KTS/KTS.H index 8884c00deb..93562557e9 100644 --- a/applications/solvers/combustion/PDRFoam/XiModels/XiGModels/KTS/KTS.H +++ b/applications/solvers/combustion/PDRFoam/XiModels/XiGModels/KTS/KTS.H @@ -23,7 +23,7 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Class - KTS + Foam::XiGModels::KTS Description Simple Kolmogorov time-scale model for the flame-wrinling generation rate. diff --git a/applications/solvers/combustion/PDRFoam/XiModels/XiGModels/XiGModel/XiGModel.H b/applications/solvers/combustion/PDRFoam/XiModels/XiGModels/XiGModel/XiGModel.H index 908dc3a623..803644261e 100644 --- a/applications/solvers/combustion/PDRFoam/XiModels/XiGModels/XiGModel/XiGModel.H +++ b/applications/solvers/combustion/PDRFoam/XiModels/XiGModels/XiGModel/XiGModel.H @@ -23,7 +23,7 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Class - XiGModel + Foam::XiGModel Description Base-class for all Xi generation models used by the b-Xi combustion model. diff --git a/applications/solvers/combustion/PDRFoam/XiModels/XiGModels/instabilityG/instabilityG.H b/applications/solvers/combustion/PDRFoam/XiModels/XiGModels/instabilityG/instabilityG.H index 596e86229b..fa6935382c 100644 --- a/applications/solvers/combustion/PDRFoam/XiModels/XiGModels/instabilityG/instabilityG.H +++ b/applications/solvers/combustion/PDRFoam/XiModels/XiGModels/instabilityG/instabilityG.H @@ -23,7 +23,7 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Class - instabilityG + Foam::XiGModels::instabilityG Description Flame-surface instabilityG flame-wrinking generation rate coefficient model. diff --git a/applications/solvers/combustion/PDRFoam/XiModels/XiModel/XiModel.H b/applications/solvers/combustion/PDRFoam/XiModels/XiModel/XiModel.H index 2b76f9bc92..2447263f7b 100644 --- a/applications/solvers/combustion/PDRFoam/XiModels/XiModel/XiModel.H +++ b/applications/solvers/combustion/PDRFoam/XiModels/XiModel/XiModel.H @@ -23,7 +23,7 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Class - XiModel + Foam::XiModel Description Base-class for all Xi models used by the b-Xi combustion model. @@ -102,8 +102,6 @@ namespace Foam Class XiModel Declaration \*---------------------------------------------------------------------------*/ - - class XiModel { diff --git a/applications/solvers/combustion/PDRFoam/XiModels/algebraic/algebraic.H b/applications/solvers/combustion/PDRFoam/XiModels/algebraic/algebraic.H index 9da38cf00d..70fde4a510 100644 --- a/applications/solvers/combustion/PDRFoam/XiModels/algebraic/algebraic.H +++ b/applications/solvers/combustion/PDRFoam/XiModels/algebraic/algebraic.H @@ -23,7 +23,7 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Class - algebraic + Foam::XiModels::algebraic Description Simple algebraic model for Xi based on Gulders correlation diff --git a/applications/solvers/combustion/PDRFoam/XiModels/fixed/fixed.H b/applications/solvers/combustion/PDRFoam/XiModels/fixed/fixed.H index 64c44fdff4..3a9919259d 100644 --- a/applications/solvers/combustion/PDRFoam/XiModels/fixed/fixed.H +++ b/applications/solvers/combustion/PDRFoam/XiModels/fixed/fixed.H @@ -23,7 +23,7 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Class - fixed + Foam::XiModels::fixed Description Fixed value model for Xi. diff --git a/applications/solvers/combustion/PDRFoam/XiModels/transport/transport.H b/applications/solvers/combustion/PDRFoam/XiModels/transport/transport.H index db2a7255aa..3023ce272f 100644 --- a/applications/solvers/combustion/PDRFoam/XiModels/transport/transport.H +++ b/applications/solvers/combustion/PDRFoam/XiModels/transport/transport.H @@ -23,7 +23,7 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Class - transport + Foam::XiModels::transport Description Simple transport model for Xi based on Gulders correlation diff --git a/applications/solvers/combustion/PDRFoam/laminarFlameSpeed/SCOPE/SCOPELaminarFlameSpeed.H b/applications/solvers/combustion/PDRFoam/laminarFlameSpeed/SCOPE/SCOPELaminarFlameSpeed.H index 8c65453b94..029d31f25d 100644 --- a/applications/solvers/combustion/PDRFoam/laminarFlameSpeed/SCOPE/SCOPELaminarFlameSpeed.H +++ b/applications/solvers/combustion/PDRFoam/laminarFlameSpeed/SCOPE/SCOPELaminarFlameSpeed.H @@ -23,7 +23,7 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Class - SCOPE + Foam::laminarFlameSpeedModels::SCOPE Description Laminar flame speed obtained from the SCOPE correlation. diff --git a/applications/solvers/multiphase/compressibleInterDyMFoam/compressibleInterDyMFoam.C b/applications/solvers/multiphase/compressibleInterDyMFoam/compressibleInterDyMFoam.C index 11a1809575..e24de6658d 100644 --- a/applications/solvers/multiphase/compressibleInterDyMFoam/compressibleInterDyMFoam.C +++ b/applications/solvers/multiphase/compressibleInterDyMFoam/compressibleInterDyMFoam.C @@ -74,24 +74,26 @@ int main(int argc, char *argv[]) Info<< "Time = " << runTime.timeName() << nl << endl; - scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime(); - - // Do any mesh changes - mesh.update(); - - if (mesh.changing()) { - Info<< "Execution time for mesh.update() = " - << runTime.elapsedCpuTime() - timeBeforeMeshUpdate - << " s" << endl; + // Store divU from the previous mesh for the correctPhi + volScalarField divU = fvc::div(phi); - gh = g & mesh.C(); - ghf = g & mesh.Cf(); - } + scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime(); - if (mesh.changing() && correctPhi) - { - //***HGW#include "correctPhi.H" + // Do any mesh changes + mesh.update(); + + if (mesh.changing()) + { + Info<< "Execution time for mesh.update() = " + << runTime.elapsedCpuTime() - timeBeforeMeshUpdate + << " s" << endl; + } + + if (mesh.changing() && correctPhi) + { + #include "correctPhi.H" + } } // Make the fluxes relative to the mesh motion @@ -102,6 +104,12 @@ int main(int argc, char *argv[]) #include "meshCourantNo.H" } + if (mesh.changing()) + { + gh = g & mesh.C(); + ghf = g & mesh.Cf(); + } + turbulence->correct(); // --- Outer-corrector loop diff --git a/applications/solvers/multiphase/compressibleInterDyMFoam/correctPhi.H b/applications/solvers/multiphase/compressibleInterDyMFoam/correctPhi.H new file mode 100644 index 0000000000..4152105784 --- /dev/null +++ b/applications/solvers/multiphase/compressibleInterDyMFoam/correctPhi.H @@ -0,0 +1,39 @@ +{ + #include "continuityErrs.H" + + volScalarField pcorr + ( + IOobject + ( + "pcorr", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimensionedScalar("pcorr", pd.dimensions(), 0.0), + pcorrTypes + ); + + dimensionedScalar rAUf("(1|A(U))", dimTime/rho.dimensions(), 1.0); + + adjustPhi(phi, U, pcorr); + + for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + { + fvScalarMatrix pcorrEqn + ( + fvm::laplacian(rAUf, pcorr) == fvc::div(phi) - divU + ); + + pcorrEqn.solve(); + + if (nonOrth == nNonOrthCorr) + { + phi -= pcorrEqn.flux(); + } + } + + #include "continuityErrs.H" +} diff --git a/applications/solvers/multiphase/compressibleInterDyMFoam/createFields.H b/applications/solvers/multiphase/compressibleInterDyMFoam/createFields.H index 1f579d245b..dc04fb4546 100644 --- a/applications/solvers/multiphase/compressibleInterDyMFoam/createFields.H +++ b/applications/solvers/multiphase/compressibleInterDyMFoam/createFields.H @@ -150,3 +150,14 @@ ( incompressible::turbulenceModel::New(U, phi, twoPhaseProperties) ); + + + wordList pcorrTypes(pd.boundaryField().types()); + + for (label i=0; i > rawList(IFstream("testRegexps")()); + Info<< "input list:" << rawList << endl; + IOobject::writeDivider(Info); + Info<< endl; + + List groups; + + // report matches: + forAll(rawList, elemI) + { + const string& pat = rawList[elemI].first(); + const string& str = rawList[elemI].second(); + regExp re(pat); + + Info<< str << " =~ m/" << pat.c_str() << "/ == "; + + if (re.match(str, groups)) + { + Info<< "true"; + if (re.ngroups()) + { + Info<< groups; + } + } + else + { + Info<< "false"; + if (re.match(str, true)) + { + Info<< " partial match"; + } + } + Info << endl; + } + + Info<< endl; + + return 0; +} + + +// ************************************************************************* // diff --git a/applications/test/regex/testRegexps b/applications/test/regex/testRegexps new file mode 100644 index 0000000000..eeae1d865a --- /dev/null +++ b/applications/test/regex/testRegexps @@ -0,0 +1,20 @@ +/*-------------------------------*- C++ -*---------------------------------*\ +| ========= | +| \\ / OpenFOAM | +| \\ / | +| \\ / The Open Source CFD Toolbox | +| \\/ http://www.OpenFOAM.org | +\*-------------------------------------------------------------------------*/ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// pattern, string +( + ( "a.*" "abc" ) + ( "a.*" "bac" ) + ( "a.*" "abcd" ) + ( "a.*" "def" ) + ( "d(.*)f" "def" ) +) + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/test/stringList/stringListTest.C b/applications/test/stringList/stringListTest.C index 045ca1fe72..2c7da0d5e9 100644 --- a/applications/test/stringList/stringListTest.C +++ b/applications/test/stringList/stringListTest.C @@ -26,7 +26,7 @@ Description \*---------------------------------------------------------------------------*/ -#include "stringList.H" +#include "stringListOps.H" #include "IOstreams.H" using namespace Foam; diff --git a/applications/test/xfer/Make/files b/applications/test/xfer/Make/files index 92414c039e..d3c1cd8ac2 100644 --- a/applications/test/xfer/Make/files +++ b/applications/test/xfer/Make/files @@ -1,4 +1,3 @@ xferListTest.C -/* EXE = $(FOAM_USER_APPBIN)/xferListTest */ -EXE = ./xferListTest +EXE = $(FOAM_USER_APPBIN)/xferListTest diff --git a/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C b/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C index 50818f4db9..3b5fca211e 100644 --- a/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C +++ b/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C @@ -45,8 +45,10 @@ Description int main(int argc, char *argv[]) { + // enable -constant ... if someone really wants it + // enable -zeroTime to prevent accidentally trashing the initial fields + timeSelector::addOptions(true, true); argList::noParallel(); - timeSelector::addOptions(); # include "addRegionOption.H" argList::validOptions.insert("fields", "\"(list of fields)\""); diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C index c8a7d89df2..05501a904d 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsightParts/foamToEnsightParts.C @@ -74,7 +74,9 @@ using namespace Foam; int main(int argc, char *argv[]) { - // with -constant and -zeroTime + // enable -constant + // probably don't need -zeroTime though, since the fields are vetted + // afterwards anyhow timeSelector::addOptions(true, false); argList::noParallel(); argList::validOptions.insert("ascii", ""); diff --git a/applications/utilities/preProcessing/foamUpgradeFvSolution/Make/files b/applications/utilities/preProcessing/foamUpgradeFvSolution/Make/files new file mode 100644 index 0000000000..f667ed655e --- /dev/null +++ b/applications/utilities/preProcessing/foamUpgradeFvSolution/Make/files @@ -0,0 +1,3 @@ +foamUpgradeFvSolution.C + +EXE = $(FOAM_APPBIN)/foamUpgradeFvSolution diff --git a/applications/utilities/preProcessing/foamUpgradeFvSolution/Make/options b/applications/utilities/preProcessing/foamUpgradeFvSolution/Make/options new file mode 100644 index 0000000000..e69de29bb2 diff --git a/applications/utilities/preProcessing/foamUpgradeFvSolution/foamUpgradeFvSolution.C b/applications/utilities/preProcessing/foamUpgradeFvSolution/foamUpgradeFvSolution.C new file mode 100644 index 0000000000..9128ad3d5c --- /dev/null +++ b/applications/utilities/preProcessing/foamUpgradeFvSolution/foamUpgradeFvSolution.C @@ -0,0 +1,109 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Application + foamUpgradeFvSolution + +Description + Simple tool to upgrade the syntax of system/fvSolution::solvers + +Usage + + - foamUpgradeFvSolution [OPTION] + + @param -test \n + Suppress writing the updated fvSolution file + +\*---------------------------------------------------------------------------*/ + +#include "argList.H" +#include "Time.H" +#include "IOdictionary.H" +#include "solution.H" + +using namespace Foam; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// Main program: + +int main(int argc, char *argv[]) +{ + argList::noParallel(); + argList::validOptions.insert("test", ""); + +# include "setRootCase.H" +# include "createTime.H" + + IOdictionary solutionDict + ( + IOobject + ( + "fvSolution", + runTime.system(), + runTime, + IOobject::MUST_READ, + IOobject::NO_WRITE, + false + ) + ); + + label nChanged = 0; + entry* e = solutionDict.lookupEntryPtr("solvers", false, false); + if (e && e->isDict()) + { + nChanged = solution::upgradeSolverDict(e->dict(), true); + } + + Info<< nChanged << " solver settings changed" << nl << endl; + if (nChanged) + { + if (args.options().found("test")) + { + Info<< "-test option: no changes made" << nl << endl; + } + else + { + mv + ( + solutionDict.objectPath(), + solutionDict.objectPath() + ".old" + ); + + solutionDict.writeObject + ( + IOstream::ASCII, + IOstream::currentVersion, + IOstream::UNCOMPRESSED + ); + + Info<< "Backup to " << (solutionDict.objectPath() + ".old") << nl + << "Write to " << solutionDict.objectPath() << nl << endl; + } + } + + return 0; +} + + +// ************************************************************************* // diff --git a/bin/paraFoam b/bin/paraFoam index 101bba1674..4fc5c3cb9f 100755 --- a/bin/paraFoam +++ b/bin/paraFoam @@ -31,19 +31,19 @@ # #------------------------------------------------------------------------------ usage() { - while [ "$#" -ge 1 ]; do echo "$1"; shift; done - cat</dev/null || usage "directory does not exist: '$caseDir'" - ;; - -region) - [ "$#" -ge 2 ] || usage "'-region' option requires an argument" - regionName=$2 - shift 2 - ;; - -touch) - touchOnly=1 - shift - ;; - *) - usage "unknown option/argument: '$*'" - ;; - esac + case "$1" in + -h | -help) + usage + ;; + -case) + [ "$#" -ge 2 ] || usage "'$1' option requires an argument" + cd "$2" 2>/dev/null || usage "directory does not exist: '$2'" + shift 2 + ;; + -region) + [ "$#" -ge 2 ] || usage "'$1' option requires an argument" + regionName=$2 + shift 2 + ;; + -touch) + touchOnly=true + shift + ;; + *) + usage "unknown option/argument: '$*'" + ;; + esac done # get a sensible caseName caseName=${PWD##*/} caseFile="$caseName.OpenFOAM" +fvControls="system" + if [ -n "$regionName" ] then - caseFile="$caseName{$regionName}.OpenFOAM" + caseFile="$caseName{$regionName}.OpenFOAM" + fvControls="$fvControls/$regionName" fi -if [ -n "$touchOnly" ]; +if [ -n "$touchOnly" ] then - touch "$caseFile" - echo "created '$caseFile'" - exit 0 + touch "$caseFile" + echo "created '$caseFile'" + exit 0 fi # parent directory for normal or parallel results case "$caseName" in - processor*) parentDir=".." ;; - *) parentDir="." ;; + processor*) parentDir=".." ;; + *) parentDir="." ;; esac # check existence of essential files -for check in system/controlDict system/fvSchemes system/fvSolution +for check in system/controlDict $fvControls/fvSchemes $fvControls/fvSolution do - [ -s "$parentDir/$check" ] || usage "file does not exist: '$parentDir/$check'" + [ -s "$parentDir/$check" ] || usage "file does not exist: '$parentDir/$check'" done case "$ParaView_VERSION" in 2*) - trap "rm -f paraFoam.pvs $caseFile 2>/dev/null; exit 0" EXIT TERM INT - touch $caseFile + trap "rm -f paraFoam.pvs $caseFile 2>/dev/null; exit 0" EXIT TERM INT + touch "$caseFile" - # since we are now in the cwd, %CASE% is '$PWD/$caseFile' - sed -e s@%CASE%@$PWD/$caseFile@g \ - $WM_PROJECT_DIR/bin/paraFoam.pvs > paraFoam.pvs + # since we are now in the cwd, %CASE% is '$PWD/$caseFile' + sed -e s@%CASE%@$PWD/$caseFile@g \ + $WM_PROJECT_DIR/bin/tools/paraFoam.pvs > paraFoam.pvs - paraview paraFoam.pvs - ;; + paraview paraFoam.pvs + ;; *) - # only create/remove caseFile if it doesn't exist - [ -e $caseFile ] || { - trap "rm -f $caseFile 2>/dev/null; exit 0" EXIT TERM INT - touch "$caseFile" - echo "created temporary '$caseFile'" - } + # only create/remove caseFile if it didn't already exist + [ -e $caseFile ] || { + trap "rm -f $caseFile 2>/dev/null; exit 0" EXIT TERM INT + touch "$caseFile" + echo "created temporary '$caseFile'" + } - paraview --data="$caseFile" - ;; + paraview --data="$caseFile" + ;; esac #------------------------------------------------------------------------------ diff --git a/bin/tools/README b/bin/tools/README index c99723b20e..2b98a9702f 100644 --- a/bin/tools/README +++ b/bin/tools/README @@ -1,2 +1,2 @@ -Misc. tools for building applications, etc that are useful to have -but which don't really need to be in the PATH. +Misc. tools, scripts, templates that are useful (eg, for building applications) +but don't need to be in the PATH. diff --git a/bin/paraFoam.pvs b/bin/tools/paraFoam.pvs similarity index 100% rename from bin/paraFoam.pvs rename to bin/tools/paraFoam.pvs diff --git a/src/OSspecific/Unix/Make/files b/src/OSspecific/Unix/Make/files index 39c40b74c4..f83513ac4a 100644 --- a/src/OSspecific/Unix/Make/files +++ b/src/OSspecific/Unix/Make/files @@ -2,6 +2,7 @@ signals/sigFpe.C signals/sigSegv.C signals/sigInt.C signals/sigQuit.C +regExp.C timer.C fileStat.C Unix.C diff --git a/src/OSspecific/Unix/regExp.C b/src/OSspecific/Unix/regExp.C new file mode 100644 index 0000000000..62c69512b7 --- /dev/null +++ b/src/OSspecific/Unix/regExp.C @@ -0,0 +1,196 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include +#include "regExp.H" +#include "label.H" +#include "string.H" +#include "List.H" +#include "IOstreams.H" + + +// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // + +void Foam::regExp::compile(const char* pat) const +{ + clear(); + preg_ = new regex_t; + + if (regcomp(preg_, pat, REG_EXTENDED) != 0) + { + FatalErrorIn + ( + "regExp::compile(const char*)" + ) << "Failed to compile regular expression '" << pat << "'" + << exit(FatalError); + } +} + + +void Foam::regExp::clear() const +{ + if (preg_) + { + regfree(preg_); + delete preg_; + preg_ = 0; + } +} + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::regExp::regExp() +: + preg_(0) +{} + + +Foam::regExp::regExp(const string& pat) +: + preg_(0) +{ + compile(pat.c_str()); +} + + +Foam::regExp::regExp(const char* pat) +: + preg_(0) +{ + compile(pat); +} + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::regExp::~regExp() +{ + clear(); +} + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +int Foam::regExp::ngroups() const +{ + return preg_ ? preg_->re_nsub : 0; +} + + +bool Foam::regExp::match +( + const string& str, + bool partialMatch +) const +{ + if (preg_ && str.size()) + { + size_t nmatch = 1; + regmatch_t pmatch[1]; + + // match and also verify that the entire string was matched + if + ( + regexec(preg_, str.c_str(), nmatch, pmatch, 0) == 0 + && + ( + partialMatch + || (pmatch[0].rm_so == 0 && pmatch[0].rm_eo == label(str.size())) + ) + ) + { + return true; + } + } + + return false; +} + + +bool Foam::regExp::match +( + const string& str, + List& groups, + bool partialMatch +) const +{ + if (preg_ && str.size()) + { + size_t nmatch = ngroups() + 1; + regmatch_t pmatch[nmatch]; + + // match and also verify that the entire string was matched + if + ( + regexec(preg_, str.c_str(), nmatch, pmatch, 0) == 0 + && + ( + partialMatch + || (pmatch[0].rm_so == 0 && pmatch[0].rm_eo == label(str.size())) + ) + ) + { + groups.setSize(ngroups()); + label groupI = 0; + + for (size_t matchI = 1; matchI < nmatch; matchI++) + { + if (pmatch[matchI].rm_so != -1 && pmatch[matchI].rm_eo != -1) + { + groups[groupI] = str.substr + ( + pmatch[matchI].rm_so, + pmatch[matchI].rm_eo - pmatch[matchI].rm_so + ); + } + else + { + groups[groupI].clear(); + } + groupI++; + } + + return true; + } + } + + groups.clear(); + return false; +} + +// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * // + + +void Foam::regExp::operator=(const string& pat) +{ + compile(pat.c_str()); +} + + +void Foam::regExp::operator=(const char* pat) +{ + compile(pat); +} + +// ************************************************************************* // diff --git a/src/OSspecific/Unix/regularExpression.H b/src/OSspecific/Unix/regExp.H similarity index 56% rename from src/OSspecific/Unix/regularExpression.H rename to src/OSspecific/Unix/regExp.H index fed14379ad..60ac68a3c2 100644 --- a/src/OSspecific/Unix/regularExpression.H +++ b/src/OSspecific/Unix/regExp.H @@ -23,94 +23,108 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Class - Foam::regularExpression + Foam::regExp Description - Wrapper around regular expressions. + Wrapper around POSIX extended regular expressions. + + The beginning-of-line (^) and the end-of-line ($) anchors are implicit + by default. + +SeeAlso + The manpage regex(7) for more information about POSIX regular expressions. + These differ somewhat from @c Perl and @c sed regular expressions. SourceFiles + regExp.C \*---------------------------------------------------------------------------*/ -#ifndef regularExpression_H -#define regularExpression_H +#ifndef regExp_H +#define regExp_H -#include #include -#include "string.H" -#include "IOstreams.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { +// Forward declaration of classes +class string; +template class List; + /*---------------------------------------------------------------------------*\ - Class regularExpression Declaration + Class regExp Declaration \*---------------------------------------------------------------------------*/ -class regularExpression +class regExp { // Private data //- Precompiled regular expression - regex_t* preg_; - + mutable regex_t* preg_; // Private member functions + //- release allocated space + void clear() const; + + //- compile into a regular expression + void compile(const char*) const; + //- Disallow default bitwise copy construct - regularExpression(const regularExpression&); + regExp(const regExp&); //- Disallow default bitwise assignment - void operator=(const regularExpression&); + void operator=(const regExp&); public: - // Constructors + //- Construct null + regExp(); + //- Construct from string - inline regularExpression(const string& s) - { - preg_ = new regex_t; - - if (regcomp(preg_, s.c_str(), REG_EXTENDED) != 0) - { - FatalErrorIn - ( - "regularExpression::regularExpression(const char*)" - ) << "Failed to compile regular expression " << s - << exit(FatalError); - } - } + regExp(const string&); + //- Construct from character array + regExp(const char*); // Destructor - //- Construct from string - inline ~regularExpression() - { - if (preg_) - { - regfree(preg_); - delete preg_; - } - } - + ~regExp(); // Member functions - //- Matches? - inline bool matches(const string& s) const - { - size_t nmatch = 1; - regmatch_t pmatch[1]; + //- Return the number of (groups) + int ngroups() const; - int errVal = regexec(preg_, s.c_str(), nmatch, pmatch, 0); + //- Return true if it matches, partial matches are optional + bool match + ( + const string&, + bool partialMatch=false + ) const; + + //- Return true if it matches and sets the sub-groups matched, + // partial matches are optional + bool match + ( + const string&, + List& groups, + bool partialMatch=false + ) const; + + // Member Operators + + //- Assign from a string + void operator=(const string&); + + //- Assign from a character array + void operator=(const char*); - return (errVal == 0 && pmatch[0].rm_eo == label(s.size())); - } }; diff --git a/src/OpenFOAM/db/Time/timeSelector.C b/src/OpenFOAM/db/Time/timeSelector.C index 002a0b5beb..bace90c28a 100644 --- a/src/OpenFOAM/db/Time/timeSelector.C +++ b/src/OpenFOAM/db/Time/timeSelector.C @@ -131,7 +131,7 @@ void Foam::timeSelector::addOptions argList::validOptions.insert("zeroTime", ""); } argList::validOptions.insert("noZero", ""); - argList::validOptions.insert("time", "time"); + argList::validOptions.insert("time", "ranges"); argList::validOptions.insert("latestTime", ""); } @@ -167,28 +167,40 @@ Foam::List Foam::timeSelector::select } } + // determine latestTime selection (if any) + // this must appear before the -time option processing + label latestIdx = -1; + if (args.options().found("latestTime")) + { + selectTimes = false; + latestIdx = timeDirs.size() - 1; + + // avoid false match on constant/ + if (latestIdx == constantIdx) + { + latestIdx = -1; + } + } + if (args.options().found("time")) { + // can match 0/, but can never match constant/ selectTimes = timeSelector ( IStringStream(args.options()["time"])() ).selected(timeDirs); } - else if (args.options().found("latestTime")) - { - selectTimes = false; - const label latestIdx = timeDirs.size() - 1; - // avoid false match on constant/ or 0/ - if (latestIdx != constantIdx && latestIdx != zeroIdx) - { - selectTimes[latestIdx] = true; - } + + // add in latestTime (if selected) + if (latestIdx >= 0) + { + selectTimes[latestIdx] = true; } - // special treatment for constant/ if (constantIdx >= 0) { + // only add constant/ if specifically requested selectTimes[constantIdx] = args.options().found("constant"); } @@ -197,10 +209,12 @@ Foam::List Foam::timeSelector::select { if (args.options().found("noZero")) { + // exclude 0/ if specifically requested selectTimes[zeroIdx] = false; } else if (argList::validOptions.found("zeroTime")) { + // with -zeroTime enabled, drop 0/ unless specifically requested selectTimes[zeroIdx] = args.options().found("zeroTime"); } } diff --git a/src/OpenFOAM/db/Time/timeSelector.H b/src/OpenFOAM/db/Time/timeSelector.H index 7d1f15fda1..6afa92ee06 100644 --- a/src/OpenFOAM/db/Time/timeSelector.H +++ b/src/OpenFOAM/db/Time/timeSelector.H @@ -60,8 +60,9 @@ Description @endverbatim The first argument avoids adding the @b -constant option. The second - argument adds an additional @b -zeroTime option and prevents the @c 0/ - directory from being included in the default time range. + argument adds an additional @b -zeroTime option and also prevents the + @c 0/ directory from being included in the default time range and in the + @b -latestTime selection. SourceFiles timeSelector.C @@ -121,14 +122,17 @@ public: // // @param constant // Add the @b -constant option to include the @c constant/ directory + // // @param zeroTime - // Additional to the @b -noZero option (explicitly exclude the - // @c 0/ directory), add the @b -zeroTime option to include the - // @c 0/ directory. The @b -noZero option has precedence. + // Enable the @b -zeroTime option and alter the normal time selection + // behaviour (and @b -latestTime behaviour) to exclude the @c 0/ + // directory. The @c 0/ directory will only be included when + // @b -zeroTime is specified. + // The @b -noZero option has precedence over the @b -zeroTime option. static void addOptions ( - const bool constant = true, - const bool zeroTime = false + const bool constant=true, + const bool zeroTime=false ); //- Return the set of times selected based on the argList options diff --git a/src/OpenFOAM/db/dictionary/dictionary.C b/src/OpenFOAM/db/dictionary/dictionary.C index 265a2944cb..d54f1bc3d2 100644 --- a/src/OpenFOAM/db/dictionary/dictionary.C +++ b/src/OpenFOAM/db/dictionary/dictionary.C @@ -27,7 +27,7 @@ License #include "dictionary.H" #include "primitiveEntry.H" #include "dictionaryEntry.H" -#include "regularExpression.H" +#include "regExp.H" /* * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * */ @@ -43,21 +43,18 @@ bool Foam::dictionary::findInWildcards const bool wildCardMatch, const word& Keyword, DLList::const_iterator& wcLink, - DLList >::const_iterator& reLink + DLList >::const_iterator& reLink ) const { if (wildCardEntries_.size() > 0) { - //wcLink = wildCardEntries_.begin(); - //reLink = wildCardRegexps_.end(); - while (wcLink != wildCardEntries_.end()) { if (!wildCardMatch && wcLink()->keyword() == Keyword) { return true; } - else if (wildCardMatch && reLink()->matches(Keyword)) + else if (wildCardMatch && reLink()->match(Keyword)) { return true; } @@ -76,7 +73,7 @@ bool Foam::dictionary::findInWildcards const bool wildCardMatch, const word& Keyword, DLList::iterator& wcLink, - DLList >::iterator& reLink + DLList >::iterator& reLink ) { if (wildCardEntries_.size() > 0) @@ -87,7 +84,7 @@ bool Foam::dictionary::findInWildcards { return true; } - else if (wildCardMatch && reLink()->matches(Keyword)) + else if (wildCardMatch && reLink()->match(Keyword)) { return true; } @@ -133,10 +130,7 @@ Foam::dictionary::dictionary wildCardEntries_.insert(&iter()); wildCardRegexps_.insert ( - autoPtr - ( - new regularExpression(iter().keyword()) - ) + autoPtr(new regExp(iter().keyword())) ); } } @@ -166,10 +160,7 @@ Foam::dictionary::dictionary wildCardEntries_.insert(&iter()); wildCardRegexps_.insert ( - autoPtr - ( - new regularExpression(iter().keyword()) - ) + autoPtr(new regExp(iter().keyword())) ); } } @@ -229,7 +220,7 @@ bool Foam::dictionary::found(const word& keyword, bool recursive) const if (wildCardEntries_.size() > 0) { DLList::const_iterator wcLink = wildCardEntries_.begin(); - DLList >::const_iterator reLink = + DLList >::const_iterator reLink = wildCardRegexps_.begin(); // Find in wildcards using regular expressions only @@ -266,7 +257,7 @@ const Foam::entry* Foam::dictionary::lookupEntryPtr { DLList::const_iterator wcLink = wildCardEntries_.begin(); - DLList >::const_iterator reLink = + DLList >::const_iterator reLink = wildCardRegexps_.begin(); // Find in wildcards using regular expressions only @@ -305,7 +296,7 @@ Foam::entry* Foam::dictionary::lookupEntryPtr { DLList::iterator wcLink = wildCardEntries_.begin(); - DLList >::iterator reLink = + DLList >::iterator reLink = wildCardRegexps_.begin(); // Find in wildcards using regular expressions only if (findInWildcards(wildCardMatch, keyword, wcLink, reLink)) @@ -487,10 +478,7 @@ bool Foam::dictionary::add(entry* entryPtr, bool mergeEntry) wildCardEntries_.insert(entryPtr); wildCardRegexps_.insert ( - autoPtr - ( - new regularExpression(entryPtr->keyword()) - ) + autoPtr(new regExp(entryPtr->keyword())) ); } @@ -519,10 +507,7 @@ bool Foam::dictionary::add(entry* entryPtr, bool mergeEntry) wildCardEntries_.insert(entryPtr); wildCardRegexps_.insert ( - autoPtr - ( - new regularExpression(entryPtr->keyword()) - ) + autoPtr(new regExp(entryPtr->keyword())) ); } @@ -615,8 +600,7 @@ bool Foam::dictionary::remove(const word& Keyword) // Delete from wildcards first DLList::iterator wcLink = wildCardEntries_.begin(); - DLList >::iterator reLink = - wildCardRegexps_.begin(); + DLList >::iterator reLink = wildCardRegexps_.begin(); // Find in wildcards using exact match only if (findInWildcards(false, Keyword, wcLink, reLink)) @@ -683,7 +667,7 @@ bool Foam::dictionary::changeKeyword // Delete from wildcards first DLList::iterator wcLink = wildCardEntries_.begin(); - DLList >::iterator reLink = + DLList >::iterator reLink = wildCardRegexps_.begin(); // Find in wildcards using exact match only @@ -697,7 +681,7 @@ bool Foam::dictionary::changeKeyword IDLList::replace(iter2(), iter()); delete iter2(); hashedEntries_.erase(iter2); - + } else { @@ -722,10 +706,7 @@ bool Foam::dictionary::changeKeyword wildCardEntries_.insert(iter()); wildCardRegexps_.insert ( - autoPtr - ( - new regularExpression(newKeyword) - ) + autoPtr(new regExp(newKeyword)) ); } @@ -789,6 +770,8 @@ void Foam::dictionary::clear() { IDLList::clear(); hashedEntries_.clear(); + wildCardEntries_.clear(); + wildCardRegexps_.clear(); } diff --git a/src/OpenFOAM/db/dictionary/dictionary.H b/src/OpenFOAM/db/dictionary/dictionary.H index b1d0d186f6..1d87a08fd6 100644 --- a/src/OpenFOAM/db/dictionary/dictionary.H +++ b/src/OpenFOAM/db/dictionary/dictionary.H @@ -67,7 +67,7 @@ namespace Foam { // Forward declaration of friend functions and operators -class regularExpression; +class regExp; class dictionary; Istream& operator>>(Istream&, dictionary&); Ostream& operator<<(Ostream&, const dictionary&); @@ -95,8 +95,8 @@ class dictionary //- Wildcard entries DLList wildCardEntries_; - //- Wildcard precompiled regex - DLList > wildCardRegexps_; + //- Wildcard precompiled regular expressions + DLList > wildCardRegexps_; // Private Member Functions @@ -107,7 +107,7 @@ class dictionary const bool wildCardMatch, const word& Keyword, DLList::const_iterator& wcLink, - DLList >::const_iterator& reLink + DLList >::const_iterator& reLink ) const; //- Search wildcard table either for exact match or for regular @@ -117,7 +117,7 @@ class dictionary const bool wildCardMatch, const word& Keyword, DLList::iterator& wcLink, - DLList >::iterator& reLink + DLList >::iterator& reLink ); @@ -163,16 +163,16 @@ public: dictionary(Istream&); //- Construct as copy given the parent dictionary - dictionary(const dictionary& parentDict, const dictionary& dict); + dictionary(const dictionary& parentDict, const dictionary&); //- Construct top-level dictionary as copy - dictionary(const dictionary& dict); + dictionary(const dictionary&); //- Construct and return clone Foam::autoPtr clone() const; //- Construct top-level dictionary on freestore from Istream - static Foam::autoPtr New(Istream& is); + static Foam::autoPtr New(Istream&); // Destructor @@ -211,12 +211,12 @@ public: //- Search dictionary for given keyword // If recursive search parent dictionaries - bool found(const word& keyword, bool recursive=false) const; + bool found(const word&, bool recursive=false) const; //- Find and return an entry data stream pointer if present // otherwise return NULL. - // If recursive search parent dictionaries. If wildCardMatch - // use wildcards. + // If recursive search parent dictionaries. + // If wildCardMatch use wildcards. const entry* lookupEntryPtr ( const word&, @@ -226,8 +226,8 @@ public: //- Find and return an entry data stream pointer for manipulation // if present otherwise return NULL. - // If recursive search parent dictionaries. If wildCardMatch - // use wildcards. + // If recursive search parent dictionaries. + // If wildCardMatch use wildcards. entry* lookupEntryPtr ( const word&, @@ -236,8 +236,8 @@ public: ); //- Find and return an entry data stream if present otherwise error. - // If recursive search parent dictionaries. If wildCardMatch - // use wildcards. + // If recursive search parent dictionaries. + // If wildCardMatch use wildcards. const entry& lookupEntry ( const word&, @@ -331,13 +331,13 @@ public: //- Add a scalar entry // optionally overwrite an existing entry - void add (const keyType&, const scalar, bool overwrite=false); + void add(const keyType&, const scalar, bool overwrite=false); //- Add a dictionary entry // optionally merge with an existing sub-dictionary void add ( - const keyType& keyword, + const keyType&, const dictionary&, bool mergeEntry=false ); @@ -345,7 +345,7 @@ public: //- Add a T entry // optionally overwrite an existing entry template - void add(const keyType& keyword, const T&, bool overwrite=false); + void add(const keyType&, const T&, bool overwrite=false); //- Assign a new entry, overwrite any existing entry void set(entry*); @@ -354,14 +354,14 @@ public: void set(const entry&); //- Assign a dictionary entry, overwrite any existing entry - void set(const keyType& keyword, const dictionary&); + void set(const keyType&, const dictionary&); //- Assign a T entry, overwrite any existing entry template - void set(const keyType& keyword, const T&); + void set(const keyType&, const T&); //- Remove an entry specified by keyword - bool remove(const word& keyword); + bool remove(const word&); //- Change the keyword for an entry, // optionally forcing overwrite of an existing entry @@ -369,7 +369,7 @@ public: ( const keyType& oldKeyword, const keyType& newKeyword, - bool forceOverwrite = false + bool forceOverwrite=false ); //- Merge entries from the given dictionary. @@ -382,7 +382,7 @@ public: // Write - void write(Ostream& os, bool subDict = true) const; + void write(Ostream&, bool subDict=true) const; // Member Operators diff --git a/src/OpenFOAM/db/dictionary/dictionaryIO.C b/src/OpenFOAM/db/dictionary/dictionaryIO.C index cb04194915..35746ea665 100644 --- a/src/OpenFOAM/db/dictionary/dictionaryIO.C +++ b/src/OpenFOAM/db/dictionary/dictionaryIO.C @@ -27,7 +27,7 @@ License #include "dictionary.H" #include "IFstream.H" #include "inputModeEntry.H" -#include "regularExpression.H" +#include "regExp.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -137,9 +137,6 @@ Foam::Istream& Foam::operator>>(Istream& is, dictionary& dict) functionEntries::inputModeEntry::clear(); dict.clear(); - dict.hashedEntries_.clear(); - dict.wildCardEntries_.clear(); - dict.wildCardRegexps_.clear(); dict.read(is); return is; diff --git a/src/OpenFOAM/global/argList/argList.C b/src/OpenFOAM/global/argList/argList.C index a2faa64133..ef8f88bfbd 100644 --- a/src/OpenFOAM/global/argList/argList.C +++ b/src/OpenFOAM/global/argList/argList.C @@ -37,19 +37,17 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -namespace Foam -{ - SLList argList::validArgs; - HashTable argList::validOptions; - HashTable argList::validParOptions; -} +Foam::SLList Foam::argList::validArgs; +Foam::HashTable Foam::argList::validOptions; +Foam::HashTable Foam::argList::validParOptions; +bool Foam::argList::bannerEnabled(true); Foam::argList::initValidTables::initValidTables() { - validOptions.insert("case", "dir"); - validOptions.insert("parallel", ""); - validParOptions.insert("parallel", ""); + validOptions.set("case", "dir"); + validOptions.set("parallel", ""); + validParOptions.set("parallel", ""); Pstream::addValidParOptions(validParOptions); } @@ -138,7 +136,7 @@ void Foam::argList::getRootCase() casePath = cwd(); // we could add this back in as '-case'? - // options_.insert("case", casePath); + // options_.set("case", casePath); } rootPath_ = casePath.path(); @@ -285,7 +283,7 @@ Foam::argList::argList string timeString = clock::clockTime(); // Print the banner once only for parallel runs - if (Pstream::master()) + if (Pstream::master() && bannerEnabled) { IOobject::writeBanner(Info, true); Info<< "Exec : " << argListString.c_str() << nl @@ -315,8 +313,6 @@ Foam::argList::argList // For the master if (Pstream::master()) { - fileNameList roots; - // establish rootPath_/globalCase_/case_ for master getRootCase(); @@ -333,45 +329,25 @@ Foam::argList::argList << exit(FatalError); } - dictionary decompositionDict(decompDictStream); - - Switch distributed(false); - - if - ( - decompositionDict.readIfPresent("distributed", distributed) - && distributed - ) - { - decompositionDict.lookup("roots") >> roots; - - if (roots.size() != Pstream::nProcs()-1) - { - FatalError - << "number of entries in decompositionDict::roots" - << " is not equal to the number of slaves " - << Pstream::nProcs()-1 - << exit(FatalError); - } - } - + dictionary decompDict(decompDictStream); label dictNProcs ( readLabel ( - decompositionDict.lookup("numberOfSubdomains") + decompDict.lookup("numberOfSubdomains") ) ); - // Check number of processors. We have nProcs(number of - // actual processes), dictNProcs(wanted number of processes read - // from decompositionDict) and nProcDirs(number of processor - // directories - n/a when running distributed) + // Check number of processors. + // nProcs => number of actual procs + // dictNProcs => number of procs specified in decompositionDict + // nProcDirs => number of processor directories + // (n/a when running distributed) // // - normal running : nProcs = dictNProcs = nProcDirs - // - decomposition to more processors : nProcs = dictNProcs - // - decomposition to less processors : nProcs = nProcDirs + // - decomposition to more processors : nProcs = dictNProcs + // - decomposition to fewer processors : nProcs = nProcDirs if (dictNProcs > Pstream::nProcs()) { FatalError @@ -382,38 +358,23 @@ Foam::argList::argList << exit(FatalError); } - if (!distributed && dictNProcs < Pstream::nProcs()) + // distributed data + if (decompDict.lookupOrDefault("distributed", false)) { - // Possibly going to fewer processors. - // Check if all procDirs are there. - label nProcDirs = 0; - while - ( - dir - ( - rootPath_/globalCase_/"processor" - + name(++nProcDirs) - ) - ) - {} + fileNameList roots; + decompDict.lookup("roots") >> roots; - if (nProcDirs != Pstream::nProcs()) + if (roots.size() != Pstream::nProcs()-1) { FatalError - << "number of processor directories = " - << nProcDirs - << " is not equal to the number of processors = " - << Pstream::nProcs() + << "number of entries in decompositionDict::roots" + << " is not equal to the number of slaves " + << Pstream::nProcs()-1 << exit(FatalError); } - } - - // distributed data - if (roots.size()) - { - bool hadOptCase = options_.found("case"); // Distribute the master's argument list (with new root) + bool hadCaseOpt = options_.found("case"); for ( int slave=Pstream::firstSlave(); @@ -421,8 +382,7 @@ Foam::argList::argList slave++ ) { - options_.erase("case"); - options_.insert + options_.set ( "case", fileName(roots[slave-1])/globalCase_ @@ -431,17 +391,42 @@ Foam::argList::argList OPstream toSlave(Pstream::scheduled, slave); toSlave << args_ << options_; } - options_.erase("case"); // restore [-case dir] - if (hadOptCase) + if (hadCaseOpt) { - options_.insert("case", rootPath_/globalCase_); + options_.set("case", rootPath_/globalCase_); } } else { + // Possibly going to fewer processors. + // Check if all procDirs are there. + if (dictNProcs < Pstream::nProcs()) + { + label nProcDirs = 0; + while + ( + dir + ( + rootPath_/globalCase_/"processor" + + name(++nProcDirs) + ) + ) + {} + + if (nProcDirs != Pstream::nProcs()) + { + FatalError + << "number of processor directories = " + << nProcDirs + << " is not equal to the number of processors = " + << Pstream::nProcs() + << exit(FatalError); + } + } + // Distribute the master's argument list (unaltered) for ( @@ -472,7 +457,6 @@ Foam::argList::argList { // establish rootPath_/globalCase_/case_ getRootCase(); - case_ = globalCase_; } @@ -510,21 +494,21 @@ Foam::argList::argList } - if (Pstream::master()) + if (Pstream::master() && bannerEnabled) { Info<< "Case : " << (rootPath_/globalCase_).c_str() << nl << "nProcs : " << nProcs << endl; - } - if (parRunControl_.parRun() && Pstream::master()) - { - Info<< "Slaves : " << slaveProcs << nl - << "Pstream initialized with:" << nl - << " floatTransfer : " << Pstream::floatTransfer << nl - << " nProcsSimpleSum : " << Pstream::nProcsSimpleSum << nl - << " commsType : " - << Pstream::commsTypeNames[Pstream::defaultCommsType] - << endl; + if (parRunControl_.parRun()) + { + Info<< "Slaves : " << slaveProcs << nl + << "Pstream initialized with:" << nl + << " floatTransfer : " << Pstream::floatTransfer << nl + << " nProcsSimpleSum : " << Pstream::nProcsSimpleSum << nl + << " commsType : " + << Pstream::commsTypeNames[Pstream::defaultCommsType] + << endl; + } } jobInfo.add("root", rootPath_); @@ -546,7 +530,7 @@ Foam::argList::argList sigQuit_.set(); sigSegv_.set(); - if (Pstream::master()) + if (Pstream::master() && bannerEnabled) { Info<< endl; IOobject::writeDivider(Info); @@ -564,6 +548,12 @@ Foam::argList::~argList() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +void Foam::argList::noBanner() +{ + bannerEnabled = false; +} + + void Foam::argList::noParallel() { validOptions.erase("parallel"); diff --git a/src/OpenFOAM/global/argList/argList.H b/src/OpenFOAM/global/argList/argList.H index 648295da84..60dd1c01e9 100644 --- a/src/OpenFOAM/global/argList/argList.H +++ b/src/OpenFOAM/global/argList/argList.H @@ -92,6 +92,7 @@ namespace Foam class argList { // Private data + static bool bannerEnabled; stringList args_; HashTable options_; @@ -213,6 +214,9 @@ public: // Edit + //- Disable emitting the banner information + static void noBanner(); + //- Remove the parallel options static void noParallel(); diff --git a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.H b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.H index 33fcda639d..c9e797d2d2 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.H +++ b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrix.H @@ -259,7 +259,7 @@ public: const FieldField& interfaceBouCoeffs, const FieldField& interfaceIntCoeffs, const lduInterfaceFieldPtrsList& interfaces, - Istream& solverData + const dictionary& solverControls ), ( fieldName, @@ -267,7 +267,7 @@ public: interfaceBouCoeffs, interfaceIntCoeffs, interfaces, - solverData + solverControls ) ); @@ -282,7 +282,7 @@ public: const FieldField& interfaceBouCoeffs, const FieldField& interfaceIntCoeffs, const lduInterfaceFieldPtrsList& interfaces, - Istream& solverData + const dictionary& solverControls ), ( fieldName, @@ -290,7 +290,7 @@ public: interfaceBouCoeffs, interfaceIntCoeffs, interfaces, - solverData + solverControls ) ); @@ -304,7 +304,7 @@ public: const FieldField& interfaceBouCoeffs, const FieldField& interfaceIntCoeffs, const lduInterfaceFieldPtrsList& interfaces, - Istream& solverData + const dictionary& solverControls ); // Selectors @@ -317,7 +317,7 @@ public: const FieldField& interfaceBouCoeffs, const FieldField& interfaceIntCoeffs, const lduInterfaceFieldPtrsList& interfaces, - Istream& solverData + const dictionary& solverControls ); @@ -359,7 +359,7 @@ public: //- Read and reset the solver parameters from the given stream - virtual void read(Istream& solverData); + virtual void read(const dictionary&); virtual solverPerformance solve ( @@ -396,6 +396,9 @@ public: public: + //- Find the smoother name (directly or from a sub-dictionary) + static word getName(const dictionary&); + //- Runtime type information virtual const word& type() const = 0; @@ -467,7 +470,7 @@ public: const FieldField& interfaceBouCoeffs, const FieldField& interfaceIntCoeffs, const lduInterfaceFieldPtrsList& interfaces, - Istream& smootherData + const dictionary& solverControls ); @@ -531,6 +534,9 @@ public: public: + //- Find the preconditioner name (directly or from a sub-dictionary) + static word getName(const dictionary&); + //- Runtime type information virtual const word& type() const = 0; @@ -544,9 +550,9 @@ public: symMatrix, ( const solver& sol, - Istream& preconditionerData + const dictionary& solverControls ), - (sol, preconditionerData) + (sol, solverControls) ); declareRunTimeSelectionTable @@ -556,9 +562,9 @@ public: asymMatrix, ( const solver& sol, - Istream& preconditionerData + const dictionary& solverControls ), - (sol, preconditionerData) + (sol, solverControls) ); @@ -579,7 +585,7 @@ public: static autoPtr New ( const solver& sol, - Istream& preconditionerData + const dictionary& solverControls ); @@ -593,7 +599,7 @@ public: //- Read and reset the preconditioner parameters // from the given stream - virtual void read(Istream& preconditionerData) + virtual void read(const dictionary&) {} //- Return wA the preconditioned form of residual rA diff --git a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixPreconditioner.C b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixPreconditioner.C index 82f9a19ac2..cb4a645df1 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixPreconditioner.C +++ b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixPreconditioner.C @@ -37,29 +37,66 @@ namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +Foam::word +Foam::lduMatrix::preconditioner::getName +( + const dictionary& solverControls +) +{ + word name; + + // handle primitive or dictionary entry + const entry& e = solverControls.lookupEntry("preconditioner", false, false); + if (e.isDict()) + { + e.dict().lookup("preconditioner") >> name; + } + else + { + e.stream() >> name; + } + + return name; +} + + Foam::autoPtr Foam::lduMatrix::preconditioner::New ( const solver& sol, - Istream& preconditionerData + const dictionary& solverControls ) { - word preconditionerName(preconditionerData); + word name; + + // handle primitive or dictionary entry + const entry& e = solverControls.lookupEntry("preconditioner", false, false); + if (e.isDict()) + { + e.dict().lookup("preconditioner") >> name; + } + else + { + e.stream() >> name; + } + + const dictionary& controls = e.isDict() ? e.dict() : dictionary::null; if (sol.matrix().symmetric()) { symMatrixConstructorTable::iterator constructorIter = - symMatrixConstructorTablePtr_->find(preconditionerName); + symMatrixConstructorTablePtr_->find(name); if (constructorIter == symMatrixConstructorTablePtr_->end()) { FatalIOErrorIn ( - "lduMatrix::preconditioner::New(const solver&, Istream&)", - preconditionerData + "lduMatrix::preconditioner::New" + "(const solver&, const dictionary&)", + controls ) << "Unknown symmetric matrix preconditioner " - << preconditionerName << endl << endl - << "Valid symmetric matrix preconditioners are :" << endl + << name << nl << nl + << "Valid symmetric matrix preconditioners :" << endl << symMatrixConstructorTablePtr_->toc() << exit(FatalIOError); } @@ -69,24 +106,25 @@ Foam::lduMatrix::preconditioner::New constructorIter() ( sol, - preconditionerData + controls ) ); } else if (sol.matrix().asymmetric()) { asymMatrixConstructorTable::iterator constructorIter = - asymMatrixConstructorTablePtr_->find(preconditionerName); + asymMatrixConstructorTablePtr_->find(name); if (constructorIter == asymMatrixConstructorTablePtr_->end()) { FatalIOErrorIn ( - "lduMatrix::preconditioner::New(const solver&, Istream&)", - preconditionerData + "lduMatrix::preconditioner::New" + "(const solver&, const dictionary&)", + controls ) << "Unknown asymmetric matrix preconditioner " - << preconditionerName << endl << endl - << "Valid asymmetric matrix preconditioners are :" << endl + << name << nl << nl + << "Valid asymmetric matrix preconditioners :" << endl << asymMatrixConstructorTablePtr_->toc() << exit(FatalIOError); } @@ -96,7 +134,7 @@ Foam::lduMatrix::preconditioner::New constructorIter() ( sol, - preconditionerData + controls ) ); } @@ -104,9 +142,10 @@ Foam::lduMatrix::preconditioner::New { FatalIOErrorIn ( - "lduMatrix::preconditioner::New(const solver&, Istream&)", - preconditionerData - ) << "cannot preconditione incomplete matrix, " + "lduMatrix::preconditioner::New" + "(const solver&, const dictionary&)", + controls + ) << "cannot solve incomplete matrix, " "no diagonal or off-diagonal coefficient" << exit(FatalIOError); diff --git a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixSmoother.C b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixSmoother.C index 7554e4085c..a18f65687d 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixSmoother.C +++ b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixSmoother.C @@ -34,9 +34,31 @@ namespace Foam defineRunTimeSelectionTable(lduMatrix::smoother, asymMatrix); } - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +Foam::word +Foam::lduMatrix::smoother::getName +( + const dictionary& solverControls +) +{ + word name; + + // handle primitive or dictionary entry + const entry& e = solverControls.lookupEntry("smoother", false, false); + if (e.isDict()) + { + e.dict().lookup("smoother") >> name; + } + else + { + e.stream() >> name; + } + + return name; +} + + Foam::autoPtr Foam::lduMatrix::smoother::New ( const word& fieldName, @@ -44,23 +66,37 @@ Foam::autoPtr Foam::lduMatrix::smoother::New const FieldField& interfaceBouCoeffs, const FieldField& interfaceIntCoeffs, const lduInterfaceFieldPtrsList& interfaces, - Istream& smootherData + const dictionary& solverControls ) { - word smootherName(smootherData); + word name; + + // handle primitive or dictionary entry + const entry& e = solverControls.lookupEntry("smoother", false, false); + if (e.isDict()) + { + e.dict().lookup("smoother") >> name; + } + else + { + e.stream() >> name; + } + + // not (yet?) needed: + // const dictionary& controls = e.isDict() ? e.dict() : dictionary::null; if (matrix.symmetric()) { symMatrixConstructorTable::iterator constructorIter = - symMatrixConstructorTablePtr_->find(smootherName); + symMatrixConstructorTablePtr_->find(name); if (constructorIter == symMatrixConstructorTablePtr_->end()) { FatalIOErrorIn ( - "lduMatrix::smoother::New", smootherData - ) << "Unknown symmetric matrix smoother " << smootherName - << endl << endl + "lduMatrix::smoother::New", solverControls + ) << "Unknown symmetric matrix smoother " + << name << nl << nl << "Valid symmetric matrix smoothers are :" << endl << symMatrixConstructorTablePtr_->toc() << exit(FatalIOError); @@ -81,15 +117,15 @@ Foam::autoPtr Foam::lduMatrix::smoother::New else if (matrix.asymmetric()) { asymMatrixConstructorTable::iterator constructorIter = - asymMatrixConstructorTablePtr_->find(smootherName); + asymMatrixConstructorTablePtr_->find(name); if (constructorIter == asymMatrixConstructorTablePtr_->end()) { FatalIOErrorIn ( - "lduMatrix::smoother::New", smootherData - ) << "Unknown asymmetric matrix smoother " << smootherName - << endl << endl + "lduMatrix::smoother::New", solverControls + ) << "Unknown asymmetric matrix smoother " + << name << nl << nl << "Valid asymmetric matrix smoothers are :" << endl << asymMatrixConstructorTablePtr_->toc() << exit(FatalIOError); @@ -111,8 +147,9 @@ Foam::autoPtr Foam::lduMatrix::smoother::New { FatalIOErrorIn ( - "lduMatrix::smoother::New", smootherData - ) << "cannot solve incomplete matrix, no off-diagonal coefficients" + "lduMatrix::smoother::New", solverControls + ) << "cannot solve incomplete matrix, " + "no diagonal or off-diagonal coefficient" << exit(FatalIOError); return autoPtr(NULL); diff --git a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixSolver.C b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixSolver.C index 19fd2435a0..4b3b8d97a9 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixSolver.C +++ b/src/OpenFOAM/matrices/lduMatrix/lduMatrix/lduMatrixSolver.C @@ -45,10 +45,10 @@ Foam::autoPtr Foam::lduMatrix::solver::New const FieldField& interfaceBouCoeffs, const FieldField& interfaceIntCoeffs, const lduInterfaceFieldPtrsList& interfaces, - Istream& solverData + const dictionary& solverControls ) { - word solverName(solverData); + word name(solverControls.lookup("solver")); if (matrix.diagonal()) { @@ -61,22 +61,21 @@ Foam::autoPtr Foam::lduMatrix::solver::New interfaceBouCoeffs, interfaceIntCoeffs, interfaces, - solverData + solverControls ) ); } else if (matrix.symmetric()) { symMatrixConstructorTable::iterator constructorIter = - symMatrixConstructorTablePtr_->find(solverName); + symMatrixConstructorTablePtr_->find(name); if (constructorIter == symMatrixConstructorTablePtr_->end()) { FatalIOErrorIn ( - "lduMatrix::solver::New", solverData - ) << "Unknown symmetric matrix solver " << solverName - << endl << endl + "lduMatrix::solver::New", solverControls + ) << "Unknown symmetric matrix solver " << name << nl << nl << "Valid symmetric matrix solvers are :" << endl << symMatrixConstructorTablePtr_->toc() << exit(FatalIOError); @@ -91,22 +90,21 @@ Foam::autoPtr Foam::lduMatrix::solver::New interfaceBouCoeffs, interfaceIntCoeffs, interfaces, - solverData + solverControls ) ); } else if (matrix.asymmetric()) { asymMatrixConstructorTable::iterator constructorIter = - asymMatrixConstructorTablePtr_->find(solverName); + asymMatrixConstructorTablePtr_->find(name); if (constructorIter == asymMatrixConstructorTablePtr_->end()) { FatalIOErrorIn ( - "lduMatrix::solver::New", solverData - ) << "Unknown asymmetric matrix solver " << solverName - << endl << endl + "lduMatrix::solver::New", solverControls + ) << "Unknown asymmetric matrix solver " << name << nl << nl << "Valid asymmetric matrix solvers are :" << endl << asymMatrixConstructorTablePtr_->toc() << exit(FatalIOError); @@ -121,7 +119,7 @@ Foam::autoPtr Foam::lduMatrix::solver::New interfaceBouCoeffs, interfaceIntCoeffs, interfaces, - solverData + solverControls ) ); } @@ -129,7 +127,7 @@ Foam::autoPtr Foam::lduMatrix::solver::New { FatalIOErrorIn ( - "lduMatrix::solver::New", solverData + "lduMatrix::solver::New", solverControls ) << "cannot solve incomplete matrix, " "no diagonal or off-diagonal coefficient" << exit(FatalIOError); @@ -148,7 +146,7 @@ Foam::lduMatrix::solver::solver const FieldField& interfaceBouCoeffs, const FieldField& interfaceIntCoeffs, const lduInterfaceFieldPtrsList& interfaces, - Istream& solverData + const dictionary& solverControls ) : fieldName_(fieldName), @@ -156,12 +154,7 @@ Foam::lduMatrix::solver::solver interfaceBouCoeffs_(interfaceBouCoeffs), interfaceIntCoeffs_(interfaceIntCoeffs), interfaces_(interfaces), - - controlDict_(solverData), - - maxIter_(1000), - tolerance_(1e-6), - relTol_(0) + controlDict_(solverControls) { readControls(); } @@ -171,16 +164,15 @@ Foam::lduMatrix::solver::solver void Foam::lduMatrix::solver::readControls() { - controlDict_.readIfPresent("maxIter", maxIter_); - controlDict_.readIfPresent("tolerance", tolerance_); - controlDict_.readIfPresent("relTol", relTol_); + maxIter_ = controlDict_.lookupOrDefault