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 "
<< meshDictIoPtr->objectPath() << endl;
blockMesh::verbose(true);
IOdictionary meshDict(meshDictIoPtr());
blockMesh blocks(meshDict);

View File

@ -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);
}

View File

@ -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_)

View File

@ -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.

View File

@ -31,7 +31,10 @@ License
// Check the blockMesh topology
void Foam::blockMesh::checkBlockMesh(const polyMesh& bm) const
{
if (verboseOutput)
{
Info<< nl << "Check topology" << endl;
}
bool ok = true;
@ -55,18 +58,16 @@ 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 : "
if (verboseOutput)
{
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)
@ -77,6 +78,7 @@ void Foam::blockMesh::checkBlockMesh(const polyMesh& bm) const
}
Info<< tab << "Checking patch -> block consistency" << endl;
}
forAll(patches, patchi)
@ -132,7 +134,10 @@ void Foam::blockMesh::checkBlockMesh(const polyMesh& bm) const
}
}
if (verboseOutput)
{
Info<< endl;
}
if (!ok)
{

View File

@ -34,7 +34,10 @@ void Foam::blockMesh::createPoints() const
{
const blockList& blocks = *this;
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"));
if (verboseOutput)
{
Info<< "Creating cells" << endl;
}
//
// generate cells
@ -221,7 +227,10 @@ void Foam::blockMesh::createPatches() const
{
const polyPatchList& topoPatches = topology().boundaryMesh();
if (verboseOutput)
{
Info<< "Creating patches" << endl;
}
//
// generate points

View File

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

View File

@ -61,8 +61,11 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& dict)
// get the non-linear edges in mesh
//
if (dict.found("edges"))
{
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
//
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
//
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
//
if (verboseOutput)
{
Info<< "Creating topology mesh" << endl;
}
PtrList<cellShape> tmpBlockShapes(blocks.size());
forAll(blocks, blockI)