mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: foamyHexMesh: Normalise the aspect ratio direction
This commit is contained in:
@ -40,11 +40,15 @@ Foam::cellAspectRatioControl::cellAspectRatioControl
|
|||||||
aspectRatioDict_.lookupOrDefault<vector>
|
aspectRatioDict_.lookupOrDefault<vector>
|
||||||
(
|
(
|
||||||
"aspectRatioDirection",
|
"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
|
<< " Ratio : " << aspectRatio_ << nl
|
||||||
<< " Direction : " << aspectRatioDirection_
|
<< " Direction : " << aspectRatioDirection_
|
||||||
<< endl;
|
<< endl;
|
||||||
@ -66,22 +70,20 @@ void Foam::cellAspectRatioControl::updateCellSizeAndFaceArea
|
|||||||
scalar& targetCellSize
|
scalar& targetCellSize
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
const scalar cosAngle = mag
|
const scalar cosAngle =
|
||||||
(
|
mag(vectorTools::cosPhi(alignmentDir, aspectRatioDirection_));
|
||||||
vectorTools::cosPhi(alignmentDir, aspectRatioDirection_)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Change target face area based on aspect ratio
|
// Change target face area based on aspect ratio
|
||||||
targetFaceArea
|
targetFaceArea +=
|
||||||
+= targetFaceArea
|
targetFaceArea
|
||||||
*(aspectRatio_ - 1.0)
|
*(aspectRatio_ - 1.0)
|
||||||
*(1.0 - cosAngle);
|
*(1.0 - cosAngle);
|
||||||
|
|
||||||
// Change target cell size based on aspect ratio
|
// Change target cell size based on aspect ratio
|
||||||
targetCellSize
|
targetCellSize +=
|
||||||
+= targetCellSize
|
targetCellSize
|
||||||
*(aspectRatio_ - 1.0)
|
*(aspectRatio_ - 1.0)
|
||||||
*cosAngle;
|
*cosAngle;
|
||||||
|
|
||||||
alignmentDir *= 0.5*targetCellSize;
|
alignmentDir *= 0.5*targetCellSize;
|
||||||
}
|
}
|
||||||
@ -95,16 +97,15 @@ void Foam::cellAspectRatioControl::updateDeltaVector
|
|||||||
vector& delta
|
vector& delta
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
const scalar cosAngle = mag
|
const scalar cosAngle =
|
||||||
(
|
mag(vectorTools::cosPhi(alignmentDir, aspectRatioDirection_));
|
||||||
vectorTools::cosPhi(alignmentDir, aspectRatioDirection_)
|
|
||||||
);
|
|
||||||
|
|
||||||
delta += 0.5
|
delta +=
|
||||||
*delta
|
0.5
|
||||||
*cosAngle
|
*delta
|
||||||
*(targetCellSize/rABMag)
|
*cosAngle
|
||||||
*(aspectRatio_ - 1.0);
|
*(targetCellSize/rABMag)
|
||||||
|
*(aspectRatio_ - 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -56,7 +56,7 @@ class cellAspectRatioControl
|
|||||||
|
|
||||||
const scalar aspectRatio_;
|
const scalar aspectRatio_;
|
||||||
|
|
||||||
const vector aspectRatioDirection_;
|
vector aspectRatioDirection_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
@ -73,10 +73,7 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from dictionary
|
//- Construct from dictionary
|
||||||
cellAspectRatioControl
|
cellAspectRatioControl(const dictionary& motionDict);
|
||||||
(
|
|
||||||
const dictionary& motionDict
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
|
|||||||
Reference in New Issue
Block a user