ENH: extrudePatchMesh: support for features. See #2103

Optional 'featureAngle' entry to disable extrusion on
sharp corners
This commit is contained in:
mattijs
2024-10-03 16:06:03 +01:00
parent 4df27f8be6
commit cd2d81b79a
2 changed files with 28 additions and 5 deletions

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020-2023 OpenCFD Ltd.
Copyright (C) 2020-2024 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -33,6 +33,7 @@ License
#include "wallPolyPatch.H"
#include "emptyPolyPatch.H"
#include "wedgePolyPatch.H"
#include "unitConversion.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -157,6 +158,12 @@ void Foam::extrudePatchMesh::extrudeMesh(polyPatchList& regionPatches)
if (this->boundaryMesh().empty())
{
const bool columnCells = dict_.get<bool>("columnCells");
scalar featAngleCos = -GREAT;
scalar featAngle = -1;
if (dict_.readIfPresent("featureAngle", featAngle))
{
featAngleCos = Foam::cos(degToRad(featAngle));
}
bitSet nonManifoldEdge(extrudedPatch_.nEdges());
for (label edgeI = 0; edgeI < extrudedPatch_.nInternalEdges(); edgeI++)
@ -165,12 +172,25 @@ void Foam::extrudePatchMesh::extrudeMesh(polyPatchList& regionPatches)
{
nonManifoldEdge.set(edgeI);
}
else if (extrudedPatch_.edgeFaces()[edgeI].size() > 2)
else
{
// TBD: issue #2780 : non-manifold edges get seen as internal
const auto& fcs = extrudedPatch_.edgeFaces()[edgeI];
if (fcs.size() > 2)
{
// TBD: issue #2780 : non-manifold edges get seen as
// internal.
// This bit of code can be removed once #2780 is solved.
nonManifoldEdge.set(edgeI);
}
else if (fcs.size() == 2 && featAngleCos >= -1)
{
const auto& n = extrudedPatch_.faceNormals();
if ((n[fcs[0]] & n[fcs[1]]) < featAngleCos)
{
nonManifoldEdge.set(edgeI);
}
}
}
}
autoPtr<extrudeModel> model_(extrudeModel::New(dict_));

View File

@ -44,6 +44,9 @@ Description
expansionRatio 1;
columnCells true;
// Optional feature angle to avoid extruding feature-angles
featureAngle 45;
// Patch information
bottomCoeffs
{