blockMesh improvements

- expose point field throughout

- make output less verbose, but can switch on/off with verbose() static method
This commit is contained in:
Mark Olesen
2009-10-05 22:53:22 +02:00
parent 97fb0c31a0
commit 2dcd867f47
8 changed files with 102 additions and 36 deletions

View File

@ -149,6 +149,8 @@ int main(int argc, char *argv[])
Info<< "Creating block mesh from\n " Info<< "Creating block mesh from\n "
<< meshDictIoPtr->objectPath() << endl; << meshDictIoPtr->objectPath() << endl;
blockMesh::verbose(true);
IOdictionary meshDict(meshDictIoPtr()); IOdictionary meshDict(meshDictIoPtr());
blockMesh blocks(meshDict); blockMesh blocks(meshDict);

View File

@ -78,7 +78,7 @@ Foam::blockDescriptor::blockDescriptor
meshDensity_(), meshDensity_(),
edgePoints_(12), edgePoints_(12),
edgeWeights_(12), edgeWeights_(12),
expand_(12), expand_(12, 1.0),
zoneName_() zoneName_()
{ {
// Examine next token // Examine next token
@ -159,7 +159,7 @@ Foam::blockDescriptor::blockDescriptor
( (
"blockDescriptor::blockDescriptor" "blockDescriptor::blockDescriptor"
"(const pointField&, const curvedEdgeList&, Istream&)" "(const pointField&, const curvedEdgeList&, Istream&)"
) << "Unknown definition of expansion ratios" ) << "Unknown definition of expansion ratios: " << expRatios
<< exit(FatalError); << exit(FatalError);
} }

View File

