lagrangian: Un-templated the tracking data

Tracking data classes are no longer templated on the derived cloud type.
The advantage of this is that they can now be passed to sub models. This
should allow continuous phase data to be removed from the parcel
classes. The disadvantage is that every function which once took a
templated TrackData argument now needs an additional TrackCloudType
argument in order to perform the necessary down-casting.
This commit is contained in:
Will Bainbridge
2017-08-22 15:28:04 +01:00
committed by Andrew Heather
parent 14d2a1efcf
commit 87c15bf1c6
62 changed files with 1196 additions and 832 deletions

View File

@ -143,7 +143,7 @@ void mapLagrangian(const meshToMesh0& meshToMesh0Interp)
IDLList<passiveParticle>() IDLList<passiveParticle>()
); );
particle::TrackingData<passiveParticleCloud> td(targetParcels); passiveParticle::trackingData td(targetParcels);
label sourceParticleI = 0; label sourceParticleI = 0;

View File

@ -133,7 +133,7 @@ void mapLagrangian(const meshToMesh& interp)
IDLList<passiveParticle>() IDLList<passiveParticle>()
); );
particle::TrackingData<passiveParticleCloud> td(targetParcels); passiveParticle::trackingData td(targetParcels);
label sourceParticleI = 0; label sourceParticleI = 0;

View File

