From 430d894e376d46f1a26c071e1e8bfe095303e9fd Mon Sep 17 00:00:00 2001
From: Henry Weller <http://cfd.direct>
Date: Wed, 2 Sep 2015 15:29:54 +0100
Subject: [PATCH] Added ROOTSMALL

---
 .../utilities/mesh/manipulation/checkMesh/checkGeometry.C   | 2 +-
 src/OpenFOAM/primitives/Scalar/doubleScalar/doubleScalar.H  | 1 +
 src/OpenFOAM/primitives/Scalar/floatScalar/floatScalar.H    | 1 +
 src/OpenFOAM/primitives/Scalar/scalar/scalar.H              | 2 ++
 .../autoMesh/autoHexMesh/meshRefinement/meshRefinement.C    | 6 +++---
 .../autoHexMesh/meshRefinement/meshRefinementBaffles.C      | 6 +++---
 .../autoHexMesh/meshRefinement/meshRefinementRefine.C       | 6 +++---
 src/meshTools/searchableSurface/searchableBox.C             | 2 +-
 .../distributedTriSurfaceMesh/distributedTriSurfaceMesh.C   | 2 +-
 9 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C b/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C
index 8677f08c659..987e26d2e3d 100644
--- a/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C
+++ b/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C
@@ -136,7 +136,7 @@ bool Foam::checkWedges
                 const point& pt = p[pp.meshPoints()[i]];
                 scalar d = mag((pt - p0) & pp.n());
 
