Correct referring of particles and evaluation of real-referred

interactions.
This commit is contained in:
graham
2009-09-02 14:42:30 +01:00
parent 1491f10729
commit bd3e435764
5 changed files with 110 additions and 161 deletions

View File

@ -389,43 +389,22 @@ Foam::vectorList Foam::referredCell<ParticleType>::rotateVectors
}
template<class ParticleType>
void Foam::referredCell<ParticleType>::referInParticles
(
const IDLList<ParticleType>& incomingParticles
)
{
// this->clear();
// Try using this = incomingParticles then transform positions
// forAllConstIter
// (
// typename IDLList<ParticleType>,
// incomingParticles,
// incomingParticle
// )
// {
// // this->append(incomingParticle);
// }
// Info<< "NEED TO REFER POSITIONS ON ARRIVAL" << endl;
}
template<class ParticleType>
void Foam::referredCell<ParticleType>::referInParticle
(
const ParticleType& incomingParticle
ParticleType* incomingParticlePtr
)
{
// Pout<< "Referring in " << incomingParticle << endl;
ParticleType& p = *incomingParticlePtr;
// Try using this = incomingParticles then transform positions
p.position() = referPosition
(
p.position()
);
// // this->append(incomingParticle);
p.transformProperties(rotation_);
// Info<< "NEED TO REFER POSITIONS ON ARRIVAL" << endl;
this->append(incomingParticlePtr);
}

View File

@ -229,10 +229,9 @@ public:
// list of vectors
vectorList rotateVectors(const vectorList& vectorsToRotate) const;
//- referInParticle(s) takes a referred particle from a source
//- referInParticle takes a referred particle from a source
// processor, transforming its position and properties
void referInParticles(const IDLList<ParticleType>& incomingParticles);
void referInParticle(const ParticleType& incomingParticle);
void referInParticle(ParticleType* incomingParticlePtr);
//- duplicate() function to test whether a referred or real cell
// supplied by arguement is a duplicate of this referredCell.

View File

@ -32,8 +32,6 @@ License
#include "globalMeshData.H"
#include "processorPolyPatch.H"
#include "cyclicPolyPatch.H"
#include "sendingReferralList.H"
#include "receivingReferralList.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -1423,6 +1421,44 @@ void Foam::referredCellList<ParticleType>::buildReferredCellList
}
template<class ParticleType>
void Foam::referredCellList<ParticleType>::storeParticles
(
const receivingReferralList& rRL,
const labelList& destinationReferredCell,
IDLList<ParticleType>& particlesToReferIn
)
{
label particleI = 0;
forAllIter
(
typename IDLList<ParticleType>,
particlesToReferIn,
referInIter
)
{
ParticleType& p = referInIter();
labelList refCellsToReferTo =
rRL[destinationReferredCell[particleI]];
forAll(refCellsToReferTo, refCellI)
{
referredCell<ParticleType>& refCellToRefParticlesTo =
(*this)[refCellsToReferTo[refCellI]];
refCellToRefParticlesTo.referInParticle
(
particlesToReferIn.remove(&p)
);
}
particleI++;
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ParticleType>
@ -1434,7 +1470,7 @@ Foam::referredCellList<ParticleType>::referredCellList
:
List<referredCell<ParticleType> >(),
il_(il),
cloud_(il_.mesh(), "referredCellListDummyCloud", IDLList<ParticleType>())
cloud_(il_.mesh(), "referredParticleCloud", IDLList<ParticleType>())
{
buildReferredCellList(pointPointListBuild);
@ -1477,8 +1513,6 @@ void Foam::referredCellList<ParticleType>::referParticles
(*this)[i].clear();
}
cloud_.clear();
// Create referred particles for sending using cell occupancy and
// cellSendingReferralLists
@ -1534,54 +1568,7 @@ void Foam::referredCellList<ParticleType>::referParticles
il_.cellReceivingReferralLists()[cSRL]
);
// forAll(rRL, rRLI)
// {
// forAll(rRL[rRLI], rC)
// {
// // referredCell<ParticleType>& refCellToRefParticlesTo =
// // (*this)[rRL[rRLI][rC]];
// // refCellToRefParticlesTo.referInParticles
// // (
// // particlesToReferOut[rRLI]
// // );
// }
// }
forAllConstIter
(
typename IDLList<ParticleType>,
particlesToReferOut,
iter
)
{
cloud_.addParticle(iter().clone().ptr());
}
label particleI = 0;
forAllIter
(
typename IDLList<ParticleType>,
particlesToReferOut,
iter
)
{
ParticleType& p = iter();
labelList refCellsToReferTo =
rRL[destinationReferredCell[particleI]];
forAll(refCellsToReferTo, refCellI)
{
referredCell<ParticleType>& refCellToRefParticlesTo =
(*this)[refCellsToReferTo[refCellI]];
refCellToRefParticlesTo.referInParticle(p);
}
particleI++;
}
storeParticles(rRL, destinationReferredCell, particlesToReferOut);
}
}
@ -1598,7 +1585,7 @@ void Foam::referredCellList<ParticleType>::referParticles
IDLList<ParticleType> particlesToReferIn;
List<label> destinationReferredCell;
labelList destinationReferredCell;
if (rRL.sourceProc() != Pstream::myProcNo())
{
@ -1618,62 +1605,36 @@ void Foam::referredCellList<ParticleType>::referParticles
fromInteractingProc,
typename ParticleType::iNew(cloud_)
);
forAllConstIter
(
typename IDLList<ParticleType>,
particlesToReferIn,
iter
)
{
cloud_.addParticle(iter().clone().ptr());
}
}
// forAll(rRL, rRLI)
// {
// forAll(rRL[rRLI], rC)
// {
// referredCell<ParticleType>& refCellToRefParticlesTo =
// (*this)[rRL[rRLI][rC]];
storeParticles(rRL, destinationReferredCell, particlesToReferIn);
}
}
// refCellToRefParticlesTo.referInParticles
// (
// particlesToReferIn[rRLI]
// );
// }
// }
bool writeCloud = false;
label particleI = 0;
if (il_.mesh().time().outputTime() && writeCloud)
{
cloud_.clear();
forAll(*this, refCellI)
{
referredCell<ParticleType>& refCell = (*this)[refCellI];
forAllIter
(
typename IDLList<ParticleType>,
particlesToReferIn,
refCell,
iter
)
{
ParticleType& p = iter();
labelList refCellsToReferTo =
rRL[destinationReferredCell[particleI]];
forAll(refCellsToReferTo, refCellI)
{
referredCell<ParticleType>& refCellToRefParticlesTo =
(*this)[refCellsToReferTo[refCellI]];
refCellToRefParticlesTo.referInParticle(p);
}
particleI++;
cloud_.addParticle(iter().clone().ptr());
}
}
}
if (il_.mesh().time().outputTime())
{
Particle<ParticleType>::writeFields(cloud_);
cloud_.clear();
}
}

