mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: use topological merge as default for blockMesh (closes #1589)
- faster and fewer issues with high aspect ratio cells. - `blockMesh -merge-geometric` for old behaviour
This commit is contained in:
@ -111,6 +111,9 @@ int main(int argc, char *argv[])
|
|||||||
#include "setRootCase.H"
|
#include "setRootCase.H"
|
||||||
#include "createTime.H"
|
#include "createTime.H"
|
||||||
|
|
||||||
|
// Remove old files, unless disabled
|
||||||
|
const bool removeOldFiles = !args.found("noClean");
|
||||||
|
|
||||||
// Instance for resulting mesh
|
// Instance for resulting mesh
|
||||||
bool useTime = false;
|
bool useTime = false;
|
||||||
word meshInstance(runTime.constant());
|
word meshInstance(runTime.constant());
|
||||||
@ -159,7 +162,7 @@ int main(int argc, char *argv[])
|
|||||||
runTime.setTime(instant(meshInstance), 0);
|
runTime.setTime(instant(meshInstance), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!args.found("noClean"))
|
if (removeOldFiles)
|
||||||
{
|
{
|
||||||
const fileName polyMeshPath
|
const fileName polyMeshPath
|
||||||
(
|
(
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2016-2019 OpenCFD Ltd.
|
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -46,6 +46,9 @@ Usage
|
|||||||
- \par -blockTopology
|
- \par -blockTopology
|
||||||
Write the topology as a set of edges in OBJ format and exit.
|
Write the topology as a set of edges in OBJ format and exit.
|
||||||
|
|
||||||
|
- \par -merge-geometric
|
||||||
|
Use geometric instead of topological merging
|
||||||
|
|
||||||
- \par -region \<name\>
|
- \par -region \<name\>
|
||||||
Specify alternative mesh region.
|
Specify alternative mesh region.
|
||||||
|
|
||||||
@ -118,6 +121,13 @@ int main(int argc, char *argv[])
|
|||||||
"Write block edges and centres as obj files and exit"
|
"Write block edges and centres as obj files and exit"
|
||||||
);
|
);
|
||||||
argList::addBoolOption
|
argList::addBoolOption
|
||||||
|
(
|
||||||
|
"merge-geometric",
|
||||||
|
"Use geometric (point) merging instead of topological merging "
|
||||||
|
"(slower, fails with high-aspect cells. default for 1912 and earlier)",
|
||||||
|
true // mark as an advanced option
|
||||||
|
);
|
||||||
|
argList::addBoolOption
|
||||||
(
|
(
|
||||||
"noClean",
|
"noClean",
|
||||||
"Do not remove any existing polyMesh/ directory or files"
|
"Do not remove any existing polyMesh/ directory or files"
|
||||||
@ -144,7 +154,18 @@ int main(int argc, char *argv[])
|
|||||||
#include "setRootCase.H"
|
#include "setRootCase.H"
|
||||||
#include "createTime.H"
|
#include "createTime.H"
|
||||||
|
|
||||||
word regionName = polyMesh::defaultRegion;
|
// Remove old files, unless disabled
|
||||||
|
const bool removeOldFiles = !args.found("noClean");
|
||||||
|
|
||||||
|
// Topological merge, unless otherwise specified
|
||||||
|
blockMesh::mergeStrategy strategy(blockMesh::TOPOLOGICAL);
|
||||||
|
|
||||||
|
if (args.found("merge-geometric"))
|
||||||
|
{
|
||||||
|
strategy = blockMesh::GEOMETRIC;
|
||||||
|
}
|
||||||
|
|
||||||
|
word regionName(polyMesh::defaultRegion);
|
||||||
word regionPath;
|
word regionPath;
|
||||||
|
|
||||||
// Check if the region is specified otherwise mesh the default region
|
// Check if the region is specified otherwise mesh the default region
|
||||||
@ -183,7 +204,7 @@ int main(int argc, char *argv[])
|
|||||||
// Locate appropriate blockMeshDict
|
// Locate appropriate blockMeshDict
|
||||||
#include "findBlockMeshDict.H"
|
#include "findBlockMeshDict.H"
|
||||||
|
|
||||||
blockMesh blocks(meshDict, regionName);
|
blockMesh blocks(meshDict, regionName, strategy);
|
||||||
|
|
||||||
if (!blocks.valid())
|
if (!blocks.valid())
|
||||||
{
|
{
|
||||||
@ -243,7 +264,7 @@ int main(int argc, char *argv[])
|
|||||||
runTime.setTime(instant(meshInstance), 0);
|
runTime.setTime(instant(meshInstance), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!args.found("noClean"))
|
if (removeOldFiles)
|
||||||
{
|
{
|
||||||
const fileName polyMeshPath
|
const fileName polyMeshPath
|
||||||
(
|
(
|
||||||
|
|||||||
@ -34,8 +34,8 @@ blockMesh/blockMesh.C
|
|||||||
blockMesh/blockMeshCreate.C
|
blockMesh/blockMeshCreate.C
|
||||||
blockMesh/blockMeshTopology.C
|
blockMesh/blockMeshTopology.C
|
||||||
blockMesh/blockMeshCheck.C
|
blockMesh/blockMeshCheck.C
|
||||||
blockMesh/blockMeshMerge.C
|
blockMesh/blockMeshMergeGeometrical.C
|
||||||
blockMesh/blockMeshMergeFast.C
|
blockMesh/blockMeshMergeTopological.C
|
||||||
|
|
||||||
blockMeshTools/blockMeshTools.C
|
blockMeshTools/blockMeshTools.C
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2018 OpenCFD Ltd.
|
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -39,13 +39,18 @@ namespace Foam
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::blockMesh::blockMesh(const IOdictionary& dict, const word& regionName)
|
Foam::blockMesh::blockMesh
|
||||||
|
(
|
||||||
|
const IOdictionary& dict,
|
||||||
|
const word& regionName,
|
||||||
|
const mergeStrategy strategy
|
||||||
|
)
|
||||||
:
|
:
|
||||||
meshDict_(dict),
|
meshDict_(dict),
|
||||||
verboseOutput(meshDict_.lookupOrDefault("verbose", true)),
|
verboseOutput(meshDict_.getOrDefault("verbose", true)),
|
||||||
checkFaceCorrespondence_
|
checkFaceCorrespondence_
|
||||||
(
|
(
|
||||||
meshDict_.lookupOrDefault("checkFaceCorrespondence", true)
|
meshDict_.getOrDefault("checkFaceCorrespondence", true)
|
||||||
),
|
),
|
||||||
geometry_
|
geometry_
|
||||||
(
|
(
|
||||||
@ -63,7 +68,7 @@ Foam::blockMesh::blockMesh(const IOdictionary& dict, const word& regionName)
|
|||||||
: dictionary(),
|
: dictionary(),
|
||||||
true
|
true
|
||||||
),
|
),
|
||||||
scaleFactor_(1.0),
|
scaleFactor_(1),
|
||||||
blockVertices_
|
blockVertices_
|
||||||
(
|
(
|
||||||
meshDict_.lookup("vertices"),
|
meshDict_.lookup("vertices"),
|
||||||
@ -72,13 +77,17 @@ Foam::blockMesh::blockMesh(const IOdictionary& dict, const word& regionName)
|
|||||||
vertices_(Foam::vertices(blockVertices_)),
|
vertices_(Foam::vertices(blockVertices_)),
|
||||||
topologyPtr_(createTopology(meshDict_, regionName))
|
topologyPtr_(createTopology(meshDict_, regionName))
|
||||||
{
|
{
|
||||||
if (meshDict_.lookupOrDefault("fastMerge", false))
|
// TODO - extend with Enum
|
||||||
|
|
||||||
|
bool useTopoMerge = (strategy == mergeStrategy::TOPOLOGICAL);
|
||||||
|
|
||||||
|
if (meshDict_.getOrDefault("fastMerge", useTopoMerge))
|
||||||
{
|
{
|
||||||
calcMergeInfoFast();
|
calcTopologicalMerge();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
calcMergeInfo();
|
calcGeometricalMerge();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2018 OpenCFD Ltd.
|
Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -66,7 +66,7 @@ class blockMesh
|
|||||||
:
|
:
|
||||||
public blockList
|
public blockList
|
||||||
{
|
{
|
||||||
// Private data
|
// Private Data
|
||||||
|
|
||||||
//- Reference to mesh dictionary
|
//- Reference to mesh dictionary
|
||||||
const IOdictionary& meshDict_;
|
const IOdictionary& meshDict_;
|
||||||
@ -155,11 +155,13 @@ class blockMesh
|
|||||||
|
|
||||||
void check(const polyMesh& bm, const dictionary& dict) const;
|
void check(const polyMesh& bm, const dictionary& dict) const;
|
||||||
|
|
||||||
//- Determine the merge info and the final number of cells/points
|
//- Determine merge info and final number of cells/points
|
||||||
void calcMergeInfo();
|
//- based on point distances
|
||||||
|
void calcGeometricalMerge();
|
||||||
|
|
||||||
//- Determine the merge info and the final number of cells/points
|
//- Determine merge info and final number of cells/points
|
||||||
void calcMergeInfoFast();
|
//- based on block topology
|
||||||
|
void calcTopologicalMerge();
|
||||||
|
|
||||||
faceList createPatchFaces(const polyPatch& patchTopologyFaces) const;
|
faceList createPatchFaces(const polyPatch& patchTopologyFaces) const;
|
||||||
|
|
||||||
@ -177,15 +179,31 @@ class blockMesh
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Static data members
|
// Data Types
|
||||||
|
|
||||||
|
//- The block merging strategy
|
||||||
|
enum mergeStrategy
|
||||||
|
{
|
||||||
|
TOPOLOGICAL, //!< Merge using block topology
|
||||||
|
GEOMETRIC //!< Merge using point geometry
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// Static Data Members
|
||||||
|
|
||||||
ClassName("blockMesh");
|
ClassName("blockMesh");
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from IOdictionary
|
//- Construct from IOdictionary for given region
|
||||||
blockMesh(const IOdictionary& dict, const word& regionName);
|
// Default is topological merging.
|
||||||
|
blockMesh
|
||||||
|
(
|
||||||
|
const IOdictionary& dict,
|
||||||
|
const word& regionName,
|
||||||
|
const mergeStrategy strategy = TOPOLOGICAL
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2020 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -29,7 +30,7 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::blockMesh::calcMergeInfo()
|
void Foam::blockMesh::calcGeometricalMerge()
|
||||||
{
|
{
|
||||||
const blockList& blocks = *this;
|
const blockList& blocks = *this;
|
||||||
|
|
||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2015-2016 OpenFOAM Foundation
|
Copyright (C) 2015-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2019 OpenCFD Ltd.
|
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -301,7 +301,7 @@ inline label facePointN
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::blockMesh::calcMergeInfoFast()
|
void Foam::blockMesh::calcTopologicalMerge()
|
||||||
{
|
{
|
||||||
// Generate the static face-face map
|
// Generate the static face-face map
|
||||||
genFaceFaceRotMap();
|
genFaceFaceRotMap();
|
||||||
Reference in New Issue
Block a user