From 5f2afe29c1981987940c1c8534fc60ac10bf46a9 Mon Sep 17 00:00:00 2001
From: mattijs <mattijs>
Date: Wed, 9 Dec 2020 17:51:15 +0000
Subject: [PATCH] BUG: snappyHexMesh: incorrect layer parameters. Fixes #10

---
 .../layerParameters/layerParameters.C         | 31 +++++++------------
 1 file changed, 12 insertions(+), 19 deletions(-)

diff --git a/src/mesh/snappyHexMesh/snappyHexMeshDriver/layerParameters/layerParameters.C b/src/mesh/snappyHexMesh/snappyHexMeshDriver/layerParameters/layerParameters.C
index f00eb6871d7..29dccf45253 100644
--- a/src/mesh/snappyHexMesh/snappyHexMeshDriver/layerParameters/layerParameters.C
+++ b/src/mesh/snappyHexMesh/snappyHexMeshDriver/layerParameters/layerParameters.C
@@ -80,11 +80,11 @@ Foam::scalar Foam::layerParameters::layerExpansionRatio
     if (totalOverFirst < n)
     {
         minR = 0.0;
-        maxR = pow(totalOverFirst/n, 1/(n-1));
+        maxR = pow(totalOverFirst/n, scalar(1)/(n-1));
     }
     else
     {
-        minR = pow(totalOverFirst/n, 1/(n-1));
+        minR = pow(totalOverFirst/n, scalar(1)/(n-1));
         maxR = totalOverFirst/(n - 1);
     }
 
@@ -240,8 +240,8 @@ void Foam::layerParameters::calculateLayerParameters
                 spec,
                 nLayers,
                 firstThickness,
-                thickness,
-                VGREAT,                 //totalThickness
+                VGREAT,
+                thickness,              //totalThickness
                 VGREAT                  //expansionRatio
             );
             finalThickness =
@@ -255,10 +255,10 @@ void Foam::layerParameters::calculateLayerParameters
             (
                 spec,
                 nLayers,
-                firstThickness,
+                firstThickness,         //firstThickness
                 VGREAT,                 //finalThickness
                 VGREAT,                 //totalThickness
-                expansionRatio
+                expansionRatio          //expansionRatio
             );
             finalThickness =
                 thickness
@@ -273,7 +273,7 @@ void Foam::layerParameters::calculateLayerParameters
                 nLayers,
                 VGREAT,                 //firstThickness
                 VGREAT,                 //finalThickness
-                thickness,
+                thickness,              //totalThickness
                 VGREAT                  //expansionRatio
             );
             expansionRatio = layerExpansionRatio
@@ -281,7 +281,7 @@ void Foam::layerParameters::calculateLayerParameters
                 spec,
                 nLayers,
                 VGREAT,                 //firstThickness
-                finalThickness,
+                finalThickness,         //finalThickness
                 thickness,              //totalThickness
                 VGREAT                  //expansionRatio
             );
@@ -296,7 +296,7 @@ void Foam::layerParameters::calculateLayerParameters
                 VGREAT,                 //firstThickness
                 finalThickness,         //finalThickness
                 VGREAT,                 //thickness
-                expansionRatio
+                expansionRatio          //expansionRatio
             );
             thickness = layerThickness
             (
@@ -305,7 +305,7 @@ void Foam::layerParameters::calculateLayerParameters
                 VGREAT,                 //firstThickness
                 finalThickness,         //finalThickness
                 VGREAT,                 //totalThickness
-                expansionRatio
+                expansionRatio          //expansionRatio
             );
         break;
 
@@ -317,7 +317,7 @@ void Foam::layerParameters::calculateLayerParameters
                 VGREAT,                 //firstThickness
                 finalThickness,         //finalThickness
                 VGREAT,                 //thickness
-                expansionRatio
+                expansionRatio          //expansionRatio
             );
             finalThickness =
                 thickness
@@ -340,18 +340,11 @@ void Foam::layerParameters::calculateLayerParameters
                 spec,
                 nLayers,
                 firstThickness,         //firstThickness
-                finalThickness,
+                finalThickness,         //finalThickness
                 VGREAT,                 //totalThickness
                 VGREAT                  //expansionRatio
             );
 
-Pout<< "FIRST_AND_RELATIVE_FINAL:"
-    << " firstThickness:" << firstThickness
-    << " finalThickness:" << finalThickness
-    << " thickness:" << thickness
-    << " expansionRatio:" << expansionRatio
-    << endl;
-
         break;
 
         default:
-- 
GitLab