View Issue Details

IDProjectCategoryView StatusLast Update
0004138OpenFOAMFeaturepublic2024-08-19 16:16
ReporterMagu Raam Prasaad Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
PlatformGNU/LinuxOSOtherOS Version(please specify)
Product Versiondev 
Summary0004138: Replacement of insidePoint with insidePoints as a command line option for snappyHexMeshConfig to accept multiple point inputs.
DescriptionSnappyHexMesh often requires multiple inside points to mesh the surface-enclosed region. To address this need, I have updated the snappyHexMeshConfig utility to support multiple points as input. Previously, the utility included an insidePoint command line option, which accepted only a single point and defaulted to (0, 0, 0) if not specified. This option has been replaced with insidePoints, which now accepts a list of points. If the insidePoints option is not provided, it defaults to ((0, 0, 0)). The diff for the implementation is attached.




Steps To ReproduceTake any OpenFOAM case and run the command:

snappyHexMeshConfig -insidePoints '((0 0 0) (0 0 1))'

Verify that snappyHexMeshConfig generates a snappyHexMeshDict file containing:

insidePoints ((0 0 0) (0 0 1));

If the insidePoints option is not provided, verify that the default in the snappyHexMeshDict is:

insidePoints ((0 0 0));
TagsNo tags attached.

Activities

Magu Raam Prasaad

2024-08-19 16:16

reporter  

diff (5,307 bytes)   
diff --git a/applications/utilities/preProcessing/snappyHexMeshConfig/snappyHexMeshConfig.C b/applications/utilities/preProcessing/snappyHexMeshConfig/snappyHexMeshConfig.C
index ee260d7..68e7f40 100644
--- a/applications/utilities/preProcessing/snappyHexMeshConfig/snappyHexMeshConfig.C
+++ b/applications/utilities/preProcessing/snappyHexMeshConfig/snappyHexMeshConfig.C
@@ -87,9 +87,10 @@ Description
     and max bounds; '-refinementDists' for distance-based refinement; and
     '-nCellsBetweenLevels' to control the transition between refinement
     levels. A '-layers' option controls additional layers of cells at specified
-    surfaces. The insidePoint parameter is set to '(0 0 0)' by default but can
-    be overridden using the '-insidePoint' option.
-
+    surfaces. The insidePoints parameter can be specified using the '-insidePoints'
+    option, which accepts multiple points. If no points are provided, the insidePoints
+    parameter defaults to '((0 0 0))'.
+
 Usage
     \b snappyHexMeshConfig [OPTIONS]

@@ -160,8 +161,8 @@ Usage
       - \par -baffles \<list\>
         Surfaces that form baffles, e.g. '(helical)'

-      - \par -insidePoint \<point\>
-        Point location inside the region of geometry to be meshed
+      - \par -insidePoints \<point\>
+        Point locations inside the region of geometry to be meshed

       - \par -nCellsBetweenLevels \<int\>
         Number of cells at successive refinement levels, default 3
@@ -374,9 +375,9 @@ int main(int argc, char *argv[])

     argList::addOption
     (
-        "insidePoint",
-        "point",
-        "point location inside the region of geometry to be meshed"
+        "insidePoints",
+        "list",
+        "point locations inside the region of geometry to be meshed, e.g. '((0 1 0) (1 1 1))'"
     );

     argList::addOption
@@ -626,10 +627,20 @@ int main(int argc, char *argv[])
         args.optionLookupOrDefault<scalar>("layerExpansionRatio", 1.2)
     );

-    const point insidePoint
-    (
-        args.optionLookupOrDefault<point>("insidePoint", point::zero)
-    );
+    List<point> insidePoints;
+    if (args.optionFound("insidePoints"))
+    {
+        insidePoints.append
+        (
+            args.optionReadList<point>("insidePoints")
+        );
+    }
+
+    if (insidePoints.empty())
+    {
+        insidePoints.append(point::zero);
+    }
+

     const label nCellsBetweenLevels
     (
@@ -664,7 +675,7 @@ int main(int argc, char *argv[])
         layers,
         firstLayerThickness,
         layerExpansionRatio,
-        insidePoint,
+        insidePoints,
         nCellsBetweenLevels
     );

diff --git a/applications/utilities/preProcessing/snappyHexMeshConfig/snappyHexMeshConfiguration.C b/applications/utilities/preProcessing/snappyHexMeshConfig/snappyHexMeshConfiguration.C
index 58de102..08e6efe 100644
--- a/applications/utilities/preProcessing/snappyHexMeshConfig/snappyHexMeshConfiguration.C
+++ b/applications/utilities/preProcessing/snappyHexMeshConfig/snappyHexMeshConfiguration.C
@@ -406,8 +406,18 @@ void Foam::snappyHexMeshConfiguration::writeCastellatedMeshControls()
     writeRefinementRegions();

     // Needs customising
-    os_ << indent << "insidePoint "
-        << insidePoint_ << ";" << endl;
+    os_ << indent << "insidePoints (";
+
+    forAll(insidePoints_, i)
+    {
+        os_ << insidePoints_[i];
+        if (i < insidePoints_.size() - 1)
+        {
+            os_ << " ";
+        }
+    }
+
+    os_ << ");" << endl;

     os_ << indent << "nCellsBetweenLevels "
         << nCellsBetweenLevels_
@@ -536,7 +546,7 @@ Foam::snappyHexMeshConfiguration::snappyHexMeshConfiguration
     const List<Tuple2<word, label>>& layers,
     const scalar firstLayerThickness,
     const scalar layerExpansionRatio,
-    const point& insidePoint,
+    const List<point>& insidePoints,
     const label nCellsBetweenLevels
 )
 :
@@ -551,7 +561,7 @@ Foam::snappyHexMeshConfiguration::snappyHexMeshConfiguration
     layers_(layers),
     firstLayerThickness_(firstLayerThickness),
     layerExpansionRatio_(layerExpansionRatio),
-    insidePoint_(insidePoint),
+    insidePoints_(insidePoints),
     nCellsBetweenLevels_(nCellsBetweenLevels)
 {}

diff --git a/applications/utilities/preProcessing/snappyHexMeshConfig/snappyHexMeshConfiguration.H b/applications/utilities/preProcessing/snappyHexMeshConfig/snappyHexMeshConfiguration.H
index e15cb35..8404e5b 100644
--- a/applications/utilities/preProcessing/snappyHexMeshConfig/snappyHexMeshConfiguration.H
+++ b/applications/utilities/preProcessing/snappyHexMeshConfig/snappyHexMeshConfiguration.H
@@ -92,8 +92,8 @@ class snappyHexMeshConfiguration
         //- Expansion ratio used with layer addition
         const scalar layerExpansionRatio_;

-        //- insidePoint parameter
-        point insidePoint_;
+        //- insidePoints parameter
+        const List<point>& insidePoints_;

         //- nCellsBetweenLevels parameter
         const label nCellsBetweenLevels_;
@@ -183,7 +183,7 @@ public:
             const List<Tuple2<word, label>>& layers,
             const scalar firstLayerThickness,
             const scalar layerExpansionRatio,
-            const point& insidePoint,
+            const List<point>& insidePoints,
             const label nCellsBetweenLevels
         );


diff (5,307 bytes)   

Issue History

Date Modified Username Field Change
2024-08-19 16:16 Magu Raam Prasaad New Issue
2024-08-19 16:16 Magu Raam Prasaad File Added: diff