ENH: Adding feature edge to the target walk for AMI

Adding mininum area tolerance in processSourceFace function to calculate weight
     Modifying calculation of face normals in function interArea
This commit is contained in:
Sergio Ferraris
2013-05-01 15:27:02 +01:00
parent 09b66079a9
commit 803b87e0c1
2 changed files with 19 additions and 6 deletions

View File

@ -26,6 +26,7 @@ License
#include "AMIMethod.H"
#include "meshTools.H"
#include "mapDistribute.H"
#include "unitConversion.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -262,6 +263,7 @@ void Foam::AMIMethod<SourcePatch, TargetPatch>::appendNbrFaces
) const
{
const labelList& nbrFaces = patch.faceFaces()[faceI];
const pointField& tgtPoints = patch.points();
// filter out faces already visited from src face neighbours
forAll(nbrFaces, i)
@ -291,7 +293,17 @@ void Foam::AMIMethod<SourcePatch, TargetPatch>::appendNbrFaces
if (valid)
{
faceIDs.append(nbrFaceI);
const face& myn = patch[faceI];
const face& nbrn = patch[nbrFaceI];
const vector& nbrNormal = nbrn.normal(tgtPoints);
const vector& mynNormal = myn.normal(tgtPoints);
scalar cosI = nbrNormal & mynNormal;
if (cosI > Foam::cos(degToRad(89.0)))
{
faceIDs.append(nbrFaceI);
}
}
}
}

View File

@ -68,7 +68,7 @@ bool Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::processSourceFace
scalar area = interArea(srcFaceI, tgtFaceI);
// store when intersection area > 0
if (area > 0)
if (area/this->srcMagSf_[srcFaceI] > faceAreaIntersect::tolerance())
{
srcAddr[srcFaceI].append(tgtFaceI);
srcWght[srcFaceI].append(area);
@ -228,10 +228,10 @@ Foam::scalar Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::interArea
// quick reject if either face has zero area
// Note: do not used stored face areas for target patch
const scalar tgtMag = tgt.mag(tgtPoints);
if
(
(this->srcMagSf_[srcFaceI] < ROOTVSMALL)
|| (tgt.mag(tgtPoints) < ROOTVSMALL)
(this->srcMagSf_[srcFaceI] < ROOTVSMALL) || (tgtMag < ROOTVSMALL)
)
{
return 0.0;
@ -242,13 +242,14 @@ Foam::scalar Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::interArea
// crude resultant norm
vector n(-src.normal(srcPoints));
n /= mag(n);
if (this->reverseTarget_)
{
n -= tgt.normal(tgtPoints);
n -= tgt.normal(tgtPoints)/tgtMag;
}
else
{
n += tgt.normal(tgtPoints);
n += tgt.normal(tgtPoints)/tgtMag;
}
n *= 0.5;