@ -95,6 +95,7 @@ Foam::findCellParticle::findCellParticle
bool Foam::findCellParticle::move bool Foam::findCellParticle::move
( (
Cloud<findCellParticle>& cloud,
trackingData& td, trackingData& td,
const scalar maxTrackLen const scalar maxTrackLen
) )
@ -105,7 +106,7 @@ bool Foam::findCellParticle::move
while (td.keepParticle && !td.switchProcessor && stepFraction() < 1) while (td.keepParticle && !td.switchProcessor && stepFraction() < 1)
{ {
const scalar f = 1 - stepFraction(); const scalar f = 1 - stepFraction();
trackToAndHitFace(f*(end_ - start_), f, td); trackToAndHitFace(f*(end_ - start_), f, cloud, td);
} }
if (stepFraction() == 1 || !td.keepParticle) if (stepFraction() == 1 || !td.keepParticle)
@ -123,6 +124,7 @@ bool Foam::findCellParticle::move
bool Foam::findCellParticle::hitPatch bool Foam::findCellParticle::hitPatch
( (
const polyPatch&, const polyPatch&,
Cloud<findCellParticle>& cloud,
trackingData& td, trackingData& td,
const label patchi, const label patchi,
const scalar trackFraction, const scalar trackFraction,
@ -136,6 +138,7 @@ bool Foam::findCellParticle::hitPatch
void Foam::findCellParticle::hitWedgePatch void Foam::findCellParticle::hitWedgePatch
( (
const wedgePolyPatch&, const wedgePolyPatch&,
Cloud<findCellParticle>& cloud,
trackingData& td trackingData& td
) )
{ {
@ -147,6 +150,7 @@ void Foam::findCellParticle::hitWedgePatch
void Foam::findCellParticle::hitSymmetryPlanePatch void Foam::findCellParticle::hitSymmetryPlanePatch
( (
const symmetryPlanePolyPatch&, const symmetryPlanePolyPatch&,
Cloud<findCellParticle>& cloud,
trackingData& td trackingData& td
) )
{ {
@ -158,6 +162,7 @@ void Foam::findCellParticle::hitSymmetryPlanePatch
void Foam::findCellParticle::hitSymmetryPatch void Foam::findCellParticle::hitSymmetryPatch
( (
const symmetryPolyPatch&, const symmetryPolyPatch&,
Cloud<findCellParticle>& cloud,
trackingData& td trackingData& td
) )
{ {
@ -169,6 +174,7 @@ void Foam::findCellParticle::hitSymmetryPatch
void Foam::findCellParticle::hitCyclicPatch void Foam::findCellParticle::hitCyclicPatch
( (
const cyclicPolyPatch&, const cyclicPolyPatch&,
Cloud<findCellParticle>& cloud,
trackingData& td trackingData& td
) )
{ {
@ -180,6 +186,7 @@ void Foam::findCellParticle::hitCyclicPatch
void Foam::findCellParticle::hitProcessorPatch void Foam::findCellParticle::hitProcessorPatch
( (
const processorPolyPatch&, const processorPolyPatch&,
Cloud<findCellParticle>& cloud,
trackingData& td trackingData& td
) )
{ {
@ -191,6 +198,7 @@ void Foam::findCellParticle::hitProcessorPatch
void Foam::findCellParticle::hitWallPatch void Foam::findCellParticle::hitWallPatch
( (
const wallPolyPatch& wpp, const wallPolyPatch& wpp,
Cloud<findCellParticle>& cloud,
trackingData& td, trackingData& td,
const tetIndices& const tetIndices&
) )
@ -203,6 +211,7 @@ void Foam::findCellParticle::hitWallPatch
void Foam::findCellParticle::hitPatch void Foam::findCellParticle::hitPatch
( (
const polyPatch& wpp, const polyPatch& wpp,
Cloud<findCellParticle>& cloud,
trackingData& td trackingData& td
) )
{ {

View File

@ -80,7 +80,7 @@ public:
//- Class used to pass tracking data to the trackToFace function //- Class used to pass tracking data to the trackToFace function
class trackingData class trackingData
: :
public particle::TrackingData<Cloud<findCellParticle>> public particle::trackingData
{ {
labelListList& cellToData_; labelListList& cellToData_;
List<List<point>>& cellToEnd_; List<List<point>>& cellToEnd_;
@ -96,7 +96,7 @@ public:
List<List<point>>& cellToEnd List<List<point>>& cellToEnd
) )
: :
particle::TrackingData<Cloud<findCellParticle>>(cloud), particle::trackingData(cloud),
cellToData_(cellToData), cellToData_(cellToData),
cellToEnd_(cellToEnd) cellToEnd_(cellToEnd)
{} {}
@ -220,7 +220,7 @@ public:
// Tracking // Tracking
//- Track all particles to their end point //- Track all particles to their end point
bool move(trackingData&, const scalar); bool move(Cloud<findCellParticle>&, trackingData&, const scalar);
//- Overridable function to handle the particle hitting a patch //- Overridable function to handle the particle hitting a patch
@ -228,6 +228,7 @@ public:
bool hitPatch bool hitPatch
( (
const polyPatch&, const polyPatch&,
Cloud<findCellParticle>&,
trackingData& td, trackingData& td,
const label patchi, const label patchi,
const scalar trackFraction, const scalar trackFraction,
@ -238,6 +239,7 @@ public:
void hitWedgePatch void hitWedgePatch
( (
const wedgePolyPatch&, const wedgePolyPatch&,
Cloud<findCellParticle>&,
trackingData& td trackingData& td
); );
@ -246,6 +248,7 @@ public:
void hitSymmetryPlanePatch void hitSymmetryPlanePatch
( (
const symmetryPlanePolyPatch&, const symmetryPlanePolyPatch&,
Cloud<findCellParticle>&,
trackingData& td trackingData& td
); );
@ -254,6 +257,7 @@ public:
void hitSymmetryPatch void hitSymmetryPatch
( (
const symmetryPolyPatch&, const symmetryPolyPatch&,
Cloud<findCellParticle>&,
trackingData& td trackingData& td
); );
@ -261,6 +265,7 @@ public:
void hitCyclicPatch void hitCyclicPatch
( (
const cyclicPolyPatch&, const cyclicPolyPatch&,
Cloud<findCellParticle>&,
trackingData& td trackingData& td
); );
@ -269,6 +274,7 @@ public:
void hitProcessorPatch void hitProcessorPatch
( (
const processorPolyPatch&, const processorPolyPatch&,
Cloud<findCellParticle>&,
trackingData& td trackingData& td
); );
@ -276,6 +282,7 @@ public:
void hitWallPatch void hitWallPatch
( (
const wallPolyPatch&, const wallPolyPatch&,
Cloud<findCellParticle>&,
trackingData& td, trackingData& td,
const tetIndices& const tetIndices&
); );
@ -284,6 +291,7 @@ public:
void hitPatch void hitPatch
( (
const polyPatch&, const polyPatch&,
Cloud<findCellParticle>&,
trackingData& td trackingData& td
); );

View File

@ -189,7 +189,7 @@ void Foam::functionObjects::nearWallFields::calcAddressing()
} }
cloud.move(td, maxTrackLen); cloud.move(cloud, td, maxTrackLen);
// Rework cell-to-globalpatchface into a map // Rework cell-to-globalpatchface into a map

View File

@ -112,7 +112,7 @@ void Foam::functionObjects::streamLine::track()
const scalar trackTime = Foam::sqrt(GREAT); const scalar trackTime = Foam::sqrt(GREAT);
// Track // Track
particles.move(td, trackTime); particles.move(particles, td, trackTime);
} }

View File

@ -24,6 +24,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "streamLineParticle.H" #include "streamLineParticle.H"
#include "streamLineParticleCloud.H"
#include "vectorFieldIOField.H" #include "vectorFieldIOField.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -140,6 +141,7 @@ Foam::streamLineParticle::streamLineParticle
bool Foam::streamLineParticle::move bool Foam::streamLineParticle::move
( (
streamLineParticleCloud& cloud,
trackingData& td, trackingData& td,
const scalar const scalar
) )
@ -198,7 +200,7 @@ bool Foam::streamLineParticle::move
dt = maxDt; dt = maxDt;
} }
trackToAndHitFace(dt*U, 0, td); trackToAndHitFace(dt*U, 0, cloud, td);
if if
( (
@ -266,6 +268,7 @@ bool Foam::streamLineParticle::move
bool Foam::streamLineParticle::hitPatch bool Foam::streamLineParticle::hitPatch
( (
const polyPatch&, const polyPatch&,
streamLineParticleCloud& cloud,
trackingData& td, trackingData& td,
const label patchi, const label patchi,
const scalar trackFraction, const scalar trackFraction,
@ -280,6 +283,7 @@ bool Foam::streamLineParticle::hitPatch
void Foam::streamLineParticle::hitWedgePatch void Foam::streamLineParticle::hitWedgePatch
( (
const wedgePolyPatch& pp, const wedgePolyPatch& pp,
streamLineParticleCloud& cloud,
trackingData& td trackingData& td
) )
{ {
@ -291,6 +295,7 @@ void Foam::streamLineParticle::hitWedgePatch
void Foam::streamLineParticle::hitSymmetryPlanePatch void Foam::streamLineParticle::hitSymmetryPlanePatch
( (
const symmetryPlanePolyPatch& pp, const symmetryPlanePolyPatch& pp,
streamLineParticleCloud& cloud,
trackingData& td trackingData& td
) )
{ {
@ -302,6 +307,7 @@ void Foam::streamLineParticle::hitSymmetryPlanePatch
void Foam::streamLineParticle::hitSymmetryPatch void Foam::streamLineParticle::hitSymmetryPatch
( (
const symmetryPolyPatch& pp, const symmetryPolyPatch& pp,
streamLineParticleCloud& cloud,
trackingData& td trackingData& td
) )
{ {
@ -313,6 +319,7 @@ void Foam::streamLineParticle::hitSymmetryPatch
void Foam::streamLineParticle::hitCyclicPatch void Foam::streamLineParticle::hitCyclicPatch
( (
const cyclicPolyPatch& pp, const cyclicPolyPatch& pp,
streamLineParticleCloud& cloud,
trackingData& td trackingData& td
) )
{ {
@ -324,6 +331,7 @@ void Foam::streamLineParticle::hitCyclicPatch
void Foam::streamLineParticle::hitProcessorPatch void Foam::streamLineParticle::hitProcessorPatch
( (
const processorPolyPatch&, const processorPolyPatch&,
streamLineParticleCloud& cloud,
trackingData& td trackingData& td
) )
{ {
@ -335,6 +343,7 @@ void Foam::streamLineParticle::hitProcessorPatch
void Foam::streamLineParticle::hitWallPatch void Foam::streamLineParticle::hitWallPatch
( (
const wallPolyPatch& wpp, const wallPolyPatch& wpp,
streamLineParticleCloud& cloud,
trackingData& td, trackingData& td,
const tetIndices& const tetIndices&
) )
@ -347,6 +356,7 @@ void Foam::streamLineParticle::hitWallPatch
void Foam::streamLineParticle::hitPatch void Foam::streamLineParticle::hitPatch
( (
const polyPatch& wpp, const polyPatch& wpp,
streamLineParticleCloud& cloud,
trackingData& td trackingData& td
) )
{ {

View File

@ -49,6 +49,7 @@ namespace Foam
// Forward declaration of friend functions and operators // Forward declaration of friend functions and operators
class streamLineParticle; class streamLineParticle;
class streamLineParticleCloud;
Ostream& operator<<(Ostream&, const streamLineParticle&); Ostream& operator<<(Ostream&, const streamLineParticle&);
@ -64,7 +65,7 @@ public:
class trackingData class trackingData
: :
public particle::TrackingData<Cloud<streamLineParticle>> public particle::trackingData
{ {
public: public:
@ -94,7 +95,7 @@ public:
//- Construct from components //- Construct from components
trackingData trackingData
( (
Cloud<streamLineParticle>& cloud, streamLineParticleCloud& cloud,
const PtrList<interpolation<scalar>>& vsInterp, const PtrList<interpolation<scalar>>& vsInterp,
const PtrList<interpolation<vector>>& vvInterp, const PtrList<interpolation<vector>>& vvInterp,
const label UIndex, const label UIndex,
@ -106,7 +107,7 @@ public:
List<DynamicList<vectorList>>& allVectors List<DynamicList<vectorList>>& allVectors
) )
: :
particle::TrackingData<Cloud<streamLineParticle>>(cloud), particle::trackingData(cloud),
vsInterp_(vsInterp), vsInterp_(vsInterp),
vvInterp_(vvInterp), vvInterp_(vvInterp),
UIndex_(UIndex), UIndex_(UIndex),
@ -206,13 +207,19 @@ public:
// Tracking // Tracking
//- Track all particles to their end point //- Track all particles to their end point
bool move(trackingData&, const scalar); bool move
(
streamLineParticleCloud& cloud,
trackingData&,
const scalar
);
//- Overridable function to handle the particle hitting a patch //- Overridable function to handle the particle hitting a patch
// Executed before other patch-hitting functions // Executed before other patch-hitting functions
bool hitPatch bool hitPatch
( (
const polyPatch&, const polyPatch&,
streamLineParticleCloud& cloud,
trackingData& td, trackingData& td,
const label patchi, const label patchi,
const scalar trackFraction, const scalar trackFraction,
@ -223,6 +230,7 @@ public:
void hitWedgePatch void hitWedgePatch
( (
const wedgePolyPatch&, const wedgePolyPatch&,
streamLineParticleCloud& cloud,
trackingData& td trackingData& td
); );
@ -231,6 +239,7 @@ public:
void hitSymmetryPlanePatch void hitSymmetryPlanePatch
( (
const symmetryPlanePolyPatch&, const symmetryPlanePolyPatch&,
streamLineParticleCloud& cloud,
trackingData& td trackingData& td
); );
@ -239,6 +248,7 @@ public:
void hitSymmetryPatch void hitSymmetryPatch
( (
const symmetryPolyPatch&, const symmetryPolyPatch&,
streamLineParticleCloud& cloud,
trackingData& td trackingData& td
); );
@ -246,6 +256,7 @@ public:
void hitCyclicPatch void hitCyclicPatch
( (
const cyclicPolyPatch&, const cyclicPolyPatch&,
streamLineParticleCloud& cloud,
trackingData& td trackingData& td
); );
@ -254,6 +265,7 @@ public:
void hitProcessorPatch void hitProcessorPatch
( (
const processorPolyPatch&, const processorPolyPatch&,
streamLineParticleCloud& cloud,
trackingData& td trackingData& td
); );
@ -261,6 +273,7 @@ public:
void hitWallPatch void hitWallPatch
( (
const wallPolyPatch&, const wallPolyPatch&,
streamLineParticleCloud& cloud,
trackingData& td, trackingData& td,
const tetIndices& const tetIndices&
); );
@ -269,6 +282,7 @@ public:
void hitPatch void hitPatch
( (
const polyPatch&, const polyPatch&,
streamLineParticleCloud& cloud,
trackingData& td trackingData& td
); );

View File

@ -952,7 +952,7 @@ void Foam::DSMCCloud<ParcelType>::evolve()
this->inflowBoundary().inflow(); this->inflowBoundary().inflow();
// Move the particles ballistically with their current velocities // Move the particles ballistically with their current velocities
Cloud<ParcelType>::move(td, mesh_.time().deltaTValue()); Cloud<ParcelType>::move(*this, td, mesh_.time().deltaTValue());
// Update cell occupancy // Update cell occupancy
buildCellOccupancy(); buildCellOccupancy();

View File

@ -29,16 +29,21 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ParcelType> template<class ParcelType>
template<class TrackData> template<class TrackCloudType>
bool Foam::DSMCParcel<ParcelType>::move(TrackData& td, const scalar trackTime) bool Foam::DSMCParcel<ParcelType>::move
(
TrackCloudType& cloud,
trackingData& td,
const scalar trackTime
)
{ {
typename TrackData::cloudType::parcelType& p = typename TrackCloudType::parcelType& p =
static_cast<typename TrackData::cloudType::parcelType&>(*this); static_cast<typename TrackCloudType::parcelType&>(*this);
td.switchProcessor = false; td.switchProcessor = false;
td.keepParticle = true; td.keepParticle = true;
const polyMesh& mesh = td.cloud().pMesh(); const polyMesh& mesh = cloud.pMesh();
const polyBoundaryMesh& pbMesh = mesh.boundaryMesh(); const polyBoundaryMesh& pbMesh = mesh.boundaryMesh();
// For reduced-D cases, the velocity used to track needs to be // For reduced-D cases, the velocity used to track needs to be
@ -59,7 +64,7 @@ bool Foam::DSMCParcel<ParcelType>::move(TrackData& td, const scalar trackTime)
meshTools::constrainDirection(mesh, mesh.solutionD(), Utracking); meshTools::constrainDirection(mesh, mesh.solutionD(), Utracking);
const scalar f = 1 - p.stepFraction(); const scalar f = 1 - p.stepFraction();
p.trackToAndHitFace(f*trackTime*Utracking, f, td); p.trackToAndHitFace(f*trackTime*Utracking, f, cloud, td);
if (p.onBoundaryFace() && td.keepParticle) if (p.onBoundaryFace() && td.keepParticle)
{ {
@ -75,11 +80,12 @@ bool Foam::DSMCParcel<ParcelType>::move(TrackData& td, const scalar trackTime)
template<class ParcelType> template<class ParcelType>
template<class TrackData> template<class TrackCloudType>
bool Foam::DSMCParcel<ParcelType>::hitPatch bool Foam::DSMCParcel<ParcelType>::hitPatch
( (
const polyPatch&, const polyPatch&,
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const label, const label,
const scalar, const scalar,
const tetIndices& const tetIndices&
@ -90,11 +96,12 @@ bool Foam::DSMCParcel<ParcelType>::hitPatch
template<class ParcelType> template<class ParcelType>
template<class TrackData> template<class TrackCloudType>
void Foam::DSMCParcel<ParcelType>::hitProcessorPatch void Foam::DSMCParcel<ParcelType>::hitProcessorPatch
( (
const processorPolyPatch&, const processorPolyPatch&,
TrackData& td TrackCloudType& cloud,
trackingData& td
) )
{ {
td.switchProcessor = true; td.switchProcessor = true;
@ -102,11 +109,12 @@ void Foam::DSMCParcel<ParcelType>::hitProcessorPatch
template<class ParcelType> template<class ParcelType>
template<class TrackData> template<class TrackCloudType>
void Foam::DSMCParcel<ParcelType>::hitWallPatch void Foam::DSMCParcel<ParcelType>::hitWallPatch
( (
const wallPolyPatch& wpp, const wallPolyPatch& wpp,
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const tetIndices& tetIs const tetIndices& tetIs
) )
{ {
@ -116,9 +124,9 @@ void Foam::DSMCParcel<ParcelType>::hitWallPatch
const scalar fA = mag(wpp.faceAreas()[wppLocalFace]); const scalar fA = mag(wpp.faceAreas()[wppLocalFace]);
const scalar deltaT = td.cloud().pMesh().time().deltaTValue(); const scalar deltaT = cloud.pMesh().time().deltaTValue();
const constantProperties& constProps(td.cloud().constProps(typeId_)); const constantProperties& constProps(cloud.constProps(typeId_));
scalar m = constProps.mass(); scalar m = constProps.mass();
@ -131,19 +139,19 @@ void Foam::DSMCParcel<ParcelType>::hitWallPatch
scalar invMagUnfA = 1/max(mag(U_dot_nw)*fA, VSMALL); scalar invMagUnfA = 1/max(mag(U_dot_nw)*fA, VSMALL);
td.cloud().rhoNBF()[wppIndex][wppLocalFace] += invMagUnfA; cloud.rhoNBF()[wppIndex][wppLocalFace] += invMagUnfA;
td.cloud().rhoMBF()[wppIndex][wppLocalFace] += m*invMagUnfA; cloud.rhoMBF()[wppIndex][wppLocalFace] += m*invMagUnfA;
td.cloud().linearKEBF()[wppIndex][wppLocalFace] += cloud.linearKEBF()[wppIndex][wppLocalFace] +=
0.5*m*(U_ & U_)*invMagUnfA; 0.5*m*(U_ & U_)*invMagUnfA;
td.cloud().internalEBF()[wppIndex][wppLocalFace] += Ei_*invMagUnfA; cloud.internalEBF()[wppIndex][wppLocalFace] += Ei_*invMagUnfA;
td.cloud().iDofBF()[wppIndex][wppLocalFace] += cloud.iDofBF()[wppIndex][wppLocalFace] +=
constProps.internalDegreesOfFreedom()*invMagUnfA; constProps.internalDegreesOfFreedom()*invMagUnfA;
td.cloud().momentumBF()[wppIndex][wppLocalFace] += m*Ut*invMagUnfA; cloud.momentumBF()[wppIndex][wppLocalFace] += m*Ut*invMagUnfA;
// pre-interaction energy // pre-interaction energy
scalar preIE = 0.5*m*(U_ & U_) + Ei_; scalar preIE = 0.5*m*(U_ & U_) + Ei_;
@ -151,7 +159,7 @@ void Foam::DSMCParcel<ParcelType>::hitWallPatch
// pre-interaction momentum // pre-interaction momentum
vector preIMom = m*U_; vector preIMom = m*U_;
td.cloud().wallInteraction().correct cloud.wallInteraction().correct
( (
static_cast<DSMCParcel<ParcelType> &>(*this), static_cast<DSMCParcel<ParcelType> &>(*this),
wpp wpp
@ -163,19 +171,19 @@ void Foam::DSMCParcel<ParcelType>::hitWallPatch
invMagUnfA = 1/max(mag(U_dot_nw)*fA, VSMALL); invMagUnfA = 1/max(mag(U_dot_nw)*fA, VSMALL);
td.cloud().rhoNBF()[wppIndex][wppLocalFace] += invMagUnfA; cloud.rhoNBF()[wppIndex][wppLocalFace] += invMagUnfA;
td.cloud().rhoMBF()[wppIndex][wppLocalFace] += m*invMagUnfA; cloud.rhoMBF()[wppIndex][wppLocalFace] += m*invMagUnfA;
td.cloud().linearKEBF()[wppIndex][wppLocalFace] += cloud.linearKEBF()[wppIndex][wppLocalFace] +=
0.5*m*(U_ & U_)*invMagUnfA; 0.5*m*(U_ & U_)*invMagUnfA;
td.cloud().internalEBF()[wppIndex][wppLocalFace] += Ei_*invMagUnfA; cloud.internalEBF()[wppIndex][wppLocalFace] += Ei_*invMagUnfA;
td.cloud().iDofBF()[wppIndex][wppLocalFace] += cloud.iDofBF()[wppIndex][wppLocalFace] +=
constProps.internalDegreesOfFreedom()*invMagUnfA; constProps.internalDegreesOfFreedom()*invMagUnfA;
td.cloud().momentumBF()[wppIndex][wppLocalFace] += m*Ut*invMagUnfA; cloud.momentumBF()[wppIndex][wppLocalFace] += m*Ut*invMagUnfA;
// post-interaction energy // post-interaction energy
scalar postIE = 0.5*m*(U_ & U_) + Ei_; scalar postIE = 0.5*m*(U_ & U_) + Ei_;
@ -183,20 +191,25 @@ void Foam::DSMCParcel<ParcelType>::hitWallPatch
// post-interaction momentum // post-interaction momentum
vector postIMom = m*U_; vector postIMom = m*U_;
scalar deltaQ = td.cloud().nParticle()*(preIE - postIE)/(deltaT*fA); scalar deltaQ = cloud.nParticle()*(preIE - postIE)/(deltaT*fA);
vector deltaFD = td.cloud().nParticle()*(preIMom - postIMom)/(deltaT*fA); vector deltaFD = cloud.nParticle()*(preIMom - postIMom)/(deltaT*fA);
td.cloud().qBF()[wppIndex][wppLocalFace] += deltaQ; cloud.qBF()[wppIndex][wppLocalFace] += deltaQ;
td.cloud().fDBF()[wppIndex][wppLocalFace] += deltaFD; cloud.fDBF()[wppIndex][wppLocalFace] += deltaFD;
} }
template<class ParcelType> template<class ParcelType>
template<class TrackData> template<class TrackCloudType>
void Foam::DSMCParcel<ParcelType>::hitPatch(const polyPatch&, TrackData& td) void Foam::DSMCParcel<ParcelType>::hitPatch
(
const polyPatch&,
TrackCloudType& cloud,
trackingData& td
)
{ {
td.keepParticle = false; td.keepParticle = false;
} }

View File

@ -125,24 +125,8 @@ public:
}; };
//- Class used to pass kinematic tracking data to the trackToFace function //- Use base tracking data
class trackingData typedef typename ParcelType::trackingData trackingData;
:
public particle::TrackingData<DSMCCloud<DSMCParcel<ParcelType>>>
{
public:
// Constructors
//- Construct from components
trackingData(DSMCCloud<DSMCParcel<ParcelType>>& cloud)
:
particle::TrackingData<DSMCCloud<DSMCParcel<ParcelType>>>
(
cloud
)
{}
};
protected: protected:
@ -262,19 +246,25 @@ public:
// Tracking // Tracking
//- Move the parcel //- Move the parcel
template<class TrackData> template<class TrackCloudType>
bool move(TrackData& td, const scalar trackTime); bool move
(
TrackCloudType& cloud,
trackingData& td,
const scalar trackTime
);
// Patch interactions // Patch interactions
//- Overridable function to handle the particle hitting a patch //- Overridable function to handle the particle hitting a patch
// Executed before other patch-hitting functions // Executed before other patch-hitting functions
template<class TrackData> template<class TrackCloudType>
bool hitPatch bool hitPatch
( (
const polyPatch&, const polyPatch&,
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const label patchi, const label patchi,
const scalar trackFraction, const scalar trackFraction,
const tetIndices& tetIs const tetIndices& tetIs
@ -282,28 +272,31 @@ public:
//- Overridable function to handle the particle hitting a //- Overridable function to handle the particle hitting a
// processorPatch // processorPatch
template<class TrackData> template<class TrackCloudType>
void hitProcessorPatch void hitProcessorPatch
( (
const processorPolyPatch&, const processorPolyPatch&,
TrackData& td TrackCloudType& cloud,
trackingData& td
); );
//- Overridable function to handle the particle hitting a wallPatch //- Overridable function to handle the particle hitting a wallPatch
template<class TrackData> template<class TrackCloudType>
void hitWallPatch void hitWallPatch
( (
const wallPolyPatch&, const wallPolyPatch&,
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const tetIndices& const tetIndices&
); );
//- Overridable function to handle the particle hitting a polyPatch //- Overridable function to handle the particle hitting a polyPatch
template<class TrackData> template<class TrackCloudType>
void hitPatch void hitPatch
( (
const polyPatch&, const polyPatch&,
TrackData& td TrackCloudType& cloud,
trackingData& td
); );
//- Transform the physical properties of the particle //- Transform the physical properties of the particle

View File

@ -181,8 +181,13 @@ void Foam::Cloud<ParticleType>::cloudReset(const Cloud<ParticleType>& c)
template<class ParticleType> template<class ParticleType>
template<class TrackData> template<class TrackCloudType>
void Foam::Cloud<ParticleType>::move(TrackData& td, const scalar trackTime) void Foam::Cloud<ParticleType>::move
(
TrackCloudType& cloud,
typename ParticleType::trackingData& td,
const scalar trackTime
)
{ {
const polyBoundaryMesh& pbm = pMesh().boundaryMesh(); const polyBoundaryMesh& pbm = pMesh().boundaryMesh();
const globalMeshData& pData = polyMesh_.globalData(); const globalMeshData& pData = polyMesh_.globalData();
@ -253,7 +258,7 @@ void Foam::Cloud<ParticleType>::move(TrackData& td, const scalar trackTime)
ParticleType& p = pIter(); ParticleType& p = pIter();
// Move the particle // Move the particle
bool keepParticle = p.move(td, trackTime); bool keepParticle = p.move(cloud, td, trackTime);
// If the particle is to be kept // If the particle is to be kept
// (i.e. it hasn't passed through an inlet or outlet) // (i.e. it hasn't passed through an inlet or outlet)
@ -282,7 +287,7 @@ void Foam::Cloud<ParticleType>::move(TrackData& td, const scalar trackTime)
).neighbProcNo() ).neighbProcNo()
]; ];
p.prepareForParallelTransfer(patchi, td); p.prepareForParallelTransfer(patchi, cloud, td);
particleTransferLists[n].append(this->remove(&p)); particleTransferLists[n].append(this->remove(&p));
@ -375,7 +380,7 @@ void Foam::Cloud<ParticleType>::move(TrackData& td, const scalar trackTime)
label patchi = procPatches[receivePatchIndex[pI++]]; label patchi = procPatches[receivePatchIndex[pI++]];
newp.correctAfterParallelTransfer(patchi, td); newp.correctAfterParallelTransfer(patchi, cloud, td);
addParticle(newParticles.remove(&newp)); addParticle(newParticles.remove(&newp));
} }

View File

@ -253,9 +253,13 @@ public:
void cloudReset(const Cloud<ParticleType>& c); void cloudReset(const Cloud<ParticleType>& c);
//- Move the particles //- Move the particles
// passing the TrackingData to the track function template<class TrackCloudType>
template<class TrackData> void move
void move(TrackData& td, const scalar trackTime); (
TrackCloudType& cloud,
typename ParticleType::trackingData& td,
const scalar trackTime
);
//- Remap the cells of particles corresponding to the //- Remap the cells of particles corresponding to the
// mesh topology change // mesh topology change

View File

@ -106,21 +106,12 @@ class particle
public: public:
template<class CloudType> class trackingData
class TrackingData
{ {
// Private data
//- Reference to the cloud containing (this) particle
CloudType& cloud_;
public: public:
// Public data // Public data
typedef CloudType cloudType;
//- Flag to switch processor //- Flag to switch processor
bool switchProcessor; bool switchProcessor;
@ -129,19 +120,9 @@ public:
// Constructor // Constructor
TrackingData(CloudType& cloud) template <class TrackCloudType>
: trackingData(const TrackCloudType& cloud)
cloud_(cloud)
{} {}
// Member functions
//- Return a reference to the cloud
CloudType& cloud()
{
return cloud_;
}
}; };
@ -305,75 +286,105 @@ protected:
// patch. Executed before other patch-hitting functions. // patch. Executed before other patch-hitting functions.
// trackFraction is passed in to allow mesh motion to // trackFraction is passed in to allow mesh motion to
// interpolate in time to the correct face state. // interpolate in time to the correct face state.
template<class TrackData> template<class TrackCloudType>
bool hitPatch bool hitPatch
( (
const polyPatch&, const polyPatch&,
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const label patchi, const label patchi,
const scalar trackFraction, const scalar trackFraction,
const tetIndices& tetIs const tetIndices& tetIs
); );
//- Overridable function to handle the particle hitting a wedgePatch //- Overridable function to handle the particle hitting a wedgePatch
template<class TrackData> template<class TrackCloudType>
void hitWedgePatch(const wedgePolyPatch&, TrackData& td); void hitWedgePatch
(
const wedgePolyPatch&,
TrackCloudType& cloud,
trackingData& td
);
//- Overridable function to handle the particle hitting a //- Overridable function to handle the particle hitting a
// symmetryPlanePatch // symmetryPlanePatch
template<class TrackData> template<class TrackCloudType>
void hitSymmetryPlanePatch void hitSymmetryPlanePatch
( (
const symmetryPlanePolyPatch&, const symmetryPlanePolyPatch&,
TrackData& td TrackCloudType& cloud,
trackingData& td
); );
//- Overridable function to handle the particle hitting a //- Overridable function to handle the particle hitting a
// symmetryPatch // symmetryPatch
template<class TrackData> template<class TrackCloudType>
void hitSymmetryPatch(const symmetryPolyPatch&, TrackData& td); void hitSymmetryPatch
(
const symmetryPolyPatch&,
TrackCloudType& cloud,
trackingData& td
);
//- Overridable function to handle the particle hitting a cyclicPatch //- Overridable function to handle the particle hitting a cyclicPatch
template<class TrackData> template<class TrackCloudType>
void hitCyclicPatch(const cyclicPolyPatch&, TrackData& td); void hitCyclicPatch
(
const cyclicPolyPatch&,
TrackCloudType& cloud,
trackingData& td
);
//- Overridable function to handle the particle hitting a cyclicAMIPatch //- Overridable function to handle the particle hitting a cyclicAMIPatch
template<class TrackData> template<class TrackCloudType>
void hitCyclicAMIPatch void hitCyclicAMIPatch
( (
const cyclicAMIPolyPatch&, const cyclicAMIPolyPatch&,
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const vector& direction const vector& direction
); );
//- Overridable function to handle the particle hitting a //- Overridable function to handle the particle hitting a
// cyclicACMIPatch // cyclicACMIPatch
template<class TrackData> template<class TrackCloudType>
void hitCyclicACMIPatch void hitCyclicACMIPatch
( (
const cyclicACMIPolyPatch&, const cyclicACMIPolyPatch&,
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const vector& direction const vector& direction
); );
//- Overridable function to handle the particle hitting a //- Overridable function to handle the particle hitting a
// processorPatch // processorPatch
template<class TrackData> template<class TrackCloudType>
void hitProcessorPatch(const processorPolyPatch&, TrackData& td); void hitProcessorPatch
(
const processorPolyPatch&,
TrackCloudType& cloud,
trackingData& td
);
//- Overridable function to handle the particle hitting a wallPatch //- Overridable function to handle the particle hitting a wallPatch
template<class TrackData> template<class TrackCloudType>
void hitWallPatch void hitWallPatch
( (
const wallPolyPatch&, const wallPolyPatch&,
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const tetIndices& tetIs const tetIndices& tetIs
); );
//- Overridable function to handle the particle hitting a //- Overridable function to handle the particle hitting a
// general patch // general patch
template<class TrackData> template<class TrackCloudType>
void hitPatch(const polyPatch&, TrackData& td); void hitPatch
(
const polyPatch&,
TrackCloudType& cloud,
trackingData& td
);
public: public:
@ -604,20 +615,22 @@ public:
//- Hit the current face. If the current face is internal than this //- Hit the current face. If the current face is internal than this
// crosses into the next cell. If it is a boundary face then this will // crosses into the next cell. If it is a boundary face then this will
// interact the particle with the relevant patch. // interact the particle with the relevant patch.
template<class TrackData> template<class TrackCloudType>
void hitFace void hitFace
( (
const vector& direction, const vector& direction,
TrackData& td TrackCloudType& cloud,
trackingData& td
); );
//- Convenience function. Combines trackToFace and hitFace //- Convenience function. Cobines trackToFace and hitFace
template<class TrackData> template<class TrackCloudType>
void trackToAndHitFace void trackToAndHitFace
( (
const vector& direction, const vector& direction,
const scalar fraction, const scalar fraction,
TrackData& td TrackCloudType& cloud,
trackingData& td
); );
//- Set the constrained components of the particle position to the //- Set the constrained components of the particle position to the
@ -650,13 +663,23 @@ public:
//- Convert global addressing to the processor patch //- Convert global addressing to the processor patch
// local equivalents // local equivalents
template<class TrackData> template<class TrackCloudType>
void prepareForParallelTransfer(const label patchi, TrackData& td); void prepareForParallelTransfer
(
const label patchi,
TrackCloudType& cloud,
trackingData& td
);
//- Convert processor patch addressing to the global equivalents //- Convert processor patch addressing to the global equivalents
// and set the celli to the face-neighbour // and set the celli to the face-neighbour
template<class TrackData> template<class TrackCloudType>
void correctAfterParallelTransfer(const label patchi, TrackData& td); void correctAfterParallelTransfer
(
const label patchi,
TrackCloudType& cloud,
trackingData& td
);
// Interaction list referral // Interaction list referral
@ -698,12 +721,12 @@ public:
// I-O // I-O
//- Read the fields associated with the owner cloud //- Read the fields associated with the owner cloud
template<class CloudType> template<class TrackCloudType>
static void readFields(CloudType& c); static void readFields(TrackCloudType& c);
//- Write the fields associated with the owner cloud //- Write the fields associated with the owner cloud
template<class CloudType> template<class TrackCloudType>
static void writeFields(const CloudType& c); static void writeFields(const TrackCloudType& c);
//- Write particle fields as objects into the obr registry //- Write particle fields as objects into the obr registry
template<class CloudType> template<class CloudType>

View File

@ -37,11 +37,12 @@ License
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class TrackData> template<class TrackCloudType>
void Foam::particle::prepareForParallelTransfer void Foam::particle::prepareForParallelTransfer
( (
const label patchi, const label patchi,
TrackData& td TrackCloudType& cloud,
trackingData& td
) )
{ {
// Convert the face index to be local to the processor patch // Convert the face index to be local to the processor patch
@ -49,11 +50,12 @@ void Foam::particle::prepareForParallelTransfer
} }
template<class TrackData> template<class TrackCloudType>
void Foam::particle::correctAfterParallelTransfer void Foam::particle::correctAfterParallelTransfer
( (
const label patchi, const label patchi,
TrackData& td TrackCloudType& cloud,
trackingData& td
) )
{ {
const coupledPolyPatch& ppp = const coupledPolyPatch& ppp =
@ -101,8 +103,8 @@ void Foam::particle::correctAfterParallelTransfer
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType> template<class TrackCloudType>
void Foam::particle::readFields(CloudType& c) void Foam::particle::readFields(TrackCloudType& c)
{ {
bool valid = c.size(); bool valid = c.size();
@ -120,7 +122,7 @@ void Foam::particle::readFields(CloudType& c)
c.checkFieldIOobject(c, origId); c.checkFieldIOobject(c, origId);
label i = 0; label i = 0;
forAllIter(typename CloudType, c, iter) forAllIter(typename TrackCloudType, c, iter)
{ {
particle& p = iter(); particle& p = iter();
@ -131,12 +133,12 @@ void Foam::particle::readFields(CloudType& c)
} }
template<class CloudType> template<class TrackCloudType>
void Foam::particle::writeFields(const CloudType& c) void Foam::particle::writeFields(const TrackCloudType& c)
{ {
label np = c.size(); label np = c.size();
IOPosition<CloudType> ioP(c); IOPosition<TrackCloudType> ioP(c);
ioP.write(np > 0); ioP.write(np > 0);
IOField<label> origProc IOField<label> origProc
@ -151,7 +153,7 @@ void Foam::particle::writeFields(const CloudType& c)
); );
label i = 0; label i = 0;
forAllConstIter(typename CloudType, c, iter) forAllConstIter(typename TrackCloudType, c, iter)
{ {
origProc[i] = iter().origProc_; origProc[i] = iter().origProc_;
origId[i] = iter().origId_; origId[i] = iter().origId_;
@ -181,13 +183,19 @@ void Foam::particle::writeObjects(const CloudType& c, objectRegistry& obr)
} }
template<class TrackData> template<class TrackCloudType>
void Foam::particle::hitFace void Foam::particle::hitFace
( (
const vector& direction, const vector& direction,
TrackData& td TrackCloudType& cloud,
trackingData& td
) )
{ {
typename TrackCloudType::particleType& p =
static_cast<typename TrackCloudType::particleType&>(*this);
typename TrackCloudType::particleType::trackingData& ttd =
static_cast<typename TrackCloudType::particleType::trackingData&>(td);
if (!onFace()) if (!onFace())
{ {
return; return;
@ -198,9 +206,6 @@ void Foam::particle::hitFace
} }
else if (onBoundaryFace()) else if (onBoundaryFace())
{ {
typename TrackData::cloudType::particleType& p =
static_cast<typename TrackData::cloudType::particleType&>(*this);
const tetIndices faceHitTetIs(celli_, tetFacei_, tetPti_); const tetIndices faceHitTetIs(celli_, tetFacei_, tetPti_);
if if
@ -208,7 +213,8 @@ void Foam::particle::hitFace
!p.hitPatch !p.hitPatch
( (
mesh_.boundaryMesh()[patch()], mesh_.boundaryMesh()[patch()],
td, cloud,
ttd,
patch(), patch(),
stepFraction(), stepFraction(),
faceHitTetIs faceHitTetIs
@ -221,28 +227,30 @@ void Foam::particle::hitFace
{ {
p.hitWedgePatch p.hitWedgePatch
( (
static_cast<const wedgePolyPatch&>(patch), td static_cast<const wedgePolyPatch&>(patch), cloud, ttd
); );
} }
else if (isA<symmetryPlanePolyPatch>(patch)) else if (isA<symmetryPlanePolyPatch>(patch))
{ {
p.hitSymmetryPlanePatch p.hitSymmetryPlanePatch
( (
static_cast<const symmetryPlanePolyPatch&>(patch), td static_cast<const symmetryPlanePolyPatch&>(patch),
cloud,
ttd
); );
} }
else if (isA<symmetryPolyPatch>(patch)) else if (isA<symmetryPolyPatch>(patch))
{ {
p.hitSymmetryPatch p.hitSymmetryPatch
( (
static_cast<const symmetryPolyPatch&>(patch), td static_cast<const symmetryPolyPatch&>(patch), cloud, ttd
); );
} }
else if (isA<cyclicPolyPatch>(patch)) else if (isA<cyclicPolyPatch>(patch))
{ {
p.hitCyclicPatch p.hitCyclicPatch
( (
static_cast<const cyclicPolyPatch&>(patch), td static_cast<const cyclicPolyPatch&>(patch), cloud, ttd
); );
} }
else if (isA<cyclicACMIPolyPatch>(patch)) else if (isA<cyclicACMIPolyPatch>(patch))
@ -250,7 +258,8 @@ void Foam::particle::hitFace
p.hitCyclicACMIPatch p.hitCyclicACMIPatch
( (
static_cast<const cyclicACMIPolyPatch&>(patch), static_cast<const cyclicACMIPolyPatch&>(patch),
td, cloud,
ttd,
direction direction
); );
} }
@ -259,7 +268,8 @@ void Foam::particle::hitFace
p.hitCyclicAMIPatch p.hitCyclicAMIPatch
( (
static_cast<const cyclicAMIPolyPatch&>(patch), static_cast<const cyclicAMIPolyPatch&>(patch),
td, cloud,
ttd,
direction direction
); );
} }
@ -267,31 +277,35 @@ void Foam::particle::hitFace
{ {
p.hitProcessorPatch p.hitProcessorPatch
( (
static_cast<const processorPolyPatch&>(patch), td static_cast<const processorPolyPatch&>(patch), cloud, ttd
); );
} }
else if (isA<wallPolyPatch>(patch)) else if (isA<wallPolyPatch>(patch))
{ {
p.hitWallPatch p.hitWallPatch
( (
static_cast<const wallPolyPatch&>(patch), td, faceHitTetIs static_cast<const wallPolyPatch&>(patch),
cloud,
ttd,
faceHitTetIs
); );
} }
else else
{ {
p.hitPatch(patch, td); p.hitPatch(patch, cloud, ttd);
} }
} }
} }
} }
template<class TrackData> template<class TrackCloudType>
void Foam::particle::trackToAndHitFace void Foam::particle::trackToAndHitFace
( (
const vector& direction, const vector& direction,
const scalar fraction, const scalar fraction,
TrackData& td TrackCloudType& cloud,
trackingData& td
) )
{ {
trackToFace(direction, fraction); trackToFace(direction, fraction);
@ -301,15 +315,16 @@ void Foam::particle::trackToAndHitFace
changeToMasterPatch(); changeToMasterPatch();
} }
hitFace(direction, td); hitFace(direction, cloud, td);
} }
template<class TrackData> template<class TrackCloudType>
bool Foam::particle::hitPatch bool Foam::particle::hitPatch
( (
const polyPatch&, const polyPatch&,
TrackData&, TrackCloudType&,
trackingData&,
const label, const label,
const scalar, const scalar,
const tetIndices& const tetIndices&
@ -319,11 +334,12 @@ bool Foam::particle::hitPatch
} }
template<class TrackData> template<class TrackCloudType>
void Foam::particle::hitWedgePatch void Foam::particle::hitWedgePatch
( (
const wedgePolyPatch& wpp, const wedgePolyPatch& wpp,
TrackData& TrackCloudType&,
trackingData&
) )
{ {
FatalErrorInFunction FatalErrorInFunction
@ -337,11 +353,12 @@ void Foam::particle::hitWedgePatch
} }
template<class TrackData> template<class TrackCloudType>
void Foam::particle::hitSymmetryPlanePatch void Foam::particle::hitSymmetryPlanePatch
( (
const symmetryPlanePolyPatch& spp, const symmetryPlanePolyPatch& spp,
TrackData& TrackCloudType&,
trackingData&
) )
{ {
vector nf = normal(); vector nf = normal();
@ -351,11 +368,12 @@ void Foam::particle::hitSymmetryPlanePatch
} }
template<class TrackData> template<class TrackCloudType>
void Foam::particle::hitSymmetryPatch void Foam::particle::hitSymmetryPatch
( (
const symmetryPolyPatch& spp, const symmetryPolyPatch& spp,
TrackData& TrackCloudType&,
trackingData&
) )
{ {
vector nf = normal(); vector nf = normal();
@ -365,11 +383,12 @@ void Foam::particle::hitSymmetryPatch
} }
template<class TrackData> template<class TrackCloudType>
void Foam::particle::hitCyclicPatch void Foam::particle::hitCyclicPatch
( (
const cyclicPolyPatch& cpp, const cyclicPolyPatch& cpp,
TrackData& td TrackCloudType&,
trackingData&
) )
{ {
const cyclicPolyPatch& receiveCpp = cpp.neighbPatch(); const cyclicPolyPatch& receiveCpp = cpp.neighbPatch();
@ -408,11 +427,12 @@ void Foam::particle::hitCyclicPatch
} }
template<class TrackData> template<class TrackCloudType>
void Foam::particle::hitCyclicAMIPatch void Foam::particle::hitCyclicAMIPatch
( (
const cyclicAMIPolyPatch& cpp, const cyclicAMIPolyPatch& cpp,
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const vector& direction const vector& direction
) )
{ {
@ -478,11 +498,12 @@ void Foam::particle::hitCyclicAMIPatch
} }
template<class TrackData> template<class TrackCloudType>
void Foam::particle::hitCyclicACMIPatch void Foam::particle::hitCyclicACMIPatch
( (
const cyclicACMIPolyPatch& cpp, const cyclicACMIPolyPatch& cpp,
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const vector& direction const vector& direction
) )
{ {
@ -506,35 +527,41 @@ void Foam::particle::hitCyclicACMIPatch
if (couple) if (couple)
{ {
hitCyclicAMIPatch(cpp, td, direction); hitCyclicAMIPatch(cpp, cloud, td, direction);
} }
else else
{ {
// Move to the face associated with the non-overlap patch and redo the // Move to the face associated with the non-overlap patch and redo the
// face interaction. // face interaction.
tetFacei_ = facei_ = cpp.nonOverlapPatch().start() + localFacei; tetFacei_ = facei_ = cpp.nonOverlapPatch().start() + localFacei;
hitFace(direction, td); hitFace(direction, cloud, td);
} }
} }
template<class TrackData> template<class TrackCloudType>
void Foam::particle::hitProcessorPatch(const processorPolyPatch&, TrackData&) void Foam::particle::hitProcessorPatch
(
const processorPolyPatch&,
TrackCloudType&,
trackingData&
)
{} {}
template<class TrackData> template<class TrackCloudType>
void Foam::particle::hitWallPatch void Foam::particle::hitWallPatch
( (
const wallPolyPatch&, const wallPolyPatch&,
TrackData&, TrackCloudType&,
trackingData&,
const tetIndices& const tetIndices&
) )
{} {}
template<class TrackData> template<class TrackCloudType>
void Foam::particle::hitPatch(const polyPatch&, TrackData&) void Foam::particle::hitPatch(const polyPatch&, TrackCloudType&, trackingData&)
{} {}

View File

@ -44,28 +44,29 @@ void Foam::CollidingCloud<CloudType>::setModels()
template<class CloudType> template<class CloudType>
template<class TrackData> template<class TrackCloudType>
void Foam::CollidingCloud<CloudType>::moveCollide void Foam::CollidingCloud<CloudType>::moveCollide
( (
TrackData& td, TrackCloudType& cloud,
typename parcelType::trackingData& td,
const scalar deltaT const scalar deltaT
) )
{ {
td.part() = TrackData::tpVelocityHalfStep; td.part() = parcelType::trackingData::tpVelocityHalfStep;
CloudType::move(td, deltaT); CloudType::move(cloud, td, deltaT);
td.part() = TrackData::tpLinearTrack; td.part() = parcelType::trackingData::tpLinearTrack;
CloudType::move(td, deltaT); CloudType::move(cloud, td, deltaT);
// td.part() = TrackData::tpRotationalTrack; // td.part() = parcelType::trackingData::tpRotationalTrack;
// CloudType::move(td); // CloudType::move(cloud, td, deltaT);
this->updateCellOccupancy(); this->updateCellOccupancy();
this->collision().collide(); this->collision().collide();
td.part() = TrackData::tpVelocityHalfStep; td.part() = parcelType::trackingData::tpVelocityHalfStep;
CloudType::move(td, deltaT); CloudType::move(cloud, td, deltaT);
} }
@ -187,17 +188,20 @@ void Foam::CollidingCloud<CloudType>::evolve()
{ {
if (this->solution().canEvolve()) if (this->solution().canEvolve())
{ {
typename parcelType::template typename parcelType::trackingData td(*this);
TrackingData<CollidingCloud<CloudType>> td(*this);
this->solve(td); this->solve(*this, td);
} }
} }
template<class CloudType> template<class CloudType>
template<class TrackData> template<class TrackCloudType>
void Foam::CollidingCloud<CloudType>::motion(TrackData& td) void Foam::CollidingCloud<CloudType>::motion
(
TrackCloudType& cloud,
typename parcelType::trackingData& td
)
{ {
// Sympletic leapfrog integration of particle forces: // Sympletic leapfrog integration of particle forces:
// + apply half deltaV with stored force // + apply half deltaV with stored force
@ -219,14 +223,14 @@ void Foam::CollidingCloud<CloudType>::motion(TrackData& td)
while(!(++moveCollideSubCycle).end()) while(!(++moveCollideSubCycle).end())
{ {
moveCollide(td, this->db().time().deltaTValue()); moveCollide(cloud, td, this->db().time().deltaTValue());
} }
moveCollideSubCycle.endSubCycle(); moveCollideSubCycle.endSubCycle();
} }
else else
{ {
moveCollide(td, this->db().time().deltaTValue()); moveCollide(cloud, td, this->db().time().deltaTValue());
} }
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -120,8 +120,13 @@ protected:
// Cloud evolution functions // Cloud evolution functions
//- Move-collide particles //- Move-collide particles
template<class TrackData> template<class TrackCloudType>
void moveCollide(TrackData& td, const scalar deltaT); void moveCollide
(
TrackCloudType& cloud,
typename parcelType::trackingData& td,
const scalar deltaT
);
//- Reset state of cloud //- Reset state of cloud
void cloudReset(CollidingCloud<CloudType>& c); void cloudReset(CollidingCloud<CloudType>& c);
@ -227,8 +232,12 @@ public:
void evolve(); void evolve();
//- Particle motion //- Particle motion
template<class TrackData> template<class TrackCloudType>
void motion(TrackData& td); void motion
(
TrackCloudType& cloud,
typename parcelType::trackingData& td
);
// I-O // I-O

View File

@ -88,43 +88,47 @@ void Foam::KinematicCloud<CloudType>::setModels()
template<class CloudType> template<class CloudType>
template<class TrackData> template<class TrackCloudType>
void Foam::KinematicCloud<CloudType>::solve(TrackData& td) void Foam::KinematicCloud<CloudType>::solve
(
TrackCloudType& cloud,
typename parcelType::trackingData& td
)
{ {
addProfiling(prof, "cloud::solve"); addProfiling(prof, "cloud::solve");
if (solution_.steadyState()) if (solution_.steadyState())
{ {
td.cloud().storeState(); cloud.storeState();
td.cloud().preEvolve(); cloud.preEvolve();
evolveCloud(td); evolveCloud(cloud, td);
if (solution_.coupled()) if (solution_.coupled())
{ {
td.cloud().relaxSources(td.cloud().cloudCopy()); cloud.relaxSources(cloud.cloudCopy());
} }
} }
else else
{ {
td.cloud().preEvolve(); cloud.preEvolve();
evolveCloud(td); evolveCloud(cloud, td);
if (solution_.coupled()) if (solution_.coupled())
{ {
td.cloud().scaleSources(); cloud.scaleSources();
} }
} }
td.cloud().info(); cloud.info();
td.cloud().postEvolve(); cloud.postEvolve();
if (solution_.steadyState()) if (solution_.steadyState())
{ {
td.cloud().restoreState(); cloud.restoreState();
} }
} }
@ -175,19 +179,23 @@ void Foam::KinematicCloud<CloudType>::updateCellOccupancy()
template<class CloudType> template<class CloudType>
template<class TrackData> template<class TrackCloudType>
void Foam::KinematicCloud<CloudType>::evolveCloud(TrackData& td) void Foam::KinematicCloud<CloudType>::evolveCloud
(
TrackCloudType& cloud,
typename parcelType::trackingData& td
)
{ {
if (solution_.coupled()) if (solution_.coupled())
{ {
td.cloud().resetSourceTerms(); cloud.resetSourceTerms();
} }
if (solution_.transient()) if (solution_.transient())
{ {
label preInjectionSize = this->size(); label preInjectionSize = this->size();
this->surfaceFilm().inject(td); this->surfaceFilm().inject(cloud);
// Update the cellOccupancy if the size of the cloud has changed // Update the cellOccupancy if the size of the cloud has changed
// during the injection. // during the injection.
@ -197,23 +205,23 @@ void Foam::KinematicCloud<CloudType>::evolveCloud(TrackData& td)
preInjectionSize = this->size(); preInjectionSize = this->size();
} }
injectors_.inject(td); injectors_.inject(cloud, td);
// Assume that motion will update the cellOccupancy as necessary // Assume that motion will update the cellOccupancy as necessary
// before it is required. // before it is required.
td.cloud().motion(td); cloud.motion(cloud, td);
stochasticCollision().update(solution_.trackTime()); stochasticCollision().update(solution_.trackTime());
} }
else else
{ {
// this->surfaceFilm().injectSteadyState(td); // this->surfaceFilm().injectSteadyState(cloud);
injectors_.injectSteadyState(td, solution_.trackTime()); injectors_.injectSteadyState(cloud, td, solution_.trackTime());
td.part() = TrackData::tpLinearTrack; td.part() = parcelType::trackingData::tpLinearTrack;
CloudType::move(td, solution_.trackTime()); CloudType::move(cloud, td, solution_.trackTime());
} }
} }
@ -676,20 +684,23 @@ void Foam::KinematicCloud<CloudType>::evolve()
{ {
if (solution_.canEvolve()) if (solution_.canEvolve())
{ {
typename parcelType::template typename parcelType::trackingData td(*this);
TrackingData<KinematicCloud<CloudType>> td(*this);
solve(td); solve(*this, td);
} }
} }
template<class CloudType> template<class CloudType>
template<class TrackData> template<class TrackCloudType>
void Foam::KinematicCloud<CloudType>::motion(TrackData& td) void Foam::KinematicCloud<CloudType>::motion
(
TrackCloudType& cloud,
typename parcelType::trackingData& td
)
{ {
td.part() = TrackData::tpLinearTrack; td.part() = parcelType::trackingData::tpLinearTrack;
CloudType::move(td, solution_.trackTime()); CloudType::move(cloud, td, solution_.trackTime());
updateCellOccupancy(); updateCellOccupancy();
} }

View File

@ -246,8 +246,12 @@ protected:
// Cloud evolution functions // Cloud evolution functions
//- Solve the cloud - calls all evolution functions //- Solve the cloud - calls all evolution functions
template<class TrackData> template<class TrackCloudType>
void solve(TrackData& td); void solve
(
TrackCloudType& cloud,
typename parcelType::trackingData& td
);
//- Build the cellOccupancy //- Build the cellOccupancy
void buildCellOccupancy(); void buildCellOccupancy();
@ -257,8 +261,12 @@ protected:
void updateCellOccupancy(); void updateCellOccupancy();
//- Evolve the cloud //- Evolve the cloud
template<class TrackData> template<class TrackCloudType>
void evolveCloud(TrackData& td); void evolveCloud
(
TrackCloudType& cloud,
typename parcelType::trackingData& td
);
//- Post-evolve //- Post-evolve
void postEvolve(); void postEvolve();
@ -582,8 +590,12 @@ public:
void evolve(); void evolve();
//- Particle motion //- Particle motion
template<class TrackData> template<class TrackCloudType>
void motion(TrackData& td); void motion
(
TrackCloudType& cloud,
typename parcelType::trackingData& td
);
//- Calculate the patch normal and velocity to interact with, //- Calculate the patch normal and velocity to interact with,
// accounting for patch motion if required. // accounting for patch motion if required.

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2013-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -164,24 +164,27 @@ void Foam::MPPICCloud<CloudType>::evolve()
{ {
if (this->solution().canEvolve()) if (this->solution().canEvolve())
{ {
typename parcelType::template typename parcelType::trackingData td(*this);
TrackingData<MPPICCloud<CloudType>> td(*this);
this->solve(td); this->solve(*this, td);
} }
} }
template<class CloudType> template<class CloudType>
template<class TrackData> template<class TrackCloudType>
void Foam::MPPICCloud<CloudType>::motion(TrackData& td) void Foam::MPPICCloud<CloudType>::motion
(
TrackCloudType& cloud,
typename parcelType::trackingData& td
)
{ {
// Kinematic // Kinematic
// ~~~~~~~~~ // ~~~~~~~~~
// force calculation and tracking // force calculation and tracking
td.part() = TrackData::tpLinearTrack; td.part() = parcelType::trackingData::tpLinearTrack;
CloudType::move(td, this->db().time().deltaTValue()); CloudType::move(cloud, td, this->db().time().deltaTValue());
// Preliminary // Preliminary
@ -198,18 +201,18 @@ void Foam::MPPICCloud<CloudType>::motion(TrackData& td)
if (dampingModel_->active()) if (dampingModel_->active())
{ {
// update averages // update averages
td.updateAverages(*this); td.updateAverages(cloud);
// memory allocation and eulerian calculations // memory allocation and eulerian calculations
dampingModel_->cacheFields(true); dampingModel_->cacheFields(true);
// calculate the damping velocity corrections without moving the parcels // calculate the damping velocity corrections without moving the parcels
td.part() = TrackData::tpDampingNoTrack; td.part() = parcelType::trackingData::tpDampingNoTrack;
CloudType::move(td, this->db().time().deltaTValue()); CloudType::move(cloud, td, this->db().time().deltaTValue());
// correct the parcel positions and velocities // correct the parcel positions and velocities
td.part() = TrackData::tpCorrectTrack; td.part() = parcelType::trackingData::tpCorrectTrack;
CloudType::move(td, this->db().time().deltaTValue()); CloudType::move(cloud, td, this->db().time().deltaTValue());
// finalise and free memory // finalise and free memory
dampingModel_->cacheFields(false); dampingModel_->cacheFields(false);
@ -222,12 +225,12 @@ void Foam::MPPICCloud<CloudType>::motion(TrackData& td)
if (packingModel_->active()) if (packingModel_->active())
{ {
// same procedure as for damping // same procedure as for damping
td.updateAverages(*this); td.updateAverages(cloud);
packingModel_->cacheFields(true); packingModel_->cacheFields(true);
td.part() = TrackData::tpPackingNoTrack; td.part() = parcelType::trackingData::tpPackingNoTrack;
CloudType::move(td, this->db().time().deltaTValue()); CloudType::move(cloud, td, this->db().time().deltaTValue());
td.part() = TrackData::tpCorrectTrack; td.part() = parcelType::trackingData::tpCorrectTrack;
CloudType::move(td, this->db().time().deltaTValue()); CloudType::move(cloud, td, this->db().time().deltaTValue());
packingModel_->cacheFields(false); packingModel_->cacheFields(false);
} }
@ -238,7 +241,7 @@ void Foam::MPPICCloud<CloudType>::motion(TrackData& td)
if (isotropyModel_->active()) if (isotropyModel_->active())
{ {
// update averages // update averages
td.updateAverages(*this); td.updateAverages(cloud);
// apply isotropy model // apply isotropy model
isotropyModel_->calculate(); isotropyModel_->calculate();

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2013-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -220,8 +220,12 @@ public:
void evolve(); void evolve();
//- Particle motion //- Particle motion
template<class TrackData> template<class TrackCloudType>
void motion(TrackData& td); void motion
(
TrackCloudType& cloud,
typename parcelType::trackingData& td
);
//- I-O //- I-O

View File

@ -322,10 +322,9 @@ void Foam::ReactingCloud<CloudType>::evolve()
{ {
if (this->solution().canEvolve()) if (this->solution().canEvolve())
{ {
typename parcelType::template typename parcelType::trackingData td(*this);
TrackingData<ReactingCloud<CloudType>> td(*this);
this->solve(td); this->solve(*this, td);
} }
} }

View File

@ -245,10 +245,9 @@ void Foam::ReactingMultiphaseCloud<CloudType>::evolve()
{ {
if (this->solution().canEvolve()) if (this->solution().canEvolve())
{ {
typename parcelType::template typename parcelType::trackingData td(*this);
TrackingData<ReactingMultiphaseCloud<CloudType>> td(*this);
this->solve(td); this->solve(*this, td);
} }
} }

View File

@ -469,10 +469,9 @@ void Foam::ThermoCloud<CloudType>::evolve()
{ {
if (this->solution().canEvolve()) if (this->solution().canEvolve())
{ {
typename parcelType::template typename parcelType::trackingData td(*this);
TrackingData<ThermoCloud<CloudType>> td(*this);
this->solve(td); this->solve(*this, td);
} }
} }

View File

@ -59,22 +59,23 @@ Foam::CollidingParcel<ParcelType>::CollidingParcel
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ParcelType> template<class ParcelType>
template<class TrackData> template<class TrackCloudType>
bool Foam::CollidingParcel<ParcelType>::move bool Foam::CollidingParcel<ParcelType>::move
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const scalar trackTime const scalar trackTime
) )
{ {
typename TrackData::cloudType::parcelType& p = typename TrackCloudType::parcelType& p =
static_cast<typename TrackData::cloudType::parcelType&>(*this); static_cast<typename TrackCloudType::parcelType&>(*this);
td.keepParticle = true; td.keepParticle = true;
td.switchProcessor = false; td.switchProcessor = false;
switch (td.part()) switch (td.part())
{ {
case TrackData::tpVelocityHalfStep: case trackingData::tpVelocityHalfStep:
{ {
// First and last leapfrog velocity adjust part, required // First and last leapfrog velocity adjust part, required
// before and after tracking and force calculation // before and after tracking and force calculation
@ -89,14 +90,14 @@ bool Foam::CollidingParcel<ParcelType>::move
break; break;
} }
case TrackData::tpLinearTrack: case trackingData::tpLinearTrack:
{ {
ParcelType::move(td, trackTime); ParcelType::move(cloud, td, trackTime);
break; break;
} }
case TrackData::tpRotationalTrack: case trackingData::tpRotationalTrack:
{ {
NotImplemented; NotImplemented;

View File

@ -121,6 +121,10 @@ public:
}; };
//- Use base tracking data
typedef typename ParcelType::trackingData trackingData;
protected: protected:
// Protected data // Protected data
@ -295,8 +299,13 @@ public:
// Tracking // Tracking
//- Move the parcel //- Move the parcel
template<class TrackData> template<class TrackCloudType>
bool move(TrackData& td, const scalar trackTime); bool move
(
TrackCloudType& cloud,
trackingData& td,
const scalar trackTime
);
//- Transform the physical properties of the particle //- Transform the physical properties of the particle
// according to the given transformation tensor // according to the given transformation tensor

View File

@ -38,10 +38,11 @@ Foam::label Foam::KinematicParcel<ParcelType>::maxTrackAttempts = 1;
// * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * // // * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
template<class ParcelType> template<class ParcelType>
template<class TrackData> template<class TrackCloudType>
void Foam::KinematicParcel<ParcelType>::setCellValues void Foam::KinematicParcel<ParcelType>::setCellValues
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const scalar dt, const scalar dt,
const label celli const label celli
) )
@ -50,16 +51,16 @@ void Foam::KinematicParcel<ParcelType>::setCellValues
rhoc_ = td.rhoInterp().interpolate(this->coordinates(), tetIs); rhoc_ = td.rhoInterp().interpolate(this->coordinates(), tetIs);
if (rhoc_ < td.cloud().constProps().rhoMin()) if (rhoc_ < cloud.constProps().rhoMin())
{ {
if (debug) if (debug)
{ {
WarningInFunction WarningInFunction
<< "Limiting observed density in cell " << celli << " to " << "Limiting observed density in cell " << celli << " to "
<< td.cloud().constProps().rhoMin() << nl << endl; << cloud.constProps().rhoMin() << nl << endl;
} }
rhoc_ = td.cloud().constProps().rhoMin(); rhoc_ = cloud.constProps().rhoMin();
} }
Uc_ = td.UInterp().interpolate(this->coordinates(), tetIs); Uc_ = td.UInterp().interpolate(this->coordinates(), tetIs);
@ -67,7 +68,7 @@ void Foam::KinematicParcel<ParcelType>::setCellValues
muc_ = td.muInterp().interpolate(this->coordinates(), tetIs); muc_ = td.muInterp().interpolate(this->coordinates(), tetIs);
// Apply dispersion components to carrier phase velocity // Apply dispersion components to carrier phase velocity
Uc_ = td.cloud().dispersion().update Uc_ = cloud.dispersion().update
( (
dt, dt,
celli, celli,
@ -80,23 +81,25 @@ void Foam::KinematicParcel<ParcelType>::setCellValues
template<class ParcelType> template<class ParcelType>
template<class TrackData> template<class TrackCloudType>
void Foam::KinematicParcel<ParcelType>::cellValueSourceCorrection void Foam::KinematicParcel<ParcelType>::cellValueSourceCorrection
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const scalar dt, const scalar dt,
const label celli const label celli
) )
{ {
Uc_ += td.cloud().UTrans()[celli]/massCell(celli); Uc_ += cloud.UTrans()[celli]/massCell(celli);
} }
template<class ParcelType> template<class ParcelType>
template<class TrackData> template<class TrackCloudType>
void Foam::KinematicParcel<ParcelType>::calc void Foam::KinematicParcel<ParcelType>::calc
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const scalar dt, const scalar dt,
const label celli const label celli
) )
@ -127,27 +130,41 @@ void Foam::KinematicParcel<ParcelType>::calc
// ~~~~~~ // ~~~~~~
// Calculate new particle velocity // Calculate new particle velocity
this->U_ = calcVelocity(td, dt, celli, Re, muc_, mass0, Su, dUTrans, Spu); this->U_ =
calcVelocity
(
cloud,
td,
dt,
celli,
Re,
muc_,
mass0,
Su,
dUTrans,
Spu
);
// Accumulate carrier phase source terms // Accumulate carrier phase source terms
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if (td.cloud().solution().coupled()) if (cloud.solution().coupled())
{ {
// Update momentum transfer // Update momentum transfer
td.cloud().UTrans()[celli] += np0*dUTrans; cloud.UTrans()[celli] += np0*dUTrans;
// Update momentum transfer coefficient // Update momentum transfer coefficient
td.cloud().UCoeff()[celli] += np0*Spu; cloud.UCoeff()[celli] += np0*Spu;
} }
} }
template<class ParcelType> template<class ParcelType>
template<class TrackData> template<class TrackCloudType>
const Foam::vector Foam::KinematicParcel<ParcelType>::calcVelocity const Foam::vector Foam::KinematicParcel<ParcelType>::calcVelocity
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const scalar dt, const scalar dt,
const label celli, const label celli,
const scalar Re, const scalar Re,
@ -158,11 +175,10 @@ const Foam::vector Foam::KinematicParcel<ParcelType>::calcVelocity
scalar& Spu scalar& Spu
) const ) const
{ {
typedef typename TrackData::cloudType cloudType; typedef typename TrackCloudType::parcelType parcelType;
typedef typename cloudType::parcelType parcelType; typedef typename TrackCloudType::forceType forceType;
typedef typename cloudType::forceType forceType;
const forceType& forces = td.cloud().forces(); const forceType& forces = cloud.forces();
// Momentum source due to particle forces // Momentum source due to particle forces
const parcelType& p = static_cast<const parcelType&>(*this); const parcelType& p = static_cast<const parcelType&>(*this);
@ -182,7 +198,7 @@ const Foam::vector Foam::KinematicParcel<ParcelType>::calcVelocity
Spu = dt*Feff.Sp(); Spu = dt*Feff.Sp();
IntegrationScheme<vector>::integrationResult Ures = IntegrationScheme<vector>::integrationResult Ures =
td.cloud().UIntegrator().integrate(U_, dt, abp, bp); cloud.UIntegrator().integrate(U_, dt, abp, bp);
vector Unew = Ures.value(); vector Unew = Ures.value();
@ -190,7 +206,7 @@ const Foam::vector Foam::KinematicParcel<ParcelType>::calcVelocity
dUTrans += dt*(Feff.Sp()*(Ures.average() - Uc_) - Fcp.Su()); dUTrans += dt*(Feff.Sp()*(Ures.average() - Uc_) - Fcp.Su());
// Apply correction to velocity and dUTrans for reduced-D cases // Apply correction to velocity and dUTrans for reduced-D cases
const polyMesh& mesh = td.cloud().pMesh(); const polyMesh& mesh = cloud.pMesh();
meshTools::constrainDirection(mesh, mesh.solutionD(), Unew); meshTools::constrainDirection(mesh, mesh.solutionD(), Unew);
meshTools::constrainDirection(mesh, mesh.solutionD(), dUTrans); meshTools::constrainDirection(mesh, mesh.solutionD(), dUTrans);
@ -250,26 +266,29 @@ Foam::KinematicParcel<ParcelType>::KinematicParcel
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ParcelType> template<class ParcelType>
template<class TrackData> template<class TrackCloudType>
bool Foam::KinematicParcel<ParcelType>::move bool Foam::KinematicParcel<ParcelType>::move
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const scalar trackTime const scalar trackTime
) )
{ {
typename TrackData::cloudType::parcelType& p = typename TrackCloudType::parcelType& p =
static_cast<typename TrackData::cloudType::parcelType&>(*this); static_cast<typename TrackCloudType::parcelType&>(*this);
typename TrackCloudType::particleType::trackingData& ttd =
static_cast<typename TrackCloudType::particleType::trackingData&>(td);
td.switchProcessor = false; ttd.switchProcessor = false;
td.keepParticle = true; ttd.keepParticle = true;
const polyMesh& mesh = td.cloud().pMesh(); const polyMesh& mesh = cloud.pMesh();
const polyBoundaryMesh& pbMesh = mesh.boundaryMesh(); const polyBoundaryMesh& pbMesh = mesh.boundaryMesh();
const cloudSolution& solution = td.cloud().solution(); const cloudSolution& solution = cloud.solution();
const scalarField& cellLengthScale = td.cloud().cellLengthScale(); const scalarField& cellLengthScale = td.cloud().cellLengthScale();
const scalar maxCo = solution.maxCo(); const scalar maxCo = solution.maxCo();
while (td.keepParticle && !td.switchProcessor && p.stepFraction() < 1) while (ttd.keepParticle && !ttd.switchProcessor && p.stepFraction() < 1)
{ {
// Apply correction to position for reduced-D cases // Apply correction to position for reduced-D cases
p.constrainToMeshCentre(); p.constrainToMeshCentre();
@ -312,26 +331,26 @@ bool Foam::KinematicParcel<ParcelType>::move
if (dt > ROOTVSMALL) if (dt > ROOTVSMALL)
{ {
// Update cell based properties // Update cell based properties
p.setCellValues(td, dt, celli); p.setCellValues(cloud, ttd, dt, celli);
if (solution.cellValueSourceCorrection()) if (solution.cellValueSourceCorrection())
{ {
p.cellValueSourceCorrection(td, dt, celli); p.cellValueSourceCorrection(cloud, ttd, dt, celli);
} }
p.calc(td, dt, celli); p.calc(cloud, ttd, dt, celli);
} }
if (p.onFace() && td.keepParticle) if (p.onFace() && ttd.keepParticle)
{ {
p.hitFace(s, td); p.hitFace(s, cloud, ttd);
} }
if (p.onBoundaryFace() && td.keepParticle) if (p.onBoundaryFace() && ttd.keepParticle)
{ {
if (isA<processorPolyPatch>(pbMesh[p.patch()])) if (isA<processorPolyPatch>(pbMesh[p.patch()]))
{ {
td.switchProcessor = true; ttd.switchProcessor = true;
} }
} }
@ -339,32 +358,33 @@ bool Foam::KinematicParcel<ParcelType>::move
if (p.onFace()) if (p.onFace())
{ {
td.cloud().functions().postFace(p, p.face(), td.keepParticle); cloud.functions().postFace(p, p.face(), ttd.keepParticle);
} }
td.cloud().functions().postMove(p, celli, dt, start, td.keepParticle); cloud.functions().postMove(p, celli, dt, start, ttd.keepParticle);
} }
return td.keepParticle; return ttd.keepParticle;
} }
template<class ParcelType> template<class ParcelType>
template<class TrackData> template<class TrackCloudType>
bool Foam::KinematicParcel<ParcelType>::hitPatch bool Foam::KinematicParcel<ParcelType>::hitPatch
( (
const polyPatch& pp, const polyPatch& pp,
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const label patchi, const label patchi,
const scalar trackFraction, const scalar trackFraction,
const tetIndices& tetIs const tetIndices& tetIs
) )
{ {
typename TrackData::cloudType::parcelType& p = typename TrackCloudType::parcelType& p =
static_cast<typename TrackData::cloudType::parcelType&>(*this); static_cast<typename TrackCloudType::parcelType&>(*this);
// Invoke post-processing model // Invoke post-processing model
td.cloud().functions().postPatch cloud.functions().postPatch
( (
p, p,
pp, pp,
@ -378,7 +398,7 @@ bool Foam::KinematicParcel<ParcelType>::hitPatch
// Skip processor patches // Skip processor patches
return false; return false;
} }
else if (td.cloud().surfaceFilm().transferParcel(p, pp, td.keepParticle)) else if (cloud.surfaceFilm().transferParcel(p, pp, td.keepParticle))
{ {
// Surface film model consumes the interaction, i.e. all // Surface film model consumes the interaction, i.e. all
// interactions done // interactions done
@ -387,7 +407,7 @@ bool Foam::KinematicParcel<ParcelType>::hitPatch
else else
{ {
// Invoke patch interaction model // Invoke patch interaction model
return td.cloud().patchInteraction().correct return cloud.patchInteraction().correct
( (
p, p,
pp, pp,
@ -400,11 +420,12 @@ bool Foam::KinematicParcel<ParcelType>::hitPatch
template<class ParcelType> template<class ParcelType>
template<class TrackData> template<class TrackCloudType>
void Foam::KinematicParcel<ParcelType>::hitProcessorPatch void Foam::KinematicParcel<ParcelType>::hitProcessorPatch
( (
const processorPolyPatch&, const processorPolyPatch&,
TrackData& td TrackCloudType& cloud,
trackingData& td
) )
{ {
td.switchProcessor = true; td.switchProcessor = true;
@ -412,11 +433,12 @@ void Foam::KinematicParcel<ParcelType>::hitProcessorPatch
template<class ParcelType> template<class ParcelType>
template<class TrackData> template<class TrackCloudType>
void Foam::KinematicParcel<ParcelType>::hitWallPatch void Foam::KinematicParcel<ParcelType>::hitWallPatch
( (
const wallPolyPatch& wpp, const wallPolyPatch& wpp,
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const tetIndices& const tetIndices&
) )
{ {
@ -425,11 +447,12 @@ void Foam::KinematicParcel<ParcelType>::hitWallPatch
template<class ParcelType> template<class ParcelType>
template<class TrackData> template<class TrackCloudType>
void Foam::KinematicParcel<ParcelType>::hitPatch void Foam::KinematicParcel<ParcelType>::hitPatch
( (
const polyPatch&, const polyPatch&,
TrackData& td TrackCloudType& cloud,
trackingData& td
) )
{ {
td.keepParticle = false; td.keepParticle = false;

View File

@ -154,10 +154,9 @@ public:
}; };
template<class CloudType> class trackingData
class TrackingData
: :
public ParcelType::template TrackingData<CloudType> public ParcelType::trackingData
{ {
public: public:
@ -198,9 +197,10 @@ public:
// Constructors // Constructors
//- Construct from components //- Construct from components
inline TrackingData template <class TrackCloudType>
inline trackingData
( (
CloudType& cloud, const TrackCloudType& cloud,
trackPart part = tpLinearTrack trackPart part = tpLinearTrack
); );
@ -283,10 +283,11 @@ protected:
// Protected Member Functions // Protected Member Functions
//- Calculate new particle velocity //- Calculate new particle velocity
template<class TrackData> template<class TrackCloudType>
const vector calcVelocity const vector calcVelocity
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const scalar dt, // timestep const scalar dt, // timestep
const label celli, // owner cell const label celli, // owner cell
const scalar Re, // Reynolds number const scalar Re, // Reynolds number
@ -561,28 +562,31 @@ public:
// Main calculation loop // Main calculation loop
//- Set cell values //- Set cell values
template<class TrackData> template<class TrackCloudType>
void setCellValues void setCellValues
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const scalar dt, const scalar dt,
const label celli const label celli
); );
//- Correct cell values using latest transfer information //- Correct cell values using latest transfer information
template<class TrackData> template<class TrackCloudType>
void cellValueSourceCorrection void cellValueSourceCorrection
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const scalar dt, const scalar dt,
const label celli const label celli
); );
//- Update parcel properties over the time interval //- Update parcel properties over the time interval
template<class TrackData> template<class TrackCloudType>
void calc void calc
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const scalar dt, const scalar dt,
const label celli const label celli
); );
@ -591,19 +595,25 @@ public:
// Tracking // Tracking
//- Move the parcel //- Move the parcel
template<class TrackData> template<class TrackCloudType>
bool move(TrackData& td, const scalar trackTime); bool move
(
TrackCloudType& cloud,
trackingData& td,
const scalar trackTime
);
// Patch interactions // Patch interactions
//- Overridable function to handle the particle hitting a patch //- Overridable function to handle the particle hitting a patch
// Executed before other patch-hitting functions // Executed before other patch-hitting functions
template<class TrackData> template<class TrackCloudType>
bool hitPatch bool hitPatch
( (
const polyPatch& p, const polyPatch& p,
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const label patchi, const label patchi,
const scalar trackFraction, const scalar trackFraction,
const tetIndices& tetIs const tetIndices& tetIs
@ -611,28 +621,31 @@ public:
//- Overridable function to handle the particle hitting a //- Overridable function to handle the particle hitting a
// processorPatch // processorPatch
template<class TrackData> template<class TrackCloudType>
void hitProcessorPatch void hitProcessorPatch
( (
const processorPolyPatch&, const processorPolyPatch&,
TrackData& td TrackCloudType& cloud,
trackingData& td
); );
//- Overridable function to handle the particle hitting a wallPatch //- Overridable function to handle the particle hitting a wallPatch
template<class TrackData> template<class TrackCloudType>
void hitWallPatch void hitWallPatch
( (
const wallPolyPatch&, const wallPolyPatch&,
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const tetIndices& const tetIndices&
); );
//- Overridable function to handle the particle hitting a polyPatch //- Overridable function to handle the particle hitting a polyPatch
template<class TrackData> template<class TrackCloudType>
void hitPatch void hitPatch
( (
const polyPatch&, const polyPatch&,
TrackData& td TrackCloudType& cloud,
trackingData& td
); );
//- Transform the physical properties of the particle //- Transform the physical properties of the particle
@ -651,12 +664,12 @@ public:
// I-O // I-O
//- Read //- Read
template<class CloudType> template<class TrackCloudType>
static void readFields(CloudType& c); static void readFields(TrackCloudType& c);
//- Write //- Write
template<class CloudType> template<class TrackCloudType>
static void writeFields(const CloudType& c); static void writeFields(const TrackCloudType& c);
//- Write particle fields as objects into the obr registry //- Write particle fields as objects into the obr registry
template<class CloudType> template<class CloudType>

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -24,14 +24,14 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
template<class ParcelType> template<class ParcelType>
template<class CloudType> template<class TrackCloudType>
inline Foam::KinematicParcel<ParcelType>::TrackingData<CloudType>::TrackingData inline Foam::KinematicParcel<ParcelType>::trackingData::trackingData
( (
CloudType& cloud, const TrackCloudType& cloud,
trackPart part trackPart part
) )
: :
ParcelType::template TrackingData<CloudType>(cloud), ParcelType::trackingData(cloud),
rhoInterp_ rhoInterp_
( (
interpolation<scalar>::New interpolation<scalar>::New
@ -62,56 +62,48 @@ inline Foam::KinematicParcel<ParcelType>::TrackingData<CloudType>::TrackingData
template<class ParcelType> template<class ParcelType>
template<class CloudType>
inline const Foam::interpolation<Foam::scalar>& inline const Foam::interpolation<Foam::scalar>&
Foam::KinematicParcel<ParcelType>::TrackingData<CloudType>::rhoInterp() const Foam::KinematicParcel<ParcelType>::trackingData::rhoInterp() const
{ {
return rhoInterp_(); return rhoInterp_();
} }
template<class ParcelType> template<class ParcelType>
template<class CloudType>
inline const Foam::interpolation<Foam::vector>& inline const Foam::interpolation<Foam::vector>&
Foam::KinematicParcel<ParcelType>::TrackingData<CloudType>::UInterp() const Foam::KinematicParcel<ParcelType>::trackingData::UInterp() const
{ {
return UInterp_(); return UInterp_();
} }
template<class ParcelType> template<class ParcelType>
template<class CloudType>
inline const Foam::interpolation<Foam::scalar>& inline const Foam::interpolation<Foam::scalar>&
Foam::KinematicParcel<ParcelType>::TrackingData<CloudType>::muInterp() const Foam::KinematicParcel<ParcelType>::trackingData::muInterp() const
{ {
return muInterp_(); return muInterp_();
} }
template<class ParcelType> template<class ParcelType>
template<class CloudType>
inline const Foam::vector& inline const Foam::vector&
Foam::KinematicParcel<ParcelType>::TrackingData<CloudType>::g() const Foam::KinematicParcel<ParcelType>::trackingData::g() const
{ {
return g_; return g_;
} }
template<class ParcelType> template<class ParcelType>
template<class CloudType> inline typename Foam::KinematicParcel<ParcelType>::trackingData::trackPart
inline typename Foam::KinematicParcel<ParcelType>::template Foam::KinematicParcel<ParcelType>::trackingData::part() const
TrackingData<CloudType>::trackPart
Foam::KinematicParcel<ParcelType>::TrackingData<CloudType>::part() const
{ {
return part_; return part_;
} }
template<class ParcelType> template<class ParcelType>
template<class CloudType> inline typename Foam::KinematicParcel<ParcelType>::trackingData::trackPart&
inline typename Foam::KinematicParcel<ParcelType>::template Foam::KinematicParcel<ParcelType>::trackingData::part()
TrackingData<CloudType>::trackPart&
Foam::KinematicParcel<ParcelType>::TrackingData<CloudType>::part()
{ {
return part_; return part_;
} }

View File

@ -53,47 +53,48 @@ Foam::MPPICParcel<ParcelType>::MPPICParcel
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ParcelType> template<class ParcelType>
template<class TrackData> template<class TrackCloudType>
bool Foam::MPPICParcel<ParcelType>::move bool Foam::MPPICParcel<ParcelType>::move
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const scalar trackTime const scalar trackTime
) )
{ {
typename TrackData::cloudType::parcelType& p = typename TrackCloudType::parcelType& p =
static_cast<typename TrackData::cloudType::parcelType&>(*this); static_cast<typename TrackCloudType::parcelType&>(*this);
td.switchProcessor = false; td.switchProcessor = false;
switch (td.part()) switch (td.part())
{ {
case TrackData::tpLinearTrack: case trackingData::tpLinearTrack:
{ {
ParcelType::move(td, trackTime); ParcelType::move(cloud, td, trackTime);
break; break;
} }
case TrackData::tpDampingNoTrack: case trackingData::tpDampingNoTrack:
{ {
p.UCorrect() = p.UCorrect() =
td.cloud().dampingModel().velocityCorrection(p, trackTime); cloud.dampingModel().velocityCorrection(p, trackTime);
td.keepParticle = true; td.keepParticle = true;
td.switchProcessor = false; td.switchProcessor = false;
break; break;
} }
case TrackData::tpPackingNoTrack: case trackingData::tpPackingNoTrack:
{ {
p.UCorrect() = p.UCorrect() =
td.cloud().packingModel().velocityCorrection(p, trackTime); cloud.packingModel().velocityCorrection(p, trackTime);
td.keepParticle = true; td.keepParticle = true;
td.switchProcessor = false; td.switchProcessor = false;
break; break;
} }
case TrackData::tpCorrectTrack: case trackingData::tpCorrectTrack:
{ {
vector U = p.U(); vector U = p.U();
@ -103,7 +104,7 @@ bool Foam::MPPICParcel<ParcelType>::move
p.U() = (1.0 - f)*p.UCorrect(); p.U() = (1.0 - f)*p.UCorrect();
ParcelType::move(td, trackTime); ParcelType::move(cloud, td, trackTime);
p.U() = U + (p.stepFraction() - f)*p.UCorrect(); p.U() = U + (p.stepFraction() - f)*p.UCorrect();

View File

@ -82,11 +82,9 @@ public:
static const std::size_t sizeofFields; static const std::size_t sizeofFields;
//- Tracking data class trackingData
template<class CloudType>
class TrackingData
: :
public ParcelType::template TrackingData<CloudType> public ParcelType::trackingData
{ {
public: public:
@ -137,15 +135,17 @@ public:
//- Constructors //- Constructors
//- Construct from components //- Construct from components
inline TrackingData template<class TrackCloudType>
inline trackingData
( (
CloudType& cloud, const TrackCloudType& cloud,
trackPart part = tpLinearTrack trackPart part = tpLinearTrack
); );
//- Update the MPPIC averages //- Update the MPPIC averages
inline void updateAverages(CloudType& cloud); template<class TrackCloudType>
inline void updateAverages(const TrackCloudType& cloud);
//- Access //- Access
@ -290,8 +290,13 @@ public:
// Tracking // Tracking
//- Move the parcel //- Move the parcel
template<class TrackData> template<class TrackCloudType>
bool move(TrackData& td, const scalar trackTime); bool move
(
TrackCloudType& cloud,
trackingData& td,
const scalar trackTime
);
// Friend Functions // Friend Functions

View File

@ -28,14 +28,14 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class ParcelType> template<class ParcelType>
template<class CloudType> template<class TrackCloudType>
inline Foam::MPPICParcel<ParcelType>::TrackingData<CloudType>::TrackingData inline Foam::MPPICParcel<ParcelType>::trackingData::trackingData
( (
CloudType& cloud, const TrackCloudType& cloud,
trackPart part trackPart part
) )
: :
ParcelType::template TrackingData<CloudType>(cloud), ParcelType::trackingData(cloud),
volumeAverage_ volumeAverage_
( (
AveragingMethod<scalar>::New AveragingMethod<scalar>::New
@ -139,11 +139,10 @@ inline Foam::MPPICParcel<ParcelType>::TrackingData<CloudType>::TrackingData
template<class ParcelType> template<class ParcelType>
template<class CloudType> template<class TrackCloudType>
inline void inline void Foam::MPPICParcel<ParcelType>::trackingData::updateAverages
Foam::MPPICParcel<ParcelType>::TrackingData<CloudType>::updateAverages
( (
CloudType& cloud const TrackCloudType& cloud
) )
{ {
// zero the sums // zero the sums
@ -173,9 +172,9 @@ Foam::MPPICParcel<ParcelType>::TrackingData<CloudType>::updateAverages
AveragingMethod<scalar>& weightAverage = weightAveragePtr(); AveragingMethod<scalar>& weightAverage = weightAveragePtr();
// averaging sums // averaging sums
forAllConstIter(typename CloudType, cloud, iter) forAllConstIter(typename TrackCloudType, cloud, iter)
{ {
const typename CloudType::parcelType& p = iter(); const typename TrackCloudType::parcelType& p = iter();
const tetIndices tetIs = p.currentTetIndices(); const tetIndices tetIs = p.currentTetIndices();
const scalar m = p.nParticle()*p.mass(); const scalar m = p.nParticle()*p.mass();
@ -191,9 +190,9 @@ Foam::MPPICParcel<ParcelType>::TrackingData<CloudType>::updateAverages
uAverage_->average(massAverage_); uAverage_->average(massAverage_);
// squared velocity deviation // squared velocity deviation
forAllConstIter(typename CloudType, cloud, iter) forAllConstIter(typename TrackCloudType, cloud, iter)
{ {
const typename CloudType::parcelType& p = iter(); const typename TrackCloudType::parcelType& p = iter();
const tetIndices tetIs = p.currentTetIndices(); const tetIndices tetIs = p.currentTetIndices();
const vector u = uAverage_->interpolate(p.coordinates(), tetIs); const vector u = uAverage_->interpolate(p.coordinates(), tetIs);
@ -210,9 +209,9 @@ Foam::MPPICParcel<ParcelType>::TrackingData<CloudType>::updateAverages
// sauter mean radius // sauter mean radius
radiusAverage_() = volumeAverage_(); radiusAverage_() = volumeAverage_();
weightAverage = 0; weightAverage = 0;
forAllConstIter(typename CloudType, cloud, iter) forAllConstIter(typename TrackCloudType, cloud, iter)
{ {
const typename CloudType::parcelType& p = iter(); const typename TrackCloudType::parcelType& p = iter();
const tetIndices tetIs = p.currentTetIndices(); const tetIndices tetIs = p.currentTetIndices();
weightAverage.add weightAverage.add
@ -227,9 +226,9 @@ Foam::MPPICParcel<ParcelType>::TrackingData<CloudType>::updateAverages
// collision frequency // collision frequency
weightAverage = 0; weightAverage = 0;
forAllConstIter(typename CloudType, cloud, iter) forAllConstIter(typename TrackCloudType, cloud, iter)
{ {
const typename CloudType::parcelType& p = iter(); const typename TrackCloudType::parcelType& p = iter();
const tetIndices tetIs = p.currentTetIndices(); const tetIndices tetIs = p.currentTetIndices();
const scalar a = volumeAverage_->interpolate(p.coordinates(), tetIs); const scalar a = volumeAverage_->interpolate(p.coordinates(), tetIs);
@ -247,20 +246,16 @@ Foam::MPPICParcel<ParcelType>::TrackingData<CloudType>::updateAverages
template<class ParcelType> template<class ParcelType>
template<class CloudType> inline typename Foam::MPPICParcel<ParcelType>::trackingData::trackPart
inline typename Foam::MPPICParcel<ParcelType>::template Foam::MPPICParcel<ParcelType>::trackingData::part() const
TrackingData<CloudType>::trackPart
Foam::MPPICParcel<ParcelType>::TrackingData<CloudType>::part() const
{ {
return part_; return part_;
} }
template<class ParcelType> template<class ParcelType>
template<class CloudType> inline typename Foam::MPPICParcel<ParcelType>::trackingData::trackPart&
inline typename Foam::MPPICParcel<ParcelType>::template Foam::MPPICParcel<ParcelType>::trackingData::part()
TrackingData<CloudType>::trackPart&
Foam::MPPICParcel<ParcelType>::TrackingData<CloudType>::part()
{ {
return part_; return part_;
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -43,10 +43,11 @@ const Foam::label Foam::ReactingMultiphaseParcel<ParcelType>::SLD(2);
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
template<class ParcelType> template<class ParcelType>
template<class TrackData> template<class TrackCloudType>
Foam::scalar Foam::ReactingMultiphaseParcel<ParcelType>::CpEff Foam::scalar Foam::ReactingMultiphaseParcel<ParcelType>::CpEff
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const scalar p, const scalar p,
const scalar T, const scalar T,
const label idG, const label idG,
@ -55,17 +56,18 @@ Foam::scalar Foam::ReactingMultiphaseParcel<ParcelType>::CpEff
) const ) const
{ {
return return
this->Y_[GAS]*td.cloud().composition().Cp(idG, YGas_, p, T) this->Y_[GAS]*cloud.composition().Cp(idG, YGas_, p, T)
+ this->Y_[LIQ]*td.cloud().composition().Cp(idL, YLiquid_, p, T) + this->Y_[LIQ]*cloud.composition().Cp(idL, YLiquid_, p, T)
+ this->Y_[SLD]*td.cloud().composition().Cp(idS, YSolid_, p, T); + this->Y_[SLD]*cloud.composition().Cp(idS, YSolid_, p, T);
} }
template<class ParcelType> template<class ParcelType>
template<class TrackData> template<class TrackCloudType>
Foam::scalar Foam::ReactingMultiphaseParcel<ParcelType>::HsEff Foam::scalar Foam::ReactingMultiphaseParcel<ParcelType>::HsEff
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const scalar p, const scalar p,
const scalar T, const scalar T,
const label idG, const label idG,
@ -74,17 +76,18 @@ Foam::scalar Foam::ReactingMultiphaseParcel<ParcelType>::HsEff
) const ) const
{ {
return return
this->Y_[GAS]*td.cloud().composition().Hs(idG, YGas_, p, T) this->Y_[GAS]*cloud.composition().Hs(idG, YGas_, p, T)
+ this->Y_[LIQ]*td.cloud().composition().Hs(idL, YLiquid_, p, T) + this->Y_[LIQ]*cloud.composition().Hs(idL, YLiquid_, p, T)
+ this->Y_[SLD]*td.cloud().composition().Hs(idS, YSolid_, p, T); + this->Y_[SLD]*cloud.composition().Hs(idS, YSolid_, p, T);
} }
template<class ParcelType> template<class ParcelType>
template<class TrackData> template<class TrackCloudType>
Foam::scalar Foam::ReactingMultiphaseParcel<ParcelType>::LEff Foam::scalar Foam::ReactingMultiphaseParcel<ParcelType>::LEff
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const scalar p, const scalar p,
const scalar T, const scalar T,
const label idG, const label idG,
@ -93,9 +96,9 @@ Foam::scalar Foam::ReactingMultiphaseParcel<ParcelType>::LEff
) const ) const
{ {
return return
this->Y_[GAS]*td.cloud().composition().L(idG, YGas_, p, T) this->Y_[GAS]*cloud.composition().L(idG, YGas_, p, T)
+ this->Y_[LIQ]*td.cloud().composition().L(idL, YLiquid_, p, T) + this->Y_[LIQ]*cloud.composition().L(idL, YLiquid_, p, T)
+ this->Y_[SLD]*td.cloud().composition().L(idS, YSolid_, p, T); + this->Y_[SLD]*cloud.composition().L(idS, YSolid_, p, T);
} }
@ -136,44 +139,47 @@ Foam::scalar Foam::ReactingMultiphaseParcel<ParcelType>::updateMassFractions
// * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * // // * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
template<class ParcelType> template<class ParcelType>
template<class TrackData> template<class TrackCloudType>
void Foam::ReactingMultiphaseParcel<ParcelType>::setCellValues void Foam::ReactingMultiphaseParcel<ParcelType>::setCellValues
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const scalar dt, const scalar dt,
const label celli const label celli
) )
{ {
ParcelType::setCellValues(td, dt, celli); ParcelType::setCellValues(cloud, td, dt, celli);
} }
template<class ParcelType> template<class ParcelType>
template<class TrackData> template<class TrackCloudType>
void Foam::ReactingMultiphaseParcel<ParcelType>::cellValueSourceCorrection void Foam::ReactingMultiphaseParcel<ParcelType>::cellValueSourceCorrection
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const scalar dt, const scalar dt,
const label celli const label celli
) )
{ {
// Re-use correction from reacting parcel // Re-use correction from reacting parcel
ParcelType::cellValueSourceCorrection(td, dt, celli); ParcelType::cellValueSourceCorrection(cloud, td, dt, celli);
} }
template<class ParcelType> template<class ParcelType>
template<class TrackData> template<class TrackCloudType>
void Foam::ReactingMultiphaseParcel<ParcelType>::calc void Foam::ReactingMultiphaseParcel<ParcelType>::calc
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const scalar dt, const scalar dt,
const label celli const label celli
) )
{ {
typedef typename TrackData::cloudType::reactingCloudType reactingCloudType; typedef typename TrackCloudType::reactingCloudType reactingCloudType;
const CompositionModel<reactingCloudType>& composition = const CompositionModel<reactingCloudType>& composition =
td.cloud().composition(); cloud.composition();
// Define local properties at beginning of timestep // Define local properties at beginning of timestep
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -194,7 +200,7 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc
// Calc surface values // Calc surface values
scalar Ts, rhos, mus, Prs, kappas; scalar Ts, rhos, mus, Prs, kappas;
this->calcSurfaceValues(td, celli, T0, Ts, rhos, mus, Prs, kappas); this->calcSurfaceValues(cloud, td, celli, T0, Ts, rhos, mus, Prs, kappas);
scalar Res = this->Re(U0, d0, rhos, mus); scalar Res = this->Re(U0, d0, rhos, mus);
@ -241,6 +247,7 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc
// Calc mass and enthalpy transfer due to phase change // Calc mass and enthalpy transfer due to phase change
this->calcPhaseChange this->calcPhaseChange
( (
cloud,
td, td,
dt, dt,
celli, celli,
@ -271,6 +278,7 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc
// Calc mass and enthalpy transfer due to devolatilisation // Calc mass and enthalpy transfer due to devolatilisation
calcDevolatilisation calcDevolatilisation
( (
cloud,
td, td,
dt, dt,
this->age_, this->age_,
@ -302,6 +310,7 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc
// Calc mass and enthalpy transfer due to surface reactions // Calc mass and enthalpy transfer due to surface reactions
calcSurfaceReactions calcSurfaceReactions
( (
cloud,
td, td,
dt, dt,
celli, celli,
@ -332,11 +341,11 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc
scalar mass1 = mass0 - sum(dMassGas) - sum(dMassLiquid) - sum(dMassSolid); scalar mass1 = mass0 - sum(dMassGas) - sum(dMassLiquid) - sum(dMassSolid);
// Remove the particle when mass falls below minimum threshold // Remove the particle when mass falls below minimum threshold
if (np0*mass1 < td.cloud().constProps().minParcelMass()) if (np0*mass1 < cloud.constProps().minParcelMass())
{ {
td.keepParticle = false; td.keepParticle = false;
if (td.cloud().solution().coupled()) if (cloud.solution().coupled())
{ {
scalar dm = np0*mass0; scalar dm = np0*mass0;
@ -344,12 +353,12 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc
forAll(YGas_, i) forAll(YGas_, i)
{ {
label gid = composition.localToCarrierId(GAS, i); label gid = composition.localToCarrierId(GAS, i);
td.cloud().rhoTrans(gid)[celli] += dm*YMix[GAS]*YGas_[i]; cloud.rhoTrans(gid)[celli] += dm*YMix[GAS]*YGas_[i];
} }
forAll(YLiquid_, i) forAll(YLiquid_, i)
{ {
label gid = composition.localToCarrierId(LIQ, i); label gid = composition.localToCarrierId(LIQ, i);
td.cloud().rhoTrans(gid)[celli] += dm*YMix[LIQ]*YLiquid_[i]; cloud.rhoTrans(gid)[celli] += dm*YMix[LIQ]*YLiquid_[i];
} }
// No mapping between solid components and carrier phase // No mapping between solid components and carrier phase
@ -357,15 +366,16 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc
forAll(YSolid_, i) forAll(YSolid_, i)
{ {
label gid = composition.localToCarrierId(SLD, i); label gid = composition.localToCarrierId(SLD, i);
td.cloud().rhoTrans(gid)[celli] += dm*YMix[SLD]*YSolid_[i]; cloud.rhoTrans(gid)[celli] += dm*YMix[SLD]*YSolid_[i];
} }
*/ */
td.cloud().UTrans()[celli] += dm*U0; cloud.UTrans()[celli] += dm*U0;
td.cloud().hsTrans()[celli] += dm*HsEff(td, pc, T0, idG, idL, idS); cloud.hsTrans()[celli] +=
dm*HsEff(cloud, td, pc, T0, idG, idL, idS);
td.cloud().phaseChange().addToPhaseChangeMass(np0*mass1); cloud.phaseChange().addToPhaseChangeMass(np0*mass1);
} }
return; return;
@ -374,7 +384,7 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc
(void)updateMassFractions(mass0, dMassGas, dMassLiquid, dMassSolid); (void)updateMassFractions(mass0, dMassGas, dMassLiquid, dMassSolid);
// Update particle density or diameter // Update particle density or diameter
if (td.cloud().constProps().constantVolume()) if (cloud.constProps().constantVolume())
{ {
this->rho_ = mass1/this->volume(); this->rho_ = mass1/this->volume();
} }
@ -384,7 +394,18 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc
} }
// Correct surface values due to emitted species // Correct surface values due to emitted species
this->correctSurfaceValues(td, celli, Ts, Cs, rhos, mus, Prs, kappas); this->correctSurfaceValues
(
cloud,
td,
celli,
Ts,
Cs,
rhos,
mus,
Prs,
kappas
);
Res = this->Re(U0, this->d_, rhos, mus); Res = this->Re(U0, this->d_, rhos, mus);
@ -398,6 +419,7 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc
this->T_ = this->T_ =
this->calcHeatTransfer this->calcHeatTransfer
( (
cloud,
td, td,
dt, dt,
celli, celli,
@ -411,7 +433,7 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc
); );
this->Cp_ = CpEff(td, pc, this->T_, idG, idL, idS); this->Cp_ = CpEff(cloud, td, pc, this->T_, idG, idL, idS);
// Motion // Motion
@ -419,13 +441,25 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc
// Calculate new particle velocity // Calculate new particle velocity
this->U_ = this->U_ =
this->calcVelocity(td, dt, celli, Res, mus, mass1, Su, dUTrans, Spu); this->calcVelocity
(
cloud,
td,
dt,
celli,
Res,
mus,
mass1,
Su,
dUTrans,
Spu
);
// 4. Accumulate carrier phase source terms // 4. Accumulate carrier phase source terms
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if (td.cloud().solution().coupled()) if (cloud.solution().coupled())
{ {
// Transfer mass lost to carrier mass, momentum and enthalpy sources // Transfer mass lost to carrier mass, momentum and enthalpy sources
forAll(YGas_, i) forAll(YGas_, i)
@ -433,18 +467,18 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc
scalar dm = np0*dMassGas[i]; scalar dm = np0*dMassGas[i];
label gid = composition.localToCarrierId(GAS, i); label gid = composition.localToCarrierId(GAS, i);
scalar hs = composition.carrier().Hs(gid, pc, T0); scalar hs = composition.carrier().Hs(gid, pc, T0);
td.cloud().rhoTrans(gid)[celli] += dm; cloud.rhoTrans(gid)[celli] += dm;
td.cloud().UTrans()[celli] += dm*U0; cloud.UTrans()[celli] += dm*U0;
td.cloud().hsTrans()[celli] += dm*hs; cloud.hsTrans()[celli] += dm*hs;
} }
forAll(YLiquid_, i) forAll(YLiquid_, i)
{ {
scalar dm = np0*dMassLiquid[i]; scalar dm = np0*dMassLiquid[i];
label gid = composition.localToCarrierId(LIQ, i); label gid = composition.localToCarrierId(LIQ, i);
scalar hs = composition.carrier().Hs(gid, pc, T0); scalar hs = composition.carrier().Hs(gid, pc, T0);
td.cloud().rhoTrans(gid)[celli] += dm; cloud.rhoTrans(gid)[celli] += dm;
td.cloud().UTrans()[celli] += dm*U0; cloud.UTrans()[celli] += dm*U0;
td.cloud().hsTrans()[celli] += dm*hs; cloud.hsTrans()[celli] += dm*hs;
} }
// No mapping between solid components and carrier phase // No mapping between solid components and carrier phase
@ -454,9 +488,9 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc
scalar dm = np0*dMassSolid[i]; scalar dm = np0*dMassSolid[i];
label gid = composition.localToCarrierId(SLD, i); label gid = composition.localToCarrierId(SLD, i);
scalar hs = composition.carrier().Hs(gid, pc, T0); scalar hs = composition.carrier().Hs(gid, pc, T0);
td.cloud().rhoTrans(gid)[celli] += dm; cloud.rhoTrans(gid)[celli] += dm;
td.cloud().UTrans()[celli] += dm*U0; cloud.UTrans()[celli] += dm*U0;
td.cloud().hsTrans()[celli] += dm*hs; cloud.hsTrans()[celli] += dm*hs;
} }
*/ */
@ -464,27 +498,27 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc
{ {
scalar dm = np0*dMassSRCarrier[i]; scalar dm = np0*dMassSRCarrier[i];
scalar hs = composition.carrier().Hs(i, pc, T0); scalar hs = composition.carrier().Hs(i, pc, T0);
td.cloud().rhoTrans(i)[celli] += dm; cloud.rhoTrans(i)[celli] += dm;
td.cloud().UTrans()[celli] += dm*U0; cloud.UTrans()[celli] += dm*U0;
td.cloud().hsTrans()[celli] += dm*hs; cloud.hsTrans()[celli] += dm*hs;
} }
// Update momentum transfer // Update momentum transfer
td.cloud().UTrans()[celli] += np0*dUTrans; cloud.UTrans()[celli] += np0*dUTrans;
td.cloud().UCoeff()[celli] += np0*Spu; cloud.UCoeff()[celli] += np0*Spu;
// Update sensible enthalpy transfer // Update sensible enthalpy transfer
td.cloud().hsTrans()[celli] += np0*dhsTrans; cloud.hsTrans()[celli] += np0*dhsTrans;
td.cloud().hsCoeff()[celli] += np0*Sph; cloud.hsCoeff()[celli] += np0*Sph;
// Update radiation fields // Update radiation fields
if (td.cloud().radiation()) if (cloud.radiation())
{ {
const scalar ap = this->areaP(); const scalar ap = this->areaP();
const scalar T4 = pow4(T0); const scalar T4 = pow4(T0);
td.cloud().radAreaP()[celli] += dt*np0*ap; cloud.radAreaP()[celli] += dt*np0*ap;
td.cloud().radT4()[celli] += dt*np0*T4; cloud.radT4()[celli] += dt*np0*T4;
td.cloud().radAreaPT4()[celli] += dt*np0*ap*T4; cloud.radAreaPT4()[celli] += dt*np0*ap*T4;
} }
} }
} }
@ -493,10 +527,11 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
template<class ParcelType> template<class ParcelType>
template<class TrackData> template<class TrackCloudType>
void Foam::ReactingMultiphaseParcel<ParcelType>::calcDevolatilisation void Foam::ReactingMultiphaseParcel<ParcelType>::calcDevolatilisation
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const scalar dt, const scalar dt,
const scalar age, const scalar age,
const scalar Ts, const scalar Ts,
@ -516,29 +551,29 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calcDevolatilisation
) const ) const
{ {
// Check that model is active // Check that model is active
if (!td.cloud().devolatilisation().active()) if (!cloud.devolatilisation().active())
{ {
return; return;
} }
// Initialise demand-driven constants // Initialise demand-driven constants
(void)td.cloud().constProps().TDevol(); (void)cloud.constProps().TDevol();
(void)td.cloud().constProps().LDevol(); (void)cloud.constProps().LDevol();
// Check that the parcel temperature is within necessary limits for // Check that the parcel temperature is within necessary limits for
// devolatilisation to occur // devolatilisation to occur
if (T < td.cloud().constProps().TDevol() || canCombust == -1) if (T < cloud.constProps().TDevol() || canCombust == -1)
{ {
return; return;
} }
typedef typename TrackData::cloudType::reactingCloudType reactingCloudType; typedef typename TrackCloudType::reactingCloudType reactingCloudType;
const CompositionModel<reactingCloudType>& composition = const CompositionModel<reactingCloudType>& composition =
td.cloud().composition(); cloud.composition();
// Total mass of volatiles evolved // Total mass of volatiles evolved
td.cloud().devolatilisation().calculate cloud.devolatilisation().calculate
( (
dt, dt,
age, age,
@ -554,15 +589,15 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calcDevolatilisation
scalar dMassTot = sum(dMassDV); scalar dMassTot = sum(dMassDV);
td.cloud().devolatilisation().addToDevolatilisationMass cloud.devolatilisation().addToDevolatilisationMass
( (
this->nParticle_*dMassTot this->nParticle_*dMassTot
); );
Sh -= dMassTot*td.cloud().constProps().LDevol()/dt; Sh -= dMassTot*cloud.constProps().LDevol()/dt;
// Update molar emissions // Update molar emissions
if (td.cloud().heatTransfer().BirdCorrection()) if (cloud.heatTransfer().BirdCorrection())
{ {
// Molar average molecular weight of carrier mix // Molar average molecular weight of carrier mix
const scalar Wc = const scalar Wc =
@ -594,10 +629,11 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calcDevolatilisation
template<class ParcelType> template<class ParcelType>
template<class TrackData> template<class TrackCloudType>
void Foam::ReactingMultiphaseParcel<ParcelType>::calcSurfaceReactions void Foam::ReactingMultiphaseParcel<ParcelType>::calcSurfaceReactions
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const scalar dt, const scalar dt,
const label celli, const label celli,
const scalar d, const scalar d,
@ -618,14 +654,14 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calcSurfaceReactions
) const ) const
{ {
// Check that model is active // Check that model is active
if (!td.cloud().surfaceReaction().active()) if (!cloud.surfaceReaction().active())
{ {
return; return;
} }
// Initialise demand-driven constants // Initialise demand-driven constants
(void)td.cloud().constProps().hRetentionCoeff(); (void)cloud.constProps().hRetentionCoeff();
(void)td.cloud().constProps().TMax(); (void)cloud.constProps().TMax();
// Check that model is active // Check that model is active
if (canCombust != 1) if (canCombust != 1)
@ -635,7 +671,7 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calcSurfaceReactions
// Update surface reactions // Update surface reactions
const scalar hReaction = td.cloud().surfaceReaction().calculate const scalar hReaction = cloud.surfaceReaction().calculate
( (
dt, dt,
celli, celli,
@ -656,15 +692,15 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calcSurfaceReactions
dMassSRCarrier dMassSRCarrier
); );
td.cloud().surfaceReaction().addToSurfaceReactionMass cloud.surfaceReaction().addToSurfaceReactionMass
( (
this->nParticle_ this->nParticle_
*(sum(dMassSRGas) + sum(dMassSRLiquid) + sum(dMassSRSolid)) *(sum(dMassSRGas) + sum(dMassSRLiquid) + sum(dMassSRSolid))
); );
const scalar xsi = min(T/td.cloud().constProps().TMax(), 1.0); const scalar xsi = min(T/cloud.constProps().TMax(), 1.0);
const scalar coeff = const scalar coeff =
(1.0 - xsi*xsi)*td.cloud().constProps().hRetentionCoeff(); (1.0 - xsi*xsi)*cloud.constProps().hRetentionCoeff();
Sh += coeff*hReaction/dt; Sh += coeff*hReaction/dt;

View File

@ -128,15 +128,20 @@ public:
}; };
//- Use base tracking data
typedef typename ParcelType::trackingData trackingData;
private: private:
// Private Member Functions // Private Member Functions
//- Return the mixture effective specific heat capacity //- Return the mixture effective specific heat capacity
template<class TrackData> template<class TrackCloudType>
scalar CpEff scalar CpEff
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const scalar p, const scalar p,
const scalar T, const scalar T,
const label idG, const label idG,
@ -145,10 +150,11 @@ private:
) const; ) const;
//- Return the mixture effective sensible enthalpy //- Return the mixture effective sensible enthalpy
template<class TrackData> template<class TrackCloudType>
scalar HsEff scalar HsEff
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const scalar p, const scalar p,
const scalar T, const scalar T,
const label idG, const label idG,
@ -157,10 +163,11 @@ private:
) const; ) const;
//- Return the mixture effective latent heat //- Return the mixture effective latent heat
template<class TrackData> template<class TrackCloudType>
scalar LEff scalar LEff
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const scalar p, const scalar p,
const scalar T, const scalar T,
const label idG, const label idG,
@ -205,10 +212,11 @@ protected:
// Protected Member Functions // Protected Member Functions
//- Calculate Devolatilisation //- Calculate Devolatilisation
template<class TrackData> template<class TrackCloudType>
void calcDevolatilisation void calcDevolatilisation
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const scalar dt, // timestep const scalar dt, // timestep
const scalar age, // age const scalar age, // age
const scalar Ts, // surface temperature const scalar Ts, // surface temperature
@ -228,10 +236,11 @@ protected:
) const; ) const;
//- Calculate surface reactions //- Calculate surface reactions
template<class TrackData> template<class TrackCloudType>
void calcSurfaceReactions void calcSurfaceReactions
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const scalar dt, // timestep const scalar dt, // timestep
const label celli, // owner cell const label celli, // owner cell
const scalar d, // diameter const scalar d, // diameter
@ -412,28 +421,31 @@ public:
// Main calculation loop // Main calculation loop
//- Set cell values //- Set cell values
template<class TrackData> template<class TrackCloudType>
void setCellValues void setCellValues
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const scalar dt, const scalar dt,
const label celli const label celli
); );
//- Correct cell values using latest transfer information //- Correct cell values using latest transfer information
template<class TrackData> template<class TrackCloudType>
void cellValueSourceCorrection void cellValueSourceCorrection
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const scalar dt, const scalar dt,
const label celli const label celli
); );
//- Update parcel properties over the time interval //- Update parcel properties over the time interval
template<class TrackData> template<class TrackCloudType>
void calc void calc
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const scalar dt, const scalar dt,
const label celli const label celli
); );

View File

@ -34,10 +34,11 @@ using namespace Foam::constant::mathematical;
// * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * // // * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
template<class ParcelType> template<class ParcelType>
template<class TrackData> template<class TrackCloudType>
void Foam::ReactingParcel<ParcelType>::calcPhaseChange void Foam::ReactingParcel<ParcelType>::calcPhaseChange
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const scalar dt, const scalar dt,
const label celli, const label celli,
const scalar Re, const scalar Re,
@ -57,10 +58,10 @@ void Foam::ReactingParcel<ParcelType>::calcPhaseChange
scalarField& Cs scalarField& Cs
) )
{ {
typedef typename TrackData::cloudType::reactingCloudType reactingCloudType; typedef typename TrackCloudType::reactingCloudType reactingCloudType;
const CompositionModel<reactingCloudType>& composition = const CompositionModel<reactingCloudType>& composition =
td.cloud().composition(); cloud.composition();
PhaseChangeModel<reactingCloudType>& phaseChange = td.cloud().phaseChange(); PhaseChangeModel<reactingCloudType>& phaseChange = cloud.phaseChange();
if (!phaseChange.active() || (YPhase < SMALL)) if (!phaseChange.active() || (YPhase < SMALL))
{ {
@ -115,7 +116,7 @@ void Foam::ReactingParcel<ParcelType>::calcPhaseChange
// Update molar emissions // Update molar emissions
if (td.cloud().heatTransfer().BirdCorrection()) if (cloud.heatTransfer().BirdCorrection())
{ {
// Average molecular weight of carrier mix - assumes perfect gas // Average molecular weight of carrier mix - assumes perfect gas
const scalar Wc = this->rhoc_*RR*this->Tc_/this->pc_; const scalar Wc = this->rhoc_*RR*this->Tc_/this->pc_;
@ -199,15 +200,16 @@ Foam::ReactingParcel<ParcelType>::ReactingParcel
// * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * * //
template<class ParcelType> template<class ParcelType>
template<class TrackData> template<class TrackCloudType>
void Foam::ReactingParcel<ParcelType>::setCellValues void Foam::ReactingParcel<ParcelType>::setCellValues
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const scalar dt, const scalar dt,
const label celli const label celli
) )
{ {
ParcelType::setCellValues(td, dt, celli); ParcelType::setCellValues(cloud, td, dt, celli);
pc_ = td.pInterp().interpolate pc_ = td.pInterp().interpolate
( (
@ -215,34 +217,35 @@ void Foam::ReactingParcel<ParcelType>::setCellValues
this->currentTetIndices() this->currentTetIndices()
); );
if (pc_ < td.cloud().constProps().pMin()) if (pc_ < cloud.constProps().pMin())
{ {
if (debug) if (debug)
{ {
WarningInFunction WarningInFunction
<< "Limiting observed pressure in cell " << celli << " to " << "Limiting observed pressure in cell " << celli << " to "
<< td.cloud().constProps().pMin() << nl << endl; << cloud.constProps().pMin() << nl << endl;
} }
pc_ = td.cloud().constProps().pMin(); pc_ = cloud.constProps().pMin();
} }
} }
template<class ParcelType> template<class ParcelType>
template<class TrackData> template<class TrackCloudType>
void Foam::ReactingParcel<ParcelType>::cellValueSourceCorrection void Foam::ReactingParcel<ParcelType>::cellValueSourceCorrection
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const scalar dt, const scalar dt,
const label celli const label celli
) )
{ {
scalar addedMass = 0.0; scalar addedMass = 0.0;
scalar maxMassI = 0.0; scalar maxMassI = 0.0;
forAll(td.cloud().rhoTrans(), i) forAll(cloud.rhoTrans(), i)
{ {
scalar dm = td.cloud().rhoTrans(i)[celli]; scalar dm = cloud.rhoTrans(i)[celli];
maxMassI = max(maxMassI, mag(dm)); maxMassI = max(maxMassI, mag(dm));
addedMass += dm; addedMass += dm;
} }
@ -254,16 +257,16 @@ void Foam::ReactingParcel<ParcelType>::cellValueSourceCorrection
const scalar massCell = this->massCell(celli); const scalar massCell = this->massCell(celli);
this->rhoc_ += addedMass/td.cloud().pMesh().cellVolumes()[celli]; this->rhoc_ += addedMass/cloud.pMesh().cellVolumes()[celli];
const scalar massCellNew = massCell + addedMass; const scalar massCellNew = massCell + addedMass;
this->Uc_ = (this->Uc_*massCell + td.cloud().UTrans()[celli])/massCellNew; this->Uc_ = (this->Uc_*massCell + cloud.UTrans()[celli])/massCellNew;
scalar CpEff = 0.0; scalar CpEff = 0.0;
forAll(td.cloud().rhoTrans(), i) forAll(cloud.rhoTrans(), i)
{ {
scalar Y = td.cloud().rhoTrans(i)[celli]/addedMass; scalar Y = cloud.rhoTrans(i)[celli]/addedMass;
CpEff += Y*td.cloud().composition().carrier().Cp CpEff += Y*cloud.composition().carrier().Cp
( (
i, i,
this->pc_, this->pc_,
@ -274,27 +277,28 @@ void Foam::ReactingParcel<ParcelType>::cellValueSourceCorrection
const scalar Cpc = td.CpInterp().psi()[celli]; const scalar Cpc = td.CpInterp().psi()[celli];
this->Cpc_ = (massCell*Cpc + addedMass*CpEff)/massCellNew; this->Cpc_ = (massCell*Cpc + addedMass*CpEff)/massCellNew;
this->Tc_ += td.cloud().hsTrans()[celli]/(this->Cpc_*massCellNew); this->Tc_ += cloud.hsTrans()[celli]/(this->Cpc_*massCellNew);
if (this->Tc_ < td.cloud().constProps().TMin()) if (this->Tc_ < cloud.constProps().TMin())
{ {
if (debug) if (debug)
{ {
WarningInFunction WarningInFunction
<< "Limiting observed temperature in cell " << celli << " to " << "Limiting observed temperature in cell " << celli << " to "
<< td.cloud().constProps().TMin() << nl << endl; << cloud.constProps().TMin() << nl << endl;
} }
this->Tc_ = td.cloud().constProps().TMin(); this->Tc_ = cloud.constProps().TMin();
} }
} }
template<class ParcelType> template<class ParcelType>
template<class TrackData> template<class TrackCloudType>
void Foam::ReactingParcel<ParcelType>::correctSurfaceValues void Foam::ReactingParcel<ParcelType>::correctSurfaceValues
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const label celli, const label celli,
const scalar T, const scalar T,
const scalarField& Cs, const scalarField& Cs,
@ -305,12 +309,12 @@ void Foam::ReactingParcel<ParcelType>::correctSurfaceValues
) )
{ {
// No correction if total concentration of emitted species is small // No correction if total concentration of emitted species is small
if (!td.cloud().heatTransfer().BirdCorrection() || (sum(Cs) < SMALL)) if (!cloud.heatTransfer().BirdCorrection() || (sum(Cs) < SMALL))
{ {
return; return;
} }
const SLGThermo& thermo = td.cloud().thermo(); const SLGThermo& thermo = cloud.thermo();
// Far field carrier molar fractions // Far field carrier molar fractions
scalarField Xinf(thermo.carrier().species().size()); scalarField Xinf(thermo.carrier().species().size());
@ -383,17 +387,18 @@ void Foam::ReactingParcel<ParcelType>::correctSurfaceValues
template<class ParcelType> template<class ParcelType>
template<class TrackData> template<class TrackCloudType>
void Foam::ReactingParcel<ParcelType>::calc void Foam::ReactingParcel<ParcelType>::calc
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const scalar dt, const scalar dt,
const label celli const label celli
) )
{ {
typedef typename TrackData::cloudType::reactingCloudType reactingCloudType; typedef typename TrackCloudType::reactingCloudType reactingCloudType;
const CompositionModel<reactingCloudType>& composition = const CompositionModel<reactingCloudType>& composition =
td.cloud().composition(); cloud.composition();
// Define local properties at beginning of time step // Define local properties at beginning of time step
@ -408,7 +413,7 @@ void Foam::ReactingParcel<ParcelType>::calc
// Calc surface values // Calc surface values
scalar Ts, rhos, mus, Prs, kappas; scalar Ts, rhos, mus, Prs, kappas;
this->calcSurfaceValues(td, celli, T0, Ts, rhos, mus, Prs, kappas); this->calcSurfaceValues(cloud, td, celli, T0, Ts, rhos, mus, Prs, kappas);
scalar Res = this->Re(U0, d0, rhos, mus); scalar Res = this->Re(U0, d0, rhos, mus);
@ -455,6 +460,7 @@ void Foam::ReactingParcel<ParcelType>::calc
// Calc mass and enthalpy transfer due to phase change // Calc mass and enthalpy transfer due to phase change
calcPhaseChange calcPhaseChange
( (
cloud,
td, td,
dt, dt,
celli, celli,
@ -485,7 +491,7 @@ void Foam::ReactingParcel<ParcelType>::calc
this->Cp_ = composition.Cp(0, Y_, pc_, T0); this->Cp_ = composition.Cp(0, Y_, pc_, T0);
// Update particle density or diameter // Update particle density or diameter
if (td.cloud().constProps().constantVolume()) if (cloud.constProps().constantVolume())
{ {
this->rho_ = mass1/this->volume(); this->rho_ = mass1/this->volume();
} }
@ -495,11 +501,11 @@ void Foam::ReactingParcel<ParcelType>::calc
} }
// Remove the particle when mass falls below minimum threshold // Remove the particle when mass falls below minimum threshold
if (np0*mass1 < td.cloud().constProps().minParcelMass()) if (np0*mass1 < cloud.constProps().minParcelMass())
{ {
td.keepParticle = false; td.keepParticle = false;
if (td.cloud().solution().coupled()) if (cloud.solution().coupled())
{ {
scalar dm = np0*mass0; scalar dm = np0*mass0;
@ -510,19 +516,19 @@ void Foam::ReactingParcel<ParcelType>::calc
label gid = composition.localToCarrierId(0, i); label gid = composition.localToCarrierId(0, i);
scalar hs = composition.carrier().Hs(gid, pc_, T0); scalar hs = composition.carrier().Hs(gid, pc_, T0);
td.cloud().rhoTrans(gid)[celli] += dmi; cloud.rhoTrans(gid)[celli] += dmi;
td.cloud().hsTrans()[celli] += dmi*hs; cloud.hsTrans()[celli] += dmi*hs;
} }
td.cloud().UTrans()[celli] += dm*U0; cloud.UTrans()[celli] += dm*U0;
td.cloud().phaseChange().addToPhaseChangeMass(np0*mass1); cloud.phaseChange().addToPhaseChangeMass(np0*mass1);
} }
return; return;
} }
// Correct surface values due to emitted species // Correct surface values due to emitted species
correctSurfaceValues(td, celli, Ts, Cs, rhos, mus, Prs, kappas); correctSurfaceValues(cloud, td, celli, Ts, Cs, rhos, mus, Prs, kappas);
Res = this->Re(U0, this->d_, rhos, mus); Res = this->Re(U0, this->d_, rhos, mus);
@ -536,6 +542,7 @@ void Foam::ReactingParcel<ParcelType>::calc
this->T_ = this->T_ =
this->calcHeatTransfer this->calcHeatTransfer
( (
cloud,
td, td,
dt, dt,
celli, celli,
@ -556,13 +563,25 @@ void Foam::ReactingParcel<ParcelType>::calc
// Calculate new particle velocity // Calculate new particle velocity
this->U_ = this->U_ =
this->calcVelocity(td, dt, celli, Res, mus, mass1, Su, dUTrans, Spu); this->calcVelocity
(
cloud,
td,
dt,
celli,
Res,
mus,
mass1,
Su,
dUTrans,
Spu
);
// 4. Accumulate carrier phase source terms // 4. Accumulate carrier phase source terms
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if (td.cloud().solution().coupled()) if (cloud.solution().coupled())
{ {
// Transfer mass lost to carrier mass, momentum and enthalpy sources // Transfer mass lost to carrier mass, momentum and enthalpy sources
forAll(dMass, i) forAll(dMass, i)
@ -571,27 +590,27 @@ void Foam::ReactingParcel<ParcelType>::calc
label gid = composition.localToCarrierId(0, i); label gid = composition.localToCarrierId(0, i);
scalar hs = composition.carrier().Hs(gid, pc_, T0); scalar hs = composition.carrier().Hs(gid, pc_, T0);
td.cloud().rhoTrans(gid)[celli] += dm; cloud.rhoTrans(gid)[celli] += dm;
td.cloud().UTrans()[celli] += dm*U0; cloud.UTrans()[celli] += dm*U0;
td.cloud().hsTrans()[celli] += dm*hs; cloud.hsTrans()[celli] += dm*hs;
} }
// Update momentum transfer // Update momentum transfer
td.cloud().UTrans()[celli] += np0*dUTrans; cloud.UTrans()[celli] += np0*dUTrans;
td.cloud().UCoeff()[celli] += np0*Spu; cloud.UCoeff()[celli] += np0*Spu;
// Update sensible enthalpy transfer // Update sensible enthalpy transfer
td.cloud().hsTrans()[celli] += np0*dhsTrans; cloud.hsTrans()[celli] += np0*dhsTrans;
td.cloud().hsCoeff()[celli] += np0*Sph; cloud.hsCoeff()[celli] += np0*Sph;
// Update radiation fields // Update radiation fields
if (td.cloud().radiation()) if (cloud.radiation())
{ {
const scalar ap = this->areaP(); const scalar ap = this->areaP();
const scalar T4 = pow4(T0); const scalar T4 = pow4(T0);
td.cloud().radAreaP()[celli] += dt*np0*ap; cloud.radAreaP()[celli] += dt*np0*ap;
td.cloud().radT4()[celli] += dt*np0*T4; cloud.radT4()[celli] += dt*np0*T4;
td.cloud().radAreaPT4()[celli] += dt*np0*ap*T4; cloud.radAreaPT4()[celli] += dt*np0*ap*T4;
} }
} }
} }

View File

@ -114,10 +114,9 @@ public:
}; };
template<class CloudType> class trackingData
class TrackingData
: :
public ParcelType::template TrackingData<CloudType> public ParcelType::trackingData
{ {
private: private:
@ -131,17 +130,16 @@ public:
public: public:
typedef typename ParcelType::template TrackingData<CloudType>::trackPart typedef typename ParcelType::trackingData::trackPart trackPart;
trackPart;
// Constructors // Constructors
//- Construct from components //- Construct from components
inline TrackingData template<class TrackCloudType>
inline trackingData
( (
CloudType& cloud, const TrackCloudType& cloud,
trackPart part = ParcelType::template trackPart part = ParcelType::trackingData::tpLinearTrack
TrackingData<CloudType>::tpLinearTrack
); );
@ -175,10 +173,11 @@ protected:
// Protected Member Functions // Protected Member Functions
//- Calculate Phase change //- Calculate Phase change
template<class TrackData> template<class TrackCloudType>
void calcPhaseChange void calcPhaseChange
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const scalar dt, // timestep const scalar dt, // timestep
const label celli, // owner cell const label celli, // owner cell
const scalar Re, // Reynolds number const scalar Re, // Reynolds number
@ -357,28 +356,31 @@ public:
// Main calculation loop // Main calculation loop
//- Set cell values //- Set cell values
template<class TrackData> template<class TrackCloudType>
void setCellValues void setCellValues
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const scalar dt, const scalar dt,
const label celli const label celli
); );
//- Correct cell values using latest transfer information //- Correct cell values using latest transfer information
template<class TrackData> template<class TrackCloudType>
void cellValueSourceCorrection void cellValueSourceCorrection
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const scalar dt, const scalar dt,
const label celli const label celli
); );
//- Correct surface values due to emitted species //- Correct surface values due to emitted species
template<class TrackData> template<class TrackCloudType>
void correctSurfaceValues void correctSurfaceValues
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const label celli, const label celli,
const scalar T, const scalar T,
const scalarField& Cs, const scalarField& Cs,
@ -389,10 +391,11 @@ public:
); );
//- Update parcel properties over the time interval //- Update parcel properties over the time interval
template<class TrackData> template<class TrackCloudType>
void calc void calc
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const scalar dt, const scalar dt,
const label celli const label celli
); );

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -24,14 +24,14 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
template<class ParcelType> template<class ParcelType>
template<class CloudType> template<class TrackCloudType>
inline Foam::ReactingParcel<ParcelType>::TrackingData<CloudType>::TrackingData inline Foam::ReactingParcel<ParcelType>::trackingData::trackingData
( (
CloudType& cloud, const TrackCloudType& cloud,
trackPart part trackPart part
) )
: :
ParcelType::template TrackingData<CloudType>(cloud, part), ParcelType::trackingData(cloud, part),
pInterp_ pInterp_
( (
interpolation<scalar>::New interpolation<scalar>::New
@ -44,9 +44,8 @@ inline Foam::ReactingParcel<ParcelType>::TrackingData<CloudType>::TrackingData
template<class ParcelType> template<class ParcelType>
template<class CloudType>
inline const Foam::interpolation<Foam::scalar>& inline const Foam::interpolation<Foam::scalar>&
Foam::ReactingParcel<ParcelType>::TrackingData<CloudType>::pInterp() const Foam::ReactingParcel<ParcelType>::trackingData::pInterp() const
{ {
return pInterp_(); return pInterp_();
} }

View File

@ -31,15 +31,16 @@ using namespace Foam::constant;
// * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * // // * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
template<class ParcelType> template<class ParcelType>
template<class TrackData> template<class TrackCloudType>
void Foam::ThermoParcel<ParcelType>::setCellValues void Foam::ThermoParcel<ParcelType>::setCellValues
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const scalar dt, const scalar dt,
const label celli const label celli
) )
{ {
ParcelType::setCellValues(td, dt, celli); ParcelType::setCellValues(cloud, td, dt, celli);
tetIndices tetIs = this->currentTetIndices(); tetIndices tetIs = this->currentTetIndices();
@ -47,56 +48,58 @@ void Foam::ThermoParcel<ParcelType>::setCellValues
Tc_ = td.TInterp().interpolate(this->coordinates(), tetIs); Tc_ = td.TInterp().interpolate(this->coordinates(), tetIs);
if (Tc_ < td.cloud().constProps().TMin()) if (Tc_ < cloud.constProps().TMin())
{ {
if (debug) if (debug)
{ {
WarningInFunction WarningInFunction
<< "Limiting observed temperature in cell " << celli << " to " << "Limiting observed temperature in cell " << celli << " to "
<< td.cloud().constProps().TMin() << nl << endl; << cloud.constProps().TMin() << nl << endl;
} }
Tc_ = td.cloud().constProps().TMin(); Tc_ = cloud.constProps().TMin();
} }
} }
template<class ParcelType> template<class ParcelType>
template<class TrackData> template<class TrackCloudType>
void Foam::ThermoParcel<ParcelType>::cellValueSourceCorrection void Foam::ThermoParcel<ParcelType>::cellValueSourceCorrection
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const scalar dt, const scalar dt,
const label celli const label celli
) )
{ {
this->Uc_ += td.cloud().UTrans()[celli]/this->massCell(celli); this->Uc_ += cloud.UTrans()[celli]/this->massCell(celli);
// tetIndices tetIs = this->currentTetIndices(); // tetIndices tetIs = this->currentTetIndices();
// Tc_ = td.TInterp().interpolate(this->coordinates(), tetIs); // Tc_ = td.TInterp().interpolate(this->coordinates(), tetIs);
const scalar CpMean = td.CpInterp().psi()[celli]; const scalar CpMean = td.CpInterp().psi()[celli];
Tc_ += td.cloud().hsTrans()[celli]/(CpMean*this->massCell(celli)); Tc_ += cloud.hsTrans()[celli]/(CpMean*this->massCell(celli));
if (Tc_ < td.cloud().constProps().TMin()) if (Tc_ < cloud.constProps().TMin())
{ {
if (debug) if (debug)
{ {
WarningInFunction WarningInFunction
<< "Limiting observed temperature in cell " << celli << " to " << "Limiting observed temperature in cell " << celli << " to "
<< td.cloud().constProps().TMin() << nl << endl; << cloud.constProps().TMin() << nl << endl;
} }
Tc_ = td.cloud().constProps().TMin(); Tc_ = cloud.constProps().TMin();
} }
} }
template<class ParcelType> template<class ParcelType>
template<class TrackData> template<class TrackCloudType>
void Foam::ThermoParcel<ParcelType>::calcSurfaceValues void Foam::ThermoParcel<ParcelType>::calcSurfaceValues
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const label celli, const label celli,
const scalar T, const scalar T,
scalar& Ts, scalar& Ts,
@ -109,16 +112,16 @@ void Foam::ThermoParcel<ParcelType>::calcSurfaceValues
// Surface temperature using two thirds rule // Surface temperature using two thirds rule
Ts = (2.0*T + Tc_)/3.0; Ts = (2.0*T + Tc_)/3.0;
if (Ts < td.cloud().constProps().TMin()) if (Ts < cloud.constProps().TMin())
{ {
if (debug) if (debug)
{ {
WarningInFunction WarningInFunction
<< "Limiting parcel surface temperature to " << "Limiting parcel surface temperature to "
<< td.cloud().constProps().TMin() << nl << endl; << cloud.constProps().TMin() << nl << endl;
} }
Ts = td.cloud().constProps().TMin(); Ts = cloud.constProps().TMin();
} }
// Assuming thermo props vary linearly with T for small d(T) // Assuming thermo props vary linearly with T for small d(T)
@ -136,10 +139,11 @@ void Foam::ThermoParcel<ParcelType>::calcSurfaceValues
template<class ParcelType> template<class ParcelType>
template<class TrackData> template<class TrackCloudType>
void Foam::ThermoParcel<ParcelType>::calc void Foam::ThermoParcel<ParcelType>::calc
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const scalar dt, const scalar dt,
const label celli const label celli
) )
@ -156,7 +160,7 @@ void Foam::ThermoParcel<ParcelType>::calc
// Calc surface values // Calc surface values
// ~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~
scalar Ts, rhos, mus, Pr, kappas; scalar Ts, rhos, mus, Pr, kappas;
calcSurfaceValues(td, celli, this->T_, Ts, rhos, mus, Pr, kappas); calcSurfaceValues(cloud, td, celli, this->T_, Ts, rhos, mus, Pr, kappas);
// Reynolds number // Reynolds number
scalar Re = this->Re(this->U_, this->d_, rhos, mus); scalar Re = this->Re(this->U_, this->d_, rhos, mus);
@ -194,6 +198,7 @@ void Foam::ThermoParcel<ParcelType>::calc
this->T_ = this->T_ =
this->calcHeatTransfer this->calcHeatTransfer
( (
cloud,
td, td,
dt, dt,
celli, celli,
@ -212,43 +217,56 @@ void Foam::ThermoParcel<ParcelType>::calc
// Calculate new particle velocity // Calculate new particle velocity
this->U_ = this->U_ =
this->calcVelocity(td, dt, celli, Re, mus, mass0, Su, dUTrans, Spu); this->calcVelocity
(
cloud,
td,
dt,
celli,
Re,
mus,
mass0,
Su,
dUTrans,
Spu
);
// Accumulate carrier phase source terms // Accumulate carrier phase source terms
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if (td.cloud().solution().coupled()) if (cloud.solution().coupled())
{ {
// Update momentum transfer // Update momentum transfer
td.cloud().UTrans()[celli] += np0*dUTrans; cloud.UTrans()[celli] += np0*dUTrans;
// Update momentum transfer coefficient // Update momentum transfer coefficient
td.cloud().UCoeff()[celli] += np0*Spu; cloud.UCoeff()[celli] += np0*Spu;
// Update sensible enthalpy transfer // Update sensible enthalpy transfer
td.cloud().hsTrans()[celli] += np0*dhsTrans; cloud.hsTrans()[celli] += np0*dhsTrans;
// Update sensible enthalpy coefficient // Update sensible enthalpy coefficient
td.cloud().hsCoeff()[celli] += np0*Sph; cloud.hsCoeff()[celli] += np0*Sph;
// Update radiation fields // Update radiation fields
if (td.cloud().radiation()) if (cloud.radiation())
{ {
const scalar ap = this->areaP(); const scalar ap = this->areaP();
const scalar T4 = pow4(T0); const scalar T4 = pow4(T0);
td.cloud().radAreaP()[celli] += dt*np0*ap; cloud.radAreaP()[celli] += dt*np0*ap;
td.cloud().radT4()[celli] += dt*np0*T4; cloud.radT4()[celli] += dt*np0*T4;
td.cloud().radAreaPT4()[celli] += dt*np0*ap*T4; cloud.radAreaPT4()[celli] += dt*np0*ap*T4;
} }
} }
} }
template<class ParcelType> template<class ParcelType>
template<class TrackData> template<class TrackCloudType>
Foam::scalar Foam::ThermoParcel<ParcelType>::calcHeatTransfer Foam::scalar Foam::ThermoParcel<ParcelType>::calcHeatTransfer
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const scalar dt, const scalar dt,
const label celli, const label celli,
const scalar Re, const scalar Re,
@ -260,7 +278,7 @@ Foam::scalar Foam::ThermoParcel<ParcelType>::calcHeatTransfer
scalar& Sph scalar& Sph
) )
{ {
if (!td.cloud().heatTransfer().active()) if (!cloud.heatTransfer().active())
{ {
return T_; return T_;
} }
@ -269,15 +287,15 @@ Foam::scalar Foam::ThermoParcel<ParcelType>::calcHeatTransfer
const scalar rho = this->rho(); const scalar rho = this->rho();
// Calc heat transfer coefficient // Calc heat transfer coefficient
scalar htc = td.cloud().heatTransfer().htc(d, Re, Pr, kappa, NCpW); scalar htc = cloud.heatTransfer().htc(d, Re, Pr, kappa, NCpW);
if (mag(htc) < ROOTVSMALL && !td.cloud().radiation()) if (mag(htc) < ROOTVSMALL && !cloud.radiation())
{ {
return return
max max
( (
T_ + dt*Sh/(this->volume(d)*rho*Cp_), T_ + dt*Sh/(this->volume(d)*rho*Cp_),
td.cloud().constProps().TMin() cloud.constProps().TMin()
); );
} }
@ -287,12 +305,12 @@ Foam::scalar Foam::ThermoParcel<ParcelType>::calcHeatTransfer
scalar ap = Tc_ + Sh/(As*htc); scalar ap = Tc_ + Sh/(As*htc);
const scalar bp = 6.0*htc/max(rho*d*Cp_, ROOTVSMALL); const scalar bp = 6.0*htc/max(rho*d*Cp_, ROOTVSMALL);
if (td.cloud().radiation()) if (cloud.radiation())
{ {
tetIndices tetIs = this->currentTetIndices(); tetIndices tetIs = this->currentTetIndices();
const scalar Gc = td.GInterp().interpolate(this->coordinates(), tetIs); const scalar Gc = td.GInterp().interpolate(this->coordinates(), tetIs);
const scalar sigma = physicoChemical::sigma.value(); const scalar sigma = physicoChemical::sigma.value();
const scalar epsilon = td.cloud().constProps().epsilon0(); const scalar epsilon = cloud.constProps().epsilon0();
// Assume constant source // Assume constant source
scalar s = epsilon*(Gc/4.0 - sigma*pow4(T_)); scalar s = epsilon*(Gc/4.0 - sigma*pow4(T_));
@ -302,7 +320,7 @@ Foam::scalar Foam::ThermoParcel<ParcelType>::calcHeatTransfer
// Integrate to find the new parcel temperature // Integrate to find the new parcel temperature
IntegrationScheme<scalar>::integrationResult Tres = IntegrationScheme<scalar>::integrationResult Tres =
td.cloud().TIntegrator().integrate(T_, dt, ap*bp, bp); cloud.TIntegrator().integrate(T_, dt, ap*bp, bp);
scalar Tnew = scalar Tnew =
min min
@ -310,9 +328,9 @@ Foam::scalar Foam::ThermoParcel<ParcelType>::calcHeatTransfer
max max
( (
Tres.value(), Tres.value(),
td.cloud().constProps().TMin() cloud.constProps().TMin()
), ),
td.cloud().constProps().TMax() cloud.constProps().TMax()
); );
Sph = dt*htc*As; Sph = dt*htc*As;

View File

@ -147,10 +147,9 @@ public:
}; };
template<class CloudType> class trackingData
class TrackingData
: :
public ParcelType::template TrackingData<CloudType> public ParcelType::trackingData
{ {
private: private:
@ -182,17 +181,16 @@ public:
public: public:
typedef typename ParcelType::template TrackingData<CloudType>::trackPart typedef typename ParcelType::trackingData::trackPart trackPart;
trackPart;
// Constructors // Constructors
//- Construct from components //- Construct from components
inline TrackingData template <class TrackCloudType>
inline trackingData
( (
CloudType& cloud, const TrackCloudType& cloud,
trackPart part = ParcelType::template trackPart part = ParcelType::trackingData::tpLinearTrack
TrackingData<CloudType>::tpLinearTrack
); );
@ -247,10 +245,11 @@ protected:
// Protected Member Functions // Protected Member Functions
//- Calculate new particle temperature //- Calculate new particle temperature
template<class TrackData> template<class TrackCloudType>
scalar calcHeatTransfer scalar calcHeatTransfer
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const scalar dt, // timestep const scalar dt, // timestep
const label celli, // owner cell const label celli, // owner cell
const scalar Re, // Reynolds number const scalar Re, // Reynolds number
@ -408,28 +407,31 @@ public:
// Main calculation loop // Main calculation loop
//- Set cell values //- Set cell values
template<class TrackData> template<class TrackCloudType>
void setCellValues void setCellValues
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const scalar dt, const scalar dt,
const label celli const label celli
); );
//- Correct cell values using latest transfer information //- Correct cell values using latest transfer information
template<class TrackData> template<class TrackCloudType>
void cellValueSourceCorrection void cellValueSourceCorrection
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const scalar dt, const scalar dt,
const label celli const label celli
); );
//- Calculate surface thermo properties //- Calculate surface thermo properties
template<class TrackData> template<class TrackCloudType>
void calcSurfaceValues void calcSurfaceValues
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const label celli, const label celli,
const scalar T, const scalar T,
scalar& Ts, scalar& Ts,
@ -440,10 +442,11 @@ public:
) const; ) const;
//- Update parcel properties over the time interval //- Update parcel properties over the time interval
template<class TrackData> template<class TrackCloudType>
void calc void calc
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const scalar dt, const scalar dt,
const label celli const label celli
); );

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -24,14 +24,14 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
template<class ParcelType> template<class ParcelType>
template<class CloudType> template<class TrackCloudType>
inline Foam::ThermoParcel<ParcelType>::TrackingData<CloudType>::TrackingData inline Foam::ThermoParcel<ParcelType>::trackingData::trackingData
( (
CloudType& cloud, const TrackCloudType& cloud,
trackPart part trackPart part
) )
: :
ParcelType::template TrackingData<CloudType>(cloud, part), ParcelType::trackingData(cloud, part),
Cp_(cloud.thermo().thermo().Cp()), Cp_(cloud.thermo().thermo().Cp()),
kappa_(cloud.thermo().thermo().kappa()), kappa_(cloud.thermo().thermo().kappa()),
TInterp_ TInterp_
@ -76,54 +76,48 @@ inline Foam::ThermoParcel<ParcelType>::TrackingData<CloudType>::TrackingData
template<class ParcelType> template<class ParcelType>
template<class CloudType>
inline const Foam::volScalarField& inline const Foam::volScalarField&
Foam::ThermoParcel<ParcelType>::TrackingData<CloudType>::Cp() const Foam::ThermoParcel<ParcelType>::trackingData::Cp() const
{ {
return Cp_; return Cp_;
} }
template<class ParcelType> template<class ParcelType>
template<class CloudType>
inline const Foam::volScalarField& inline const Foam::volScalarField&
Foam::ThermoParcel<ParcelType>::TrackingData<CloudType>::kappa() const Foam::ThermoParcel<ParcelType>::trackingData::kappa() const
{ {
return kappa_; return kappa_;
} }
template<class ParcelType> template<class ParcelType>
template<class CloudType>
inline const Foam::interpolation<Foam::scalar>& inline const Foam::interpolation<Foam::scalar>&
Foam::ThermoParcel<ParcelType>::TrackingData<CloudType>::TInterp() const Foam::ThermoParcel<ParcelType>::trackingData::TInterp() const
{ {
return TInterp_(); return TInterp_();
} }
template<class ParcelType> template<class ParcelType>
template<class CloudType>
inline const Foam::interpolation<Foam::scalar>& inline const Foam::interpolation<Foam::scalar>&
Foam::ThermoParcel<ParcelType>::TrackingData<CloudType>::CpInterp() const Foam::ThermoParcel<ParcelType>::trackingData::CpInterp() const
{ {
return CpInterp_(); return CpInterp_();
} }
template<class ParcelType> template<class ParcelType>
template<class CloudType>
inline const Foam::interpolation<Foam::scalar>& inline const Foam::interpolation<Foam::scalar>&
Foam::ThermoParcel<ParcelType>::TrackingData<CloudType>::kappaInterp() const Foam::ThermoParcel<ParcelType>::trackingData::kappaInterp() const
{ {
return kappaInterp_(); return kappaInterp_();
} }
template<class ParcelType> template<class ParcelType>
template<class CloudType>
inline const Foam::interpolation<Foam::scalar>& inline const Foam::interpolation<Foam::scalar>&
Foam::ThermoParcel<ParcelType>::TrackingData<CloudType>::GInterp() const Foam::ThermoParcel<ParcelType>::trackingData::GInterp() const
{ {
if (!GInterp_.valid()) if (!GInterp_.valid())
{ {

View File

@ -419,8 +419,12 @@ Foam::scalar Foam::InjectionModel<CloudType>::averageParcelMass()
template<class CloudType> template<class CloudType>
template<class TrackData> template<class TrackCloudType>
void Foam::InjectionModel<CloudType>::inject(TrackData& td) void Foam::InjectionModel<CloudType>::inject
(
TrackCloudType& cloud,
typename CloudType::parcelType::trackingData& td
)
{ {
if (!this->active()) if (!this->active())
{ {
@ -440,7 +444,6 @@ void Foam::InjectionModel<CloudType>::inject(TrackData& td)
{ {
const scalar trackTime = this->owner().solution().trackTime(); const scalar trackTime = this->owner().solution().trackTime();
const polyMesh& mesh = this->owner().mesh(); const polyMesh& mesh = this->owner().mesh();
typename TrackData::cloudType& cloud = td.cloud();
// Duration of injection period during this timestep // Duration of injection period during this timestep
const scalar deltaT = const scalar deltaT =
@ -519,7 +522,7 @@ void Foam::InjectionModel<CloudType>::inject(TrackData& td)
parcelsAdded++; parcelsAdded++;
massAdded += pPtr->nParticle()*pPtr->mass(); massAdded += pPtr->nParticle()*pPtr->mass();
if (pPtr->move(td, dt)) if (pPtr->move(cloud, td, dt))
{ {
pPtr->typeId() = injectorID_; pPtr->typeId() = injectorID_;
cloud.addParticle(pPtr); cloud.addParticle(pPtr);
@ -546,10 +549,11 @@ void Foam::InjectionModel<CloudType>::inject(TrackData& td)
template<class CloudType> template<class CloudType>
template<class TrackData> template<class TrackCloudType>
void Foam::InjectionModel<CloudType>::injectSteadyState void Foam::InjectionModel<CloudType>::injectSteadyState
( (
TrackData& td, TrackCloudType& cloud,
typename CloudType::parcelType::trackingData& td,
const scalar trackTime const scalar trackTime
) )
{ {
@ -566,7 +570,6 @@ void Foam::InjectionModel<CloudType>::injectSteadyState
} }
const polyMesh& mesh = this->owner().mesh(); const polyMesh& mesh = this->owner().mesh();
typename TrackData::cloudType& cloud = td.cloud();
massTotal_ = massFlowRate_.value(mesh.time().value()); massTotal_ = massFlowRate_.value(mesh.time().value());

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -307,12 +307,21 @@ public:
// Per-injection event functions // Per-injection event functions
//- Main injection loop //- Main injection loop
template<class TrackData> template<class TrackCloudType>
void inject(TrackData& td); void inject
(
TrackCloudType& cloud,
typename CloudType::parcelType::trackingData& td
);
//- Main injection loop - steady-state //- Main injection loop - steady-state
template<class TrackData> template<class TrackCloudType>
void injectSteadyState(TrackData& td, const scalar trackTime); void injectSteadyState
(
TrackCloudType& cloud,
typename CloudType::parcelType::trackingData& td,
const scalar trackTime
);
// Injection geometry // Injection geometry

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -179,27 +179,32 @@ void Foam::InjectionModelList<CloudType>::updateMesh()
template<class CloudType> template<class CloudType>
template<class TrackData> template<class TrackCloudType>
void Foam::InjectionModelList<CloudType>::inject(TrackData& td) void Foam::InjectionModelList<CloudType>::inject
(
TrackCloudType& cloud,
typename CloudType::parcelType::trackingData& td
)
{ {
forAll(*this, i) forAll(*this, i)
{ {
this->operator[](i).inject(td); this->operator[](i).inject(cloud, td);
} }
} }
template<class CloudType> template<class CloudType>
template<class TrackData> template<class TrackCloudType>
void Foam::InjectionModelList<CloudType>::injectSteadyState void Foam::InjectionModelList<CloudType>::injectSteadyState
( (
TrackData& td, TrackCloudType& cloud,
typename CloudType::parcelType::trackingData& td,
const scalar trackTime const scalar trackTime
) )
{ {
forAll(*this, i) forAll(*this, i)
{ {
this->operator[](i).injectSteadyState(td, trackTime); this->operator[](i).injectSteadyState(cloud, td, trackTime);
} }
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -106,12 +106,21 @@ public:
// Per-injection event functions // Per-injection event functions
//- Main injection loop //- Main injection loop
template<class TrackData> template<class TrackCloudType>
void inject(TrackData& td); void inject
(
TrackCloudType& cloud,
typename CloudType::parcelType::trackingData& td
);
//- Main injection loop - steady-state //- Main injection loop - steady-state
template<class TrackData> template<class TrackCloudType>
void injectSteadyState(TrackData& td, const scalar trackTime); void injectSteadyState
(
TrackCloudType& cloud,
typename CloudType::parcelType::trackingData& td,
const scalar trackTime
);
// I-O // I-O

View File

@ -100,8 +100,8 @@ Foam::SurfaceFilmModel<CloudType>::~SurfaceFilmModel()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType> template<class CloudType>
template<class TrackData> template<class TrackCloudType>
void Foam::SurfaceFilmModel<CloudType>::inject(TrackData& td) void Foam::SurfaceFilmModel<CloudType>::inject(TrackCloudType& cloud)
{ {
if (!this->active()) if (!this->active())
{ {
@ -159,18 +159,18 @@ void Foam::SurfaceFilmModel<CloudType>::inject(TrackData& td)
new parcelType(this->owner().pMesh(), pos, celli); new parcelType(this->owner().pMesh(), pos, celli);
// Check/set new parcel thermo properties // Check/set new parcel thermo properties
td.cloud().setParcelThermoProperties(*pPtr, 0.0); cloud.setParcelThermoProperties(*pPtr, 0.0);
setParcelProperties(*pPtr, j); setParcelProperties(*pPtr, j);
if (pPtr->nParticle() > 0.001) if (pPtr->nParticle() > 0.001)
{ {
// Check new parcel properties // Check new parcel properties
// td.cloud().checkParcelProperties(*pPtr, 0.0, true); // cloud.checkParcelProperties(*pPtr, 0.0, true);
td.cloud().checkParcelProperties(*pPtr, 0.0, false); cloud.checkParcelProperties(*pPtr, 0.0, false);
// Add the new parcel to the cloud // Add the new parcel to the cloud
td.cloud().addParticle(pPtr); cloud.addParticle(pPtr);
nParcelsInjected_++; nParcelsInjected_++;
} }

View File

@ -215,8 +215,8 @@ public:
) = 0; ) = 0;
//- Inject parcels into the cloud //- Inject parcels into the cloud
template<class TrackData> template<class TrackCloudType>
void inject(TrackData& td); void inject(TrackCloudType& cloud);
// I-O // I-O

View File

@ -65,12 +65,17 @@ Foam::tensor Foam::molecule::rotationTensorZ(scalar phi) const
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::molecule::move(molecule::trackingData& td, const scalar trackTime) bool Foam::molecule::move
(
moleculeCloud& cloud,
trackingData& td,
const scalar trackTime
)
{ {
td.switchProcessor = false; td.switchProcessor = false;
td.keepParticle = true; td.keepParticle = true;
const constantProperties& constProps(td.cloud().constProps(id_)); const constantProperties& constProps(cloud.constProps(id_));
if (td.part() == 0) if (td.part() == 0)
{ {
@ -88,7 +93,7 @@ bool Foam::molecule::move(molecule::trackingData& td, const scalar trackTime)
while (td.keepParticle && !td.switchProcessor && stepFraction() < 1) while (td.keepParticle && !td.switchProcessor && stepFraction() < 1)
{ {
const scalar f = 1 - stepFraction(); const scalar f = 1 - stepFraction();
trackToAndHitFace(f*trackTime*v_, f, td); trackToAndHitFace(f*trackTime*v_, f, cloud, td);
} }
} }
else if (td.part() == 2) else if (td.part() == 2)
@ -233,6 +238,7 @@ void Foam::molecule::setSiteSizes(label size)
bool Foam::molecule::hitPatch bool Foam::molecule::hitPatch
( (
const polyPatch&, const polyPatch&,
moleculeCloud&,
trackingData&, trackingData&,
const label, const label,
const scalar, const scalar,
@ -246,6 +252,7 @@ bool Foam::molecule::hitPatch
void Foam::molecule::hitProcessorPatch void Foam::molecule::hitProcessorPatch
( (
const processorPolyPatch&, const processorPolyPatch&,
moleculeCloud&,
trackingData& td trackingData& td
) )
{ {
@ -256,6 +263,7 @@ void Foam::molecule::hitProcessorPatch
void Foam::molecule::hitWallPatch void Foam::molecule::hitWallPatch
( (
const wallPolyPatch& wpp, const wallPolyPatch& wpp,
moleculeCloud& cloud,
trackingData& td, trackingData& td,
const tetIndices& tetIs const tetIndices& tetIs
) )
@ -278,6 +286,7 @@ void Foam::molecule::hitWallPatch
void Foam::molecule::hitPatch void Foam::molecule::hitPatch
( (
const polyPatch&, const polyPatch&,
moleculeCloud&,
trackingData& td trackingData& td
) )
{ {

View File

@ -164,7 +164,7 @@ public:
//- Class used to pass tracking data to the trackToFace function //- Class used to pass tracking data to the trackToFace function
class trackingData class trackingData
: :
public particle::TrackingData<moleculeCloud> public particle::trackingData
{ {
// label specifying which part of the integration algorithm is taking // label specifying which part of the integration algorithm is taking
label part_; label part_;
@ -176,7 +176,7 @@ public:
trackingData(moleculeCloud& cloud, label part) trackingData(moleculeCloud& cloud, label part)
: :
particle::TrackingData<moleculeCloud>(cloud), particle::trackingData(cloud),
part_(part) part_(part)
{} {}
@ -309,7 +309,7 @@ public:
// Tracking // Tracking
bool move(trackingData&, const scalar trackTime); bool move(moleculeCloud&, trackingData&, const scalar trackTime);
virtual void transformProperties(const tensor& T); virtual void transformProperties(const tensor& T);
@ -366,6 +366,7 @@ public:
bool hitPatch bool hitPatch
( (
const polyPatch&, const polyPatch&,
moleculeCloud& cloud,
trackingData& td, trackingData& td,
const label patchi, const label patchi,
const scalar trackFraction, const scalar trackFraction,
@ -376,6 +377,7 @@ public:
void hitProcessorPatch void hitProcessorPatch
( (
const processorPolyPatch&, const processorPolyPatch&,
moleculeCloud& cloud,
trackingData& td trackingData& td
); );
@ -383,6 +385,7 @@ public:
void hitWallPatch void hitWallPatch
( (
const wallPolyPatch&, const wallPolyPatch&,
moleculeCloud& cloud,
trackingData& td, trackingData& td,
const tetIndices& const tetIndices&
); );
@ -391,6 +394,7 @@ public:
void hitPatch void hitPatch
( (
const polyPatch&, const polyPatch&,
moleculeCloud& cloud,
trackingData& td trackingData& td
); );

View File

@ -1119,18 +1119,18 @@ Foam::moleculeCloud::moleculeCloud
void Foam::moleculeCloud::evolve() void Foam::moleculeCloud::evolve()
{ {
molecule::trackingData td0(*this, 0); molecule::trackingData td0(*this, 0);
Cloud<molecule>::move(td0, mesh_.time().deltaTValue()); Cloud<molecule>::move(*this, td0, mesh_.time().deltaTValue());
molecule::trackingData td1(*this, 1); molecule::trackingData td1(*this, 1);
Cloud<molecule>::move(td1, mesh_.time().deltaTValue()); Cloud<molecule>::move(*this, td1, mesh_.time().deltaTValue());
molecule::trackingData td2(*this, 2); molecule::trackingData td2(*this, 2);
Cloud<molecule>::move(td2, mesh_.time().deltaTValue()); Cloud<molecule>::move(*this, td2, mesh_.time().deltaTValue());
calculateForce(); calculateForce();
molecule::trackingData td3(*this, 3); molecule::trackingData td3(*this, 3);
Cloud<molecule>::move(td3, mesh_.time().deltaTValue()); Cloud<molecule>::move(*this, td3, mesh_.time().deltaTValue());
} }

View File

@ -36,6 +36,7 @@ namespace Foam
bool Foam::solidParticle::move bool Foam::solidParticle::move
( (
solidParticleCloud& cloud,
trackingData& td, trackingData& td,
const scalar trackTime const scalar trackTime
) )
@ -58,7 +59,7 @@ bool Foam::solidParticle::move
const scalar sfrac = stepFraction(); const scalar sfrac = stepFraction();
const scalar f = 1 - stepFraction(); const scalar f = 1 - stepFraction();
trackToAndHitFace(f*trackTime*U_, f, td); trackToAndHitFace(f*trackTime*U_, f, cloud, td);
const scalar dt = (stepFraction() - sfrac)*trackTime; const scalar dt = (stepFraction() - sfrac)*trackTime;
@ -67,7 +68,7 @@ bool Foam::solidParticle::move
vector Uc = td.UInterp().interpolate(this->coordinates(), tetIs); vector Uc = td.UInterp().interpolate(this->coordinates(), tetIs);
scalar nuc = td.nuInterp().interpolate(this->coordinates(), tetIs); scalar nuc = td.nuInterp().interpolate(this->coordinates(), tetIs);
scalar rhop = td.cloud().rhop(); scalar rhop = cloud.rhop();
scalar magUr = mag(Uc - U_); scalar magUr = mag(Uc - U_);
scalar ReFunc = 1.0; scalar ReFunc = 1.0;
@ -98,6 +99,7 @@ bool Foam::solidParticle::move
bool Foam::solidParticle::hitPatch bool Foam::solidParticle::hitPatch
( (
const polyPatch&, const polyPatch&,
solidParticleCloud& cloud,
trackingData&, trackingData&,
const label, const label,
const scalar, const scalar,
@ -111,6 +113,7 @@ bool Foam::solidParticle::hitPatch
void Foam::solidParticle::hitProcessorPatch void Foam::solidParticle::hitProcessorPatch
( (
const processorPolyPatch&, const processorPolyPatch&,
solidParticleCloud& cloud,
trackingData& td trackingData& td
) )
{ {
@ -121,6 +124,7 @@ void Foam::solidParticle::hitProcessorPatch
void Foam::solidParticle::hitWallPatch void Foam::solidParticle::hitWallPatch
( (
const wallPolyPatch& wpp, const wallPolyPatch& wpp,
solidParticleCloud& cloud,
trackingData& td, trackingData& td,
const tetIndices& tetIs const tetIndices& tetIs
) )
@ -133,16 +137,17 @@ void Foam::solidParticle::hitWallPatch
if (Un > 0) if (Un > 0)
{ {
U_ -= (1.0 + td.cloud().e())*Un*nw; U_ -= (1.0 + cloud.e())*Un*nw;
} }
U_ -= td.cloud().mu()*Ut; U_ -= cloud.mu()*Ut;
} }
void Foam::solidParticle::hitPatch void Foam::solidParticle::hitPatch
( (
const polyPatch&, const polyPatch&,
solidParticleCloud& cloud,
trackingData& td trackingData& td
) )
{ {

View File

@ -83,7 +83,7 @@ public:
//- Class used to pass tracking data to the trackToFace function //- Class used to pass tracking data to the trackToFace function
class trackingData class trackingData
: :
public particle::TrackingData<solidParticleCloud> public particle::trackingData
{ {
// Interpolators for continuous phase fields // Interpolators for continuous phase fields
@ -101,7 +101,7 @@ public:
inline trackingData inline trackingData
( (
solidParticleCloud& spc, const solidParticleCloud& spc,
const interpolationCellPoint<scalar>& rhoInterp, const interpolationCellPoint<scalar>& rhoInterp,
const interpolationCellPoint<vector>& UInterp, const interpolationCellPoint<vector>& UInterp,
const interpolationCellPoint<scalar>& nuInterp, const interpolationCellPoint<scalar>& nuInterp,
@ -192,7 +192,7 @@ public:
// Tracking // Tracking
//- Move //- Move
bool move(trackingData&, const scalar); bool move(solidParticleCloud&, trackingData&, const scalar);
// Patch interactions // Patch interactions
@ -202,6 +202,7 @@ public:
bool hitPatch bool hitPatch
( (
const polyPatch&, const polyPatch&,
solidParticleCloud& cloud,
trackingData& td, trackingData& td,
const label patchi, const label patchi,
const scalar trackFraction, const scalar trackFraction,
@ -213,6 +214,7 @@ public:
void hitProcessorPatch void hitProcessorPatch
( (
const processorPolyPatch&, const processorPolyPatch&,
solidParticleCloud& cloud,
trackingData& td trackingData& td
); );
@ -220,6 +222,7 @@ public:
void hitWallPatch void hitWallPatch
( (
const wallPolyPatch&, const wallPolyPatch&,
solidParticleCloud& cloud,
trackingData& td, trackingData& td,
const tetIndices& const tetIndices&
); );
@ -228,6 +231,7 @@ public:
void hitPatch void hitPatch
( (
const polyPatch&, const polyPatch&,
solidParticleCloud& cloud,
trackingData& td trackingData& td
); );

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -82,7 +82,7 @@ void Foam::solidParticleCloud::move(const dimensionedVector& g)
solidParticle::trackingData solidParticle::trackingData
td(*this, rhoInterp, UInterp, nuInterp, g.value()); td(*this, rhoInterp, UInterp, nuInterp, g.value());
Cloud<solidParticle>::move(td, mesh_.time().deltaTValue()); Cloud<solidParticle>::move(*this, td, mesh_.time().deltaTValue());
} }

View File

@ -27,14 +27,14 @@ License
inline Foam::solidParticle::trackingData::trackingData inline Foam::solidParticle::trackingData::trackingData
( (
solidParticleCloud& spc, const solidParticleCloud& spc,
const interpolationCellPoint<scalar>& rhoInterp, const interpolationCellPoint<scalar>& rhoInterp,
const interpolationCellPoint<vector>& UInterp, const interpolationCellPoint<vector>& UInterp,
const interpolationCellPoint<scalar>& nuInterp, const interpolationCellPoint<scalar>& nuInterp,
const vector& g const vector& g
) )
: :
particle::TrackingData<solidParticleCloud>(spc), particle::trackingData(spc),
rhoInterp_(rhoInterp), rhoInterp_(rhoInterp),
UInterp_(UInterp), UInterp_(UInterp),
nuInterp_(nuInterp), nuInterp_(nuInterp),

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -218,10 +218,9 @@ void Foam::SprayCloud<CloudType>::evolve()
{ {
if (this->solution().canEvolve()) if (this->solution().canEvolve())
{ {
typename parcelType::template typename parcelType::trackingData td(*this);
TrackingData<SprayCloud<CloudType>> td(*this);
this->solve(td); this->solve(*this, td);
} }
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -31,49 +31,52 @@ License
// * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * // // * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
template<class ParcelType> template<class ParcelType>
template<class TrackData> template<class TrackCloudType>
void Foam::SprayParcel<ParcelType>::setCellValues void Foam::SprayParcel<ParcelType>::setCellValues
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const scalar dt, const scalar dt,
const label celli const label celli
) )
{ {
ParcelType::setCellValues(td, dt, celli); ParcelType::setCellValues(cloud, td, dt, celli);
} }
template<class ParcelType> template<class ParcelType>
template<class TrackData> template<class TrackCloudType>
void Foam::SprayParcel<ParcelType>::cellValueSourceCorrection void Foam::SprayParcel<ParcelType>::cellValueSourceCorrection
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const scalar dt, const scalar dt,
const label celli const label celli
) )
{ {
ParcelType::cellValueSourceCorrection(td, dt, celli); ParcelType::cellValueSourceCorrection(cloud, td, dt, celli);
} }
template<class ParcelType> template<class ParcelType>
template<class TrackData> template<class TrackCloudType>
void Foam::SprayParcel<ParcelType>::calc void Foam::SprayParcel<ParcelType>::calc
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const scalar dt, const scalar dt,
const label celli const label celli
) )
{ {
typedef typename TrackData::cloudType::reactingCloudType reactingCloudType; typedef typename TrackCloudType::reactingCloudType reactingCloudType;
const CompositionModel<reactingCloudType>& composition = const CompositionModel<reactingCloudType>& composition =
td.cloud().composition(); cloud.composition();
// Check if parcel belongs to liquid core // Check if parcel belongs to liquid core
if (liquidCore() > 0.5) if (liquidCore() > 0.5)
{ {
// Liquid core parcels should not experience coupled forces // Liquid core parcels should not experience coupled forces
td.cloud().forces().setCalcCoupled(false); cloud.forces().setCalcCoupled(false);
} }
// Get old mixture composition // Get old mixture composition
@ -90,7 +93,7 @@ void Foam::SprayParcel<ParcelType>::calc
} }
// Set the maximum temperature limit // Set the maximum temperature limit
td.cloud().constProps().setTMax(TMax); cloud.constProps().setTMax(TMax);
// Store the parcel properties // Store the parcel properties
this->Cp() = composition.liquids().Cp(pc0, T0, X0); this->Cp() = composition.liquids().Cp(pc0, T0, X0);
@ -100,7 +103,7 @@ void Foam::SprayParcel<ParcelType>::calc
const scalar mass0 = this->mass(); const scalar mass0 = this->mass();
mu_ = composition.liquids().mu(pc0, T0, X0); mu_ = composition.liquids().mu(pc0, T0, X0);
ParcelType::calc(td, dt, celli); ParcelType::calc(cloud,td, dt, celli);
if (td.keepParticle) if (td.keepParticle)
{ {
@ -127,7 +130,7 @@ void Foam::SprayParcel<ParcelType>::calc
if (liquidCore() > 0.5) if (liquidCore() > 0.5)
{ {
calcAtomization(td, dt, celli); calcAtomization(cloud, td, dt, celli);
// Preserve the total mass/volume by increasing the number of // Preserve the total mass/volume by increasing the number of
// particles in parcels due to breakup // particles in parcels due to breakup
@ -136,24 +139,26 @@ void Foam::SprayParcel<ParcelType>::calc
} }
else else
{ {
calcBreakup(td, dt, celli); calcBreakup(cloud, td, dt, celli);
} }
} }
// Restore coupled forces // Restore coupled forces
td.cloud().forces().setCalcCoupled(true); cloud.forces().setCalcCoupled(true);
} }
template<class ParcelType> template<class ParcelType>
template<class TrackData> template<class TrackCloudType>
void Foam::SprayParcel<ParcelType>::calcAtomization void Foam::SprayParcel<ParcelType>::calcAtomization
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const scalar dt, const scalar dt,
const label celli const label celli
) )
{ {
<<<<<<< HEAD
typedef typename TrackData::cloudType::sprayCloudType sprayCloudType; typedef typename TrackData::cloudType::sprayCloudType sprayCloudType;
const AtomizationModel<sprayCloudType>& atomization = const AtomizationModel<sprayCloudType>& atomization =
td.cloud().atomization(); td.cloud().atomization();
@ -164,9 +169,18 @@ void Foam::SprayParcel<ParcelType>::calcAtomization
} }
typedef typename TrackData::cloudType::reactingCloudType reactingCloudType; typedef typename TrackData::cloudType::reactingCloudType reactingCloudType;
=======
typedef typename TrackCloudType::reactingCloudType reactingCloudType;
>>>>>>> 4fd4fadab... lagrangian: Un-templated the tracking data
const CompositionModel<reactingCloudType>& composition = const CompositionModel<reactingCloudType>& composition =
td.cloud().composition(); cloud.composition();
<<<<<<< HEAD
=======
typedef typename TrackCloudType::sprayCloudType sprayCloudType;
const AtomizationModel<sprayCloudType>& atomization =
cloud.atomization();
>>>>>>> 4fd4fadab... lagrangian: Un-templated the tracking data
// Average molecular weight of carrier mix - assumes perfect gas // Average molecular weight of carrier mix - assumes perfect gas
scalar Wc = this->rhoc_*RR*this->Tc()/this->pc(); scalar Wc = this->rhoc_*RR*this->Tc()/this->pc();
@ -176,8 +190,8 @@ void Foam::SprayParcel<ParcelType>::calcAtomization
// Calculate average gas density based on average temperature // Calculate average gas density based on average temperature
scalar rhoAv = this->pc()/(R*Tav); scalar rhoAv = this->pc()/(R*Tav);
scalar soi = td.cloud().injectors().timeStart(); scalar soi = cloud.injectors().timeStart();
scalar currentTime = td.cloud().db().time().value(); scalar currentTime = cloud.db().time().value();
const vector& pos = this->position(); const vector& pos = this->position();
const vector& injectionPos = this->position0(); const vector& injectionPos = this->position0();
@ -186,15 +200,15 @@ void Foam::SprayParcel<ParcelType>::calcAtomization
scalar Urel = mag(this->U()); scalar Urel = mag(this->U());
scalar t0 = max(0.0, currentTime - this->age() - soi); scalar t0 = max(0.0, currentTime - this->age() - soi);
scalar t1 = min(t0 + dt, td.cloud().injectors().timeEnd() - soi); scalar t1 = min(t0 + dt, cloud.injectors().timeEnd() - soi);
// This should be the vol flow rate from when the parcel was injected // This should be the vol flow rate from when the parcel was injected
scalar volFlowRate = td.cloud().injectors().volumeToInject(t0, t1)/dt; scalar volFlowRate = cloud.injectors().volumeToInject(t0, t1)/dt;
scalar chi = 0.0; scalar chi = 0.0;
if (atomization.calcChi()) if (atomization.calcChi())
{ {
chi = this->chi(td, composition.liquids().X(this->Y())); chi = this->chi(cloud, td, composition.liquids().X(this->Y()));
} }
atomization.update atomization.update
@ -211,46 +225,45 @@ void Foam::SprayParcel<ParcelType>::calcAtomization
Urel, Urel,
pos, pos,
injectionPos, injectionPos,
td.cloud().pAmbient(), cloud.pAmbient(),
chi, chi,
td.cloud().rndGen() cloud.rndGen()
); );
} }
template<class ParcelType> template<class ParcelType>
template<class TrackData> template<class TrackCloudType>
void Foam::SprayParcel<ParcelType>::calcBreakup void Foam::SprayParcel<ParcelType>::calcBreakup
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const scalar dt, const scalar dt,
const label celli const label celli
) )
{ {
typedef typename TrackData::cloudType cloudType; auto& breakup = cloud.breakup();
typedef typename cloudType::parcelType parcelType;
typedef typename cloudType::forceType forceType;
typedef typename TrackData::cloudType::sprayCloudType sprayCloudType;
BreakupModel<sprayCloudType>& breakup = td.cloud().breakup();
if (!breakup.active()) if (!breakup.active())
{ {
return; return;
} }
typedef typename TrackCloudType::parcelType parcelType;
typedef typename TrackCloudType::forceType forceType;
const parcelType& p = static_cast<const parcelType&>(*this); const parcelType& p = static_cast<const parcelType&>(*this);
const forceType& forces = td.cloud().forces(); const forceType& forces = cloud.forces();
if (breakup.solveOscillationEq()) if (breakup.solveOscillationEq())
{ {
solveTABEq(td, dt); solveTABEq(cloud, td, dt);
} }
// Average molecular weight of carrier mix - assumes perfect gas // Average molecular weight of carrier mix - assumes perfect gas
scalar Wc = this->rhoc()*RR*this->Tc()/this->pc(); scalar Wc = this->rhoc()*RR*this->Tc()/this->pc();
scalar R = RR/Wc; scalar R = RR/Wc;
scalar Tav = td.cloud().atomization().Taverage(this->T(), this->Tc()); scalar Tav = cloud.atomization().Taverage(this->T(), this->Tc());
// Calculate average gas density based on average temperature // Calculate average gas density based on average temperature
scalar rhoAv = this->pc()/(R*Tav); scalar rhoAv = this->pc()/(R*Tav);
@ -264,7 +277,7 @@ void Foam::SprayParcel<ParcelType>::calcBreakup
const forceSuSp Fncp = forces.calcNonCoupled(p, dt, mass, Re, muAv); const forceSuSp Fncp = forces.calcNonCoupled(p, dt, mass, Re, muAv);
this->tMom() = mass/(Fcp.Sp() + Fncp.Sp() + ROOTVSMALL); this->tMom() = mass/(Fcp.Sp() + Fncp.Sp() + ROOTVSMALL);
const vector g = td.cloud().g().value(); const vector g = cloud.g().value();
scalar parcelMassChild = 0.0; scalar parcelMassChild = 0.0;
scalar dChild = 0.0; scalar dChild = 0.0;
@ -315,38 +328,39 @@ void Foam::SprayParcel<ParcelType>::calcBreakup
child->age() = 0.0; child->age() = 0.0;
child->liquidCore() = 0.0; child->liquidCore() = 0.0;
child->KHindex() = 1.0; child->KHindex() = 1.0;
child->y() = td.cloud().breakup().y0(); child->y() = cloud.breakup().y0();
child->yDot() = td.cloud().breakup().yDot0(); child->yDot() = cloud.breakup().yDot0();
child->tc() = 0.0; child->tc() = 0.0;
child->ms() = -GREAT; child->ms() = -GREAT;
child->injector() = this->injector(); child->injector() = this->injector();
child->tMom() = massChild/(Fcp.Sp() + Fncp.Sp()); child->tMom() = massChild/(Fcp.Sp() + Fncp.Sp());
child->user() = 0.0; child->user() = 0.0;
child->setCellValues(td, dt, celli); child->setCellValues(cloud, td, dt, celli);
td.cloud().addParticle(child); cloud.addParticle(child);
} }
} }
template<class ParcelType> template<class ParcelType>
template<class TrackData> template<class TrackCloudType>
Foam::scalar Foam::SprayParcel<ParcelType>::chi Foam::scalar Foam::SprayParcel<ParcelType>::chi
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const scalarField& X const scalarField& X
) const ) const
{ {
// Modifications to take account of the flash boiling on primary break-up // Modifications to take account of the flash boiling on primary break-up
typedef typename TrackData::cloudType::reactingCloudType reactingCloudType; typedef typename TrackCloudType::reactingCloudType reactingCloudType;
const CompositionModel<reactingCloudType>& composition = const CompositionModel<reactingCloudType>& composition =
td.cloud().composition(); cloud.composition();
scalar chi = 0.0; scalar chi = 0.0;
scalar T0 = this->T(); scalar T0 = this->T();
scalar p0 = this->pc(); scalar p0 = this->pc();
scalar pAmb = td.cloud().pAmbient(); scalar pAmb = cloud.pAmbient();
scalar pv = composition.liquids().pv(p0, T0, X); scalar pv = composition.liquids().pv(p0, T0, X);
@ -374,16 +388,17 @@ Foam::scalar Foam::SprayParcel<ParcelType>::chi
template<class ParcelType> template<class ParcelType>
template<class TrackData> template<class TrackCloudType>
void Foam::SprayParcel<ParcelType>::solveTABEq void Foam::SprayParcel<ParcelType>::solveTABEq
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const scalar dt const scalar dt
) )
{ {
const scalar& TABCmu = td.cloud().breakup().TABCmu(); const scalar& TABCmu = cloud.breakup().TABCmu();
const scalar& TABtwoWeCrit = td.cloud().breakup().TABtwoWeCrit(); const scalar& TABtwoWeCrit = cloud.breakup().TABtwoWeCrit();
const scalar& TABComega = td.cloud().breakup().TABComega(); const scalar& TABComega = cloud.breakup().TABComega();
scalar r = 0.5*this->d(); scalar r = 0.5*this->d();
scalar r2 = r*r; scalar r2 = r*r;

View File

@ -121,6 +121,10 @@ public:
}; };
//- Use base tracking data
typedef typename ParcelType::trackingData trackingData;
protected: protected:
// Protected data // Protected data
@ -413,46 +417,51 @@ public:
// Main calculation loop // Main calculation loop
//- Set cell values //- Set cell values
template<class TrackData> template<class TrackCloudType>
void setCellValues void setCellValues
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const scalar dt, const scalar dt,
const label celli const label celli
); );
//- Correct parcel properties according to atomization model //- Correct parcel properties according to atomization model
template<class TrackData> template<class TrackCloudType>
void calcAtomization void calcAtomization
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const scalar dt, const scalar dt,
const label celli const label celli
); );
//- Correct parcel properties according to breakup model //- Correct parcel properties according to breakup model
template<class TrackData> template<class TrackCloudType>
void calcBreakup void calcBreakup
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const scalar dt, const scalar dt,
const label celli const label celli
); );
//- Correct cell values using latest transfer information //- Correct cell values using latest transfer information
template<class TrackData> template<class TrackCloudType>
void cellValueSourceCorrection void cellValueSourceCorrection
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const scalar dt, const scalar dt,
const label celli const label celli
); );
//- Correct surface values due to emitted species //- Correct surface values due to emitted species
template<class TrackData> template<class TrackCloudType>
void correctSurfaceValues void correctSurfaceValues
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const label celli, const label celli,
const scalar T, const scalar T,
const scalarField& Cs, const scalarField& Cs,
@ -463,28 +472,31 @@ public:
); );
//- Update parcel properties over the time interval //- Update parcel properties over the time interval
template<class TrackData> template<class TrackCloudType>
void calc void calc
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const scalar dt, const scalar dt,
const label celli const label celli
); );
//- Calculate the chi-factor for flash-boiling for the //- Calculate the chi-factor for flash-boiling for the
// atomization model // atomization model
template<class TrackData> template<class TrackCloudType>
scalar chi scalar chi
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const scalarField& X const scalarField& X
) const; ) const;
//- Solve the TAB equation //- Solve the TAB equation
template<class TrackData> template<class TrackCloudType>
void solveTABEq void solveTABEq
( (
TrackData& td, TrackCloudType& cloud,
trackingData& td,
const scalar dt const scalar dt
); );

View File

@ -481,7 +481,7 @@ void Foam::meshRefinement::markFeatureCellLevel
<< " particles over distance " << maxTrackLen << " particles over distance " << maxTrackLen
<< " to find the starting cell" << endl; << " to find the starting cell" << endl;
} }
startPointCloud.move(td, maxTrackLen); startPointCloud.move(startPointCloud, td, maxTrackLen);
// Reset levels // Reset levels
@ -559,7 +559,7 @@ void Foam::meshRefinement::markFeatureCellLevel
<< " particles over distance " << maxTrackLen << " particles over distance " << maxTrackLen
<< " to mark cells" << endl; << " to mark cells" << endl;
} }
cloud.move(td, maxTrackLen); cloud.move(cloud, td, maxTrackLen);
// Make particle follow edge. // Make particle follow edge.
forAllIter(Cloud<trackedParticle>, cloud, iter) forAllIter(Cloud<trackedParticle>, cloud, iter)

View File

@ -112,6 +112,7 @@ Foam::trackedParticle::trackedParticle
bool Foam::trackedParticle::move bool Foam::trackedParticle::move
( (
Cloud<trackedParticle>& cloud,
trackingData& td, trackingData& td,
const scalar trackTime const scalar trackTime
) )
@ -140,7 +141,7 @@ bool Foam::trackedParticle::move
const scalar f = 1 - stepFraction(); const scalar f = 1 - stepFraction();
const vector s = end_ - start_; const vector s = end_ - start_;
trackToAndHitFace(f*s, f, td); trackToAndHitFace(f*s, f, cloud, td);
} }
} }
@ -151,6 +152,7 @@ bool Foam::trackedParticle::move
bool Foam::trackedParticle::hitPatch bool Foam::trackedParticle::hitPatch
( (
const polyPatch&, const polyPatch&,
Cloud<trackedParticle>& cloud,
trackingData& td, trackingData& td,
const label patchi, const label patchi,
const scalar trackFraction, const scalar trackFraction,
@ -164,6 +166,7 @@ bool Foam::trackedParticle::hitPatch
void Foam::trackedParticle::hitWedgePatch void Foam::trackedParticle::hitWedgePatch
( (
const wedgePolyPatch&, const wedgePolyPatch&,
Cloud<trackedParticle>& cloud,
trackingData& td trackingData& td
) )
{ {
@ -175,6 +178,7 @@ void Foam::trackedParticle::hitWedgePatch
void Foam::trackedParticle::hitSymmetryPlanePatch void Foam::trackedParticle::hitSymmetryPlanePatch
( (
const symmetryPlanePolyPatch&, const symmetryPlanePolyPatch&,
Cloud<trackedParticle>& cloud,
trackingData& td trackingData& td
) )
{ {
@ -186,6 +190,7 @@ void Foam::trackedParticle::hitSymmetryPlanePatch
void Foam::trackedParticle::hitSymmetryPatch void Foam::trackedParticle::hitSymmetryPatch
( (
const symmetryPolyPatch&, const symmetryPolyPatch&,
Cloud<trackedParticle>& cloud,
trackingData& td trackingData& td
) )
{ {
@ -197,6 +202,7 @@ void Foam::trackedParticle::hitSymmetryPatch
void Foam::trackedParticle::hitCyclicPatch void Foam::trackedParticle::hitCyclicPatch
( (
const cyclicPolyPatch&, const cyclicPolyPatch&,
Cloud<trackedParticle>& cloud,
trackingData& td trackingData& td
) )
{ {
@ -208,6 +214,7 @@ void Foam::trackedParticle::hitCyclicPatch
void Foam::trackedParticle::hitCyclicAMIPatch void Foam::trackedParticle::hitCyclicAMIPatch
( (
const cyclicAMIPolyPatch&, const cyclicAMIPolyPatch&,
Cloud<trackedParticle>& cloud,
trackingData& td, trackingData& td,
const vector& const vector&
) )
@ -220,6 +227,7 @@ void Foam::trackedParticle::hitCyclicAMIPatch
void Foam::trackedParticle::hitProcessorPatch void Foam::trackedParticle::hitProcessorPatch
( (
const processorPolyPatch&, const processorPolyPatch&,
Cloud<trackedParticle>& cloud,
trackingData& td trackingData& td
) )
{ {
@ -231,6 +239,7 @@ void Foam::trackedParticle::hitProcessorPatch
void Foam::trackedParticle::hitWallPatch void Foam::trackedParticle::hitWallPatch
( (
const wallPolyPatch& wpp, const wallPolyPatch& wpp,
Cloud<trackedParticle>& cloud,
trackingData& td, trackingData& td,
const tetIndices& const tetIndices&
) )
@ -243,6 +252,7 @@ void Foam::trackedParticle::hitWallPatch
void Foam::trackedParticle::hitPatch void Foam::trackedParticle::hitPatch
( (
const polyPatch& wpp, const polyPatch& wpp,
Cloud<trackedParticle>& cloud,
trackingData& td trackingData& td
) )
{ {
@ -254,10 +264,11 @@ void Foam::trackedParticle::hitPatch
void Foam::trackedParticle::correctAfterParallelTransfer void Foam::trackedParticle::correctAfterParallelTransfer
( (
const label patchi, const label patchi,
Cloud<trackedParticle>& cloud,
trackingData& td trackingData& td
) )
{ {
particle::correctAfterParallelTransfer(patchi, td); particle::correctAfterParallelTransfer(patchi, cloud, td);
label edgeI = k(); label edgeI = k();
if (edgeI != -1) if (edgeI != -1)

View File

@ -90,7 +90,7 @@ public:
//- Class used to pass tracking data to the trackToFace function //- Class used to pass tracking data to the trackToFace function
class trackingData class trackingData
: :
public particle::TrackingData<Cloud<trackedParticle>> public particle::trackingData
{ {
public: public:
@ -108,7 +108,7 @@ public:
List<PackedBoolList>& featureEdgeVisited List<PackedBoolList>& featureEdgeVisited
) )
: :
particle::TrackingData<Cloud<trackedParticle>>(cloud), particle::trackingData(cloud),
maxLevel_(maxLevel), maxLevel_(maxLevel),
featureEdgeVisited_(featureEdgeVisited) featureEdgeVisited_(featureEdgeVisited)
{} {}
@ -240,7 +240,7 @@ public:
// Tracking // Tracking
//- Track all particles to their end point //- Track all particles to their end point
bool move(trackingData&, const scalar); bool move(Cloud<trackedParticle>&, trackingData&, const scalar);
//- Overridable function to handle the particle hitting a patch //- Overridable function to handle the particle hitting a patch
@ -248,6 +248,7 @@ public:
bool hitPatch bool hitPatch
( (
const polyPatch&, const polyPatch&,
Cloud<trackedParticle>& cloud,
trackingData& td, trackingData& td,
const label patchi, const label patchi,
const scalar trackFraction, const scalar trackFraction,
@ -258,6 +259,7 @@ public:
void hitWedgePatch void hitWedgePatch
( (
const wedgePolyPatch&, const wedgePolyPatch&,
Cloud<trackedParticle>& cloud,
trackingData& td trackingData& td
); );
@ -266,6 +268,7 @@ public:
void hitSymmetryPlanePatch void hitSymmetryPlanePatch
( (
const symmetryPlanePolyPatch&, const symmetryPlanePolyPatch&,
Cloud<trackedParticle>& cloud,
trackingData& td trackingData& td
); );
@ -274,6 +277,7 @@ public:
void hitSymmetryPatch void hitSymmetryPatch
( (
const symmetryPolyPatch&, const symmetryPolyPatch&,
Cloud<trackedParticle>& cloud,
trackingData& td trackingData& td
); );
@ -281,6 +285,7 @@ public:
void hitCyclicPatch void hitCyclicPatch
( (
const cyclicPolyPatch&, const cyclicPolyPatch&,
Cloud<trackedParticle>& cloud,
trackingData& td trackingData& td
); );
@ -288,6 +293,7 @@ public:
void hitCyclicAMIPatch void hitCyclicAMIPatch
( (
const cyclicAMIPolyPatch&, const cyclicAMIPolyPatch&,
Cloud<trackedParticle>& cloud,
trackingData& td, trackingData& td,
const vector& const vector&
); );
@ -297,6 +303,7 @@ public:
void hitProcessorPatch void hitProcessorPatch
( (
const processorPolyPatch&, const processorPolyPatch&,
Cloud<trackedParticle>& cloud,
trackingData& td trackingData& td
); );
@ -304,6 +311,7 @@ public:
void hitWallPatch void hitWallPatch
( (
const wallPolyPatch&, const wallPolyPatch&,
Cloud<trackedParticle>& cloud,
trackingData& td, trackingData& td,
const tetIndices& const tetIndices&
); );
@ -312,12 +320,18 @@ public:
void hitPatch void hitPatch
( (
const polyPatch&, const polyPatch&,
Cloud<trackedParticle>& cloud,
trackingData& td trackingData& td
); );
//- Convert processor patch addressing to the global equivalents //- Convert processor patch addressing to the global equivalents
// and set the celli to the face-neighbour // and set the celli to the face-neighbour
void correctAfterParallelTransfer(const label, trackingData&); void correctAfterParallelTransfer
(
const label,
Cloud<trackedParticle>& cloud,
trackingData& td
);
// Ostream Operator // Ostream Operator

View File

@ -54,7 +54,7 @@ bool Foam::faceOnlySet::trackToBoundary
DynamicList<scalar>& samplingCurveDist DynamicList<scalar>& samplingCurveDist
) const ) const
{ {
particle::TrackingData<passiveParticleCloud> trackData(particleCloud); particle::trackingData td(particleCloud);
point trackPt = singleParticle.position(); point trackPt = singleParticle.position();
@ -62,7 +62,7 @@ bool Foam::faceOnlySet::trackToBoundary
{ {
point oldPoint = trackPt; point oldPoint = trackPt;
singleParticle.trackToAndHitFace(end_ - start_, 0, trackData); singleParticle.trackToAndHitFace(end_ - start_, 0, particleCloud, td);
trackPt = singleParticle.position(); trackPt = singleParticle.position();

View File

@ -54,8 +54,6 @@ bool Foam::polyLineSet::trackToBoundary
DynamicList<scalar>& samplingCurveDist DynamicList<scalar>& samplingCurveDist
) const ) const
{ {
particle::TrackingData<passiveParticleCloud> trackData(particleCloud);
while (true) while (true)
{ {
// Local geometry info // Local geometry info

View File

@ -96,8 +96,6 @@ bool Foam::uniformSet::trackToBoundary
point trackPt = singleParticle.position(); point trackPt = singleParticle.position();
particle::TrackingData<passiveParticleCloud> trackData(particleCloud);
while(true) while(true)
{ {
// Find next samplePt on/after trackPt. Update samplePt, sampleI // Find next samplePt on/after trackPt. Update samplePt, sampleI