blockMesh: Change default location of blockMeshDict from constant/polyMesh to system
For multi-region cases the default location of blockMeshDict is now system/<region name> If the blockMeshDict is not found in system then the constant directory is also checked providing backward-compatibility
This commit is contained in:
parent
608cb3ad2c
commit
06b52e581b
1 changed files with 46 additions and 34 deletions
|
|
@ -2,7 +2,7 @@
|
||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|
@ -28,8 +28,10 @@ Description
|
||||||
A multi-block mesh generator.
|
A multi-block mesh generator.
|
||||||
|
|
||||||
Uses the block mesh description found in
|
Uses the block mesh description found in
|
||||||
\a constant/polyMesh/blockMeshDict
|
\a system/blockMeshDict
|
||||||
(or \a constant/\<region\>/polyMesh/blockMeshDict).
|
or \a system/\<region\>/blockMeshDict
|
||||||
|
or \a constant/polyMesh/blockMeshDict
|
||||||
|
or \a constant/\<region\>/polyMesh/blockMeshDict
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
|
|
||||||
|
|
@ -81,57 +83,67 @@ int main(int argc, char *argv[])
|
||||||
"specify alternative dictionary for the blockMesh description"
|
"specify alternative dictionary for the blockMesh description"
|
||||||
);
|
);
|
||||||
|
|
||||||
# include "addRegionOption.H"
|
#include "addRegionOption.H"
|
||||||
# include "setRootCase.H"
|
#include "setRootCase.H"
|
||||||
# include "createTime.H"
|
#include "createTime.H"
|
||||||
|
|
||||||
const word dictName("blockMeshDict");
|
const word dictName("blockMeshDict");
|
||||||
|
|
||||||
word regionName;
|
word regionName;
|
||||||
fileName polyMeshDir;
|
word regionPath;
|
||||||
|
|
||||||
|
// Check if the region is specified otherwise mesh the default region
|
||||||
if (args.optionReadIfPresent("region", regionName, polyMesh::defaultRegion))
|
if (args.optionReadIfPresent("region", regionName, polyMesh::defaultRegion))
|
||||||
{
|
{
|
||||||
// constant/<region>/polyMesh/blockMeshDict
|
|
||||||
polyMeshDir = regionName/polyMesh::meshSubDir;
|
|
||||||
|
|
||||||
Info<< nl << "Generating mesh for region " << regionName << endl;
|
Info<< nl << "Generating mesh for region " << regionName << endl;
|
||||||
|
regionPath = regionName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Search for the appropriate blockMesh dictionary....
|
||||||
|
|
||||||
|
fileName dictPath;
|
||||||
|
|
||||||
|
// Check if the dictionary is specified on the command-line
|
||||||
|
if (args.optionFound("dict"))
|
||||||
|
{
|
||||||
|
dictPath = args["dict"];
|
||||||
|
|
||||||
|
dictPath =
|
||||||
|
(
|
||||||
|
isDir(dictPath)
|
||||||
|
? dictPath/dictName
|
||||||
|
: dictPath
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// Check if dictionary is present in the constant directory
|
||||||
|
else if
|
||||||
|
(
|
||||||
|
exists
|
||||||
|
(
|
||||||
|
runTime.path()/runTime.constant()
|
||||||
|
/regionPath/polyMesh::meshSubDir/dictName
|
||||||
|
)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
dictPath =
|
||||||
|
runTime.path()/runTime.constant()
|
||||||
|
/regionPath/polyMesh::meshSubDir/dictName;
|
||||||
|
}
|
||||||
|
// Otherwise assume the dictionary is present in the system directory
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// constant/polyMesh/blockMeshDict
|
dictPath = runTime.path()/runTime.system()/regionPath/dictName;
|
||||||
polyMeshDir = polyMesh::meshSubDir;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IOobject meshDictIO
|
IOobject meshDictIO
|
||||||
(
|
(
|
||||||
dictName,
|
dictPath,
|
||||||
runTime.constant(),
|
|
||||||
polyMeshDir,
|
|
||||||
runTime,
|
runTime,
|
||||||
IOobject::MUST_READ,
|
IOobject::MUST_READ,
|
||||||
IOobject::NO_WRITE,
|
IOobject::NO_WRITE,
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
||||||
if (args.optionFound("dict"))
|
|
||||||
{
|
|
||||||
const fileName dictPath = args["dict"];
|
|
||||||
|
|
||||||
meshDictIO = IOobject
|
|
||||||
(
|
|
||||||
(
|
|
||||||
isDir(dictPath)
|
|
||||||
? dictPath/dictName
|
|
||||||
: dictPath
|
|
||||||
),
|
|
||||||
runTime,
|
|
||||||
IOobject::MUST_READ,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!meshDictIO.headerOk())
|
if (!meshDictIO.headerOk())
|
||||||
{
|
{
|
||||||
FatalErrorIn(args.executable())
|
FatalErrorIn(args.executable())
|
||||||
|
|
@ -222,7 +234,7 @@ int main(int argc, char *argv[])
|
||||||
meshDict.lookup("mergePatchPairs")
|
meshDict.lookup("mergePatchPairs")
|
||||||
);
|
);
|
||||||
|
|
||||||
# include "mergePatchPairs.H"
|
#include "mergePatchPairs.H"
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue