Skip to content

Commit

Permalink
Robustness improvement for layer addition/removal triggering
Browse files Browse the repository at this point in the history
  • Loading branch information
Hrvoje Jasak committed Apr 12, 2018
1 parent cf76aac commit afef1ba
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ void Foam::layerAdditionRemoval::addCellLayer
{
extrusionDir[mpI] = points[ptc[mpI]] - points[mp[mpI]];
}
extrusionDir *= addDelta_*maxLayerThickness_;
extrusionDir *= addDelta_()*maxLayerThickness_;
}
else
{
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 * * * * * * * * * * * //
Expand Down Expand Up @@ -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_)
Expand Down Expand Up @@ -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_)
Expand All @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ SourceFiles
#include "polyMeshModifier.H"
#include "primitiveFacePatch.H"
#include "ZoneIDs.H"
#include "tolerancesSwitch.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

Expand Down Expand Up @@ -128,13 +129,14 @@ class layerAdditionRemoval

// Static data members

//- 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 scalar addDelta_;
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:

Expand Down Expand Up @@ -166,9 +168,8 @@ public:
);


// Destructor

virtual ~layerAdditionRemoval();
//- Destructor
virtual ~layerAdditionRemoval();


// Member Functions
Expand Down

0 comments on commit afef1ba

Please sign in to comment.