@ -26,6 +26,11 @@ License
#include "blockMesh.H" #include "blockMesh.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
bool Foam::blockMesh::blockMesh::verboseOutput(false);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::blockMesh::blockMesh(IOdictionary& dict) Foam::blockMesh::blockMesh(IOdictionary& dict)
@ -48,6 +53,18 @@ Foam::blockMesh::~blockMesh()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * 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 const Foam::polyMesh& Foam::blockMesh::topology() const
{ {
if (!topologyPtr_) if (!topologyPtr_)

View File

@ -62,6 +62,7 @@ class blockMesh
public blockList public blockList
{ {
// Private data // Private data
static bool verboseOutput;
//- Point field defining the block mesh (corners) //- Point field defining the block mesh (corners)
pointField blockPointField_; pointField blockPointField_;
@ -142,6 +143,9 @@ public:
// Access // Access
//- Reference to point field defining the block mesh
const pointField& blockPointField() const;
const polyMesh& topology() const; const polyMesh& topology() const;
const curvedEdgeList& edges() const const curvedEdgeList& edges() const
@ -170,6 +174,9 @@ public:
//- Clear geometry (internal points, cells, boundaryPatches) //- Clear geometry (internal points, cells, boundaryPatches)
void clearGeom(); void clearGeom();
//- Enable/disable verbose information about the progress
static void verbose(const bool on=true);
// Write // Write
//- Writes edges of blockMesh in OBJ format. //- Writes edges of blockMesh in OBJ format.

View File

@ -31,7 +31,10 @@ License
// Check the blockMesh topology // Check the blockMesh topology
void Foam::blockMesh::checkBlockMesh(const polyMesh& bm) const void Foam::blockMesh::checkBlockMesh(const polyMesh& bm) const
{ {
Info<< nl << "Check topology" << endl; if (verboseOutput)
{
Info<< nl << "Check topology" << endl;
}
bool ok = true; bool ok = true;
@ -55,28 +58,27 @@ void Foam::blockMesh::checkBlockMesh(const polyMesh& bm) const
} }
Info<< nl << tab << "Basic statistics" << nl; if (verboseOutput)
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)
{ {
Info<< tab << tab << tab Info<< nl << tab << "Basic statistics" << nl
<< "(Warning : only leave undefined the front and back planes " << tab << tab << "Number of internal faces : "
<< "of 2D planar geometries!)" << endl; << 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;
Info<< tab << "Checking patch -> block consistency" << endl; 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;
}
forAll(patches, patchi) forAll(patches, patchi)
@ -132,7 +134,10 @@ void Foam::blockMesh::checkBlockMesh(const polyMesh& bm) const
} }
} }
Info<< endl; if (verboseOutput)
{
Info<< endl;
}
if (!ok) if (!ok)
{ {

View File

@ -34,7 +34,10 @@ void Foam::blockMesh::createPoints() const
{ {
const blockList& blocks = *this; const blockList& blocks = *this;
Info<< "Creating points with scale " << scaleFactor_ << endl; if (verboseOutput)
{
Info<< "Creating points with scale " << scaleFactor_ << endl;
}
// //
// generate points // generate points
@ -65,7 +68,10 @@ void Foam::blockMesh::createCells() const
const blockList& blocks = *this; const blockList& blocks = *this;
const cellModel& hex = *(cellModeller::lookup("hex")); const cellModel& hex = *(cellModeller::lookup("hex"));
Info<< "Creating cells" << endl; if (verboseOutput)
{
Info<< "Creating cells" << endl;
}
// //
// generate cells // generate cells
@ -221,7 +227,10 @@ void Foam::blockMesh::createPatches() const
{ {
const polyPatchList& topoPatches = topology().boundaryMesh(); const polyPatchList& topoPatches = topology().boundaryMesh();
Info<< "Creating patches" << endl; if (verboseOutput)
{
Info<< "Creating patches" << endl;
}
// //
// generate points // generate points

View File

@ -32,7 +32,10 @@ void Foam::blockMesh::calcMergeInfo()
{ {
const blockList& blocks = *this; const blockList& blocks = *this;
Info<< "Creating block offsets" << endl; if (verboseOutput)
{
Info<< "Creating block offsets" << endl;
}
blockOffsets_.setSize(blocks.size()); 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 // set unused to -1
mergeList_.setSize(nPoints_); mergeList_.setSize(nPoints_);
@ -411,7 +417,10 @@ void Foam::blockMesh::calcMergeInfo()
} }
} }
} }
Info<< "." << flush; if (verboseOutput)
{
Info<< "." << flush;
}
if (nPasses > 100) if (nPasses > 100)
{ {
@ -421,7 +430,11 @@ void Foam::blockMesh::calcMergeInfo()
} }
} }
while (changedPointMerge); while (changedPointMerge);
Info<< endl;
if (verboseOutput)
{
Info<< endl;
}
forAll(blockInternalFaces, blockFaceLabel) forAll(blockInternalFaces, blockFaceLabel)
{ {

View File

@ -62,7 +62,10 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& dict)
// //
if (dict.found("edges")) if (dict.found("edges"))
{ {
Info<< "Creating curved edges" << endl; if (verboseOutput)
{
Info<< "Creating curved edges" << endl;
}
ITstream& is(dict.lookup("edges")); ITstream& is(dict.lookup("edges"));
@ -117,7 +120,7 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& dict)
// Read end of edges // Read end of edges
is.readEnd("edges"); is.readEnd("edges");
} }
else else if (verboseOutput)
{ {
Info<< "No non-linear edges defined" << endl; Info<< "No non-linear edges defined" << endl;
} }
@ -126,7 +129,11 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& dict)
// //
// Create the blocks // Create the blocks
// //
Info<< "Creating topology blocks" << endl; if (verboseOutput)
{
Info<< "Creating topology blocks" << endl;
}
{ {
ITstream& is(dict.lookup("blocks")); ITstream& is(dict.lookup("blocks"));
@ -198,7 +205,10 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& dict)
// //
// Create the patches // Create the patches
// //
Info<< "Creating topology patches" << endl; if (verboseOutput)
{
Info<< "Creating topology patches" << endl;
}
faceListList tmpBlocksPatches; faceListList tmpBlocksPatches;
wordList patchNames; wordList patchNames;
@ -298,7 +308,10 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& dict)
// //
// Create the topology // Create the topology
// //
Info<< "Creating topology mesh" << endl; if (verboseOutput)
{
Info<< "Creating topology mesh" << endl;
}
PtrList<cellShape> tmpBlockShapes(blocks.size()); PtrList<cellShape> tmpBlockShapes(blocks.size());
forAll(blocks, blockI) forAll(blocks, blockI)