Skip to content
Snippets Groups Projects
Commit 3ae1a491 authored by Mark Olesen's avatar Mark Olesen
Browse files

blockMesh:

  renamed genBlockMesh.C -> blockMeshApp.C for the -doc option

  Followed Eugene's suggestions and moved blockMeshDict out of polyMesh/.

  Rationale:
  blockMeshDict is not a polyMesh or part of a polyMesh, thus it doesn't
  really belong in the polyMesh/ dir anyhow. Moving it to constant/ or
  constant/<region>/ improves the overview and eases cleanup of polyMesh/ as
  well. For compatibility, constant/polyMesh/ or constant/<region>/polyMesh/
  will be searched if the new locations fail.
parent d0ee8739
No related merge requests found
......@@ -26,6 +26,6 @@ blockPoints.C
blockCells.C
blockBoundary.C
genBlockMesh.C
blockMeshApp.C
EXE = $(FOAM_APPBIN)/blockMesh
......@@ -22,14 +22,35 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Application
blockMesh
Description
A multi-block mesh generator.
The @a constant/blockMeshDict (or @a constant/\<region\>/blockMeshDict)
is used.
For backwards compatibility, @a constant/polyMesh/blockMeshDict
(or @a constant/\<region\>/polyMesh/blockMeshDict) can also be used
if the previous search failed.
Usage
- blockMesh [OPTION]
@param -blockTopology \n
Write the topology as a set of edges in OBJ format.
@param -region \<name\>\n
Specify an alternative mesh region
\*---------------------------------------------------------------------------*/
#include "Time.H"
#include "IOdictionary.H"
#include "IOPtrList.H"
#include "autoPtr.H"
#include "blockMesh.H"
#include "attachPolyTopoChanger.H"
......@@ -60,47 +81,89 @@ int main(int argc, char *argv[])
word regionName;
fileName polyMeshDir;
fileName constantDir;
autoPtr<IOobject> meshDictPtr;
if (args.options().found("region"))
{
regionName = args.options()["region"];
polyMeshDir = regionName/polyMesh::meshSubDir;
constantDir = runTime.constant()/regionName;
Info<< nl << "Generating mesh for region " << regionName << endl;
// try constant/<region>/blockMeshDict
meshDictPtr.reset
(
new IOobject
(
"blockMeshDict",
runTime.constant(),
regionName,
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
)
);
}
else
{
regionName = polyMesh::defaultRegion;
polyMeshDir = polyMesh::meshSubDir;
}
constantDir = runTime.constant();
Info<< nl << "Reading block mesh description dictionary" << endl;
// try constant/blockMeshDict
meshDictPtr.reset
(
new IOobject
(
"blockMeshDict",
runTime.constant(),
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
)
);
}
IOobject meshDescriptionIOobject
(
"blockMeshDict",
runTime.constant(),
polyMeshDir,
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
);
// not found, fallback to polyMesh directory
if (!meshDictPtr->headerOk())
{
meshDictPtr.reset
(
new IOobject
(
"blockMeshDict",
runTime.constant(),
polyMeshDir,
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
)
);
}
if (!meshDescriptionIOobject.headerOk())
if (!meshDictPtr->headerOk())
{
FatalErrorIn(args.executable())
<< "Cannot open mesh description file " << nl
<< runTime.constant()/polyMeshDir/"blockMeshDict" << nl
<< constantDir/"blockMeshDict" << nl
<< "or "<< nl
<< constantDir/polyMeshDir/polyMesh::meshSubDir/"blockMeshDict"
<< nl
<< exit(FatalError);
}
IOdictionary meshDescription(meshDescriptionIOobject);
Info<< nl << "Reading mesh description file" << endl;
IOdictionary blockMeshDict(meshDictPtr());
Info<< nl << "Creating block mesh" << endl;
blockMesh blocks(meshDescription);
blockMesh blocks(blockMeshDict);
if (writeTopo)
......@@ -145,7 +208,6 @@ int main(int argc, char *argv[])
}
Info<< nl << "Creating mesh from block mesh" << endl;
wordList patchNames = blocks.patchNames();
......@@ -186,11 +248,11 @@ int main(int argc, char *argv[])
// Read in a list of dictionaries for the merge patch pairs
if (meshDescription.found("mergePatchPairs"))
if (blockMeshDict.found("mergePatchPairs"))
{
List<Pair<word> > mergePatchPairs
(
meshDescription.lookup("mergePatchPairs")
blockMeshDict.lookup("mergePatchPairs")
);
if (mergePatchPairs.size())
......@@ -296,7 +358,7 @@ int main(int argc, char *argv[])
// Set the precision of the points data to 10
IOstream::defaultPrecision(10);
Info << nl << "Writing polyMesh" << endl;
Info<< nl << "Writing polyMesh" << endl;
mesh.removeFiles(mesh.instance());
if (!mesh.write())
{
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment