From d8a812ced15143348765d8537c79702cfb22260d Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Thu, 14 Jul 2011 11:26:42 +0200 Subject: [PATCH 1/6] ENH: add '-all' option to foamEtcFile for similar results as findEtcFiles --- bin/foamEtcFile | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/bin/foamEtcFile b/bin/foamEtcFile index 8a1f5d97e6..cf52c1d62a 100755 --- a/bin/foamEtcFile +++ b/bin/foamEtcFile @@ -44,7 +44,7 @@ # #------------------------------------------------------------------------------- usage() { - [ "${quietOpt:-$silentOpt}" = true ] && exit 1 + [ "${optQuiet:-$optSilent}" = true ] && exit 1 exec 1>&2 while [ "$#" -ge 1 ]; do echo "$1"; shift; done @@ -53,6 +53,7 @@ usage() { Usage: ${0##*/} [OPTION] fileName ${0##*/} [OPTION] -list options: + -all return all files (otherwise stop after the first match) -list list the directories to be searched -mode any combination of u(user), g(group), o(other) -prefix specify an alternative installation prefix @@ -129,7 +130,7 @@ esac # default mode is 'ugo' mode=ugo -unset listOpt quietOpt silentOpt +unset optAll optList optQuiet optSilent # parse options while [ "$#" -gt 0 ] @@ -138,8 +139,11 @@ do -h | -help) usage ;; + -a | -all) + optAll=true + ;; -l | -list) - listOpt=true + optList=true ;; -m | -mode) [ "$#" -ge 2 ] || usage "'$1' option requires an argument" @@ -161,10 +165,10 @@ do shift ;; -q | -quiet) - quietOpt=true + optQuiet=true ;; -s | -silent) - silentOpt=true + optSilent=true ;; -v | -version) [ "$#" -ge 2 ] || usage "'$1' option requires an argument" @@ -239,14 +243,15 @@ set -- $dirList # The main routine # -if [ "$listOpt" = true ] +exitCode=0 +if [ "$optList" = true ] then # list directories, or potential file locations [ "$nArgs" -le 1 ] || usage # a silly combination, but -quiet does have precedence - [ "$quietOpt" = true ] && exit 0 + [ "$optQuiet" = true ] && exit 0 for dir do @@ -257,25 +262,32 @@ then echo "$dir" fi done - exit 0 else [ "$nArgs" -eq 1 ] || usage + # general error, eg file not found + exitCode=2 + for dir do if [ -f "$dir/$fileName" ] then - [ "$quietOpt" = true ] || echo "$dir/$fileName" - exit 0 + exitCode=0 + if [ "$optQuiet" = true ] + then + break + else + echo "$dir/$fileName" + [ "$optAll" = true ] || break + fi fi done fi -# general error, eg file not found -exit 2 +exit $exitCode #------------------------------------------------------------------------------ From 6980e724d9feaf8ac2d4051b92711611e6180a7d Mon Sep 17 00:00:00 2001 From: Henry Date: Mon, 25 Jul 2011 15:26:27 +0100 Subject: [PATCH 2/6] linearUpwind: Corrected warning messages --- .../schemes/linearUpwind/linearUpwind.H | 9 ++++-- .../schemes/linearUpwind/linearUpwindV.H | 30 ++++++++++++------- 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/linearUpwind/linearUpwind.H b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/linearUpwind/linearUpwind.H index 13b98512df..d180be69ed 100644 --- a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/linearUpwind/linearUpwind.H +++ b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/linearUpwind/linearUpwind.H @@ -141,10 +141,15 @@ public: ) ) { + if (!schemeData.eof()) { - IOWarningIn("linearUpwind(const fvMesh&, Istream&)", schemeData) - << "unexpected additional entries in stream." << nl + IOWarningIn + ( + "linearUpwind(const fvMesh&, " + "const surfaceScalarField& faceFlux, Istream&)", + schemeData + ) << "unexpected additional entries in stream." << nl << " Only the name of the gradient scheme in the" " 'gradSchemes' dictionary should be specified." << endl; diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/linearUpwind/linearUpwindV.H b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/linearUpwind/linearUpwindV.H index ce07b1017b..d97ea2cbb5 100644 --- a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/linearUpwind/linearUpwindV.H +++ b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/linearUpwind/linearUpwindV.H @@ -111,11 +111,14 @@ public: ) ) { - IOWarningIn("linearUpwindV(const fvMesh&, Istream&)", schemeData) - << "unexpected additional entries in stream." << nl - << " Only the name of the gradient scheme in the" - " 'gradSchemes' dictionary should be specified." - << endl; + if (!schemeData.eof()) + { + IOWarningIn("linearUpwindV(const fvMesh&, Istream&)", schemeData) + << "unexpected additional entries in stream." << nl + << " Only the name of the gradient scheme in the" + " 'gradSchemes' dictionary should be specified." + << endl; + } } //- Construct from faceFlux and Istream @@ -137,11 +140,18 @@ public: ) ) { - IOWarningIn("linearUpwindV(const fvMesh&, Istream&)", schemeData) - << "unexpected additional entries in stream." << nl - << " Only the name of the gradient scheme in the" - " 'gradSchemes' dictionary should be specified." - << endl; + if (!schemeData.eof()) + { + IOWarningIn + ( + "linearUpwindV(const fvMesh&, " + "const surfaceScalarField& faceFlux, Istream&)", + schemeData + ) << "unexpected additional entries in stream." << nl + << " Only the name of the gradient scheme in the" + " 'gradSchemes' dictionary should be specified." + << endl; + } } From 2e90deddcc38d385c6c44ec3a7f8a6487b7767aa Mon Sep 17 00:00:00 2001 From: Henry Date: Mon, 25 Jul 2011 15:26:43 +0100 Subject: [PATCH 3/6] changeDictionary: added -dict option --- .../changeDictionary/changeDictionary.C | 41 ++++++++++++++++--- 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/applications/utilities/preProcessing/changeDictionary/changeDictionary.C b/applications/utilities/preProcessing/changeDictionary/changeDictionary.C index 9dd677a61a..6ca7be44ef 100644 --- a/applications/utilities/preProcessing/changeDictionary/changeDictionary.C +++ b/applications/utilities/preProcessing/changeDictionary/changeDictionary.C @@ -246,6 +246,12 @@ bool merge int main(int argc, char *argv[]) { + argList::addOption + ( + "dict", + "file", + "specify an alternative to system/changeDictionaryDict" + ); argList::addOption ( "instance", @@ -268,6 +274,18 @@ int main(int argc, char *argv[]) #include "createTime.H" #include "createNamedMesh.H" + const word dictName("changeDictionaryDict"); + + fileName dictPath = dictName; + if (args.optionFound("dict")) + { + dictPath = args["dict"]; + if (isDir(dictPath)) + { + dictPath = dictPath / dictName; + } + } + const bool literalRE = args.optionFound("literalRE"); if (literalRE) @@ -313,15 +331,26 @@ int main(int argc, char *argv[]) // Get the replacement rules from a dictionary IOdictionary dict ( - IOobject ( - "changeDictionaryDict", - runTime.system(), - mesh, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE + args.optionFound("dict") + ? IOobject + ( + dictPath, + mesh, + IOobject::MUST_READ_IF_MODIFIED, + IOobject::NO_WRITE + ) + : IOobject + ( + dictName, + runTime.system(), + mesh, + IOobject::MUST_READ_IF_MODIFIED, + IOobject::NO_WRITE + ) ) ); + const dictionary& replaceDicts = dict.subDict("dictionaryReplacement"); Info<< "Read dictionary " << dict.name() << " with replacements for dictionaries " From d191bac75559905b1d7e19fa3a2b5e085d7e1e13 Mon Sep 17 00:00:00 2001 From: Henry Date: Mon, 25 Jul 2011 15:28:18 +0100 Subject: [PATCH 4/6] damBreakPorousBaffle: Updated tutorial case --- .../multiphase/interFoam/ras/damBreakPorousBaffle/0/p_rgh | 2 +- .../interFoam/ras/damBreakPorousBaffle/selectCyclics.setSet | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) delete mode 100644 tutorials/multiphase/interFoam/ras/damBreakPorousBaffle/selectCyclics.setSet diff --git a/tutorials/multiphase/interFoam/ras/damBreakPorousBaffle/0/p_rgh b/tutorials/multiphase/interFoam/ras/damBreakPorousBaffle/0/p_rgh index e760b71ca3..ef9a9fcfb2 100644 --- a/tutorials/multiphase/interFoam/ras/damBreakPorousBaffle/0/p_rgh +++ b/tutorials/multiphase/interFoam/ras/damBreakPorousBaffle/0/p_rgh @@ -52,7 +52,7 @@ boundaryField { type porousBafflePressure; patchType cyclic; - jump uniform 0; + jump uniform 0 value uniform 0; D 700; I 500; length 1.05; diff --git a/tutorials/multiphase/interFoam/ras/damBreakPorousBaffle/selectCyclics.setSet b/tutorials/multiphase/interFoam/ras/damBreakPorousBaffle/selectCyclics.setSet deleted file mode 100644 index 95bacaa24f..0000000000 --- a/tutorials/multiphase/interFoam/ras/damBreakPorousBaffle/selectCyclics.setSet +++ /dev/null @@ -1,3 +0,0 @@ -faceSet cyclicFaces new boxToFace (0.3015 0.0493 -1) (0.3069 0.2077 1); -cellSet cyclicFacesSlaveCells new boxToCell (-1 0 -1) (0.305 0.31 1) -faceZoneSet cyclicZoneFaces new setsToFaceZone cyclicFaces cyclicFacesSlaveCells From cb13c50765168a97f00216c2adaa51469ddb8767 Mon Sep 17 00:00:00 2001 From: Henry Date: Mon, 25 Jul 2011 15:28:48 +0100 Subject: [PATCH 5/6] CleanFunctions: Added statement to remove the tetDualMesh --- bin/tools/CleanFunctions | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bin/tools/CleanFunctions b/bin/tools/CleanFunctions index e7f1ad40a6..c43f1d2017 100644 --- a/bin/tools/CleanFunctions +++ b/bin/tools/CleanFunctions @@ -97,6 +97,9 @@ cleanCase() cellToRegion cellLevel* pointLevel* \ > /dev/null 2>&1 \ ) + + rm -rf constant/tetDualMesh > /dev/null 2>&1 + rm -rf VTK > /dev/null 2>&1 rm -f 0/cellLevel 0/pointLevel From 1e35ccafbb976d6e9d92b29fc9cb20312929c7be Mon Sep 17 00:00:00 2001 From: Henry Date: Mon, 25 Jul 2011 15:30:34 +0100 Subject: [PATCH 6/6] Corrected line lengths --- .../schemes/linearUpwind/linearUpwindV.H | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/linearUpwind/linearUpwindV.H b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/linearUpwind/linearUpwindV.H index d97ea2cbb5..ca0be6d359 100644 --- a/src/finiteVolume/interpolation/surfaceInterpolation/schemes/linearUpwind/linearUpwindV.H +++ b/src/finiteVolume/interpolation/surfaceInterpolation/schemes/linearUpwind/linearUpwindV.H @@ -113,8 +113,11 @@ public: { if (!schemeData.eof()) { - IOWarningIn("linearUpwindV(const fvMesh&, Istream&)", schemeData) - << "unexpected additional entries in stream." << nl + IOWarningIn + ( + "linearUpwindV(const fvMesh&, Istream&)", + schemeData + ) << "unexpected additional entries in stream." << nl << " Only the name of the gradient scheme in the" " 'gradSchemes' dictionary should be specified." << endl;