ENH: InteractionLists. Adding inverse addressing for referred wall

faces and interactions with the referred faces.
This commit is contained in:
graham
2010-04-12 16:52:52 +01:00
parent 33fa12519d
commit 4f4958c2bb
4 changed files with 103 additions and 70 deletions

View File

@ -881,6 +881,33 @@ Foam::InteractionLists<ParticleType>::InteractionLists
// Store wallFaceIndexAndTransformToDistribute
wallFaceIndexAndTransformToDistribute_.transfer(wallFaceIAndTToExchange);
// Determine inverse addressing for referred wallFaces
rwfilInverse_.setSize(mesh_.nCells());
// Temporary Dynamic lists for accumulation
List<DynamicList<label> > rwfilInverseTemp(rwfilInverse_.size());
// Loop over all referred wall faces
forAll(rwfil_, refWallFaceI)
{
const labelList& realCells = rwfil_[refWallFaceI];
// Loop over all real cells in that the referred wall face is
// to supply interactions to and record the index of this
// referred wall face in the real cells entry in rwfilInverse
forAll(realCells, realCellI)
{
rwfilInverseTemp[realCells[realCellI]].append(refWallFaceI);
}
}
forAll(rwfilInverse_, cellI)
{
rwfilInverse_[cellI].transfer(rwfilInverseTemp[cellI]);
}
// Refer wall faces to the appropriate processor
referredWallFaces_.setSize(wallFaceIndexAndTransformToDistribute_.size());
@ -895,18 +922,17 @@ Foam::InteractionLists<ParticleType>::InteractionLists
globalTransforms_.transformIndex(wfiat)
);
Tuple2<face, pointField>& referredWallFace = referredWallFaces_[rwfI];
Tuple2<face, pointField>& rwf = referredWallFaces_[rwfI];
const labelList& facePts = mesh_.faces()[wallFaceIndex];
referredWallFace.first() = face(identity(facePts.size()));
rwf.first() = face(identity(facePts.size()));
referredWallFace.second().setSize(facePts.size());
rwf.second().setSize(facePts.size());
forAll(facePts, fPtI)
{
referredWallFace.second()[fPtI] =
mesh_.points()[facePts[fPtI]] - transform;
rwf.second()[fPtI] = mesh_.points()[facePts[fPtI]] - transform;
}
}

View File

@ -128,6 +128,11 @@ class InteractionLists
// wall face interaction list)
labelListList rwfil_;
//- Inverse addressing for referred wall faces, specifies
// which referred wall faces interact with the real cells
// indexed in this container.
labelListList rwfilInverse_;
//- Which cells are to be sent via the cellMap, and an index
// specifying how they should be transformed.
List<labelPair> cellIndexAndTransformToDistribute_;
@ -252,6 +257,10 @@ public:
//- Return access to the referred wall face interaction list
inline const labelListList& rwfil() const;
//- Return access to the inverse referred wall face
// interaction list
inline const labelListList& rwfilInverse() const;
//- Return access to the cellIndexAndTransformToDistribute list
inline const List<labelPair>&
cellIndexAndTransformToDistribute() const;

View File

@ -80,6 +80,14 @@ const Foam::labelListList& Foam::InteractionLists<ParticleType>::ril() const
}
template<class ParticleType>
const Foam::labelListList&
Foam::InteractionLists<ParticleType>::rilInverse() const
{
return rilInverse_;
}
template<class ParticleType>
const Foam::labelListList& Foam::InteractionLists<ParticleType>::rwfil() const
{
@ -87,6 +95,14 @@ const Foam::labelListList& Foam::InteractionLists<ParticleType>::rwfil() const
}
template<class ParticleType>
const Foam::labelListList&
Foam::InteractionLists<ParticleType>::rwfilInverse() const
{
return rwfilInverse_;
}
template<class ParticleType>
const Foam::List<Foam::labelPair>&
Foam::InteractionLists<ParticleType>::cellIndexAndTransformToDistribute() const
@ -104,14 +120,6 @@ wallFaceIndexAndTransformToDistribute() const
}
template<class ParticleType>
const Foam::labelListList&
Foam::InteractionLists<ParticleType>::rilInverse() const
{
return rilInverse_;
}
template<class ParticleType>
const Foam::List<Foam::Tuple2<Foam::face, Foam::pointField> >&
Foam::InteractionLists<ParticleType>::referredWallFaces() const

