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:
Henry
2015-04-24 22:29:57 +01:00
parent a99f9f0378
commit 50ada7c994
199 changed files with 331 additions and 65 deletions

View File

@ -28,8 +28,10 @@ Description
A multi-block mesh generator.
Uses the block mesh description found in
\a constant/polyMesh/blockMeshDict
(or \a constant/\<region\>/polyMesh/blockMeshDict).
\a system/blockMeshDict
or \a system/\<region\>/blockMeshDict
or \a constant/polyMesh/blockMeshDict
or \a constant/\<region\>/polyMesh/blockMeshDict
Usage
@ -88,50 +90,60 @@ int main(int argc, char *argv[])
const word dictName("blockMeshDict");
word regionName;
fileName polyMeshDir;
word regionPath;
// Check if the region is specified otherwise mesh the default region
if (args.optionReadIfPresent("region", regionName, polyMesh::defaultRegion))
{
// constant/<region>/polyMesh/blockMeshDict
polyMeshDir = regionName/polyMesh::meshSubDir;
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
{
// constant/polyMesh/blockMeshDict
polyMeshDir = polyMesh::meshSubDir;
dictPath = runTime.path()/runTime.system()/regionPath/dictName;
}
IOobject meshDictIO
(
dictName,
runTime.constant(),
polyMeshDir,
dictPath,
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE,
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())
{
FatalErrorIn(args.executable())

View File

@ -1,7 +1,7 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
m4 constant/polyMesh/blockMeshDict.m4 > constant/polyMesh/blockMeshDict
m4 system/blockMeshDict.m4 > system/blockMeshDict
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions

View File

@ -1,7 +1,7 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
m4 constant/polyMesh/blockMeshDict.m4 > constant/polyMesh/blockMeshDict
m4 system/blockMeshDict.m4 > system/blockMeshDict
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions

View File

@ -4,5 +4,5 @@ cd ${0%/*} || exit 1 # Run from this directory
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
m4 < constant/polyMesh/blockMeshDict.m4 > constant/polyMesh/blockMeshDict
m4 < system/blockMeshDict.m4 > system/blockMeshDict
runApplication blockMesh

View File

@ -1,7 +1,7 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
m4 constant/polyMesh/blockMeshDict.m4 > constant/polyMesh/blockMeshDict
m4 system/blockMeshDict.m4 > system/blockMeshDict
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions

View File

@ -0,0 +1,123 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// block definition for a porosity with an angled inlet/outlet
// the porosity is not aligned with the main axes
//
convertToMeters 0.001;
vertices
(
// inlet region
( -150 0 -25 ) // pt 0 (in1b)
( -150 35.35533906 -25 ) // pt 1 (in2b)
( -150 0 25 ) // pt 2 (in1f)
( -150 35.35533906 25 ) // pt 3 (in2f)
// join inlet->outlet
( 0 0 -25 ) // pt 4 (join1b)
( -35.35533906 35.35533906 -25 ) // pt 5 (join2b)
( 0 0 25 ) // pt 6 (join1f)
( -35.35533906 35.35533906 25 ) // pt 7 (join2f)
// porosity ends ->outlet
( 70.71067812 70.71067812 -25 ) // pt 8 (poro1b)
( 35.35533906 106.06601718 -25 ) // pt 9 (poro2b)
( 70.71067812 70.71067812 25 ) // pt 10 (poro1f)
( 35.35533906 106.06601718 25 ) // pt 11 (poro2f)
// outlet
( 141.42135624 141.42135624 -25 ) // pt 12 (out1b)
( 106.06601718 176.7766953 -25 ) // pt 13 (out2b)
( 141.42135624 141.42135624 25 ) // pt 14 (out1f)
( 106.06601718 176.7766953 25 ) // pt 15 (out2f)
);
blocks
(
// inlet block
hex (0 4 5 1 2 6 7 3)
inlet ( 15 20 20 ) simpleGrading (1 1 1)
// porosity block
hex (4 8 9 5 6 10 11 7)
porosity ( 20 20 20 ) simpleGrading (1 1 1)
// outlet block
hex (8 12 13 9 10 14 15 11)
outlet ( 20 20 20 ) simpleGrading (1 1 1)
);
edges
(
);
patches
(
// is there no way of defining all my 'defaultFaces' to be 'wall'?
wall front
(
// inlet block
(2 6 7 3)
// outlet block
(10 14 15 11)
)
wall back
(
// inlet block
(1 5 4 0)
// outlet block
(9 13 12 8)
)
wall walls
(
// inlet block
(2 0 4 6)
(7 5 1 3)
// outlet block
(10 8 12 14)
(15 13 9 11)
)
wall porosityWall
(
// porosity block
(6 10 11 7)
// porosity block
(5 9 8 4)
// porosity block
(6 4 8 10)
(11 9 5 7)
)
patch inlet
(
(3 1 0 2)
)
patch outlet
(
(15 13 12 14)
)
);
mergePatchPairs
(
);
// ************************************************************************* //

View File

@ -0,0 +1 @@
../../angledDuctImplicit/system/blockMeshDict.m4

View File

@ -1,7 +1,7 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
m4 constant/polyMesh/blockMeshDict.m4 > constant/polyMesh/blockMeshDict
m4 system/blockMeshDict.m4 > system/blockMeshDict
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions

View File

@ -20,24 +20,28 @@ FoamFile
front
{
type wall;
inGroups 1(wall);
nFaces 700;
startFace 63400;
}
back
{
type wall;
inGroups 1(wall);
nFaces 700;
startFace 64100;
}
wall
walls
{
type wall;
inGroups 1(wall);
nFaces 1400;
startFace 64800;
}
porosityWall
{
type wall;
inGroups 1(wall);
nFaces 1600;
startFace 66200;
}

View File

@ -0,0 +1,123 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// block definition for a porosity with an angled inlet/outlet
// the porosity is not aligned with the main axes
//
convertToMeters 0.001;
vertices
(
// inlet region
( -150 0 -25 ) // pt 0 (in1b)
( -150 35.35533906 -25 ) // pt 1 (in2b)
( -150 0 25 ) // pt 2 (in1f)
( -150 35.35533906 25 ) // pt 3 (in2f)
// join inlet->outlet
( 0 0 -25 ) // pt 4 (join1b)
( -35.35533906 35.35533906 -25 ) // pt 5 (join2b)
( 0 0 25 ) // pt 6 (join1f)
( -35.35533906 35.35533906 25 ) // pt 7 (join2f)
// porosity ends ->outlet
( 70.71067812 70.71067812 -25 ) // pt 8 (poro1b)
( 35.35533906 106.06601718 -25 ) // pt 9 (poro2b)
( 70.71067812 70.71067812 25 ) // pt 10 (poro1f)
( 35.35533906 106.06601718 25 ) // pt 11 (poro2f)
// outlet
( 141.42135624 141.42135624 -25 ) // pt 12 (out1b)
( 106.06601718 176.7766953 -25 ) // pt 13 (out2b)
( 141.42135624 141.42135624 25 ) // pt 14 (out1f)
( 106.06601718 176.7766953 25 ) // pt 15 (out2f)
);
blocks
(
// inlet block
hex (0 4 5 1 2 6 7 3)
inlet ( 15 20 20 ) simpleGrading (1 1 1)
// porosity block
hex (4 8 9 5 6 10 11 7)
porosity ( 20 20 20 ) simpleGrading (1 1 1)
// outlet block
hex (8 12 13 9 10 14 15 11)
outlet ( 20 20 20 ) simpleGrading (1 1 1)
);
edges
(
);
patches
(
// is there no way of defining all my 'defaultFaces' to be 'wall'?
wall front
(
// inlet block
(2 6 7 3)
// outlet block
(10 14 15 11)
)
wall back
(
// inlet block
(1 5 4 0)
// outlet block
(9 13 12 8)
)
wall walls
(
// inlet block
(2 0 4 6)
(7 5 1 3)
// outlet block
(10 8 12 14)
(15 13 9 11)
)
wall porosityWall
(
// porosity block
(6 10 11 7)
// porosity block
(5 9 8 4)
// porosity block
(6 4 8 10)
(11 9 5 7)
)
patch inlet
(
(3 1 0 2)
)
patch outlet
(
(15 13 12 14)
)
);
mergePatchPairs
(
);
// ************************************************************************* //

View File

@ -1,7 +1,7 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
m4 constant/polyMesh/blockMeshDict.m4 > constant/polyMesh/blockMeshDict
m4 system/blockMeshDict.m4 > system/blockMeshDict
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions

View File

@ -6,7 +6,7 @@ cd ${0%/*} || exit 1 # Run from this directory
setDecompressionTankFine()
{
blockMeshDict="constant/polyMesh/blockMeshDict"
blockMeshDict="system/blockMeshDict"
controlDict="system/controlDict"
sed \

View File

@ -8,7 +8,7 @@
FoamFile
{
version 2.0;
format binary;
format ascii;
class polyBoundaryMesh;
location "constant/polyMesh";
object boundary;
@ -20,6 +20,7 @@ FoamFile
maxY
{
type wall;
inGroups 1(wall);
nFaces 300;
startFace 8300;
}
@ -38,18 +39,21 @@ FoamFile
minY
{
type wall;
inGroups 1(wall);
nFaces 300;
startFace 8800;
}
minZ
{
type wall;
inGroups 1(wall);
nFaces 300;
startFace 9100;
}
maxZ
{
type wall;
inGroups 1(wall);
nFaces 300;
startFace 9400;
}

View File

@ -3,7 +3,7 @@ cd ${0%/*} || exit 1 # Run from this directory
set -x
m4 < constant/polyMesh/blockMeshDict.m4 > constant/polyMesh/blockMeshDict
m4 < system/blockMeshDict.m4 > system/blockMeshDict
blockMesh > log.blockMesh 2>&1
# ----------------------------------------------------------------- end-of-file

View File

@ -26,7 +26,7 @@ copySolutionDirs()
setCavityFine()
{
blockMeshDict="$caseName/constant/polyMesh/blockMeshDict"
blockMeshDict="$caseName/system/blockMeshDict"
controlDict="$caseName/system/controlDict"
sed s/"20 20 1"/"41 41 1"/g $blockMeshDict > temp.$$
mv temp.$$ $blockMeshDict

View File

@ -4,7 +4,7 @@ cd ${0%/*} || exit 1 # Run from this directory
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
m4 < constant/polyMesh/blockMeshDict.m4 > constant/polyMesh/blockMeshDict
m4 < system/blockMeshDict.m4 > system/blockMeshDict
runApplication blockMesh

View File

@ -0,0 +1 @@
../../angledDuctImplicit/system/blockMeshDict.m4

Some files were not shown because too many files have changed in this diff Show More