View File

@ -37,6 +37,8 @@ SourceFiles
#define referredCellList_H
#include "referredCell.H"
#include "sendingReferralList.H"
#include "receivingReferralList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -71,6 +73,14 @@ class referredCellList
bool pointPointListBuild
);
//- Store the referred particles in the referred cells
void storeParticles
(
const receivingReferralList& rRL,
const labelList& destinationReferredCell,
IDLList<ParticleType>& particlesToReferIn
);
public:

View File

@ -63,7 +63,7 @@ void Foam::DeterministicPairForce<CloudType>::evaluatePair
{
//Particles in collision
vector n = deltaP/mag(deltaP);
vector n = deltaP/(mag(deltaP) + VSMALL);
vector Urel = pA.U() - pB.U();
@ -73,7 +73,7 @@ void Foam::DeterministicPairForce<CloudType>::evaluatePair
// Effective mass
scalar M = pA.mass()*pB.mass()/(pA.mass() + pB.mass());
scalar E = 5e5;
scalar E = 2e3;
scalar sigma = 0.25;
scalar alpha = 0.2;
scalar b = 1.0;
@ -180,44 +180,44 @@ void Foam::DeterministicPairForce<CloudType>::collide()
// real-referred interactions
// const referredCellList<typename CloudType::parcelType>& ril(il_.ril());
referredCellList<typename CloudType::parcelType>& ril(il_.ril());
// // Loop over all referred cells
// forAll(ril, refCellI)
// {
// const referredCell<typename CloudType::parcelType>& refCell =
// ril[refCellI];
// Loop over all referred cells
forAll(ril, refCellI)
{
referredCell<typename CloudType::parcelType>& refCell =
ril[refCellI];
// const List<label>& realCells = refCell.realCellsForInteraction();
const labelList& realCells = refCell.realCellsForInteraction();
// // Loop over all referred parcels in the referred cell
// Loop over all referred parcels in the referred cell
// forAllIter
// (
// typename IDLList<typename CloudType::parcelType>,
// refCell,
// iter
// )
// {
// pB_ptr = &referredParcel();
forAllIter
(
typename IDLList<typename CloudType::parcelType>,
refCell,
referredParcel
)
{
// Loop over all real cells in that the referred cell is
// to supply interactions to
// // Loop over all real cells in that the referred cell is
// // to supply interactions to
forAll(realCells, realCellI)
{
List<typename CloudType::parcelType*> realCellParcels =
cellOccupancy_[realCells[realCellI]];
// forAll(realCells, realCellI)
// {
// List<typename CloudType::parcelType*> realCellParcels =
// cellOccupancy_[realCells[realCellI]];
// forAll(realCellParcels, realParcelI)
// {
// pA_ptr = realCellParcels[realParcelI];
// evaluatePair(*pA_ptr, *pB_ptr);
// }
// }
// }
// }
forAll(realCellParcels, realParcelI)
{
evaluatePair
(
*realCellParcels[realParcelI],
referredParcel()
);
}
}
}
}
Info<< "ADD COLLISIONS WITH WALLS HERE, DOES NOT NEED TO BE A TRACKING "