Commit 685afaaf authored by Henry Weller's avatar Henry Weller
Browse files

changeDictionary: Simplified by removing the need for the superfluous...

changeDictionary: Simplified by removing the need for the superfluous dictionaryReplacement sub-dictionary

Added the option '-subDict' to specify a sub-dictionary if multiple
replacement sets are present in the same file.  This also provides
backward compatibility by setting '-subDict dictionaryReplacement'
parent a1cc51b1
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -33,21 +33,18 @@ Description
\em Walls a zeroGradient boundary condition, the
\c system/changeDictionaryDict would contain the following:
\verbatim
dictionaryReplacement
p // field to change
{
p // field to change
boundaryField
{
boundaryField
".*Wall" // entry to change
{
".*Wall" // entry to change
{
type zeroGradient;
}
movingWall // entry to change
{
type fixedValue;
value uniform 123.45;
}
type zeroGradient;
}
movingWall // entry to change
{
type fixedValue;
value uniform 123.45;
}
}
}
......@@ -56,17 +53,20 @@ Description
Usage
- changeDictionary [OPTION]
changeDictionary [OPTION]
\param -subDict \n
Specify the subDict name of the replacements dictionary.
\param -literalRE \n
Do not interpret regular expressions or patchGroups;
treat them as any other keyword.
Do not interpret regular expressions or patchGroups; treat them as any
other keyword.
\param -enableFunctionEntries \n
By default all dictionary preprocessing of fields is disabled
Enable function entries (default: disabled)
\param -disablePatchGroups \n
By default all keys are also checked for being patchGroups
Disable the default checking for keys being patchGroups
\*---------------------------------------------------------------------------*/
......@@ -89,7 +89,7 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Extract groupPatch (= shortcut) info from boundary file info
// Extract groupPatch info from boundary file info
HashTable<wordList, word> extractPatchGroups(const dictionary& boundaryDict)
{
HashTable<wordList, word> groupToPatch;
......@@ -268,7 +268,6 @@ bool merge
if (entryPtr)
{
// Mark thisDict entry as having been match for wildcard
// handling later on.
thisKeysSet.erase(entryPtr->keyword());
......@@ -386,6 +385,12 @@ int main(int argc, char *argv[])
{
#include "addDictOption.H"
argList::addOption
(
"subDict",
"name",
"specify the subDict name of the replacements dictionary"
);
argList::addOption
(
"instance",
"name",
......@@ -479,7 +484,16 @@ int main(int argc, char *argv[])
#include "setSystemMeshDictionaryIO.H"
IOdictionary dict(dictIO);
const dictionary& replaceDicts = dict.subDict("dictionaryReplacement");
const dictionary* replaceDictsPtr = &dict;
if (args.optionFound("subDict"))
{
word subDictName(args.optionLookup("subDict")());
replaceDictsPtr = &dict.subDict(subDictName);
}
const dictionary& replaceDicts = *replaceDictsPtr;
Info<< "Read dictionary " << dict.name()
<< " with replacements for dictionaries "
<< replaceDicts.toc() << endl;
......@@ -514,6 +528,7 @@ int main(int argc, char *argv[])
)
);
const_cast<word&>(IOPtrList<entry>::typeName) = oldTypeName;
// Fake type back to what was in field
const_cast<word&>(dictList.type()) = dictList.headerClassName();
......@@ -632,6 +647,7 @@ int main(int argc, char *argv[])
);
const_cast<word&>(IOdictionary::typeName) = oldTypeName;
// Fake type back to what was in field
const_cast<word&>(fieldDict.type()) = fieldDict.headerClassName();
......@@ -652,9 +668,7 @@ int main(int argc, char *argv[])
entry::disableFunctionEntries = oldFlag;
Info<< endl;
Info<< "End\n" << endl;
Info<< "\nEnd\n" << endl;
return 0;
}
......
......@@ -14,75 +14,72 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dictionaryReplacement
boundary
{
boundary
".*"
{
".*"
{
type mappedPatch;
}
type mappedPatch;
}
}
T
{
internalField uniform 300;
T
{
internalField uniform 300;
boundaryField
boundaryField
{
".*"
{
".*"
{
type zeroGradient;
}
type zeroGradient;
}
minY
{
type fixedValue;
value uniform 500;
}
minY
{
type fixedValue;
value uniform 500;
}
}
}
rho
{
internalField uniform 8000;
rho
{
internalField uniform 8000;
boundaryField
boundaryField
{
".*"
{
".*"
{
type zeroGradient;
}
type zeroGradient;
}
}
}
K
{
internalField uniform 80;
K
{
internalField uniform 80;
boundaryField
boundaryField
{
".*"
{
".*"
{
type zeroGradient;
}
type zeroGradient;
}
}
}
cp
{
internalField uniform 450;
cp
{
internalField uniform 450;
boundaryField
boundaryField
{
".*"
{
".*"
{
type zeroGradient;
}
type zeroGradient;
}
}
}
......
......@@ -14,450 +14,447 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dictionaryReplacement
p
{
p
boundaryField
{
boundaryField
{
blockedFaces
{
type zeroGradient;
}
baffleWall
{
type zeroGradient;
}
baffleCyclic_half0
{
type cyclic;
}
baffleCyclic_half1
{
type cyclic;
}
blockedFaces
{
type zeroGradient;
}
baffleWall
{
type zeroGradient;
}
baffleCyclic_half0
{
type cyclic;
}
baffleCyclic_half1
{
type cyclic;
}
}
}
U
U
{
boundaryField
{
boundaryField
{
blockedFaces
{
type fixedValue;
value uniform (0 0 0);
}
baffleWall
{
type activePressureForceBaffleVelocity;
cyclicPatch baffleCyclic_half0;
orientation 1;
openingTime 0.01;
maxOpenFractionDelta 0.1;
openFraction 0;
minThresholdValue 8000;
forceBased 0;
value uniform (0 0 0);
}
baffleCyclic_half0
{
type cyclic;
}
baffleCyclic_half1
{
type cyclic;
}
blockedFaces
{
type fixedValue;
value uniform (0 0 0);
}
baffleWall
{
type activePressureForceBaffleVelocity;
cyclicPatch baffleCyclic_half0;
orientation 1;
openingTime 0.01;
maxOpenFractionDelta 0.1;
openFraction 0;
minThresholdValue 8000;
forceBased 0;
value uniform (0 0 0);
}
baffleCyclic_half0
{
type cyclic;
}
baffleCyclic_half1
{
type cyclic;
}
}
}
epsilon
epsilon
{
boundaryField
{
boundaryField
{
blockedFaces
{
type epsilonWallFunction;
value uniform 0.1;
}
baffleWall
{
type epsilonWallFunction;
value uniform 1e-5;
}
baffleCyclic_half0
{
type cyclic;
}
baffleCyclic_half1
{
type cyclic;
}
blockedFaces
{
type epsilonWallFunction;
value uniform 0.1;
}
baffleWall
{
type epsilonWallFunction;
value uniform 1e-5;
}
baffleCyclic_half0
{
type cyclic;
}
baffleCyclic_half1
{
type cyclic;
}
}
}
k
k
{
boundaryField
{
boundaryField
{
blockedFaces
{
type kqRWallFunction;
value uniform 1.5;
}
baffleWall
{
type kqRWallFunction;
value uniform 1.5;
}
baffleCyclic_half0
{
type cyclic;
}
baffleCyclic_half1
{
type cyclic;
}
blockedFaces
{
type kqRWallFunction;
value uniform 1.5;
}
baffleWall
{
type kqRWallFunction;
value uniform 1.5;
}
baffleCyclic_half0
{
type cyclic;
}
baffleCyclic_half1
{
type cyclic;
}
}
}
Su
Su
{
boundaryField
{
boundaryField
{
blockedFaces
{
type zeroGradient;
}
baffleWall
{
type zeroGradient;
}
baffleCyclic_half0
{
type cyclic;
}
baffleCyclic_half1
{
type cyclic;
}
blockedFaces
{
type zeroGradient;
}
baffleWall
{
type zeroGradient;
}
baffleCyclic_half0
{
type cyclic;
}
baffleCyclic_half1
{
type cyclic;
}
}
}
Xi
Xi
{
boundaryField
{
boundaryField
{
blockedFaces
{
type zeroGradient;
value uniform 1;
}
baffleWall
{
type zeroGradient;
value uniform 1;
}
baffleCyclic_half0
{
type cyclic;
}
baffleCyclic_half1
{
type cyclic;
}
blockedFaces
{
type zeroGradient;
value uniform 1;
}
baffleWall
{
type zeroGradient;
value uniform 1;
}
baffleCyclic_half0
{
type cyclic;
}
baffleCyclic_half1
{
type cyclic;
}
}
}
T
T
{
boundaryField
{
boundaryField
{
blockedFaces
{
type zeroGradient;
value uniform 300;
}
baffleWall
{
type zeroGradient;
value uniform 300;
}
baffleCyclic_half0
{
type cyclic;
}
baffleCyclic_half1
{
type cyclic;
}
blockedFaces
{
type zeroGradient;
value uniform 300;
}
baffleWall
{
type zeroGradient;
value uniform 300;
}
baffleCyclic_half0
{
type cyclic;
}
baffleCyclic_half1
{
type cyclic;
}
}
}
Tu
Tu
{
boundaryField
{
boundaryField
{
blockedFaces
{
type zeroGradient;
value uniform 300;
}
baffleWall
{
type zeroGradient;
value uniform 300;
}
baffleCyclic_half0
<