Commit fa7924a7 authored by Henry's avatar Henry
Browse files
parents f4dee922 4ced40cb
......@@ -102,7 +102,8 @@ Foam::lagrangianFieldDecomposer::lagrangianFieldDecomposer
(
positions_,
ppi.position(),
procCelli
procCelli,
false
)
);
}
......
......@@ -162,7 +162,8 @@ Foam::Particle<ParticleType>::Particle
(
const Cloud<ParticleType>& cloud,
const vector& position,
const label cellI
const label cellI,
bool doCellFacePt
)
:
cloud_(cloud),
......@@ -175,7 +176,10 @@ Foam::Particle<ParticleType>::Particle
origProc_(Pstream::myProcNo()),
origId_(cloud_.getNewParticleID())
{
initCellFacePt();
if (doCellFacePt)
{
initCellFacePt();
}
}
......
......@@ -346,7 +346,8 @@ public:
(
const Cloud<ParticleType>&,
const vector& position,
const label cellI
const label cellI,
bool doCellFacePt = true
);
//- Construct from Istream
......
......@@ -68,15 +68,17 @@ public:
Particle<passiveParticle>(c, position, cellI, tetFaceI, tetPtI)
{}
//- Construct from components, with searching for tetFace and tetPt
//- Construct from components, with searching for tetFace and
// tetPt unless disabled by doCellFacePt = false.
passiveParticle
(
const Cloud<passiveParticle>& c,
const vector& position,
const label cellI
const label cellI,
bool doCellFacePt = true
)
:
Particle<passiveParticle>(c, position, cellI)
Particle<passiveParticle>(c, position, cellI, doCellFacePt)
{}
//- Construct from Istream
......
......@@ -57,6 +57,7 @@ Foam::coalParcel::coalParcel
const label typeId,
const scalar nParticle0,
const scalar d0,
const scalar dTarget0,
const vector& U0,
const vector& f0,
const vector& pi0,
......@@ -78,6 +79,7 @@ Foam::coalParcel::coalParcel
typeId,
nParticle0,
d0,
dTarget0,
U0,
f0,
pi0,
......
......@@ -79,6 +79,7 @@ public:
const label typeId,
const scalar nParticle0,
const scalar d0,
const scalar dTarget0,
const vector& U0,
const vector& f0,
const vector& pi0,
......
......@@ -43,6 +43,52 @@ void Foam::KinematicCloud<ParcelType>::preEvolve()
{
this->dispersion().cacheFields(true);
forces_.cacheFields(true, interpolationSchemes_);
updateCellOccupancy();
}
template<class ParcelType>
void Foam::KinematicCloud<ParcelType>::buildCellOccupancy()
{
if (cellOccupancyPtr_.empty())
{
cellOccupancyPtr_.reset
(
new List<DynamicList<ParcelType*> >(mesh_.nCells())
);
}
else if (cellOccupancyPtr_().size() != mesh_.nCells())
{
// If the size of the mesh has changed, reset the
// cellOccupancy size
cellOccupancyPtr_().setSize(mesh_.nCells());
}
List<DynamicList<ParcelType*> >& cellOccupancy = cellOccupancyPtr_();
forAll(cellOccupancy, cO)
{
cellOccupancy[cO].clear();
}
forAllIter(typename KinematicCloud<ParcelType>, *this, iter)
{
cellOccupancy[iter().cell()].append(&iter());
}
}
template<class ParcelType>
void Foam::KinematicCloud<ParcelType>::updateCellOccupancy()
{
// Only build the cellOccupancy if the pointer is set, i.e. it has
// been requested before.
if (cellOccupancyPtr_.valid())
{
buildCellOccupancy();
}
}
......@@ -80,8 +126,19 @@ void Foam::KinematicCloud<ParcelType>::evolveCloud()
g_.value()
);
label preInjectionSize = this->size();
this->surfaceFilm().inject(td);
// Update the cellOccupancy if the size of the cloud has changed
// during the injection.
if (preInjectionSize != this->size())
{
updateCellOccupancy();
preInjectionSize = this->size();
}
this->injection().inject(td);
if (coupled_)
......@@ -89,6 +146,18 @@ void Foam::KinematicCloud<ParcelType>::evolveCloud()
resetSourceTerms();
}
// Assume that motion will update the cellOccupancy as necessary
// before it is required.
motion(td);
}
template<class ParcelType>
void Foam::KinematicCloud<ParcelType>::motion
(
typename ParcelType::trackData& td
)
{
// Sympletic leapfrog integration of particle forces:
// + apply half deltaV with stored force
// + move positions with new velocity
......@@ -136,6 +205,8 @@ void Foam::KinematicCloud<ParcelType>::moveCollide
// td.part() = ParcelType::trackData::tpRotationalTrack;
// Cloud<ParcelType>::move(td);
updateCellOccupancy();
this->collision().collide();
td.part() = ParcelType::trackData::tpVelocityHalfStep;
......@@ -194,6 +265,7 @@ Foam::KinematicCloud<ParcelType>::KinematicCloud
particleProperties_.lookup("cellValueSourceCorrection")
),
rndGen_(label(0)),
cellOccupancyPtr_(),
rho_(rho),
U_(U),
mu_(mu),
......
......@@ -136,6 +136,9 @@ protected:
//- Random number generator - used by some injection routines
Random rndGen_;
//- Cell occupancy information for each parcel, (demand driven)
autoPtr<List<DynamicList<ParcelType*> > > cellOccupancyPtr_;
// References to the carrier gas fields
......@@ -209,10 +212,20 @@ protected:
//- Pre-evolve
void preEvolve();
//- Build the cellOccupancy
void buildCellOccupancy();
//- Update (i.e. build) the cellOccupancy if it has
// already been used
void updateCellOccupancy();
//- Evolve the cloud
void evolveCloud();
//- Move-collide
//- Particle motion
void motion(typename ParcelType::trackData& td);
//- Move-collide particles
void moveCollide(typename ParcelType::trackData& td);
//- Post-evolve
......@@ -284,6 +297,12 @@ public:
//- Return refernce to the random object
inline Random& rndGen();
//- Return the cell occupancy information for each
// parcel, non-const access, the caller is
// responsible for updating it for its own purposes
// if particles are removed or created.
inline List<DynamicList<ParcelType*> >& cellOccupancy();
// References to the carrier gas fields
......
......@@ -302,6 +302,19 @@ inline Foam::Random& Foam::KinematicCloud<ParcelType>::rndGen()
}
template<class ParcelType>
inline Foam::List<Foam::DynamicList<ParcelType*> >&
Foam::KinematicCloud<ParcelType>::cellOccupancy()
{
if (cellOccupancyPtr_.empty())
{
buildCellOccupancy();
}
return cellOccupancyPtr_();
}
template<class ParcelType>
inline Foam::DimensionedField<Foam::vector, Foam::volMesh>&
Foam::KinematicCloud<ParcelType>::UTrans()
......
......@@ -120,8 +120,19 @@ void Foam::ReactingCloud<ParcelType>::evolveCloud()
this->g().value()
);
label preInjectionSize = this->size();
this->surfaceFilm().inject(td);
// Update the cellOccupancy if the size of the cloud has changed
// during the injection.
if (preInjectionSize != this->size())
{
this->updateCellOccupancy();
preInjectionSize = this->size();
}
this->injection().inject(td);
if (this->coupled())
......@@ -129,7 +140,19 @@ void Foam::ReactingCloud<ParcelType>::evolveCloud()
resetSourceTerms();
}
Cloud<ParcelType>::move(td);
// Assume that motion will update the cellOccupancy as necessary
// before it is required.
motion(td);
}
template<class ParcelType>
void Foam::ReactingCloud<ParcelType>::motion
(
typename ParcelType::trackData& td
)
{
ThermoCloud<ParcelType>::motion(td);
}
......
......@@ -130,6 +130,9 @@ protected:
//- Evolve the cloud
void evolveCloud();
//- Particle motion
void motion(typename ParcelType::trackData& td);
//- Post-evolve
void postEvolve();
......
......@@ -93,8 +93,19 @@ void Foam::ReactingMultiphaseCloud<ParcelType>::evolveCloud()
this->g().value()
);
label preInjectionSize = this->size();
this->surfaceFilm().inject(td);
// Update the cellOccupancy if the size of the cloud has changed
// during the injection.
if (preInjectionSize != this->size())
{
this->updateCellOccupancy();
preInjectionSize = this->size();
}
this->injection().inject(td);
if (this->coupled())
......@@ -102,7 +113,19 @@ void Foam::ReactingMultiphaseCloud<ParcelType>::evolveCloud()
resetSourceTerms();
}
Cloud<ParcelType>::move(td);
// Assume that motion will update the cellOccupancy as necessary
// before it is required.
motion(td);
}
template<class ParcelType>
void Foam::ReactingMultiphaseCloud<ParcelType>::motion
(
typename ParcelType::trackData& td
)
{
ReactingCloud<ParcelType>::motion(td);
}
......
......@@ -121,6 +121,9 @@ protected:
//- Evolve the cloud
void evolveCloud();
//- Particle motion
void motion(typename ParcelType::trackData& td);
//- Post-evolve
void postEvolve();
......
......@@ -86,8 +86,19 @@ void Foam::ThermoCloud<ParcelType>::evolveCloud()
this->g().value()
);
label preInjectionSize = this->size();
// Update the cellOccupancy if the size of the cloud has changed
// during the injection.
this->surfaceFilm().inject(td);
if (preInjectionSize != this->size())
{
this->updateCellOccupancy();
preInjectionSize = this->size();
}
this->injection().inject(td);
if (this->coupled())
......@@ -95,7 +106,19 @@ void Foam::ThermoCloud<ParcelType>::evolveCloud()
resetSourceTerms();
}
Cloud<ParcelType>::move(td);
// Assume that motion will update the cellOccupancy as necessary
// before it is required.
motion(td);
}
template<class ParcelType>
void Foam::ThermoCloud<ParcelType>::motion
(
typename ParcelType::trackData& td
)
{
KinematicCloud<ParcelType>::motion(td);
}
......
......@@ -121,6 +121,9 @@ protected:
//- Evolve the cloud
void evolveCloud();
//- Particle motion
void motion(typename ParcelType::trackData& td);
//- Post-evolve
void postEvolve();
......
......@@ -300,6 +300,27 @@ Foam::CollisionRecordList<PairType, WallType>::matchPairRecord
}
template<class PairType, class WallType>
bool Foam::CollisionRecordList<PairType, WallType>::checkPairRecord
(
label origProcOfOther,
label origIdOfOther
)
{
forAll(pairRecords_, i)
{
PairCollisionRecord<PairType>& pCR = pairRecords_[i];
if (pCR.match(origProcOfOther, origIdOfOther))
{
return true;
}
}
return false;
}
template<class PairType, class WallType>
Foam::WallCollisionRecord<WallType>&
Foam::CollisionRecordList<PairType, WallType>::matchWallRecord
......@@ -333,6 +354,26 @@ Foam::CollisionRecordList<PairType, WallType>::matchWallRecord
}
template<class PairType, class WallType>
bool Foam::CollisionRecordList<PairType, WallType>::checkWallRecord
(
const vector& pRel,
scalar radius
)
{
forAll(wallRecords_, i)
{
WallCollisionRecord<WallType>& wCR = wallRecords_[i];
if (wCR.match(pRel, radius))
{
return true;
}
}
return false;
}
template<class PairType, class WallType>
void Foam::CollisionRecordList<PairType, WallType>::update()
......
......@@ -168,6 +168,10 @@ public:
label origIdOfOther
);
//- Enquire if the specified record exists without modifying
// its accessed status
bool checkPairRecord(label origProcOfOther, label origIdOfOther);
//- Enquires if the position of wall impact relative to the
// particle centre is present in the records. If so, return
// access to the WallCollisionRecord (hence the data) and
......@@ -179,6 +183,10 @@ public:
scalar radius
);
//- Enquire if the specified record exists without modifying
// its accessed status
bool checkWallRecord(const vector& pRel, scalar radius);
//- Update the collision records, deleting any records not
// marked as having been accessed, then mark all records as
// not accessed ready for the next evaluation
......
......@@ -225,6 +225,7 @@ Foam::KinematicParcel<ParcelType>::KinematicParcel
typeId_(p.typeId_),
nParticle_(p.nParticle_),
d_(p.d_),
dTarget_(p.dTarget_),
U_(p.U_),
f_(p.f_),
angularMomentum_(p.angularMomentum_),
......
......@@ -250,6 +250,9 @@ protected:
//- Diameter [m]
scalar d_;
//- Target diameter [m]
scalar dTarget_;
//- Velocity of Parcel [m/s]
vector U_;
......@@ -347,6 +350,7 @@ public:
const label typeId,
const scalar nParticle0,
const scalar d0,
const scalar dTarget0,
const vector& U0,
const vector& f0,
const vector& angularMomentum0,
......@@ -388,6 +392,9 @@ public:
//- Return const access to diameter
inline scalar d() const;
//- Return const access to target diameter
inline scalar dTarget() const;
//- Return const access to velocity
inline const vector& U() const;
......@@ -427,6 +434,9 @@ public:
//- Return access to diameter
inline scalar& d();
//- Return access to target diameter
inline scalar& dTarget();
//- Return access to velocity
inline vector& U();
......@@ -478,19 +488,19 @@ public:
inline scalar volume() const;
//- Particle volume for a given diameter
inline scalar volume(const scalar d) const;
inline static scalar volume(const scalar d);
//- Particle projected area
inline scalar areaP() const;
//- Projected area for given diameter
inline scalar areaP(const scalar d) const;
inline static scalar areaP(const scalar d);
//- Particle surface area
inline scalar areaS() const;
//- Surface area for given diameter
inline scalar areaS(const scalar d) const;
inline static scalar areaS(const scalar d);
//- Reynolds number
inline scalar Re
......
......@@ -91,6 +91,7 @@ inline Foam::KinematicParcel<ParcelType>::KinematicParcel
typeId_(owner.parcelTypeId()),
nParticle_(0),
d_(0.0),
dTarget_(0.0),
U_(vector::zero),
f_(vector::zero),
angularMomentum_(vector::zero),
......@@ -116,6 +117,7 @@ inline Foam::KinematicParcel<ParcelType>::KinematicParcel
const label typeId,
const scalar nParticle0,
const scalar d0,
const scalar dTarget0,
const vector& U0,
const vector& f0,
const vector& angularMomentum0,
......@@ -128,6 +130,7 @@ inline Foam::KinematicParcel<ParcelType>::KinematicParcel
typeId_(typeId),
nParticle_(nParticle0),
d_(d0),
dTarget_(dTarget0),
U_(U0),
f_(f0),
angularMomentum_(angularMomentum0),
......@@ -292,6 +295,13 @@ inline Foam::scalar Foam::KinematicParcel<ParcelType>::d() const
}