Skip to content
Snippets Groups Projects
Commit f008250b authored by laurence's avatar laurence
Browse files

ENH: foamyHexMesh: Normalise the aspect ratio direction

parent 1c55166d
No related merge requests found
......@@ -40,11 +40,15 @@ Foam::cellAspectRatioControl::cellAspectRatioControl
aspectRatioDict_.lookupOrDefault<vector>
(
"aspectRatioDirection",
vector(0, 0, 0)
vector::zero
)
)
{
Info<< nl << "Cell Aspect Ratio Control" << nl
// Normalise the direction
aspectRatioDirection_ /= mag(aspectRatioDirection_) + SMALL;
Info<< nl
<< "Cell Aspect Ratio Control" << nl
<< " Ratio : " << aspectRatio_ << nl
<< " Direction : " << aspectRatioDirection_
<< endl;
......@@ -66,22 +70,20 @@ void Foam::cellAspectRatioControl::updateCellSizeAndFaceArea
scalar& targetCellSize
) const
{
const scalar cosAngle = mag
(
vectorTools::cosPhi(alignmentDir, aspectRatioDirection_)
);
const scalar cosAngle =
mag(vectorTools::cosPhi(alignmentDir, aspectRatioDirection_));
// Change target face area based on aspect ratio
targetFaceArea
+= targetFaceArea
*(aspectRatio_ - 1.0)
*(1.0 - cosAngle);
targetFaceArea +=
targetFaceArea
*(aspectRatio_ - 1.0)
*(1.0 - cosAngle);
// Change target cell size based on aspect ratio
targetCellSize
+= targetCellSize
*(aspectRatio_ - 1.0)
*cosAngle;
targetCellSize +=
targetCellSize
*(aspectRatio_ - 1.0)
*cosAngle;
alignmentDir *= 0.5*targetCellSize;
}
......@@ -95,16 +97,15 @@ void Foam::cellAspectRatioControl::updateDeltaVector
vector& delta
) const
{
const scalar cosAngle = mag
(
vectorTools::cosPhi(alignmentDir, aspectRatioDirection_)
);
delta += 0.5
*delta
*cosAngle
*(targetCellSize/rABMag)
*(aspectRatio_ - 1.0);
const scalar cosAngle =
mag(vectorTools::cosPhi(alignmentDir, aspectRatioDirection_));
delta +=
0.5
*delta
*cosAngle
*(targetCellSize/rABMag)
*(aspectRatio_ - 1.0);
}
......
......@@ -56,7 +56,7 @@ class cellAspectRatioControl
const scalar aspectRatio_;
const vector aspectRatioDirection_;
vector aspectRatioDirection_;
// Private Member Functions
......@@ -73,10 +73,7 @@ public:
// Constructors
//- Construct from dictionary
cellAspectRatioControl
(
const dictionary& motionDict
);
cellAspectRatioControl(const dictionary& motionDict);
//- Destructor
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment