openfoam/applications/utilities/mesh/generation/blockMesh/findBlockMeshDict.H
Mark Olesen 84270ed667 ENH: new PDRblockMesh mesh generation utility (issue #1216)
- While a rectilinear mesh can be created with blockMesh, not every mesh
  created with blockMesh will satisfy the requirements for being a
  rectilinear mesh.

  This alternative to blockMesh uses a single block that is aligned
  with the xy-z directions and specifications of the control points,
  mesh divisions and expansion ratios. For example,

    x
    {
        points  ( -13.28 -0.10 6.0 19.19 );
        nCells  (  10  12 10 );
        ratios  ( 0.2   1  5 );
    }

    y { ... }
    z { ... }

  With only one block, the boundary patch definition is simple and the
  canonical face number is used directly. For example,

    inlet
    {
        type    patch;
        faces   ( 0 );
    }
    outlet
    {
        type    patch;
        faces   ( 1 );
    }

    sides
    {
        type    patch;
        faces   ( 2 3 );
    }

    ...

- After a mesh is defined, it is trivial to retrieve mesh-related
  information such as cell-volume, cell-centres for any i-j-k location
  without an actual polyMesh.

STYLE: remove -noFunctionObjects from blockMesh

- no time loop, so function objects cannot be triggered anyhow.
2019-02-23 15:45:32 +01:00

73 lines
1.7 KiB
C

// Search for the appropriate blockMesh dictionary....
const word dictName("blockMeshDict");
autoPtr<IOdictionary> meshDictPtr;
{
fileName dictPath;
if (args.readIfPresent("dict", dictPath))
{
// Dictionary specified on the command-line ...
if (isDir(dictPath))
{
dictPath /= dictName;
}
}
else if
(
exists
(
runTime.path()/runTime.constant()
/regionPath/polyMesh::meshSubDir/dictName
)
)
{
// Dictionary present in constant polyMesh directory (old-style)
dictPath =
runTime.constant()
/regionPath/polyMesh::meshSubDir/dictName;
// Warn that constant/polyMesh/blockMeshDict was used
// instead of system/blockMeshDict
WarningIn(args.executable())
<< "Using the old blockMeshDict location: "
<< dictPath << nl
<< " instead of the default location: "
<< runTime.system()/regionPath/dictName << nl
<< endl;
}
else
{
// Assume dictionary is to be found in the system directory
dictPath = runTime.system()/regionPath/dictName;
}
IOobject meshDictIO
(
dictPath,
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
);
if (!meshDictIO.typeHeaderOk<IOdictionary>(true))
{
FatalErrorInFunction
<< meshDictIO.objectPath() << nl
<< exit(FatalError);
}
Info<< "Creating block mesh from "
<< runTime.relativePath(meshDictIO.objectPath()) << endl;
meshDictPtr = autoPtr<IOdictionary>::New(meshDictIO);
}
const IOdictionary& meshDict = *meshDictPtr;