diff --git a/src/dynamicMesh/dynamicMesh/polyMeshModifiers/layerAdditionRemoval/addCellLayer.C b/src/dynamicMesh/dynamicMesh/polyMeshModifiers/layerAdditionRemoval/addCellLayer.C index b1ea2c9b3..81dc957a9 100644 --- a/src/dynamicMesh/dynamicMesh/polyMeshModifiers/layerAdditionRemoval/addCellLayer.C +++ b/src/dynamicMesh/dynamicMesh/polyMeshModifiers/layerAdditionRemoval/addCellLayer.C @@ -87,7 +87,7 @@ void Foam::layerAdditionRemoval::addCellLayer { extrusionDir[mpI] = points[ptc[mpI]] - points[mp[mpI]]; } - extrusionDir *= addDelta_*maxLayerThickness_; + extrusionDir *= addDelta_()*maxLayerThickness_; } else { @@ -118,7 +118,7 @@ void Foam::layerAdditionRemoval::addCellLayer polyAddPoint ( points[mp[pointI]] // point -// + addDelta_*maxLayerThickness_*extrusionDir[pointI], +// + addDelta_()*maxLayerThickness_*extrusionDir[pointI], + extrusionDir[pointI], mp[pointI], // master point -1, // zone for point diff --git a/src/dynamicMesh/dynamicMesh/polyMeshModifiers/layerAdditionRemoval/layerAdditionRemoval.C b/src/dynamicMesh/dynamicMesh/polyMeshModifiers/layerAdditionRemoval/layerAdditionRemoval.C index e15066faa..47443b8de 100644 --- a/src/dynamicMesh/dynamicMesh/polyMeshModifiers/layerAdditionRemoval/layerAdditionRemoval.C +++ b/src/dynamicMesh/dynamicMesh/polyMeshModifiers/layerAdditionRemoval/layerAdditionRemoval.C @@ -48,8 +48,19 @@ namespace Foam } -const Foam::scalar Foam::layerAdditionRemoval::addDelta_ = 0.3; -const Foam::scalar Foam::layerAdditionRemoval::removeDelta_ = 0.1; +const Foam::debug::tolerancesSwitch +Foam::layerAdditionRemoval::motionDelta_ +( + "layerAdditionRemoval::motionDelta", + 0.01 +); + +const Foam::debug::tolerancesSwitch +Foam::layerAdditionRemoval::addDelta_ +( + "layerAdditionRemoval::addDelta", + 0.3 +); // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -354,7 +365,12 @@ bool Foam::layerAdditionRemoval::changeTopology() const topologicalChange = false; } - else if (avgDelta < oldLayerThickness_) + // New criterion to avoid round-off triggering layer addition/removal + // HJ, 30/Mar/2018 + else if + ( + (oldLayerThickness_ - avgDelta) > motionDelta_()*minLayerThickness_ + ) { // Layers moving towards removal if (minDelta < minLayerThickness_) @@ -397,7 +413,12 @@ bool Foam::layerAdditionRemoval::changeTopology() const oldLayerThickness_ = avgDelta; } } - else + // New criterion to avoid round-off triggering layer addition/removal + // HJ, 30/Mar/2018 + else if + ( + (avgDelta - oldLayerThickness_) > motionDelta_()*minLayerThickness_ + ) { // Layers moving towards addition if (maxDelta > maxLayerThickness_) @@ -422,6 +443,8 @@ bool Foam::layerAdditionRemoval::changeTopology() const oldLayerThickness_ = avgDelta; } } + // else the motion change is smaller than the tolerance and the layer + // interface is practically static. HJ, 30/Mar/2018 return topologicalChange; } diff --git a/src/dynamicMesh/dynamicMesh/polyMeshModifiers/layerAdditionRemoval/layerAdditionRemoval.H b/src/dynamicMesh/dynamicMesh/polyMeshModifiers/layerAdditionRemoval/layerAdditionRemoval.H index c13c616fe..56497d60d 100644 --- a/src/dynamicMesh/dynamicMesh/polyMeshModifiers/layerAdditionRemoval/layerAdditionRemoval.H +++ b/src/dynamicMesh/dynamicMesh/polyMeshModifiers/layerAdditionRemoval/layerAdditionRemoval.H @@ -40,6 +40,7 @@ SourceFiles #include "polyMeshModifier.H" #include "primitiveFacePatch.H" #include "ZoneIDs.H" +#include "tolerancesSwitch.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -128,13 +129,14 @@ class layerAdditionRemoval // Static data members - //- Thickness insertion fraction for the pre-motion - static const scalar addDelta_; + //- Motion detection fraction: if the motion is smaller than + // motionDelta*minLayerThickness_, it is assumed that the mesh is + // not layering + static const debug::tolerancesSwitch motionDelta_; + + //- Thickness insertion fraction for the pre-motion + static const debug::tolerancesSwitch addDelta_; - //- Thickness removal fraction for the cell collapse - // Note: the cell will be collapsed to this relative - // thickness before the layer is removed. - static const scalar removeDelta_; public: @@ -166,9 +168,8 @@ public: ); - // Destructor - - virtual ~layerAdditionRemoval(); + //- Destructor + virtual ~layerAdditionRemoval(); // Member Functions