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 // Store wallFaceIndexAndTransformToDistribute
wallFaceIndexAndTransformToDistribute_.transfer(wallFaceIAndTToExchange); 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 // Refer wall faces to the appropriate processor
referredWallFaces_.setSize(wallFaceIndexAndTransformToDistribute_.size()); referredWallFaces_.setSize(wallFaceIndexAndTransformToDistribute_.size());
@ -895,18 +922,17 @@ Foam::InteractionLists<ParticleType>::InteractionLists
globalTransforms_.transformIndex(wfiat) globalTransforms_.transformIndex(wfiat)
); );
Tuple2<face, pointField>& referredWallFace = referredWallFaces_[rwfI]; Tuple2<face, pointField>& rwf = referredWallFaces_[rwfI];
const labelList& facePts = mesh_.faces()[wallFaceIndex]; 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) forAll(facePts, fPtI)
{ {
referredWallFace.second()[fPtI] = rwf.second()[fPtI] = mesh_.points()[facePts[fPtI]] - transform;
mesh_.points()[facePts[fPtI]] - transform;
} }
} }

View File

@ -128,6 +128,11 @@ class InteractionLists
// wall face interaction list) // wall face interaction list)
labelListList rwfil_; 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 //- Which cells are to be sent via the cellMap, and an index
// specifying how they should be transformed. // specifying how they should be transformed.
List<labelPair> cellIndexAndTransformToDistribute_; List<labelPair> cellIndexAndTransformToDistribute_;
@ -252,6 +257,10 @@ public:
//- Return access to the referred wall face interaction list //- Return access to the referred wall face interaction list
inline const labelListList& rwfil() const; 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 //- Return access to the cellIndexAndTransformToDistribute list
inline const List<labelPair>& inline const List<labelPair>&
cellIndexAndTransformToDistribute() const; 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> template<class ParticleType>
const Foam::labelListList& Foam::InteractionLists<ParticleType>::rwfil() const 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> template<class ParticleType>
const Foam::List<Foam::labelPair>& const Foam::List<Foam::labelPair>&
Foam::InteractionLists<ParticleType>::cellIndexAndTransformToDistribute() const 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> template<class ParticleType>
const Foam::List<Foam::Tuple2<Foam::face, Foam::pointField> >& const Foam::List<Foam::Tuple2<Foam::face, Foam::pointField> >&
Foam::InteractionLists<ParticleType>::referredWallFaces() const Foam::InteractionLists<ParticleType>::referredWallFaces() const

View File

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