systemDict: Include region in the default directory for the -dict option

With this change both of the following commands are equivalent:

    topoSet -region air -dict topoSetDict1
    topoSet -region air -dict system/air/topoSetDict1

I.e., if the system/<regionName> path is not specified then it is
assumed.
This commit is contained in:
Will Bainbridge
2021-07-04 10:19:44 +01:00
parent 500f1ee9f4
commit cce3e1b1d0
3 changed files with 12 additions and 18 deletions

View File

@ -37,7 +37,7 @@ Foam::IOobject Foam::systemDictIO
const word& regionName const word& regionName
) )
{ {
fileName dictPath = fileName::null; fileName dictPath = dictName;
if (args.optionFound("dict")) if (args.optionFound("dict"))
{ {
@ -55,33 +55,29 @@ Foam::IOobject Foam::systemDictIO
{ {
dictPath = dictPath/dictName; dictPath = dictPath/dictName;
} }
else if (dictPath.isName())
{
dictPath = ob.time().system()/dictPath;
}
} }
if (dictPath.size()) Info<< "Reading " << dictPath << nl << endl;
{
Info<< "Reading " << dictPath << nl << endl;
if (args.optionFound("dict") && !dictPath.isName())
{
return return
IOobject IOobject
( (
dictPath, dictPath.isAbsolute()
ob.time(), ? dictPath
: ob.time().globalPath()/dictPath,
ob,
IOobject::MUST_READ_IF_MODIFIED, IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE IOobject::NO_WRITE
); );
} }
else else
{ {
Info<< "Reading " << dictName << nl << endl;
return return
IOobject IOobject
( (
dictName, dictPath,
ob.time().system(), ob.time().system(),
regionName == polyMesh::defaultRegion ? word::null : regionName, regionName == polyMesh::defaultRegion ? word::null : regionName,
ob, ob,

View File

@ -10,7 +10,7 @@ runApplication foamSetupCHT
runApplication foamDictionary -entry internalField -set "uniform 348" 0/solid/T runApplication foamDictionary -entry internalField -set "uniform 348" 0/solid/T
runApplication decomposePar -allRegions -dict decomposeParDict runApplication decomposePar -allRegions -dict system/decomposeParDict
printf "\n%s\n" "Creating files for paraview post-processing" printf "\n%s\n" "Creating files for paraview post-processing"
paraFoam -touchAll paraFoam -touchAll

View File

@ -10,14 +10,12 @@ runApplication -s air blockMesh -region air
runApplication -s porous blockMesh -region porous runApplication -s porous blockMesh -region porous
# Create rotor blades in air region # Create rotor blades in air region
runApplication -s air.1 \ runApplication -s air.1 topoSet -region air -dict topoSetDict.1
topoSet -region air -dict system/air/topoSetDict.1
runApplication createBaffles -region air -overwrite runApplication createBaffles -region air -overwrite
# Create rotor zone in air region for MRF # Create rotor zone in air region for MRF
runApplication -s air.2 \ runApplication -s air.2 topoSet -region air -dict topoSetDict.2
topoSet -region air -dict system/air/topoSetDict.2
rm -rf constant/air/polyMesh/sets rm -rf constant/air/polyMesh/sets