Commit 2dcd867f authored by Mark Olesen's avatar Mark Olesen
Browse files

blockMesh improvements

- expose point field throughout

- make output less verbose, but can switch on/off with verbose() static method
parent 97fb0c31
......@@ -149,6 +149,8 @@ int main(int argc, char *argv[])
Info<< "Creating block mesh from\n "
<< meshDictIoPtr->objectPath() << endl;
blockMesh::verbose(true);
IOdictionary meshDict(meshDictIoPtr());
blockMesh blocks(meshDict);
......
......@@ -78,7 +78,7 @@ Foam::blockDescriptor::blockDescriptor
meshDensity_(),
edgePoints_(12),
edgeWeights_(12),
expand_(12),
expand_(12, 1.0),
zoneName_()
{
// Examine next token
......@@ -159,7 +159,7 @@ Foam::blockDescriptor::blockDescriptor
(
"blockDescriptor::blockDescriptor"
"(const pointField&, const curvedEdgeList&, Istream&)"
) << "Unknown definition of expansion ratios"
) << "Unknown definition of expansion ratios: " << expRatios
<< exit(FatalError);
}
......
......@@ -26,6 +26,11 @@ License
#include "blockMesh.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
bool Foam::blockMesh::blockMesh::verboseOutput(false);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::blockMesh::blockMesh(IOdictionary& dict)
......@@ -48,6 +53,18 @@ Foam::blockMesh::~blockMesh()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::blockMesh::verbose(const bool on)
{
verboseOutput = on;
}
const Foam::pointField& Foam::blockMesh::blockPointField() const
{
return blockPointField_;
}
const Foam::polyMesh& Foam::blockMesh::topology() const
{
if (!topologyPtr_)
......
......@@ -62,6 +62,7 @@ class blockMesh
public blockList
{
// Private data
static bool verboseOutput;
//- Point field defining the block mesh (corners)
pointField blockPointField_;
......@@ -142,6 +143,9 @@ public:
// Access
//- Reference to point field defining the block mesh
const pointField& blockPointField() const;
const polyMesh& topology() const;
const curvedEdgeList& edges() const
......@@ -170,6 +174,9 @@ public:
//- Clear geometry (internal points, cells, boundaryPatches)
void clearGeom();
//- Enable/disable verbose information about the progress
static void verbose(const bool on=true);
// Write
//- Writes edges of blockMesh in OBJ format.
......
......@@ -31,7 +31,10 @@ License
// Check the blockMesh topology
void Foam::blockMesh::checkBlockMesh(const polyMesh& bm) const
{
Info<< nl << "Check topology" << endl;
if (verboseOutput)
{
Info<< nl << "Check topology" << endl;
}
bool ok = true;
......@@ -55,28 +58,27 @@ void Foam::blockMesh::checkBlockMesh(const polyMesh& bm) const
}
Info<< nl << tab << "Basic statistics" << nl;
Info<< tab << tab << "Number of internal faces : "
<< bm.nInternalFaces() << nl;
Info<< tab << tab << "Number of boundary faces : "
<< nBoundaryFaces << nl;
Info<< tab << tab << "Number of defined boundary faces : "
<< nDefinedBoundaryFaces << nl;
Info<< tab << tab << "Number of undefined boundary faces : "
<< nBoundaryFaces - nDefinedBoundaryFaces << nl;
if ((nBoundaryFaces - nDefinedBoundaryFaces) > 0)
if (verboseOutput)
{
Info<< tab << tab << tab
<< "(Warning : only leave undefined the front and back planes "
<< "of 2D planar geometries!)" << endl;
}
Info<< nl << tab << "Basic statistics" << nl
<< tab << tab << "Number of internal faces : "
<< bm.nInternalFaces() << nl
<< tab << tab << "Number of boundary faces : "
<< nBoundaryFaces << nl
<< tab << tab << "Number of defined boundary faces : "
<< nDefinedBoundaryFaces << nl
<< tab << tab << "Number of undefined boundary faces : "
<< nBoundaryFaces - nDefinedBoundaryFaces << nl;
if ((nBoundaryFaces - nDefinedBoundaryFaces) > 0)
{
Info<< tab << tab << tab
<< "(Warning : only leave undefined the front and back planes "
<< "of 2D planar geometries!)" << endl;
}
Info<< tab << "Checking patch -> block consistency" << endl;
Info<< tab << "Checking patch -> block consistency" << endl;
}
forAll(patches, patchi)
......@@ -132,7 +134,10 @@ void Foam::blockMesh::checkBlockMesh(const polyMesh& bm) const
}
}
Info<< endl;
if (verboseOutput)
{
Info<< endl;
}
if (!ok)
{
......
......@@ -34,7 +34,10 @@ void Foam::blockMesh::createPoints() const
{
const blockList& blocks = *this;
Info<< "Creating points with scale " << scaleFactor_ << endl;
if (verboseOutput)
{
Info<< "Creating points with scale " << scaleFactor_ << endl;
}
//
// generate points
......@@ -65,7 +68,10 @@ void Foam::blockMesh::createCells() const
const blockList& blocks = *this;
const cellModel& hex = *(cellModeller::lookup("hex"));
Info<< "Creating cells" << endl;
if (verboseOutput)
{
Info<< "Creating cells" << endl;
}
//
// generate cells
......@@ -221,7 +227,10 @@ void Foam::blockMesh::createPatches() const
{
const polyPatchList& topoPatches = topology().boundaryMesh();
Info<< "Creating patches" << endl;
if (verboseOutput)
{
Info<< "Creating patches" << endl;
}
//
// generate points
......
......@@ -32,7 +32,10 @@ void Foam::blockMesh::calcMergeInfo()
{
const blockList& blocks = *this;
Info<< "Creating block offsets" << endl;
if (verboseOutput)
{
Info<< "Creating block offsets" << endl;
}
blockOffsets_.setSize(blocks.size());
......@@ -48,7 +51,10 @@ void Foam::blockMesh::calcMergeInfo()
}
Info<< "Creating merge list " << flush;
if (verboseOutput)
{
Info<< "Creating merge list " << flush;
}
// set unused to -1
mergeList_.setSize(nPoints_);
......@@ -411,7 +417,10 @@ void Foam::blockMesh::calcMergeInfo()
}
}
}
Info<< "." << flush;
if (verboseOutput)
{
Info<< "." << flush;
}
if (nPasses > 100)
{
......@@ -421,7 +430,11 @@ void Foam::blockMesh::calcMergeInfo()
}
}
while (changedPointMerge);
Info<< endl;
if (verboseOutput)
{
Info<< endl;
}
forAll(blockInternalFaces, blockFaceLabel)
{
......
......@@ -62,7 +62,10 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& dict)
//
if (dict.found("edges"))
{
Info<< "Creating curved edges" << endl;
if (verboseOutput)
{
Info<< "Creating curved edges" << endl;
}
ITstream& is(dict.lookup("edges"));
......@@ -117,7 +120,7 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& dict)
// Read end of edges
is.readEnd("edges");
}
else
else if (verboseOutput)
{
Info<< "No non-linear edges defined" << endl;
}
......@@ -126,7 +129,11 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& dict)
//
// Create the blocks
//
Info<< "Creating topology blocks" << endl;
if (verboseOutput)
{
Info<< "Creating topology blocks" << endl;
}
{
ITstream& is(dict.lookup("blocks"));
......@@ -198,7 +205,10 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& dict)
//
// Create the patches
//
Info<< "Creating topology patches" << endl;
if (verboseOutput)
{
Info<< "Creating topology patches" << endl;
}
faceListList tmpBlocksPatches;
wordList patchNames;
......@@ -298,7 +308,10 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& dict)
//
// Create the topology
//
Info<< "Creating topology mesh" << endl;
if (verboseOutput)
{
Info<< "Creating topology mesh" << endl;
}
PtrList<cellShape> tmpBlockShapes(blocks.size());
forAll(blocks, blockI)
......
Supports Markdown
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