mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
blockMesh improvements
- expose point field throughout - make output less verbose, but can switch on/off with verbose() static method
This commit is contained in:
@ -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);
|
||||||
|
|
||||||
|
|||||||
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -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_)
|
||||||
|
|||||||
@ -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.
|
||||||
|
|||||||
@ -30,8 +30,11 @@ 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
|
||||||
|
{
|
||||||
|
if (verboseOutput)
|
||||||
{
|
{
|
||||||
Info<< nl << "Check topology" << endl;
|
Info<< nl << "Check topology" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
|
|
||||||
@ -55,18 +58,16 @@ void Foam::blockMesh::checkBlockMesh(const polyMesh& bm) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Info<< nl << tab << "Basic statistics" << nl;
|
if (verboseOutput)
|
||||||
|
{
|
||||||
Info<< tab << tab << "Number of internal faces : "
|
Info<< nl << tab << "Basic statistics" << nl
|
||||||
<< bm.nInternalFaces() << nl;
|
<< tab << tab << "Number of internal faces : "
|
||||||
|
<< bm.nInternalFaces() << nl
|
||||||
Info<< tab << tab << "Number of boundary faces : "
|
<< tab << tab << "Number of boundary faces : "
|
||||||
<< nBoundaryFaces << nl;
|
<< nBoundaryFaces << nl
|
||||||
|
<< tab << tab << "Number of defined boundary faces : "
|
||||||
Info<< tab << tab << "Number of defined boundary faces : "
|
<< nDefinedBoundaryFaces << nl
|
||||||
<< nDefinedBoundaryFaces << nl;
|
<< tab << tab << "Number of undefined boundary faces : "
|
||||||
|
|
||||||
Info<< tab << tab << "Number of undefined boundary faces : "
|
|
||||||
<< nBoundaryFaces - nDefinedBoundaryFaces << nl;
|
<< nBoundaryFaces - nDefinedBoundaryFaces << nl;
|
||||||
|
|
||||||
if ((nBoundaryFaces - nDefinedBoundaryFaces) > 0)
|
if ((nBoundaryFaces - nDefinedBoundaryFaces) > 0)
|
||||||
@ -77,6 +78,7 @@ void Foam::blockMesh::checkBlockMesh(const polyMesh& bm) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
Info<< tab << "Checking patch -> block consistency" << 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
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (verboseOutput)
|
||||||
|
{
|
||||||
Info<< endl;
|
Info<< endl;
|
||||||
|
}
|
||||||
|
|
||||||
if (!ok)
|
if (!ok)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -34,7 +34,10 @@ void Foam::blockMesh::createPoints() const
|
|||||||
{
|
{
|
||||||
const blockList& blocks = *this;
|
const blockList& blocks = *this;
|
||||||
|
|
||||||
|
if (verboseOutput)
|
||||||
|
{
|
||||||
Info<< "Creating points with scale " << scaleFactor_ << endl;
|
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"));
|
||||||
|
|
||||||
|
if (verboseOutput)
|
||||||
|
{
|
||||||
Info<< "Creating cells" << endl;
|
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();
|
||||||
|
|
||||||
|
if (verboseOutput)
|
||||||
|
{
|
||||||
Info<< "Creating patches" << endl;
|
Info<< "Creating patches" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// generate points
|
// generate points
|
||||||
|
|||||||
@ -32,7 +32,10 @@ void Foam::blockMesh::calcMergeInfo()
|
|||||||
{
|
{
|
||||||
const blockList& blocks = *this;
|
const blockList& blocks = *this;
|
||||||
|
|
||||||
|
if (verboseOutput)
|
||||||
|
{
|
||||||
Info<< "Creating block offsets" << endl;
|
Info<< "Creating block offsets" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
blockOffsets_.setSize(blocks.size());
|
blockOffsets_.setSize(blocks.size());
|
||||||
|
|
||||||
@ -48,7 +51,10 @@ void Foam::blockMesh::calcMergeInfo()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (verboseOutput)
|
||||||
|
{
|
||||||
Info<< "Creating merge list " << flush;
|
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()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (verboseOutput)
|
||||||
|
{
|
||||||
Info<< "." << flush;
|
Info<< "." << flush;
|
||||||
|
}
|
||||||
|
|
||||||
if (nPasses > 100)
|
if (nPasses > 100)
|
||||||
{
|
{
|
||||||
@ -421,7 +430,11 @@ void Foam::blockMesh::calcMergeInfo()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (changedPointMerge);
|
while (changedPointMerge);
|
||||||
|
|
||||||
|
if (verboseOutput)
|
||||||
|
{
|
||||||
Info<< endl;
|
Info<< endl;
|
||||||
|
}
|
||||||
|
|
||||||
forAll(blockInternalFaces, blockFaceLabel)
|
forAll(blockInternalFaces, blockFaceLabel)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -61,8 +61,11 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& dict)
|
|||||||
// get the non-linear edges in mesh
|
// get the non-linear edges in mesh
|
||||||
//
|
//
|
||||||
if (dict.found("edges"))
|
if (dict.found("edges"))
|
||||||
|
{
|
||||||
|
if (verboseOutput)
|
||||||
{
|
{
|
||||||
Info<< "Creating curved edges" << endl;
|
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
|
||||||
//
|
//
|
||||||
|
if (verboseOutput)
|
||||||
|
{
|
||||||
Info<< "Creating topology blocks" << endl;
|
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
|
||||||
//
|
//
|
||||||
|
if (verboseOutput)
|
||||||
|
{
|
||||||
Info<< "Creating topology patches" << endl;
|
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
|
||||||
//
|
//
|
||||||
|
if (verboseOutput)
|
||||||
|
{
|
||||||
Info<< "Creating topology mesh" << endl;
|
Info<< "Creating topology mesh" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
PtrList<cellShape> tmpBlockShapes(blocks.size());
|
PtrList<cellShape> tmpBlockShapes(blocks.size());
|
||||||
forAll(blocks, blockI)
|
forAll(blocks, blockI)
|
||||||
|
|||||||
Reference in New Issue
Block a user