ENH: foamyHexMesh: Normalise the aspect ratio direction

This commit is contained in:
laurence
2013-07-19 16:43:07 +01:00
parent 1c55166d36
commit f008250b03
2 changed files with 26 additions and 28 deletions

View File

@ -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);
} }

View File

@ -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