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:
Mark Olesen
2020-05-04 16:19:03 +02:00
parent 8d29896fca
commit 8756791b00
7 changed files with 79 additions and 27 deletions

View File

@ -34,8 +34,8 @@ blockMesh/blockMesh.C
blockMesh/blockMeshCreate.C
blockMesh/blockMeshTopology.C
blockMesh/blockMeshCheck.C
blockMesh/blockMeshMerge.C
blockMesh/blockMeshMergeFast.C
blockMesh/blockMeshMergeGeometrical.C
blockMesh/blockMeshMergeTopological.C
blockMeshTools/blockMeshTools.C

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2018 OpenCFD Ltd.
Copyright (C) 2018-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -39,13 +39,18 @@ namespace Foam
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::blockMesh::blockMesh(const IOdictionary& dict, const word& regionName)
Foam::blockMesh::blockMesh
(
const IOdictionary& dict,
const word& regionName,
const mergeStrategy strategy
)
:
meshDict_(dict),
verboseOutput(meshDict_.lookupOrDefault("verbose", true)),
verboseOutput(meshDict_.getOrDefault("verbose", true)),
checkFaceCorrespondence_
(
meshDict_.lookupOrDefault("checkFaceCorrespondence", true)
meshDict_.getOrDefault("checkFaceCorrespondence", true)
),
geometry_
(
@ -63,7 +68,7 @@ Foam::blockMesh::blockMesh(const IOdictionary& dict, const word& regionName)
: dictionary(),
true
),
scaleFactor_(1.0),
scaleFactor_(1),
blockVertices_
(
meshDict_.lookup("vertices"),
@ -72,13 +77,17 @@ Foam::blockMesh::blockMesh(const IOdictionary& dict, const word& regionName)
vertices_(Foam::vertices(blockVertices_)),
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
{
calcMergeInfo();
calcGeometricalMerge();
}
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2018 OpenCFD Ltd.
Copyright (C) 2018-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -66,7 +66,7 @@ class blockMesh
:
public blockList
{
// Private data
// Private Data
//- Reference to mesh dictionary
const IOdictionary& meshDict_;
@ -155,11 +155,13 @@ class blockMesh
void check(const polyMesh& bm, const dictionary& dict) const;
//- Determine the merge info and the final number of cells/points
void calcMergeInfo();
//- Determine merge info and final number of cells/points
//- based on point distances
void calcGeometricalMerge();
//- Determine the merge info and the final number of cells/points
void calcMergeInfoFast();
//- Determine merge info and final number of cells/points
//- based on block topology
void calcTopologicalMerge();
faceList createPatchFaces(const polyPatch& patchTopologyFaces) const;
@ -177,15 +179,31 @@ class blockMesh
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");
// Constructors
//- Construct from IOdictionary
blockMesh(const IOdictionary& dict, const word& regionName);
//- Construct from IOdictionary for given region
// Default is topological merging.
blockMesh
(
const IOdictionary& dict,
const word& regionName,
const mergeStrategy strategy = TOPOLOGICAL
);
//- Destructor

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -29,7 +30,7 @@ License
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::blockMesh::calcMergeInfo()
void Foam::blockMesh::calcGeometricalMerge()
{
const blockList& blocks = *this;

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2015-2016 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -301,7 +301,7 @@ inline label facePointN
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::blockMesh::calcMergeInfoFast()
void Foam::blockMesh::calcTopologicalMerge()
{
// Generate the static face-face map
genFaceFaceRotMap();