View File

@ -175,8 +175,6 @@ void Foam::PairCollision<CloudType>::wallInteraction()
const labelListList directWallFaces = il_.dwfil();
// const ReferredCellList<typename CloudType::parcelType>& ril = il_.ril();
// Storage for the wall interaction sites
DynamicList<point> flatSites;
DynamicList<scalar> flatSiteExclusionDistancesSqr;
@ -264,74 +262,66 @@ void Foam::PairCollision<CloudType>::wallInteraction()
}
}
// // referred wallFace interactions
// referred wallFace interactions
// // The labels of referred cells in range of this real cell
// const labelList& referredCellsInRange =
// dil.referredCellsForInteraction()[realCellI];
// The labels of referred wall faces in range of this real cell
const labelList& cellRefWallFaces = il_.rwfilInverse()[realCellI];
// forAll(referredCellsInRange, refCellInRangeI)
// {
// const ReferredCell<typename CloudType::parcelType>& refCell =
// ril[referredCellsInRange[refCellInRangeI]];
forAll(cellRefWallFaces, rWFI)
{
const Tuple2<face, pointField>& rwf =
il_.referredWallFaces()[cellRefWallFaces[rWFI]];
// const labelList& refWallFaces = refCell.wallFaces();
const face& f = rwf.first();
// forAll(refWallFaces, refWallFaceI)
// {
// label refFaceI = refWallFaces[refWallFaceI];
const pointField& pts = rwf.second();
// pointHit nearest = refCell.faces()[refFaceI].nearestPoint
// (
// pos,
// refCell.points()
// );
pointHit nearest = f.nearestPoint(pos, pts);
// if (nearest.distance() < r)
// {
// vector normal = refCell.faceAreas()[refFaceI];
if (nearest.distance() < r)
{
vector normal = f.normal(pts);
// normal /= mag(normal);
normal /= mag(normal);
// const vector& nearPt = nearest.rawPoint();
const vector& nearPt = nearest.rawPoint();
// vector pW = nearPt - pos;
vector pW = nearPt - pos;
// scalar normalAlignment = normal & pW/mag(pW);
scalar normalAlignment = normal & pW/mag(pW);
// if (normalAlignment > cosPhiMinFlatWall)
// {
// // Guard against a flat interaction being
// // present on the boundary of two or more
// // faces, which would create duplicate contact
// // points. Duplicates are discarded.
// if
// (
// !duplicatePointInList
// (
// flatSites,
// nearPt,
// sqr(r*flatWallDuplicateExclusion)
// )
// )
// {
// flatSites.append(nearPt);
if (normalAlignment > cosPhiMinFlatWall)
{
// Guard against a flat interaction being
// present on the boundary of two or more
// faces, which would create duplicate contact
// points. Duplicates are discarded.
if
(
!duplicatePointInList
(
flatSites,
nearPt,
sqr(r*flatWallDuplicateExclusion)
)
)
{
flatSites.append(nearPt);
// flatSiteExclusionDistancesSqr.append
// (
// sqr(r) - sqr(nearest.distance())
// );
// }
// }
// else
// {
// otherSites.append(nearPt);
flatSiteExclusionDistancesSqr.append
(
sqr(r) - sqr(nearest.distance())
);
}
}
else
{
otherSites.append(nearPt);
// otherSiteDistances.append(nearest.distance());
// }
// }
// }
// }
otherSiteDistances.append(nearest.distance());
}
}
}
// All flat interaction sites found, now classify the
// other sites as being in range of a flat interaction, or