From bfc3a6961eed270d60d02b710a51b936a2148d27 Mon Sep 17 00:00:00 2001
From: mattijs <mattijs@hunt.opencfd.co.uk>
Date: Tue, 28 Apr 2009 12:14:05 +0100
Subject: [PATCH] use relaxed mesh checks in shrinking as well as layering

---
 .../autoHexMeshDriver/autoLayerDriver.C       | 30 +++++++++++--------
 .../autoHexMeshDriver/autoLayerDriver.H       |  1 +
 .../autoHexMeshDriver/autoLayerDriverShrink.C | 20 ++++++++++---
 .../motionSmoother/motionSmoother.C           |  6 ++++
 .../motionSmoother/motionSmoother.H           |  2 ++
 5 files changed, 42 insertions(+), 17 deletions(-)

diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C b/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C
index ee6cea3e121..01ab952c165 100644
--- a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C
+++ b/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C
@@ -2804,6 +2804,22 @@ void Foam::autoLayerDriver::addLayers
             << "Layer addition iteration " << iteration << nl
             << "--------------------------" << endl;
 
+
+        // Unset the extrusion at the pp.
+        const dictionary& meshQualityDict =
+        (
+            iteration < layerParams.nRelaxedIter()
+          ? motionDict
+          : motionDict.subDict("relaxed")
+        );
+
+        if (iteration >= layerParams.nRelaxedIter())
+        {
+            Info<< "Switched to relaxed meshQuality constraints." << endl;
+        }
+
+
+
         // Make sure displacement is equal on both sides of coupled patches.
         syncPatchDisplacement
         (
@@ -2845,6 +2861,7 @@ void Foam::autoLayerDriver::addLayers
             shrinkMeshMedialDistance
             (
                 meshMover,
+                meshQualityDict,
 
                 layerParams.nSmoothThickness(),
                 layerParams.maxThicknessToMedialRatio(),
@@ -3044,19 +3061,6 @@ void Foam::autoLayerDriver::addLayers
             layerFacesSet.write();
         }
 
-        // Unset the extrusion at the pp.
-        const dictionary& meshQualityDict =
-        (
-            iteration < layerParams.nRelaxedIter()
-          ? motionDict
-          : motionDict.subDict("relaxed")
-        );
-
-        if (iteration >= layerParams.nRelaxedIter())
-        {
-            Info<< "Switched to relaxed meshQuality constraints." << endl;
-        }
-
 
         label nTotChanged = checkAndUnmark
         (
diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.H b/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.H
index 6cdec2004b6..164fd88ce04 100644
--- a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.H
+++ b/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.H
@@ -473,6 +473,7 @@ class autoLayerDriver
                 void shrinkMeshMedialDistance
                 (
                     motionSmoother& meshMover,
+                    const dictionary& meshQualityDict,
                     const label nSmoothThickness,
                     const scalar maxThicknessToMedialRatio,
                     const label nAllowableErrors,
diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriverShrink.C b/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriverShrink.C
index 615978a308a..cc88231b745 100644
--- a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriverShrink.C
+++ b/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriverShrink.C
@@ -792,7 +792,7 @@ void Foam::autoLayerDriver::medialAxisSmoothingInfo
             wallInfo,
             pointWallDist,
             edgeWallDist,
-            mesh.nPoints()  // max iterations
+            mesh.globalData().nTotalPoints()    // max iterations
         );
     }
 
@@ -897,7 +897,7 @@ void Foam::autoLayerDriver::medialAxisSmoothingInfo
 
             pointMedialDist,
             edgeMedialDist,
-            mesh.nPoints()  // max iterations
+            mesh.globalData().nTotalPoints()    // max iterations
         );
 
         // Extract medial axis distance as pointScalarField
@@ -953,6 +953,7 @@ void Foam::autoLayerDriver::medialAxisSmoothingInfo
 void Foam::autoLayerDriver::shrinkMeshMedialDistance
 (
     motionSmoother& meshMover,
+    const dictionary& meshQualityDict,
     const label nSmoothThickness,
     const scalar maxThicknessToMedialRatio,
     const label nAllowableErrors,
@@ -1103,7 +1104,7 @@ void Foam::autoLayerDriver::shrinkMeshMedialDistance
             wallInfo,
             pointWallDist,
             edgeWallDist,
-            mesh.nPoints()  // max iterations
+            mesh.globalData().nTotalPoints()    // max iterations
         );
     }
 
@@ -1138,7 +1139,18 @@ void Foam::autoLayerDriver::shrinkMeshMedialDistance
             oldErrorReduction = meshMover.setErrorReduction(0.0);
         }
 
-        if (meshMover.scaleMesh(checkFaces, true, nAllowableErrors))
+        if
+        (
+            meshMover.scaleMesh
+            (
+                checkFaces,
+                List<labelPair>(0),
+                meshMover.paramDict(),
+                meshQualityDict,
+                true,
+                nAllowableErrors
+            )
+        )
         {
             Info<< "shrinkMeshMedialDistance : Successfully moved mesh" << endl;
             break;
diff --git a/src/dynamicMesh/motionSmoother/motionSmoother.C b/src/dynamicMesh/motionSmoother/motionSmoother.C
index 4f40827f4b3..d780ec79dde 100644
--- a/src/dynamicMesh/motionSmoother/motionSmoother.C
+++ b/src/dynamicMesh/motionSmoother/motionSmoother.C
@@ -502,6 +502,12 @@ const Foam::labelList& Foam::motionSmoother::adaptPatchIDs() const
 }
 
 
+const Foam::dictionary& Foam::motionSmoother::paramDict() const
+{
+    return paramDict_;
+}
+
+
 Foam::pointVectorField& Foam::motionSmoother::displacement()
 {
     return displacement_;
diff --git a/src/dynamicMesh/motionSmoother/motionSmoother.H b/src/dynamicMesh/motionSmoother/motionSmoother.H
index e4aeac6f507..3d853e476d3 100644
--- a/src/dynamicMesh/motionSmoother/motionSmoother.H
+++ b/src/dynamicMesh/motionSmoother/motionSmoother.H
@@ -327,6 +327,8 @@ public:
             //- Patch labels that are being adapted
             const labelList& adaptPatchIDs() const;
 
+            const dictionary& paramDict() const;
+
             //- Reference to displacement field
             pointVectorField& displacement();
 
-- 
GitLab