-                if (d > sqrt(SMALL))
+                if (d > ROOTSMALL)
                 {
                     if (report)
                     {
diff --git a/src/OpenFOAM/primitives/Scalar/doubleScalar/doubleScalar.H b/src/OpenFOAM/primitives/Scalar/doubleScalar/doubleScalar.H
index 2498f5f9cc8..30899478530 100644
--- a/src/OpenFOAM/primitives/Scalar/doubleScalar/doubleScalar.H
+++ b/src/OpenFOAM/primitives/Scalar/doubleScalar/doubleScalar.H
@@ -55,6 +55,7 @@ static const doubleScalar doubleScalarGREAT = 1.0e+15;
 static const doubleScalar doubleScalarVGREAT = 1.0e+300;
 static const doubleScalar doubleScalarROOTVGREAT = 1.0e+150;
 static const doubleScalar doubleScalarSMALL = 1.0e-15;
+static const doubleScalar doubleScalarROOTSMALL = 3.0e-8;
 static const doubleScalar doubleScalarVSMALL = 1.0e-300;
 static const doubleScalar doubleScalarROOTVSMALL = 1.0e-150;
 
diff --git a/src/OpenFOAM/primitives/Scalar/floatScalar/floatScalar.H b/src/OpenFOAM/primitives/Scalar/floatScalar/floatScalar.H
index 31ae9891dd0..1cfb728a235 100644
--- a/src/OpenFOAM/primitives/Scalar/floatScalar/floatScalar.H
+++ b/src/OpenFOAM/primitives/Scalar/floatScalar/floatScalar.H
@@ -55,6 +55,7 @@ static const floatScalar floatScalarGREAT = 1.0e+6;
 static const floatScalar floatScalarVGREAT = 1.0e+37;
 static const floatScalar floatScalarROOTVGREAT = 1.0e+18;
 static const floatScalar floatScalarSMALL = 1.0e-6;
+static const floatScalar floatScalarROOTSMALL = 1.0e-3;
 static const floatScalar floatScalarVSMALL = 1.0e-37;
 static const floatScalar floatScalarROOTVSMALL = 1.0e-18;
 
diff --git a/src/OpenFOAM/primitives/Scalar/scalar/scalar.H b/src/OpenFOAM/primitives/Scalar/scalar/scalar.H
index cb5496a65ed..8f9c1c56165 100644
--- a/src/OpenFOAM/primitives/Scalar/scalar/scalar.H
+++ b/src/OpenFOAM/primitives/Scalar/scalar/scalar.H
@@ -53,6 +53,7 @@ namespace Foam
     static const scalar VGREAT = floatScalarVGREAT;
     static const scalar ROOTVGREAT = floatScalarROOTVGREAT;
     static const scalar SMALL = floatScalarSMALL;
+    static const scalar ROOTSMALL = floatScalarROOTSMALL;
     static const scalar VSMALL = floatScalarVSMALL;
     static const scalar ROOTVSMALL = floatScalarROOTVSMALL;
 
@@ -71,6 +72,7 @@ namespace Foam
     static const scalar VGREAT = doubleScalarVGREAT;
     static const scalar ROOTVGREAT = doubleScalarROOTVGREAT;
     static const scalar SMALL = doubleScalarSMALL;
+    static const scalar ROOTSMALL = doubleScalarROOTSMALL;
     static const scalar VSMALL = doubleScalarVSMALL;
     static const scalar ROOTVSMALL = doubleScalarROOTVSMALL;
 
diff --git a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C
index 5d96aafca97..12e94465f0a 100644
--- a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C
+++ b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.C
@@ -272,7 +272,7 @@ void Foam::meshRefinement::updateIntersections(const labelList& changedFaces)
 
     // Extend segments a bit
     {
-        const vectorField smallVec(Foam::sqrt(SMALL)*(end-start));
+        const vectorField smallVec(ROOTSMALL*(end-start));
         start -= smallVec;
         end += smallVec;
     }
@@ -483,7 +483,7 @@ void Foam::meshRefinement::checkData()
 
         // Extend segments a bit
         {
-            const vectorField smallVec(Foam::sqrt(SMALL)*(end-start));
+            const vectorField smallVec(ROOTSMALL*(end-start));
             start -= smallVec;
             end += smallVec;
         }
@@ -2897,7 +2897,7 @@ void Foam::meshRefinement::dumpIntersections(const fileName& prefix) const
 
         // Extend segments a bit
         {
-            const vectorField smallVec(Foam::sqrt(SMALL)*(end-start));
+            const vectorField smallVec(ROOTSMALL*(end-start));
             start -= smallVec;
             end += smallVec;
         }
diff --git a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementBaffles.C b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementBaffles.C
index 8cf215729d9..bbbe08c353b 100644
--- a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementBaffles.C
+++ b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementBaffles.C
@@ -243,7 +243,7 @@ void Foam::meshRefinement::getBafflePatches
 
     // Extend segments a bit
     {
-        const vectorField smallVec(Foam::sqrt(SMALL)*(end-start));
+        const vectorField smallVec(ROOTSMALL*(end-start));
         start -= smallVec;
         end += smallVec;
     }
@@ -830,7 +830,7 @@ Foam::List<Foam::labelPair> Foam::meshRefinement::freeStandingBaffles
 
         // Extend segments a bit
         {
-            const vectorField smallVec(Foam::sqrt(SMALL)*(end-start));
+            const vectorField smallVec(ROOTSMALL*(end-start));
             start -= smallVec;
             end += smallVec;
         }
@@ -2967,7 +2967,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::zonify
 
         // Extend segments a bit
         {
-            const vectorField smallVec(Foam::sqrt(SMALL)*(end-start));
+            const vectorField smallVec(ROOTSMALL*(end-start));
             start -= smallVec;
             end += smallVec;
         }
diff --git a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementRefine.C b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementRefine.C
index 3ccaa728350..e2224f7cd4e 100644
--- a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementRefine.C
+++ b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementRefine.C
@@ -967,7 +967,7 @@ Foam::label Foam::meshRefinement::markSurfaceRefinement
 
     // Extend segments a bit
     {
-        const vectorField smallVec(Foam::sqrt(SMALL)*(end-start));
+        const vectorField smallVec(ROOTSMALL*(end-start));
         start -= smallVec;
         end += smallVec;
     }
@@ -1161,7 +1161,7 @@ Foam::label Foam::meshRefinement::markSurfaceCurvatureRefinement
 
     // Extend segments a bit
     {
-        const vectorField smallVec(Foam::sqrt(SMALL)*(end-start));
+        const vectorField smallVec(ROOTSMALL*(end-start));
         start -= smallVec;
         end += smallVec;
     }
@@ -1764,7 +1764,7 @@ Foam::label Foam::meshRefinement::markProximityRefinement
 
     // Extend segments a bit
     {
-        const vectorField smallVec(Foam::sqrt(SMALL)*(end-start));
+        const vectorField smallVec(ROOTSMALL*(end-start));
         start -= smallVec;
         end += smallVec;
     }
diff --git a/src/meshTools/searchableSurface/searchableBox.C b/src/meshTools/searchableSurface/searchableBox.C
index 5970e825759..f20b808e862 100644
--- a/src/meshTools/searchableSurface/searchableBox.C
+++ b/src/meshTools/searchableSurface/searchableBox.C
@@ -531,7 +531,7 @@ void Foam::searchableBox::findLineAll
     const scalarField magSqrDirVec(magSqr(dirVec));
     const vectorField smallVec
     (
-        Foam::sqrt(SMALL)*dirVec
+        ROOTSMALL*dirVec
       + vector(ROOTVSMALL,ROOTVSMALL,ROOTVSMALL)
     );
 
diff --git a/src/parallel/distributed/distributedTriSurfaceMesh/distributedTriSurfaceMesh.C b/src/parallel/distributed/distributedTriSurfaceMesh/distributedTriSurfaceMesh.C
index 1a636b1cadd..80e3943cd1b 100644
--- a/src/parallel/distributed/distributedTriSurfaceMesh/distributedTriSurfaceMesh.C
+++ b/src/parallel/distributed/distributedTriSurfaceMesh/distributedTriSurfaceMesh.C
@@ -1752,7 +1752,7 @@ void Foam::distributedTriSurfaceMesh::findLineAll
     const scalarField magSqrDirVec(magSqr(dirVec));
     const vectorField smallVec
     (
-        Foam::sqrt(SMALL)*dirVec
+        ROOTSMALL*dirVec
       + vector(ROOTVSMALL,ROOTVSMALL,ROOTVSMALL)
     );
 
-- 
GitLab