Robustness improvement for layer addition/removal triggering

This commit is contained in:
Hrvoje Jasak 2018-04-12 14:05:28 +01:00
parent c52c51e367
commit efcc2b1b7d
3 changed files with 39 additions and 15 deletions

View file

@ -87,7 +87,7 @@ void Foam::layerAdditionRemoval::addCellLayer
{ {
extrusionDir[mpI] = points[ptc[mpI]] - points[mp[mpI]]; extrusionDir[mpI] = points[ptc[mpI]] - points[mp[mpI]];
} }
extrusionDir *= addDelta_*maxLayerThickness_; extrusionDir *= addDelta_()*maxLayerThickness_;
} }
else else
{ {
@ -118,7 +118,7 @@ void Foam::layerAdditionRemoval::addCellLayer
polyAddPoint polyAddPoint
( (
points[mp[pointI]] // point points[mp[pointI]] // point
// + addDelta_*maxLayerThickness_*extrusionDir[pointI], // + addDelta_()*maxLayerThickness_*extrusionDir[pointI],
+ extrusionDir[pointI], + extrusionDir[pointI],
mp[pointI], // master point mp[pointI], // master point
-1, // zone for point -1, // zone for point

View file

@ -48,8 +48,19 @@ namespace Foam
} }
const Foam::scalar Foam::layerAdditionRemoval::addDelta_ = 0.3; const Foam::debug::tolerancesSwitch
const Foam::scalar Foam::layerAdditionRemoval::removeDelta_ = 0.1; Foam::layerAdditionRemoval::motionDelta_
(
"layerAdditionRemoval::motionDelta",
0.01
);
const Foam::debug::tolerancesSwitch
Foam::layerAdditionRemoval::addDelta_
(
"layerAdditionRemoval::addDelta",
0.3
);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -354,7 +365,12 @@ bool Foam::layerAdditionRemoval::changeTopology() const
topologicalChange = false; 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 // Layers moving towards removal
if (minDelta < minLayerThickness_) if (minDelta < minLayerThickness_)
@ -397,7 +413,12 @@ bool Foam::layerAdditionRemoval::changeTopology() const
oldLayerThickness_ = avgDelta; 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 // Layers moving towards addition
if (maxDelta > maxLayerThickness_) if (maxDelta > maxLayerThickness_)
@ -422,6 +443,8 @@ bool Foam::layerAdditionRemoval::changeTopology() const
oldLayerThickness_ = avgDelta; oldLayerThickness_ = avgDelta;
} }
} }
// else the motion change is smaller than the tolerance and the layer
// interface is practically static. HJ, 30/Mar/2018
return topologicalChange; return topologicalChange;
} }

View file

@ -40,6 +40,7 @@ SourceFiles
#include "polyMeshModifier.H" #include "polyMeshModifier.H"
#include "primitiveFacePatch.H" #include "primitiveFacePatch.H"
#include "ZoneIDs.H" #include "ZoneIDs.H"
#include "tolerancesSwitch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -128,13 +129,14 @@ class layerAdditionRemoval
// Static data members // Static data members
//- Thickness insertion fraction for the pre-motion //- Motion detection fraction: if the motion is smaller than
static const scalar addDelta_; // 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: public:
@ -166,9 +168,8 @@ public:
); );
// Destructor //- Destructor
virtual ~layerAdditionRemoval();
virtual ~layerAdditionRemoval();
// Member Functions // Member Functions