diff --git a/applications/utilities/surface/surfaceFeatures/surfaceFeatures.C b/applications/utilities/surface/surfaceFeatures/surfaceFeatures.C index 38c50f5211..5956ead88e 100644 --- a/applications/utilities/surface/surfaceFeatures/surfaceFeatures.C +++ b/applications/utilities/surface/surfaceFeatures/surfaceFeatures.C @@ -172,10 +172,6 @@ namespace Foam dict.lookupOrDefault("curvature", "off"); const Switch featureProximity = dict.lookupOrDefault("featureProximity", "off"); - const Switch faceCloseness = - dict.lookupOrDefault("faceCloseness", "off"); - const Switch pointCloseness = - dict.lookupOrDefault("pointCloseness", "off"); Info<< nl << "Feature line extraction is only valid on closed manifold " @@ -426,11 +422,34 @@ namespace Foam // Find distance between close features - if (faceCloseness || pointCloseness) + if (dict.isDict("closeness")) { Info<< nl << "Extracting internal and external closeness of " << "surface." << endl; + const dictionary& closenessDict = dict.subDict("closeness"); + + const Switch faceCloseness = + closenessDict.lookupOrDefault("faceCloseness", "off"); + const Switch pointCloseness = + closenessDict.lookupOrDefault("pointCloseness", "off"); + + const scalar internalAngleTolerance + ( + closenessDict.lookupOrDefault + ( + "internalAngleTolerance", 80 + ) + ); + + const scalar externalAngleTolerance + ( + closenessDict.lookupOrDefault + ( + "externalAngleTolerance", 80 + ) + ); + // Searchable triSurface const triSurfaceMesh searchSurf ( @@ -448,7 +467,11 @@ namespace Foam { Pair> closenessFields ( - searchSurf.extractCloseness() + searchSurf.extractCloseness + ( + internalAngleTolerance, + externalAngleTolerance + ) ); Info<< " writing " @@ -491,7 +514,11 @@ namespace Foam { Pair> closenessFields ( - searchSurf.extractPointCloseness(10, 10) + searchSurf.extractPointCloseness + ( + internalAngleTolerance, + externalAngleTolerance + ) ); Info<< " writing " diff --git a/etc/caseDicts/annotated/surfaceFeaturesDict b/etc/caseDicts/annotated/surfaceFeaturesDict index e1263f3613..1f0e152e60 100644 --- a/etc/caseDicts/annotated/surfaceFeaturesDict +++ b/etc/caseDicts/annotated/surfaceFeaturesDict @@ -100,11 +100,18 @@ surface2 // points and edges maxFeatureProximity 1; - // Output the closeness of surface elements to other surface elements. - faceCloseness no; + closeness + { + // Output the closeness of surface elements to other surface elements. + faceCloseness no; - // Output the closeness of surface points to other surface elements. - pointCloseness no; + // Output the closeness of surface points to other surface elements. + pointCloseness no; + + // Optional maximum angle between opposite points considered close + internalAngleTolerance 80; + externalAngleTolerance 80; + } // Write features to obj format for postprocessing writeObj yes; diff --git a/src/meshTools/searchableSurfaces/triSurfaceMesh/triSurfaceMesh.H b/src/meshTools/searchableSurfaces/triSurfaceMesh/triSurfaceMesh.H index b140a262d2..74b150d97c 100644 --- a/src/meshTools/searchableSurfaces/triSurfaceMesh/triSurfaceMesh.H +++ b/src/meshTools/searchableSurfaces/triSurfaceMesh/triSurfaceMesh.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -318,7 +318,7 @@ public: Pair> extractCloseness ( const scalar internalAngleTolerance = 80, - const scalar externalAngleTolerance = 10 + const scalar externalAngleTolerance = 80 ) const; //- Return a pair of triSurfaceScalarPointFields representing the @@ -326,7 +326,7 @@ public: Pair> extractPointCloseness ( const scalar internalAngleTolerance = 80, - const scalar externalAngleTolerance = 10 + const scalar externalAngleTolerance = 80 ) const; diff --git a/tutorials/mesh/snappyHexMesh/pipe/system/surfaceFeaturesDict b/tutorials/mesh/snappyHexMesh/pipe/system/surfaceFeaturesDict index 573ae26684..40352fa3c2 100644 --- a/tutorials/mesh/snappyHexMesh/pipe/system/surfaceFeaturesDict +++ b/tutorials/mesh/snappyHexMesh/pipe/system/surfaceFeaturesDict @@ -47,8 +47,11 @@ pipeWall // - 180: selects all edges includedAngle 150; - // Output the closeness of surface points to other surface elements. - pointCloseness yes; + closeness + { + // Output the closeness of surface points to other surface elements. + pointCloseness yes; + } writeVTK yes; }