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
parent 9825b4889d
commit 4fd4fadab2
62 changed files with 1193 additions and 837 deletions

View File

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

View File

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

View File

@ -100,6 +100,7 @@ Foam::findCellParticle::findCellParticle
bool Foam::findCellParticle::move
(
Cloud<findCellParticle>& cloud,
trackingData& td,
const scalar maxTrackLen
)
@ -110,7 +111,7 @@ bool Foam::findCellParticle::move
while (td.keepParticle && !td.switchProcessor && stepFraction() < 1)
{
const scalar f = 1 - stepFraction();
trackToAndHitFace(f*(end_ - start_), f, td);
trackToAndHitFace(f*(end_ - start_), f, cloud, td);
}
if (stepFraction() == 1 || !td.keepParticle)
@ -128,6 +129,7 @@ bool Foam::findCellParticle::move
bool Foam::findCellParticle::hitPatch
(
const polyPatch&,
Cloud<findCellParticle>& cloud,
trackingData& td,
const label patchi,
const scalar trackFraction,
@ -141,6 +143,7 @@ bool Foam::findCellParticle::hitPatch
void Foam::findCellParticle::hitWedgePatch
(
const wedgePolyPatch&,
Cloud<findCellParticle>& cloud,
trackingData& td
)
{
@ -152,6 +155,7 @@ void Foam::findCellParticle::hitWedgePatch
void Foam::findCellParticle::hitSymmetryPlanePatch
(
const symmetryPlanePolyPatch&,
Cloud<findCellParticle>& cloud,
trackingData& td
)
{
@ -163,6 +167,7 @@ void Foam::findCellParticle::hitSymmetryPlanePatch
void Foam::findCellParticle::hitSymmetryPatch
(
const symmetryPolyPatch&,
Cloud<findCellParticle>& cloud,
trackingData& td
)
{
@ -174,6 +179,7 @@ void Foam::findCellParticle::hitSymmetryPatch
void Foam::findCellParticle::hitCyclicPatch
(
const cyclicPolyPatch&,
Cloud<findCellParticle>& cloud,
trackingData& td
)
{
@ -185,6 +191,7 @@ void Foam::findCellParticle::hitCyclicPatch
void Foam::findCellParticle::hitProcessorPatch
(
const processorPolyPatch&,
Cloud<findCellParticle>& cloud,
trackingData& td
)
{
@ -196,6 +203,7 @@ void Foam::findCellParticle::hitProcessorPatch
void Foam::findCellParticle::hitWallPatch
(
const wallPolyPatch& wpp,
Cloud<findCellParticle>& cloud,
trackingData& td,
const tetIndices&
)
@ -208,6 +216,7 @@ void Foam::findCellParticle::hitWallPatch
void Foam::findCellParticle::hitPatch
(
const polyPatch& wpp,
Cloud<findCellParticle>& cloud,
trackingData& td
)
{

View File

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

View File

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

View File

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

View File

@ -24,6 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "streamLineParticle.H"
#include "streamLineParticleCloud.H"
#include "vectorFieldIOField.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -145,6 +146,7 @@ Foam::streamLineParticle::streamLineParticle
bool Foam::streamLineParticle::move
(
streamLineParticleCloud& cloud,
trackingData& td,
const scalar
)
@ -203,7 +205,7 @@ bool Foam::streamLineParticle::move
dt = maxDt;
}
trackToAndHitFace(dt*U, 0, td);
trackToAndHitFace(dt*U, 0, cloud, td);
if
(
@ -271,6 +273,7 @@ bool Foam::streamLineParticle::move
bool Foam::streamLineParticle::hitPatch
(
const polyPatch&,
streamLineParticleCloud& cloud,
trackingData& td,
const label patchi,
const scalar trackFraction,
@ -285,6 +288,7 @@ bool Foam::streamLineParticle::hitPatch
void Foam::streamLineParticle::hitWedgePatch
(
const wedgePolyPatch& pp,
streamLineParticleCloud& cloud,
trackingData& td
)
{
@ -296,6 +300,7 @@ void Foam::streamLineParticle::hitWedgePatch
void Foam::streamLineParticle::hitSymmetryPlanePatch
(
const symmetryPlanePolyPatch& pp,
streamLineParticleCloud& cloud,
trackingData& td
)
{
@ -307,6 +312,7 @@ void Foam::streamLineParticle::hitSymmetryPlanePatch
void Foam::streamLineParticle::hitSymmetryPatch
(
const symmetryPolyPatch& pp,
streamLineParticleCloud& cloud,
trackingData& td
)
{
@ -318,6 +324,7 @@ void Foam::streamLineParticle::hitSymmetryPatch
void Foam::streamLineParticle::hitCyclicPatch
(
const cyclicPolyPatch& pp,
streamLineParticleCloud& cloud,
trackingData& td
)
{
@ -329,6 +336,7 @@ void Foam::streamLineParticle::hitCyclicPatch
void Foam::streamLineParticle::hitProcessorPatch
(
const processorPolyPatch&,
streamLineParticleCloud& cloud,
trackingData& td
)
{
@ -340,6 +348,7 @@ void Foam::streamLineParticle::hitProcessorPatch
void Foam::streamLineParticle::hitWallPatch
(
const wallPolyPatch& wpp,
streamLineParticleCloud& cloud,
trackingData& td,
const tetIndices&
)
@ -352,6 +361,7 @@ void Foam::streamLineParticle::hitWallPatch
void Foam::streamLineParticle::hitPatch
(
const polyPatch& wpp,
streamLineParticleCloud& cloud,
trackingData& td
)
{

View File

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

View File

@ -951,7 +951,7 @@ void Foam::DSMCCloud<ParcelType>::evolve()
this->inflowBoundary().inflow();
// 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
buildCellOccupancy();

View File

@ -29,16 +29,21 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ParcelType>
template<class TrackData>
bool Foam::DSMCParcel<ParcelType>::move(TrackData& td, const scalar trackTime)
template<class TrackCloudType>
bool Foam::DSMCParcel<ParcelType>::move
(
TrackCloudType& cloud,
trackingData& td,
const scalar trackTime
)
{
typename TrackData::cloudType::parcelType& p =
static_cast<typename TrackData::cloudType::parcelType&>(*this);
typename TrackCloudType::parcelType& p =
static_cast<typename TrackCloudType::parcelType&>(*this);
td.switchProcessor = false;
td.keepParticle = true;
const polyMesh& mesh = td.cloud().pMesh();
const polyMesh& mesh = cloud.pMesh();
const polyBoundaryMesh& pbMesh = mesh.boundaryMesh();
// 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);
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)
{
@ -75,11 +80,12 @@ bool Foam::DSMCParcel<ParcelType>::move(TrackData& td, const scalar trackTime)
template<class ParcelType>
template<class TrackData>
template<class TrackCloudType>
bool Foam::DSMCParcel<ParcelType>::hitPatch
(
const polyPatch&,
TrackData& td,
TrackCloudType& cloud,
trackingData& td,
const label,
const scalar,
const tetIndices&
@ -90,11 +96,12 @@ bool Foam::DSMCParcel<ParcelType>::hitPatch
template<class ParcelType>
template<class TrackData>
template<class TrackCloudType>
void Foam::DSMCParcel<ParcelType>::hitProcessorPatch
(
const processorPolyPatch&,
TrackData& td
TrackCloudType& cloud,
trackingData& td
)
{
td.switchProcessor = true;
@ -102,11 +109,12 @@ void Foam::DSMCParcel<ParcelType>::hitProcessorPatch
template<class ParcelType>
template<class TrackData>
template<class TrackCloudType>
void Foam::DSMCParcel<ParcelType>::hitWallPatch
(
const wallPolyPatch& wpp,
TrackData& td,
TrackCloudType& cloud,
trackingData& td,
const tetIndices& tetIs
)
{
@ -116,9 +124,9 @@ void Foam::DSMCParcel<ParcelType>::hitWallPatch
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();
@ -131,19 +139,19 @@ void Foam::DSMCParcel<ParcelType>::hitWallPatch
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;
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;
td.cloud().momentumBF()[wppIndex][wppLocalFace] += m*Ut*invMagUnfA;
cloud.momentumBF()[wppIndex][wppLocalFace] += m*Ut*invMagUnfA;
// pre-interaction energy
scalar preIE = 0.5*m*(U_ & U_) + Ei_;
@ -151,7 +159,7 @@ void Foam::DSMCParcel<ParcelType>::hitWallPatch
// pre-interaction momentum
vector preIMom = m*U_;
td.cloud().wallInteraction().correct
cloud.wallInteraction().correct
(
static_cast<DSMCParcel<ParcelType> &>(*this),
wpp
@ -163,19 +171,19 @@ void Foam::DSMCParcel<ParcelType>::hitWallPatch
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;
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;
td.cloud().momentumBF()[wppIndex][wppLocalFace] += m*Ut*invMagUnfA;
cloud.momentumBF()[wppIndex][wppLocalFace] += m*Ut*invMagUnfA;
// post-interaction energy
scalar postIE = 0.5*m*(U_ & U_) + Ei_;
@ -183,20 +191,25 @@ void Foam::DSMCParcel<ParcelType>::hitWallPatch
// post-interaction momentum
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 TrackData>
void Foam::DSMCParcel<ParcelType>::hitPatch(const polyPatch&, TrackData& td)
template<class TrackCloudType>
void Foam::DSMCParcel<ParcelType>::hitPatch
(
const polyPatch&,
TrackCloudType& cloud,
trackingData& td
)
{
td.keepParticle = false;
}

View File

@ -127,24 +127,8 @@ public:
};
//- Class used to pass kinematic tracking data to the trackToFace function
class trackingData
:
public particle::TrackingData<DSMCCloud<DSMCParcel<ParcelType>>>
{
public:
// Constructors
//- Construct from components
trackingData(DSMCCloud<DSMCParcel<ParcelType>>& cloud)
:
particle::TrackingData<DSMCCloud<DSMCParcel<ParcelType>>>
(
cloud
)
{}
};
//- Use base tracking data
typedef typename ParcelType::trackingData trackingData;
protected:
@ -264,19 +248,25 @@ public:
// Tracking
//- Move the parcel
template<class TrackData>
bool move(TrackData& td, const scalar trackTime);
template<class TrackCloudType>
bool move
(
TrackCloudType& cloud,
trackingData& td,
const scalar trackTime
);
// Patch interactions
//- Overridable function to handle the particle hitting a patch
// Executed before other patch-hitting functions
template<class TrackData>
template<class TrackCloudType>
bool hitPatch
(
const polyPatch&,
TrackData& td,
TrackCloudType& cloud,
trackingData& td,
const label patchi,
const scalar trackFraction,
const tetIndices& tetIs
@ -284,28 +274,31 @@ public:
//- Overridable function to handle the particle hitting a
// processorPatch
template<class TrackData>
template<class TrackCloudType>
void hitProcessorPatch
(
const processorPolyPatch&,
TrackData& td
TrackCloudType& cloud,
trackingData& td
);
//- Overridable function to handle the particle hitting a wallPatch
template<class TrackData>
template<class TrackCloudType>
void hitWallPatch
(
const wallPolyPatch&,
TrackData& td,
TrackCloudType& cloud,
trackingData& td,
const tetIndices&
);
//- Overridable function to handle the particle hitting a polyPatch
template<class TrackData>
template<class TrackCloudType>
void hitPatch
(
const polyPatch&,
TrackData& td
TrackCloudType& cloud,
trackingData& td
);
//- 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 TrackData>
void Foam::Cloud<ParticleType>::move(TrackData& td, const scalar trackTime)
template<class TrackCloudType>
void Foam::Cloud<ParticleType>::move
(
TrackCloudType& cloud,
typename ParticleType::trackingData& td,
const scalar trackTime
)
{
const polyBoundaryMesh& pbm = pMesh().boundaryMesh();
const globalMeshData& pData = polyMesh_.globalData();
@ -253,7 +258,7 @@ void Foam::Cloud<ParticleType>::move(TrackData& td, const scalar trackTime)
ParticleType& p = pIter();
// Move the particle
bool keepParticle = p.move(td, trackTime);
bool keepParticle = p.move(cloud, td, trackTime);
// If the particle is to be kept
// (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()
];
p.prepareForParallelTransfer(patchi, td);
p.prepareForParallelTransfer(patchi, cloud, td);
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++]];
newp.correctAfterParallelTransfer(patchi, td);
newp.correctAfterParallelTransfer(patchi, cloud, td);
addParticle(newParticles.remove(&newp));
}

View File

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

View File

@ -106,21 +106,12 @@ class particle
public:
template<class CloudType>
class TrackingData
class trackingData
{
// Private data
//- Reference to the cloud containing (this) particle
CloudType& cloud_;
public:
// Public data
typedef CloudType cloudType;
//- Flag to switch processor
bool switchProcessor;
@ -129,19 +120,9 @@ public:
// Constructor
TrackingData(CloudType& cloud)
:
cloud_(cloud)
template <class TrackCloudType>
trackingData(const TrackCloudType& cloud)
{}
// Member functions
//- Return a reference to the cloud
CloudType& cloud()
{
return cloud_;
}
};
@ -307,75 +288,105 @@ protected:
// patch. Executed before other patch-hitting functions.
// trackFraction is passed in to allow mesh motion to
// interpolate in time to the correct face state.
template<class TrackData>
template<class TrackCloudType>
bool hitPatch
(
const polyPatch&,
TrackData& td,
TrackCloudType& cloud,
trackingData& td,
const label patchi,
const scalar trackFraction,
const tetIndices& tetIs
);
//- Overridable function to handle the particle hitting a wedgePatch
template<class TrackData>
void hitWedgePatch(const wedgePolyPatch&, TrackData& td);
template<class TrackCloudType>
void hitWedgePatch
(
const wedgePolyPatch&,
TrackCloudType& cloud,
trackingData& td
);
//- Overridable function to handle the particle hitting a
// symmetryPlanePatch
template<class TrackData>
template<class TrackCloudType>
void hitSymmetryPlanePatch
(
const symmetryPlanePolyPatch&,
TrackData& td
TrackCloudType& cloud,
trackingData& td
);
//- Overridable function to handle the particle hitting a
// symmetryPatch
template<class TrackData>
void hitSymmetryPatch(const symmetryPolyPatch&, TrackData& td);
template<class TrackCloudType>
void hitSymmetryPatch
(
const symmetryPolyPatch&,
TrackCloudType& cloud,
trackingData& td
);
//- Overridable function to handle the particle hitting a cyclicPatch
template<class TrackData>
void hitCyclicPatch(const cyclicPolyPatch&, TrackData& td);
template<class TrackCloudType>
void hitCyclicPatch
(
const cyclicPolyPatch&,
TrackCloudType& cloud,
trackingData& td
);
//- Overridable function to handle the particle hitting a cyclicAMIPatch
template<class TrackData>
template<class TrackCloudType>
void hitCyclicAMIPatch
(
const cyclicAMIPolyPatch&,
TrackData& td,
TrackCloudType& cloud,
trackingData& td,
const vector& direction
);
//- Overridable function to handle the particle hitting a
// cyclicACMIPatch
template<class TrackData>
template<class TrackCloudType>
void hitCyclicACMIPatch
(
const cyclicACMIPolyPatch&,
TrackData& td,
TrackCloudType& cloud,
trackingData& td,
const vector& direction
);
//- Overridable function to handle the particle hitting a
// processorPatch
template<class TrackData>
void hitProcessorPatch(const processorPolyPatch&, TrackData& td);
template<class TrackCloudType>
void hitProcessorPatch
(
const processorPolyPatch&,
TrackCloudType& cloud,
trackingData& td
);
//- Overridable function to handle the particle hitting a wallPatch
template<class TrackData>
template<class TrackCloudType>
void hitWallPatch
(
const wallPolyPatch&,
TrackData& td,
TrackCloudType& cloud,
trackingData& td,
const tetIndices& tetIs
);
//- Overridable function to handle the particle hitting a
// general patch
template<class TrackData>
void hitPatch(const polyPatch&, TrackData& td);
template<class TrackCloudType>
void hitPatch
(
const polyPatch&,
TrackCloudType& cloud,
trackingData& td
);
public:
@ -597,20 +608,22 @@ public:
//- 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
// interact the particle with the relevant patch.
template<class TrackData>
template<class TrackCloudType>
void hitFace
(
const vector& direction,
TrackData& td
TrackCloudType& cloud,
trackingData& td
);
//- Convenience function. Cobines trackToFace and hitFace
template<class TrackData>
template<class TrackCloudType>
void trackToAndHitFace
(
const vector& direction,
const scalar fraction,
TrackData& td
TrackCloudType& cloud,
trackingData& td
);
//- Set the constrained components of the particle position to the
@ -643,13 +656,23 @@ public:
//- Convert global addressing to the processor patch
// local equivalents
template<class TrackData>
void prepareForParallelTransfer(const label patchi, TrackData& td);
template<class TrackCloudType>
void prepareForParallelTransfer
(
const label patchi,
TrackCloudType& cloud,
trackingData& td
);
//- Convert processor patch addressing to the global equivalents
// and set the celli to the face-neighbour
template<class TrackData>
void correctAfterParallelTransfer(const label patchi, TrackData& td);
template<class TrackCloudType>
void correctAfterParallelTransfer
(
const label patchi,
TrackCloudType& cloud,
trackingData& td
);
// Interaction list referral
@ -687,12 +710,12 @@ public:
// I-O
//- Read the fields associated with the owner cloud
template<class CloudType>
static void readFields(CloudType& c);
template<class TrackCloudType>
static void readFields(TrackCloudType& c);
//- Write the fields associated with the owner cloud
template<class CloudType>
static void writeFields(const CloudType& c);
template<class TrackCloudType>
static void writeFields(const TrackCloudType& c);
//- Write the particle position and cell
void writePosition(Ostream&) const;

View File

@ -37,11 +37,12 @@ License
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class TrackData>
template<class TrackCloudType>
void Foam::particle::prepareForParallelTransfer
(
const label patchi,
TrackData& td
TrackCloudType& cloud,
trackingData& td
)
{
// 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
(
const label patchi,
TrackData& td
TrackCloudType& cloud,
trackingData& td
)
{
const coupledPolyPatch& ppp =
@ -101,8 +103,8 @@ void Foam::particle::correctAfterParallelTransfer
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
void Foam::particle::readFields(CloudType& c)
template<class TrackCloudType>
void Foam::particle::readFields(TrackCloudType& c)
{
bool valid = c.size();
@ -120,7 +122,7 @@ void Foam::particle::readFields(CloudType& c)
c.checkFieldIOobject(c, origId);
label i = 0;
forAllIter(typename CloudType, c, iter)
forAllIter(typename TrackCloudType, c, iter)
{
particle& p = iter();
@ -131,12 +133,12 @@ void Foam::particle::readFields(CloudType& c)
}
template<class CloudType>
void Foam::particle::writeFields(const CloudType& c)
template<class TrackCloudType>
void Foam::particle::writeFields(const TrackCloudType& c)
{
label np = c.size();
IOPosition<CloudType> ioP(c);
IOPosition<TrackCloudType> ioP(c);
ioP.write(np > 0);
IOField<label> origProc
@ -151,7 +153,7 @@ void Foam::particle::writeFields(const CloudType& c)
);
label i = 0;
forAllConstIter(typename CloudType, c, iter)
forAllConstIter(typename TrackCloudType, c, iter)
{
origProc[i] = iter().origProc_;
origId[i] = iter().origId_;
@ -163,13 +165,19 @@ void Foam::particle::writeFields(const CloudType& c)
}
template<class TrackData>
template<class TrackCloudType>
void Foam::particle::hitFace
(
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())
{
return;
@ -180,9 +188,6 @@ void Foam::particle::hitFace
}
else if (onBoundaryFace())
{
typename TrackData::cloudType::particleType& p =
static_cast<typename TrackData::cloudType::particleType&>(*this);
const tetIndices faceHitTetIs(celli_, tetFacei_, tetPti_);
if
@ -190,7 +195,8 @@ void Foam::particle::hitFace
!p.hitPatch
(
mesh_.boundaryMesh()[patch()],
td,
cloud,
ttd,
patch(),
stepFraction(),
faceHitTetIs
@ -203,28 +209,30 @@ void Foam::particle::hitFace
{
p.hitWedgePatch
(
static_cast<const wedgePolyPatch&>(patch), td
static_cast<const wedgePolyPatch&>(patch), cloud, ttd
);
}
else if (isA<symmetryPlanePolyPatch>(patch))
{
p.hitSymmetryPlanePatch
(
static_cast<const symmetryPlanePolyPatch&>(patch), td
static_cast<const symmetryPlanePolyPatch&>(patch),
cloud,
ttd
);
}
else if (isA<symmetryPolyPatch>(patch))
{
p.hitSymmetryPatch
(
static_cast<const symmetryPolyPatch&>(patch), td
static_cast<const symmetryPolyPatch&>(patch), cloud, ttd
);
}
else if (isA<cyclicPolyPatch>(patch))
{
p.hitCyclicPatch
(
static_cast<const cyclicPolyPatch&>(patch), td
static_cast<const cyclicPolyPatch&>(patch), cloud, ttd
);
}
else if (isA<cyclicACMIPolyPatch>(patch))
@ -232,7 +240,8 @@ void Foam::particle::hitFace
p.hitCyclicACMIPatch
(
static_cast<const cyclicACMIPolyPatch&>(patch),
td,
cloud,
ttd,
direction
);
}
@ -241,7 +250,8 @@ void Foam::particle::hitFace
p.hitCyclicAMIPatch
(
static_cast<const cyclicAMIPolyPatch&>(patch),
td,
cloud,
ttd,
direction
);
}
@ -249,31 +259,35 @@ void Foam::particle::hitFace
{
p.hitProcessorPatch
(
static_cast<const processorPolyPatch&>(patch), td
static_cast<const processorPolyPatch&>(patch), cloud, ttd
);
}
else if (isA<wallPolyPatch>(patch))
{
p.hitWallPatch
(
static_cast<const wallPolyPatch&>(patch), td, faceHitTetIs
static_cast<const wallPolyPatch&>(patch),
cloud,
ttd,
faceHitTetIs
);
}
else
{
p.hitPatch(patch, td);
p.hitPatch(patch, cloud, ttd);
}
}
}
}
template<class TrackData>
template<class TrackCloudType>
void Foam::particle::trackToAndHitFace
(
const vector& direction,
const scalar fraction,
TrackData& td
TrackCloudType& cloud,
trackingData& td
)
{
trackToFace(direction, fraction);
@ -283,15 +297,16 @@ void Foam::particle::trackToAndHitFace
changeToMasterPatch();
}
hitFace(direction, td);
hitFace(direction, cloud, td);
}
template<class TrackData>
template<class TrackCloudType>
bool Foam::particle::hitPatch
(
const polyPatch&,
TrackData&,
TrackCloudType&,
trackingData&,
const label,
const scalar,
const tetIndices&
@ -301,11 +316,12 @@ bool Foam::particle::hitPatch
}
template<class TrackData>
template<class TrackCloudType>
void Foam::particle::hitWedgePatch
(
const wedgePolyPatch& wpp,
TrackData&
TrackCloudType&,
trackingData&
)
{
FatalErrorInFunction
@ -319,11 +335,12 @@ void Foam::particle::hitWedgePatch
}
template<class TrackData>
template<class TrackCloudType>
void Foam::particle::hitSymmetryPlanePatch
(
const symmetryPlanePolyPatch& spp,
TrackData&
TrackCloudType&,
trackingData&
)
{
vector nf = normal();
@ -333,11 +350,12 @@ void Foam::particle::hitSymmetryPlanePatch
}
template<class TrackData>
template<class TrackCloudType>
void Foam::particle::hitSymmetryPatch
(
const symmetryPolyPatch& spp,
TrackData&
TrackCloudType&,
trackingData&
)
{
vector nf = normal();
@ -347,11 +365,12 @@ void Foam::particle::hitSymmetryPatch
}
template<class TrackData>
template<class TrackCloudType>
void Foam::particle::hitCyclicPatch
(
const cyclicPolyPatch& cpp,
TrackData& td
TrackCloudType&,
trackingData&
)
{
const cyclicPolyPatch& receiveCpp = cpp.neighbPatch();
@ -390,11 +409,12 @@ void Foam::particle::hitCyclicPatch
}
template<class TrackData>
template<class TrackCloudType>
void Foam::particle::hitCyclicAMIPatch
(
const cyclicAMIPolyPatch& cpp,
TrackData& td,
TrackCloudType& cloud,
trackingData& td,
const vector& direction
)
{
@ -460,11 +480,12 @@ void Foam::particle::hitCyclicAMIPatch
}
template<class TrackData>
template<class TrackCloudType>
void Foam::particle::hitCyclicACMIPatch
(
const cyclicACMIPolyPatch& cpp,
TrackData& td,
TrackCloudType& cloud,
trackingData& td,
const vector& direction
)
{
@ -488,35 +509,41 @@ void Foam::particle::hitCyclicACMIPatch
if (couple)
{
hitCyclicAMIPatch(cpp, td, direction);
hitCyclicAMIPatch(cpp, cloud, td, direction);
}
else
{
// Move to the face associated with the non-overlap patch and redo the
// face interaction.
tetFacei_ = facei_ = cpp.nonOverlapPatch().start() + localFacei;
hitFace(direction, td);
hitFace(direction, cloud, td);
}
}
template<class TrackData>
void Foam::particle::hitProcessorPatch(const processorPolyPatch&, TrackData&)
template<class TrackCloudType>
void Foam::particle::hitProcessorPatch
(
const processorPolyPatch&,
TrackCloudType&,
trackingData&
)
{}
template<class TrackData>
template<class TrackCloudType>
void Foam::particle::hitWallPatch
(
const wallPolyPatch&,
TrackData&,
TrackCloudType&,
trackingData&,
const tetIndices&
)
{}
template<class TrackData>
void Foam::particle::hitPatch(const polyPatch&, TrackData&)
template<class TrackCloudType>
void Foam::particle::hitPatch(const polyPatch&, TrackCloudType&, trackingData&)
{}

View File

@ -44,28 +44,29 @@ void Foam::CollidingCloud<CloudType>::setModels()
template<class CloudType>
template<class TrackData>
template<class TrackCloudType>
void Foam::CollidingCloud<CloudType>::moveCollide
(
TrackData& td,
TrackCloudType& cloud,
typename parcelType::trackingData& td,
const scalar deltaT
)
{
td.part() = TrackData::tpVelocityHalfStep;
CloudType::move(td, deltaT);
td.part() = parcelType::trackingData::tpVelocityHalfStep;
CloudType::move(cloud, td, deltaT);
td.part() = TrackData::tpLinearTrack;
CloudType::move(td, deltaT);
td.part() = parcelType::trackingData::tpLinearTrack;
CloudType::move(cloud, td, deltaT);
// td.part() = TrackData::tpRotationalTrack;
// CloudType::move(td);
// td.part() = parcelType::trackingData::tpRotationalTrack;
// CloudType::move(cloud, td, deltaT);
this->updateCellOccupancy();
this->collision().collide();
td.part() = TrackData::tpVelocityHalfStep;
CloudType::move(td, deltaT);
td.part() = parcelType::trackingData::tpVelocityHalfStep;
CloudType::move(cloud, td, deltaT);
}
@ -187,17 +188,20 @@ void Foam::CollidingCloud<CloudType>::evolve()
{
if (this->solution().canEvolve())
{
typename parcelType::template
TrackingData<CollidingCloud<CloudType>> td(*this);
typename parcelType::trackingData td(*this);
this->solve(td);
this->solve(*this, td);
}
}
template<class CloudType>
template<class TrackData>
void Foam::CollidingCloud<CloudType>::motion(TrackData& td)
template<class TrackCloudType>
void Foam::CollidingCloud<CloudType>::motion
(
TrackCloudType& cloud,
typename parcelType::trackingData& td
)
{
// Sympletic leapfrog integration of particle forces:
// + apply half deltaV with stored force
@ -219,14 +223,14 @@ void Foam::CollidingCloud<CloudType>::motion(TrackData& td)
while(!(++moveCollideSubCycle).end())
{
moveCollide(td, this->db().time().deltaTValue());
moveCollide(cloud, td, this->db().time().deltaTValue());
}
moveCollideSubCycle.endSubCycle();
}
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
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -117,8 +117,13 @@ protected:
// Cloud evolution functions
//- Move-collide particles
template<class TrackData>
void moveCollide(TrackData& td, const scalar deltaT);
template<class TrackCloudType>
void moveCollide
(
TrackCloudType& cloud,
typename parcelType::trackingData& td,
const scalar deltaT
);
//- Reset state of cloud
void cloudReset(CollidingCloud<CloudType>& c);
@ -224,8 +229,12 @@ public:
void evolve();
//- Particle motion
template<class TrackData>
void motion(TrackData& td);
template<class TrackCloudType>
void motion
(
TrackCloudType& cloud,
typename parcelType::trackingData& td
);
// I-O

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -37,10 +37,11 @@ Foam::label Foam::KinematicParcel<ParcelType>::maxTrackAttempts = 1;
// * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
template<class ParcelType>
template<class TrackData>
template<class TrackCloudType>
void Foam::KinematicParcel<ParcelType>::setCellValues
(
TrackData& td,
TrackCloudType& cloud,
trackingData& td,
const scalar dt,
const label celli
)
@ -49,16 +50,16 @@ void Foam::KinematicParcel<ParcelType>::setCellValues
rhoc_ = td.rhoInterp().interpolate(this->coordinates(), tetIs);
if (rhoc_ < td.cloud().constProps().rhoMin())
if (rhoc_ < cloud.constProps().rhoMin())
{
if (debug)
{
WarningInFunction
<< "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);
@ -66,7 +67,7 @@ void Foam::KinematicParcel<ParcelType>::setCellValues
muc_ = td.muInterp().interpolate(this->coordinates(), tetIs);
// Apply dispersion components to carrier phase velocity
Uc_ = td.cloud().dispersion().update
Uc_ = cloud.dispersion().update
(
dt,
celli,
@ -79,23 +80,25 @@ void Foam::KinematicParcel<ParcelType>::setCellValues
template<class ParcelType>
template<class TrackData>
template<class TrackCloudType>
void Foam::KinematicParcel<ParcelType>::cellValueSourceCorrection
(
TrackData& td,
TrackCloudType& cloud,
trackingData& td,
const scalar dt,
const label celli
)
{
Uc_ += td.cloud().UTrans()[celli]/massCell(celli);
Uc_ += cloud.UTrans()[celli]/massCell(celli);
}
template<class ParcelType>
template<class TrackData>
template<class TrackCloudType>
void Foam::KinematicParcel<ParcelType>::calc
(
TrackData& td,
TrackCloudType& cloud,
trackingData& td,
const scalar dt,
const label celli
)
@ -126,27 +129,41 @@ void Foam::KinematicParcel<ParcelType>::calc
// ~~~~~~
// 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
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if (td.cloud().solution().coupled())
if (cloud.solution().coupled())
{
// Update momentum transfer
td.cloud().UTrans()[celli] += np0*dUTrans;
cloud.UTrans()[celli] += np0*dUTrans;
// Update momentum transfer coefficient
td.cloud().UCoeff()[celli] += np0*Spu;
cloud.UCoeff()[celli] += np0*Spu;
}
}
template<class ParcelType>
template<class TrackData>
template<class TrackCloudType>
const Foam::vector Foam::KinematicParcel<ParcelType>::calcVelocity
(
TrackData& td,
TrackCloudType& cloud,
trackingData& td,
const scalar dt,
const label celli,
const scalar Re,
@ -157,11 +174,10 @@ const Foam::vector Foam::KinematicParcel<ParcelType>::calcVelocity
scalar& Spu
) const
{
typedef typename TrackData::cloudType cloudType;
typedef typename cloudType::parcelType parcelType;
typedef typename cloudType::forceType forceType;
typedef typename TrackCloudType::parcelType parcelType;
typedef typename TrackCloudType::forceType forceType;
const forceType& forces = td.cloud().forces();
const forceType& forces = cloud.forces();
// Momentum source due to particle forces
const parcelType& p = static_cast<const parcelType&>(*this);
@ -181,7 +197,7 @@ const Foam::vector Foam::KinematicParcel<ParcelType>::calcVelocity
Spu = dt*Feff.Sp();
IntegrationScheme<vector>::integrationResult Ures =
td.cloud().UIntegrator().integrate(U_, dt, abp, bp);
cloud.UIntegrator().integrate(U_, dt, abp, bp);
vector Unew = Ures.value();
@ -189,7 +205,7 @@ const Foam::vector Foam::KinematicParcel<ParcelType>::calcVelocity
dUTrans += dt*(Feff.Sp()*(Ures.average() - Uc_) - Fcp.Su());
// 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(), dUTrans);
@ -249,25 +265,28 @@ Foam::KinematicParcel<ParcelType>::KinematicParcel
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ParcelType>
template<class TrackData>
template<class TrackCloudType>
bool Foam::KinematicParcel<ParcelType>::move
(
TrackData& td,
TrackCloudType& cloud,
trackingData& td,
const scalar trackTime
)
{
typename TrackData::cloudType::parcelType& p =
static_cast<typename TrackData::cloudType::parcelType&>(*this);
typename TrackCloudType::parcelType& p =
static_cast<typename TrackCloudType::parcelType&>(*this);
typename TrackCloudType::particleType::trackingData& ttd =
static_cast<typename TrackCloudType::particleType::trackingData&>(td);
td.switchProcessor = false;
td.keepParticle = true;
ttd.switchProcessor = false;
ttd.keepParticle = true;
const polyMesh& mesh = td.cloud().pMesh();
const polyMesh& mesh = cloud.pMesh();
const polyBoundaryMesh& pbMesh = mesh.boundaryMesh();
const scalarField& cellLengthScale = td.cloud().cellLengthScale();
const scalar maxCo = td.cloud().solution().maxCo();
const scalarField& cellLengthScale = cloud.cellLengthScale();
const scalar maxCo = cloud.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
p.constrainToMeshCentre();
@ -310,26 +329,26 @@ bool Foam::KinematicParcel<ParcelType>::move
if (dt > ROOTVSMALL)
{
// Update cell based properties
p.setCellValues(td, dt, celli);
p.setCellValues(cloud, ttd, dt, celli);
if (td.cloud().solution().cellValueSourceCorrection())
if (cloud.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()]))
{
td.switchProcessor = true;
ttd.switchProcessor = true;
}
}
@ -337,32 +356,33 @@ bool Foam::KinematicParcel<ParcelType>::move
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 TrackData>
template<class TrackCloudType>
bool Foam::KinematicParcel<ParcelType>::hitPatch
(
const polyPatch& pp,
TrackData& td,
TrackCloudType& cloud,
trackingData& td,
const label patchi,
const scalar trackFraction,
const tetIndices& tetIs
)
{
typename TrackData::cloudType::parcelType& p =
static_cast<typename TrackData::cloudType::parcelType&>(*this);
typename TrackCloudType::parcelType& p =
static_cast<typename TrackCloudType::parcelType&>(*this);
// Invoke post-processing model
td.cloud().functions().postPatch
cloud.functions().postPatch
(
p,
pp,
@ -372,7 +392,7 @@ bool Foam::KinematicParcel<ParcelType>::hitPatch
);
// Invoke surface film model
if (td.cloud().surfaceFilm().transferParcel(p, pp, td.keepParticle))
if (cloud.surfaceFilm().transferParcel(p, pp, td.keepParticle))
{
// All interactions done
return true;
@ -385,7 +405,7 @@ bool Foam::KinematicParcel<ParcelType>::hitPatch
else
{
// Invoke patch interaction model
return td.cloud().patchInteraction().correct
return cloud.patchInteraction().correct
(
p,
pp,
@ -398,11 +418,12 @@ bool Foam::KinematicParcel<ParcelType>::hitPatch
template<class ParcelType>
template<class TrackData>
template<class TrackCloudType>
void Foam::KinematicParcel<ParcelType>::hitProcessorPatch
(
const processorPolyPatch&,
TrackData& td
TrackCloudType& cloud,
trackingData& td
)
{
td.switchProcessor = true;
@ -410,11 +431,12 @@ void Foam::KinematicParcel<ParcelType>::hitProcessorPatch
template<class ParcelType>
template<class TrackData>
template<class TrackCloudType>
void Foam::KinematicParcel<ParcelType>::hitWallPatch
(
const wallPolyPatch& wpp,
TrackData& td,
TrackCloudType& cloud,
trackingData& td,
const tetIndices&
)
{
@ -423,11 +445,12 @@ void Foam::KinematicParcel<ParcelType>::hitWallPatch
template<class ParcelType>
template<class TrackData>
template<class TrackCloudType>
void Foam::KinematicParcel<ParcelType>::hitPatch
(
const polyPatch&,
TrackData& td
TrackCloudType& cloud,
trackingData& td
)
{
td.keepParticle = false;

View File

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

View File

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

View File

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

View File

@ -81,10 +81,9 @@ class MPPICParcel
public:
template<class CloudType>
class TrackingData
class trackingData
:
public ParcelType::template TrackingData<CloudType>
public ParcelType::trackingData
{
public:
@ -135,15 +134,17 @@ public:
//- Constructors
//- Construct from components
inline TrackingData
template<class TrackCloudType>
inline trackingData
(
CloudType& cloud,
const TrackCloudType& cloud,
trackPart part = tpLinearTrack
);
//- Update the MPPIC averages
inline void updateAverages(CloudType& cloud);
template<class TrackCloudType>
inline void updateAverages(const TrackCloudType& cloud);
//- Access
@ -281,8 +282,13 @@ public:
// Tracking
//- Move the parcel
template<class TrackData>
bool move(TrackData& td, const scalar trackTime);
template<class TrackCloudType>
bool move
(
TrackCloudType& cloud,
trackingData& td,
const scalar trackTime
);
// Friend Functions

View File

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

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -43,10 +43,11 @@ const Foam::label Foam::ReactingMultiphaseParcel<ParcelType>::SLD(2);
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
template<class ParcelType>
template<class TrackData>
template<class TrackCloudType>
Foam::scalar Foam::ReactingMultiphaseParcel<ParcelType>::CpEff
(
TrackData& td,
TrackCloudType& cloud,
trackingData& td,
const scalar p,
const scalar T,
const label idG,
@ -55,17 +56,18 @@ Foam::scalar Foam::ReactingMultiphaseParcel<ParcelType>::CpEff
) const
{
return
this->Y_[GAS]*td.cloud().composition().Cp(idG, YGas_, p, T)
+ this->Y_[LIQ]*td.cloud().composition().Cp(idL, YLiquid_, p, T)
+ this->Y_[SLD]*td.cloud().composition().Cp(idS, YSolid_, p, T);
this->Y_[GAS]*cloud.composition().Cp(idG, YGas_, p, T)
+ this->Y_[LIQ]*cloud.composition().Cp(idL, YLiquid_, p, T)
+ this->Y_[SLD]*cloud.composition().Cp(idS, YSolid_, p, T);
}
template<class ParcelType>
template<class TrackData>
template<class TrackCloudType>
Foam::scalar Foam::ReactingMultiphaseParcel<ParcelType>::HsEff
(
TrackData& td,
TrackCloudType& cloud,
trackingData& td,
const scalar p,
const scalar T,
const label idG,
@ -74,17 +76,18 @@ Foam::scalar Foam::ReactingMultiphaseParcel<ParcelType>::HsEff
) const
{
return
this->Y_[GAS]*td.cloud().composition().Hs(idG, YGas_, p, T)
+ this->Y_[LIQ]*td.cloud().composition().Hs(idL, YLiquid_, p, T)
+ this->Y_[SLD]*td.cloud().composition().Hs(idS, YSolid_, p, T);
this->Y_[GAS]*cloud.composition().Hs(idG, YGas_, p, T)
+ this->Y_[LIQ]*cloud.composition().Hs(idL, YLiquid_, p, T)
+ this->Y_[SLD]*cloud.composition().Hs(idS, YSolid_, p, T);
}
template<class ParcelType>
template<class TrackData>
template<class TrackCloudType>
Foam::scalar Foam::ReactingMultiphaseParcel<ParcelType>::LEff
(
TrackData& td,
TrackCloudType& cloud,
trackingData& td,
const scalar p,
const scalar T,
const label idG,
@ -93,9 +96,9 @@ Foam::scalar Foam::ReactingMultiphaseParcel<ParcelType>::LEff
) const
{
return
this->Y_[GAS]*td.cloud().composition().L(idG, YGas_, p, T)
+ this->Y_[LIQ]*td.cloud().composition().L(idL, YLiquid_, p, T)
+ this->Y_[SLD]*td.cloud().composition().L(idS, YSolid_, p, T);
this->Y_[GAS]*cloud.composition().L(idG, YGas_, p, T)
+ this->Y_[LIQ]*cloud.composition().L(idL, YLiquid_, p, T)
+ this->Y_[SLD]*cloud.composition().L(idS, YSolid_, p, T);
}
@ -130,44 +133,47 @@ Foam::scalar Foam::ReactingMultiphaseParcel<ParcelType>::updateMassFractions
// * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
template<class ParcelType>
template<class TrackData>
template<class TrackCloudType>
void Foam::ReactingMultiphaseParcel<ParcelType>::setCellValues
(
TrackData& td,
TrackCloudType& cloud,
trackingData& td,
const scalar dt,
const label celli
)
{
ParcelType::setCellValues(td, dt, celli);
ParcelType::setCellValues(cloud, td, dt, celli);
}
template<class ParcelType>
template<class TrackData>
template<class TrackCloudType>
void Foam::ReactingMultiphaseParcel<ParcelType>::cellValueSourceCorrection
(
TrackData& td,
TrackCloudType& cloud,
trackingData& td,
const scalar dt,
const label celli
)
{
// Re-use correction from reacting parcel
ParcelType::cellValueSourceCorrection(td, dt, celli);
ParcelType::cellValueSourceCorrection(cloud, td, dt, celli);
}
template<class ParcelType>
template<class TrackData>
template<class TrackCloudType>
void Foam::ReactingMultiphaseParcel<ParcelType>::calc
(
TrackData& td,
TrackCloudType& cloud,
trackingData& td,
const scalar dt,
const label celli
)
{
typedef typename TrackData::cloudType::reactingCloudType reactingCloudType;
typedef typename TrackCloudType::reactingCloudType reactingCloudType;
const CompositionModel<reactingCloudType>& composition =
td.cloud().composition();
cloud.composition();
// Define local properties at beginning of timestep
@ -189,7 +195,7 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc
// Calc surface values
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);
@ -236,6 +242,7 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc
// Calc mass and enthalpy transfer due to phase change
this->calcPhaseChange
(
cloud,
td,
dt,
celli,
@ -266,6 +273,7 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc
// Calc mass and enthalpy transfer due to devolatilisation
calcDevolatilisation
(
cloud,
td,
dt,
this->age_,
@ -298,6 +306,7 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc
// Calc mass and enthalpy transfer due to surface reactions
calcSurfaceReactions
(
cloud,
td,
dt,
celli,
@ -328,10 +337,10 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc
scalar mass1 =
updateMassFractions(mass0, dMassGas, dMassLiquid, dMassSolid);
this->Cp_ = CpEff(td, pc, T0, idG, idL, idS);
this->Cp_ = CpEff(cloud, td, pc, T0, idG, idL, idS);
// Update particle density or diameter
if (td.cloud().constProps().constantVolume())
if (cloud.constProps().constantVolume())
{
this->rho_ = mass1/this->volume();
}
@ -341,11 +350,11 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc
}
// 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;
if (td.cloud().solution().coupled())
if (cloud.solution().coupled())
{
scalar dm = np0*mass0;
@ -353,12 +362,12 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc
forAll(YGas_, 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)
{
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
@ -366,22 +375,34 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc
forAll(YSolid_, 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;
}
// 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);
@ -395,6 +416,7 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc
this->T_ =
this->calcHeatTransfer
(
cloud,
td,
dt,
celli,
@ -408,7 +430,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
@ -416,13 +438,25 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc
// Calculate new particle velocity
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
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if (td.cloud().solution().coupled())
if (cloud.solution().coupled())
{
// Transfer mass lost to carrier mass, momentum and enthalpy sources
forAll(YGas_, i)
@ -430,18 +464,18 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc
scalar dm = np0*dMassGas[i];
label gid = composition.localToCarrierId(GAS, i);
scalar hs = composition.carrier().Hs(gid, pc, T0);
td.cloud().rhoTrans(gid)[celli] += dm;
td.cloud().UTrans()[celli] += dm*U0;
td.cloud().hsTrans()[celli] += dm*hs;
cloud.rhoTrans(gid)[celli] += dm;
cloud.UTrans()[celli] += dm*U0;
cloud.hsTrans()[celli] += dm*hs;
}
forAll(YLiquid_, i)
{
scalar dm = np0*dMassLiquid[i];
label gid = composition.localToCarrierId(LIQ, i);
scalar hs = composition.carrier().Hs(gid, pc, T0);
td.cloud().rhoTrans(gid)[celli] += dm;
td.cloud().UTrans()[celli] += dm*U0;
td.cloud().hsTrans()[celli] += dm*hs;
cloud.rhoTrans(gid)[celli] += dm;
cloud.UTrans()[celli] += dm*U0;
cloud.hsTrans()[celli] += dm*hs;
}
// No mapping between solid components and carrier phase
@ -451,9 +485,9 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc
scalar dm = np0*dMassSolid[i];
label gid = composition.localToCarrierId(SLD, i);
scalar hs = composition.carrier().Hs(gid, pc, T0);
td.cloud().rhoTrans(gid)[celli] += dm;
td.cloud().UTrans()[celli] += dm*U0;
td.cloud().hsTrans()[celli] += dm*hs;
cloud.rhoTrans(gid)[celli] += dm;
cloud.UTrans()[celli] += dm*U0;
cloud.hsTrans()[celli] += dm*hs;
}
*/
@ -461,27 +495,27 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc
{
scalar dm = np0*dMassSRCarrier[i];
scalar hs = composition.carrier().Hs(i, pc, T0);
td.cloud().rhoTrans(i)[celli] += dm;
td.cloud().UTrans()[celli] += dm*U0;
td.cloud().hsTrans()[celli] += dm*hs;
cloud.rhoTrans(i)[celli] += dm;
cloud.UTrans()[celli] += dm*U0;
cloud.hsTrans()[celli] += dm*hs;
}
// Update momentum transfer
td.cloud().UTrans()[celli] += np0*dUTrans;
td.cloud().UCoeff()[celli] += np0*Spu;
cloud.UTrans()[celli] += np0*dUTrans;
cloud.UCoeff()[celli] += np0*Spu;
// Update sensible enthalpy transfer
td.cloud().hsTrans()[celli] += np0*dhsTrans;
td.cloud().hsCoeff()[celli] += np0*Sph;
cloud.hsTrans()[celli] += np0*dhsTrans;
cloud.hsCoeff()[celli] += np0*Sph;
// Update radiation fields
if (td.cloud().radiation())
if (cloud.radiation())
{
const scalar ap = this->areaP();
const scalar T4 = pow4(T0);
td.cloud().radAreaP()[celli] += dt*np0*ap;
td.cloud().radT4()[celli] += dt*np0*T4;
td.cloud().radAreaPT4()[celli] += dt*np0*ap*T4;
cloud.radAreaP()[celli] += dt*np0*ap;
cloud.radT4()[celli] += dt*np0*T4;
cloud.radAreaPT4()[celli] += dt*np0*ap*T4;
}
}
}
@ -490,10 +524,11 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
template<class ParcelType>
template<class TrackData>
template<class TrackCloudType>
void Foam::ReactingMultiphaseParcel<ParcelType>::calcDevolatilisation
(
TrackData& td,
TrackCloudType& cloud,
trackingData& td,
const scalar dt,
const scalar age,
const scalar Ts,
@ -513,29 +548,29 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calcDevolatilisation
) const
{
// Check that model is active
if (!td.cloud().devolatilisation().active())
if (!cloud.devolatilisation().active())
{
return;
}
// Initialise demand-driven constants
(void)td.cloud().constProps().TDevol();
(void)td.cloud().constProps().LDevol();
(void)cloud.constProps().TDevol();
(void)cloud.constProps().LDevol();
// Check that the parcel temperature is within necessary limits for
// devolatilisation to occur
if (T < td.cloud().constProps().TDevol() || canCombust == -1)
if (T < cloud.constProps().TDevol() || canCombust == -1)
{
return;
}
typedef typename TrackData::cloudType::reactingCloudType reactingCloudType;
typedef typename TrackCloudType::reactingCloudType reactingCloudType;
const CompositionModel<reactingCloudType>& composition =
td.cloud().composition();
cloud.composition();
// Total mass of volatiles evolved
td.cloud().devolatilisation().calculate
cloud.devolatilisation().calculate
(
dt,
age,
@ -551,15 +586,15 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calcDevolatilisation
scalar dMassTot = sum(dMassDV);
td.cloud().devolatilisation().addToDevolatilisationMass
cloud.devolatilisation().addToDevolatilisationMass
(
this->nParticle_*dMassTot
);
Sh -= dMassTot*td.cloud().constProps().LDevol()/dt;
Sh -= dMassTot*cloud.constProps().LDevol()/dt;
// Update molar emissions
if (td.cloud().heatTransfer().BirdCorrection())
if (cloud.heatTransfer().BirdCorrection())
{
// Molar average molecular weight of carrier mix
const scalar Wc =
@ -591,10 +626,11 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calcDevolatilisation
template<class ParcelType>
template<class TrackData>
template<class TrackCloudType>
void Foam::ReactingMultiphaseParcel<ParcelType>::calcSurfaceReactions
(
TrackData& td,
TrackCloudType& cloud,
trackingData& td,
const scalar dt,
const label celli,
const scalar d,
@ -615,14 +651,14 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calcSurfaceReactions
) const
{
// Check that model is active
if (!td.cloud().surfaceReaction().active())
if (!cloud.surfaceReaction().active())
{
return;
}
// Initialise demand-driven constants
(void)td.cloud().constProps().hRetentionCoeff();
(void)td.cloud().constProps().TMax();
(void)cloud.constProps().hRetentionCoeff();
(void)cloud.constProps().TMax();
// Check that model is active
if (canCombust != 1)
@ -632,7 +668,7 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calcSurfaceReactions
// Update surface reactions
const scalar hReaction = td.cloud().surfaceReaction().calculate
const scalar hReaction = cloud.surfaceReaction().calculate
(
dt,
celli,
@ -653,15 +689,15 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calcSurfaceReactions
dMassSRCarrier
);
td.cloud().surfaceReaction().addToSurfaceReactionMass
cloud.surfaceReaction().addToSurfaceReactionMass
(
this->nParticle_
*(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 =
(1.0 - xsi*xsi)*td.cloud().constProps().hRetentionCoeff();
(1.0 - xsi*xsi)*cloud.constProps().hRetentionCoeff();
Sh += coeff*hReaction/dt;

View File

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

View File

@ -34,10 +34,11 @@ using namespace Foam::constant::mathematical;
// * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
template<class ParcelType>
template<class TrackData>
template<class TrackCloudType>
void Foam::ReactingParcel<ParcelType>::calcPhaseChange
(
TrackData& td,
TrackCloudType& cloud,
trackingData& td,
const scalar dt,
const label celli,
const scalar Re,
@ -57,10 +58,10 @@ void Foam::ReactingParcel<ParcelType>::calcPhaseChange
scalarField& Cs
)
{
typedef typename TrackData::cloudType::reactingCloudType reactingCloudType;
typedef typename TrackCloudType::reactingCloudType reactingCloudType;
const CompositionModel<reactingCloudType>& composition =
td.cloud().composition();
PhaseChangeModel<reactingCloudType>& phaseChange = td.cloud().phaseChange();
cloud.composition();
PhaseChangeModel<reactingCloudType>& phaseChange = cloud.phaseChange();
if (!phaseChange.active() || (YPhase < SMALL))
{
@ -117,7 +118,7 @@ void Foam::ReactingParcel<ParcelType>::calcPhaseChange
// Update molar emissions
if (td.cloud().heatTransfer().BirdCorrection())
if (cloud.heatTransfer().BirdCorrection())
{
// Average molecular weight of carrier mix - assumes perfect gas
const scalar Wc = this->rhoc_*RR*this->Tc_/this->pc_;
@ -201,15 +202,16 @@ Foam::ReactingParcel<ParcelType>::ReactingParcel
// * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * * //
template<class ParcelType>
template<class TrackData>
template<class TrackCloudType>
void Foam::ReactingParcel<ParcelType>::setCellValues
(
TrackData& td,
TrackCloudType& cloud,
trackingData& td,
const scalar dt,
const label celli
)
{
ParcelType::setCellValues(td, dt, celli);
ParcelType::setCellValues(cloud, td, dt, celli);
pc_ = td.pInterp().interpolate
(
@ -217,34 +219,35 @@ void Foam::ReactingParcel<ParcelType>::setCellValues
this->currentTetIndices()
);
if (pc_ < td.cloud().constProps().pMin())
if (pc_ < cloud.constProps().pMin())
{
if (debug)
{
WarningInFunction
<< "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 TrackData>
template<class TrackCloudType>
void Foam::ReactingParcel<ParcelType>::cellValueSourceCorrection
(
TrackData& td,
TrackCloudType& cloud,
trackingData& td,
const scalar dt,
const label celli
)
{
scalar addedMass = 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));
addedMass += dm;
}
@ -256,16 +259,16 @@ void Foam::ReactingParcel<ParcelType>::cellValueSourceCorrection
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;
this->Uc_ = (this->Uc_*massCell + td.cloud().UTrans()[celli])/massCellNew;
this->Uc_ = (this->Uc_*massCell + cloud.UTrans()[celli])/massCellNew;
scalar CpEff = 0.0;
forAll(td.cloud().rhoTrans(), i)
forAll(cloud.rhoTrans(), i)
{
scalar Y = td.cloud().rhoTrans(i)[celli]/addedMass;
CpEff += Y*td.cloud().composition().carrier().Cp
scalar Y = cloud.rhoTrans(i)[celli]/addedMass;
CpEff += Y*cloud.composition().carrier().Cp
(
i,
this->pc_,
@ -276,27 +279,28 @@ void Foam::ReactingParcel<ParcelType>::cellValueSourceCorrection
const scalar Cpc = td.CpInterp().psi()[celli];
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)
{
WarningInFunction
<< "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 TrackData>
template<class TrackCloudType>
void Foam::ReactingParcel<ParcelType>::correctSurfaceValues
(
TrackData& td,
TrackCloudType& cloud,
trackingData& td,
const label celli,
const scalar T,
const scalarField& Cs,
@ -307,12 +311,12 @@ void Foam::ReactingParcel<ParcelType>::correctSurfaceValues
)
{
// 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;
}
const SLGThermo& thermo = td.cloud().thermo();
const SLGThermo& thermo = cloud.thermo();
// Far field carrier molar fractions
scalarField Xinf(thermo.carrier().species().size());
@ -385,17 +389,18 @@ void Foam::ReactingParcel<ParcelType>::correctSurfaceValues
template<class ParcelType>
template<class TrackData>
template<class TrackCloudType>
void Foam::ReactingParcel<ParcelType>::calc
(
TrackData& td,
TrackCloudType& cloud,
trackingData& td,
const scalar dt,
const label celli
)
{
typedef typename TrackData::cloudType::reactingCloudType reactingCloudType;
typedef typename TrackCloudType::reactingCloudType reactingCloudType;
const CompositionModel<reactingCloudType>& composition =
td.cloud().composition();
cloud.composition();
// Define local properties at beginning of time step
@ -410,7 +415,7 @@ void Foam::ReactingParcel<ParcelType>::calc
// Calc surface values
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);
@ -457,6 +462,7 @@ void Foam::ReactingParcel<ParcelType>::calc
// Calc mass and enthalpy transfer due to phase change
calcPhaseChange
(
cloud,
td,
dt,
celli,
@ -487,7 +493,7 @@ void Foam::ReactingParcel<ParcelType>::calc
this->Cp_ = composition.Cp(0, Y_, pc_, T0);
// Update particle density or diameter
if (td.cloud().constProps().constantVolume())
if (cloud.constProps().constantVolume())
{
this->rho_ = mass1/this->volume();
}
@ -497,11 +503,11 @@ void Foam::ReactingParcel<ParcelType>::calc
}
// 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;
if (td.cloud().solution().coupled())
if (cloud.solution().coupled())
{
scalar dm = np0*mass0;
@ -512,19 +518,19 @@ void Foam::ReactingParcel<ParcelType>::calc
label gid = composition.localToCarrierId(0, i);
scalar hs = composition.carrier().Hs(gid, pc_, T0);
td.cloud().rhoTrans(gid)[celli] += dmi;
td.cloud().hsTrans()[celli] += dmi*hs;
cloud.rhoTrans(gid)[celli] += dmi;
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;
}
// 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);
@ -538,6 +544,7 @@ void Foam::ReactingParcel<ParcelType>::calc
this->T_ =
this->calcHeatTransfer
(
cloud,
td,
dt,
celli,
@ -558,13 +565,25 @@ void Foam::ReactingParcel<ParcelType>::calc
// Calculate new particle velocity
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
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if (td.cloud().solution().coupled())
if (cloud.solution().coupled())
{
// Transfer mass lost to carrier mass, momentum and enthalpy sources
forAll(dMass, i)
@ -573,27 +592,27 @@ void Foam::ReactingParcel<ParcelType>::calc
label gid = composition.localToCarrierId(0, i);
scalar hs = composition.carrier().Hs(gid, pc_, T0);
td.cloud().rhoTrans(gid)[celli] += dm;
td.cloud().UTrans()[celli] += dm*U0;
td.cloud().hsTrans()[celli] += dm*hs;
cloud.rhoTrans(gid)[celli] += dm;
cloud.UTrans()[celli] += dm*U0;
cloud.hsTrans()[celli] += dm*hs;
}
// Update momentum transfer
td.cloud().UTrans()[celli] += np0*dUTrans;
td.cloud().UCoeff()[celli] += np0*Spu;
cloud.UTrans()[celli] += np0*dUTrans;
cloud.UCoeff()[celli] += np0*Spu;
// Update sensible enthalpy transfer
td.cloud().hsTrans()[celli] += np0*dhsTrans;
td.cloud().hsCoeff()[celli] += np0*Sph;
cloud.hsTrans()[celli] += np0*dhsTrans;
cloud.hsCoeff()[celli] += np0*Sph;
// Update radiation fields
if (td.cloud().radiation())
if (cloud.radiation())
{
const scalar ap = this->areaP();
const scalar T4 = pow4(T0);
td.cloud().radAreaP()[celli] += dt*np0*ap;
td.cloud().radT4()[celli] += dt*np0*T4;
td.cloud().radAreaPT4()[celli] += dt*np0*ap*T4;
cloud.radAreaP()[celli] += dt*np0*ap;
cloud.radT4()[celli] += dt*np0*T4;
cloud.radAreaPT4()[celli] += dt*np0*ap*T4;
}
}
}

View File

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

View File

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

View File

@ -31,15 +31,16 @@ using namespace Foam::constant;
// * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
template<class ParcelType>
template<class TrackData>
template<class TrackCloudType>
void Foam::ThermoParcel<ParcelType>::setCellValues
(
TrackData& td,
TrackCloudType& cloud,
trackingData& td,
const scalar dt,
const label celli
)
{
ParcelType::setCellValues(td, dt, celli);
ParcelType::setCellValues(cloud, td, dt, celli);
tetIndices tetIs = this->currentTetIndices();
@ -47,53 +48,55 @@ void Foam::ThermoParcel<ParcelType>::setCellValues
Tc_ = td.TInterp().interpolate(this->coordinates(), tetIs);
if (Tc_ < td.cloud().constProps().TMin())
if (Tc_ < cloud.constProps().TMin())
{
if (debug)
{
WarningInFunction
<< "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 TrackData>
template<class TrackCloudType>
void Foam::ThermoParcel<ParcelType>::cellValueSourceCorrection
(
TrackData& td,
TrackCloudType& cloud,
trackingData& td,
const scalar dt,
const label celli
)
{
this->Uc_ += td.cloud().UTrans()[celli]/this->massCell(celli);
this->Uc_ += cloud.UTrans()[celli]/this->massCell(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)
{
WarningInFunction
<< "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 TrackData>
template<class TrackCloudType>
void Foam::ThermoParcel<ParcelType>::calcSurfaceValues
(
TrackData& td,
TrackCloudType& cloud,
trackingData& td,
const label celli,
const scalar T,
scalar& Ts,
@ -106,16 +109,16 @@ void Foam::ThermoParcel<ParcelType>::calcSurfaceValues
// Surface temperature using two thirds rule
Ts = (2.0*T + Tc_)/3.0;
if (Ts < td.cloud().constProps().TMin())
if (Ts < cloud.constProps().TMin())
{
if (debug)
{
WarningInFunction
<< "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)
@ -133,10 +136,11 @@ void Foam::ThermoParcel<ParcelType>::calcSurfaceValues
template<class ParcelType>
template<class TrackData>
template<class TrackCloudType>
void Foam::ThermoParcel<ParcelType>::calc
(
TrackData& td,
TrackCloudType& cloud,
trackingData& td,
const scalar dt,
const label celli
)
@ -153,7 +157,7 @@ void Foam::ThermoParcel<ParcelType>::calc
// Calc surface values
// ~~~~~~~~~~~~~~~~~~~
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
scalar Re = this->Re(this->U_, this->d_, rhos, mus);
@ -191,6 +195,7 @@ void Foam::ThermoParcel<ParcelType>::calc
this->T_ =
this->calcHeatTransfer
(
cloud,
td,
dt,
celli,
@ -209,43 +214,56 @@ void Foam::ThermoParcel<ParcelType>::calc
// Calculate new particle velocity
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
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if (td.cloud().solution().coupled())
if (cloud.solution().coupled())
{
// Update momentum transfer
td.cloud().UTrans()[celli] += np0*dUTrans;
cloud.UTrans()[celli] += np0*dUTrans;
// Update momentum transfer coefficient
td.cloud().UCoeff()[celli] += np0*Spu;
cloud.UCoeff()[celli] += np0*Spu;
// Update sensible enthalpy transfer
td.cloud().hsTrans()[celli] += np0*dhsTrans;
cloud.hsTrans()[celli] += np0*dhsTrans;
// Update sensible enthalpy coefficient
td.cloud().hsCoeff()[celli] += np0*Sph;
cloud.hsCoeff()[celli] += np0*Sph;
// Update radiation fields
if (td.cloud().radiation())
if (cloud.radiation())
{
const scalar ap = this->areaP();
const scalar T4 = pow4(T0);
td.cloud().radAreaP()[celli] += dt*np0*ap;
td.cloud().radT4()[celli] += dt*np0*T4;
td.cloud().radAreaPT4()[celli] += dt*np0*ap*T4;
cloud.radAreaP()[celli] += dt*np0*ap;
cloud.radT4()[celli] += dt*np0*T4;
cloud.radAreaPT4()[celli] += dt*np0*ap*T4;
}
}
}
template<class ParcelType>
template<class TrackData>
template<class TrackCloudType>
Foam::scalar Foam::ThermoParcel<ParcelType>::calcHeatTransfer
(
TrackData& td,
TrackCloudType& cloud,
trackingData& td,
const scalar dt,
const label celli,
const scalar Re,
@ -257,7 +275,7 @@ Foam::scalar Foam::ThermoParcel<ParcelType>::calcHeatTransfer
scalar& Sph
)
{
if (!td.cloud().heatTransfer().active())
if (!cloud.heatTransfer().active())
{
return T_;
}
@ -266,15 +284,15 @@ Foam::scalar Foam::ThermoParcel<ParcelType>::calcHeatTransfer
const scalar rho = this->rho();
// 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
max
(
T_ + dt*Sh/(this->volume(d)*rho*Cp_),
td.cloud().constProps().TMin()
cloud.constProps().TMin()
);
}
@ -284,12 +302,12 @@ Foam::scalar Foam::ThermoParcel<ParcelType>::calcHeatTransfer
scalar ap = Tc_ + Sh/(As*htc);
const scalar bp = 6.0*htc/max(rho*d*Cp_, ROOTVSMALL);
if (td.cloud().radiation())
if (cloud.radiation())
{
tetIndices tetIs = this->currentTetIndices();
const scalar Gc = td.GInterp().interpolate(this->coordinates(), tetIs);
const scalar sigma = physicoChemical::sigma.value();
const scalar epsilon = td.cloud().constProps().epsilon0();
const scalar epsilon = cloud.constProps().epsilon0();
// Assume constant source
scalar s = epsilon*(Gc/4.0 - sigma*pow4(T_));
@ -299,7 +317,7 @@ Foam::scalar Foam::ThermoParcel<ParcelType>::calcHeatTransfer
// Integrate to find the new parcel temperature
IntegrationScheme<scalar>::integrationResult Tres =
td.cloud().TIntegrator().integrate(T_, dt, ap*bp, bp);
cloud.TIntegrator().integrate(T_, dt, ap*bp, bp);
scalar Tnew =
min
@ -307,9 +325,9 @@ Foam::scalar Foam::ThermoParcel<ParcelType>::calcHeatTransfer
max
(
Tres.value(),
td.cloud().constProps().TMin()
cloud.constProps().TMin()
),
td.cloud().constProps().TMax()
cloud.constProps().TMax()
);
Sph = dt*htc*As;

View File

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

View File

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

View File

@ -406,8 +406,12 @@ Foam::scalar Foam::InjectionModel<CloudType>::averageParcelMass()
template<class CloudType>
template<class TrackData>
void Foam::InjectionModel<CloudType>::inject(TrackData& td)
template<class TrackCloudType>
void Foam::InjectionModel<CloudType>::inject
(
TrackCloudType& cloud,
typename CloudType::parcelType::trackingData& td
)
{
if (!this->active())
{
@ -428,7 +432,6 @@ void Foam::InjectionModel<CloudType>::inject(TrackData& td)
const scalar trackTime = this->owner().solution().trackTime();
const polyMesh& mesh = this->owner().mesh();
typename TrackData::cloudType& cloud = td.cloud();
// Duration of injection period during this timestep
const scalar deltaT =
@ -507,9 +510,9 @@ void Foam::InjectionModel<CloudType>::inject(TrackData& td)
parcelsAdded++;
massAdded += pPtr->nParticle()*pPtr->mass();
if (pPtr->move(td, dt))
if (pPtr->move(cloud, td, dt))
{
td.cloud().addParticle(pPtr);
cloud.addParticle(pPtr);
}
else
{
@ -533,10 +536,11 @@ void Foam::InjectionModel<CloudType>::inject(TrackData& td)
template<class CloudType>
template<class TrackData>
template<class TrackCloudType>
void Foam::InjectionModel<CloudType>::injectSteadyState
(
TrackData& td,
TrackCloudType& cloud,
typename CloudType::parcelType::trackingData& td,
const scalar trackTime
)
{
@ -546,7 +550,6 @@ void Foam::InjectionModel<CloudType>::injectSteadyState
}
const polyMesh& mesh = this->owner().mesh();
typename TrackData::cloudType& cloud = td.cloud();
massTotal_ = massFlowRate_.value(mesh.time().value());
@ -614,7 +617,7 @@ void Foam::InjectionModel<CloudType>::injectSteadyState
);
// Add the new parcel
td.cloud().addParticle(pPtr);
cloud.addParticle(pPtr);
massAdded += pPtr->nParticle()*pPtr->mass();
parcelsAdded++;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -165,7 +165,7 @@ public:
//- Class used to pass tracking data to the trackToFace function
class trackingData
:
public particle::TrackingData<moleculeCloud>
public particle::trackingData
{
// label specifying which part of the integration algorithm is taking
label part_;
@ -177,7 +177,7 @@ public:
trackingData(moleculeCloud& cloud, label part)
:
particle::TrackingData<moleculeCloud>(cloud),
particle::trackingData(cloud),
part_(part)
{}
@ -310,7 +310,7 @@ public:
// Tracking
bool move(trackingData&, const scalar trackTime);
bool move(moleculeCloud&, trackingData&, const scalar trackTime);
virtual void transformProperties(const tensor& T);
@ -367,6 +367,7 @@ public:
bool hitPatch
(
const polyPatch&,
moleculeCloud& cloud,
trackingData& td,
const label patchi,
const scalar trackFraction,
@ -377,6 +378,7 @@ public:
void hitProcessorPatch
(
const processorPolyPatch&,
moleculeCloud& cloud,
trackingData& td
);
@ -384,6 +386,7 @@ public:
void hitWallPatch
(
const wallPolyPatch&,
moleculeCloud& cloud,
trackingData& td,
const tetIndices&
);
@ -392,6 +395,7 @@ public:
void hitPatch
(
const polyPatch&,
moleculeCloud& cloud,
trackingData& td
);

View File

@ -1119,18 +1119,18 @@ Foam::moleculeCloud::moleculeCloud
void Foam::moleculeCloud::evolve()
{
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);
Cloud<molecule>::move(td1, mesh_.time().deltaTValue());
Cloud<molecule>::move(*this, td1, mesh_.time().deltaTValue());
molecule::trackingData td2(*this, 2);
Cloud<molecule>::move(td2, mesh_.time().deltaTValue());
Cloud<molecule>::move(*this, td2, mesh_.time().deltaTValue());
calculateForce();
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
(
solidParticleCloud& cloud,
trackingData& td,
const scalar trackTime
)
@ -58,7 +59,7 @@ bool Foam::solidParticle::move
const scalar sfrac = 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;
@ -67,7 +68,7 @@ bool Foam::solidParticle::move
vector Uc = td.UInterp().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 ReFunc = 1.0;
@ -98,6 +99,7 @@ bool Foam::solidParticle::move
bool Foam::solidParticle::hitPatch
(
const polyPatch&,
solidParticleCloud& cloud,
trackingData&,
const label,
const scalar,
@ -111,6 +113,7 @@ bool Foam::solidParticle::hitPatch
void Foam::solidParticle::hitProcessorPatch
(
const processorPolyPatch&,
solidParticleCloud& cloud,
trackingData& td
)
{
@ -121,6 +124,7 @@ void Foam::solidParticle::hitProcessorPatch
void Foam::solidParticle::hitWallPatch
(
const wallPolyPatch& wpp,
solidParticleCloud& cloud,
trackingData& td,
const tetIndices& tetIs
)
@ -133,16 +137,17 @@ void Foam::solidParticle::hitWallPatch
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
(
const polyPatch&,
solidParticleCloud& cloud,
trackingData& td
)
{

View File

@ -86,7 +86,7 @@ public:
//- Class used to pass tracking data to the trackToFace function
class trackingData
:
public particle::TrackingData<solidParticleCloud>
public particle::trackingData
{
// Interpolators for continuous phase fields
@ -104,7 +104,7 @@ public:
inline trackingData
(
solidParticleCloud& spc,
const solidParticleCloud& spc,
const interpolationCellPoint<scalar>& rhoInterp,
const interpolationCellPoint<vector>& UInterp,
const interpolationCellPoint<scalar>& nuInterp,
@ -189,7 +189,7 @@ public:
// Tracking
//- Move
bool move(trackingData&, const scalar);
bool move(solidParticleCloud&, trackingData&, const scalar);
// Patch interactions
@ -199,6 +199,7 @@ public:
bool hitPatch
(
const polyPatch&,
solidParticleCloud& cloud,
trackingData& td,
const label patchi,
const scalar trackFraction,
@ -210,6 +211,7 @@ public:
void hitProcessorPatch
(
const processorPolyPatch&,
solidParticleCloud& cloud,
trackingData& td
);
@ -217,6 +219,7 @@ public:
void hitWallPatch
(
const wallPolyPatch&,
solidParticleCloud& cloud,
trackingData& td,
const tetIndices&
);
@ -225,6 +228,7 @@ public:
void hitPatch
(
const polyPatch&,
solidParticleCloud& cloud,
trackingData& td
);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -82,7 +82,7 @@ void Foam::solidParticleCloud::move(const dimensionedVector& g)
solidParticle::trackingData
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
(
solidParticleCloud& spc,
const solidParticleCloud& spc,
const interpolationCellPoint<scalar>& rhoInterp,
const interpolationCellPoint<vector>& UInterp,
const interpolationCellPoint<scalar>& nuInterp,
const vector& g
)
:
particle::TrackingData<solidParticleCloud>(spc),
particle::trackingData(spc),
rhoInterp_(rhoInterp),
UInterp_(UInterp),
nuInterp_(nuInterp),

View File

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

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -30,49 +30,52 @@ License
// * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
template<class ParcelType>
template<class TrackData>
template<class TrackCloudType>
void Foam::SprayParcel<ParcelType>::setCellValues
(
TrackData& td,
TrackCloudType& cloud,
trackingData& td,
const scalar dt,
const label celli
)
{
ParcelType::setCellValues(td, dt, celli);
ParcelType::setCellValues(cloud, td, dt, celli);
}
template<class ParcelType>
template<class TrackData>
template<class TrackCloudType>
void Foam::SprayParcel<ParcelType>::cellValueSourceCorrection
(
TrackData& td,
TrackCloudType& cloud,
trackingData& td,
const scalar dt,
const label celli
)
{
ParcelType::cellValueSourceCorrection(td, dt, celli);
ParcelType::cellValueSourceCorrection(cloud, td, dt, celli);
}
template<class ParcelType>
template<class TrackData>
template<class TrackCloudType>
void Foam::SprayParcel<ParcelType>::calc
(
TrackData& td,
TrackCloudType& cloud,
trackingData& td,
const scalar dt,
const label celli
)
{
typedef typename TrackData::cloudType::reactingCloudType reactingCloudType;
typedef typename TrackCloudType::reactingCloudType reactingCloudType;
const CompositionModel<reactingCloudType>& composition =
td.cloud().composition();
cloud.composition();
// Check if parcel belongs to liquid core
if (liquidCore() > 0.5)
{
// Liquid core parcels should not experience coupled forces
td.cloud().forces().setCalcCoupled(false);
cloud.forces().setCalcCoupled(false);
}
// Get old mixture composition
@ -89,7 +92,7 @@ void Foam::SprayParcel<ParcelType>::calc
}
// Set the maximum temperature limit
td.cloud().constProps().setTMax(TMax);
cloud.constProps().setTMax(TMax);
// Store the parcel properties
this->Cp() = composition.liquids().Cp(pc0, T0, X0);
@ -99,7 +102,7 @@ void Foam::SprayParcel<ParcelType>::calc
const scalar mass0 = this->mass();
mu_ = composition.liquids().mu(pc0, T0, X0);
ParcelType::calc(td, dt, celli);
ParcelType::calc(cloud,td, dt, celli);
if (td.keepParticle)
{
@ -126,7 +129,7 @@ void Foam::SprayParcel<ParcelType>::calc
if (liquidCore() > 0.5)
{
calcAtomization(td, dt, celli);
calcAtomization(cloud, td, dt, celli);
// Preserve the total mass/volume by increasing the number of
// particles in parcels due to breakup
@ -135,31 +138,32 @@ void Foam::SprayParcel<ParcelType>::calc
}
else
{
calcBreakup(td, dt, celli);
calcBreakup(cloud, td, dt, celli);
}
}
// Restore coupled forces
td.cloud().forces().setCalcCoupled(true);
cloud.forces().setCalcCoupled(true);
}
template<class ParcelType>
template<class TrackData>
template<class TrackCloudType>
void Foam::SprayParcel<ParcelType>::calcAtomization
(
TrackData& td,
TrackCloudType& cloud,
trackingData& td,
const scalar dt,
const label celli
)
{
typedef typename TrackData::cloudType::reactingCloudType reactingCloudType;
typedef typename TrackCloudType::reactingCloudType reactingCloudType;
const CompositionModel<reactingCloudType>& composition =
td.cloud().composition();
cloud.composition();
typedef typename TrackData::cloudType::sprayCloudType sprayCloudType;
typedef typename TrackCloudType::sprayCloudType sprayCloudType;
const AtomizationModel<sprayCloudType>& atomization =
td.cloud().atomization();
cloud.atomization();
// Average molecular weight of carrier mix - assumes perfect gas
scalar Wc = this->rhoc_*RR*this->Tc()/this->pc();
@ -169,8 +173,8 @@ void Foam::SprayParcel<ParcelType>::calcAtomization
// Calculate average gas density based on average temperature
scalar rhoAv = this->pc()/(R*Tav);
scalar soi = td.cloud().injectors().timeStart();
scalar currentTime = td.cloud().db().time().value();
scalar soi = cloud.injectors().timeStart();
scalar currentTime = cloud.db().time().value();
const vector& pos = this->position();
const vector& injectionPos = this->position0();
@ -179,15 +183,15 @@ void Foam::SprayParcel<ParcelType>::calcAtomization
scalar Urel = mag(this->U());
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
scalar volFlowRate = td.cloud().injectors().volumeToInject(t0, t1)/dt;
scalar volFlowRate = cloud.injectors().volumeToInject(t0, t1)/dt;
scalar chi = 0.0;
if (atomization.calcChi())
{
chi = this->chi(td, composition.liquids().X(this->Y()));
chi = this->chi(cloud, td, composition.liquids().X(this->Y()));
}
atomization.update
@ -204,38 +208,38 @@ void Foam::SprayParcel<ParcelType>::calcAtomization
Urel,
pos,
injectionPos,
td.cloud().pAmbient(),
cloud.pAmbient(),
chi,
td.cloud().rndGen()
cloud.rndGen()
);
}
template<class ParcelType>
template<class TrackData>
template<class TrackCloudType>
void Foam::SprayParcel<ParcelType>::calcBreakup
(
TrackData& td,
TrackCloudType& cloud,
trackingData& td,
const scalar dt,
const label celli
)
{
typedef typename TrackData::cloudType cloudType;
typedef typename cloudType::parcelType parcelType;
typedef typename cloudType::forceType forceType;
typedef typename TrackCloudType::parcelType parcelType;
typedef typename TrackCloudType::forceType forceType;
const parcelType& p = static_cast<const parcelType&>(*this);
const forceType& forces = td.cloud().forces();
const forceType& forces = cloud.forces();
if (td.cloud().breakup().solveOscillationEq())
if (cloud.breakup().solveOscillationEq())
{
solveTABEq(td, dt);
solveTABEq(cloud, td, dt);
}
// Average molecular weight of carrier mix - assumes perfect gas
scalar Wc = this->rhoc()*RR*this->Tc()/this->pc();
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
scalar rhoAv = this->pc()/(R*Tav);
@ -249,13 +253,13 @@ void Foam::SprayParcel<ParcelType>::calcBreakup
const forceSuSp Fncp = forces.calcNonCoupled(p, dt, mass, Re, muAv);
this->tMom() = mass/(Fcp.Sp() + Fncp.Sp());
const vector g = td.cloud().g().value();
const vector g = cloud.g().value();
scalar parcelMassChild = 0.0;
scalar dChild = 0.0;
if
(
td.cloud().breakup().update
cloud.breakup().update
(
dt,
g,
@ -300,38 +304,39 @@ void Foam::SprayParcel<ParcelType>::calcBreakup
child->age() = 0.0;
child->liquidCore() = 0.0;
child->KHindex() = 1.0;
child->y() = td.cloud().breakup().y0();
child->yDot() = td.cloud().breakup().yDot0();
child->y() = cloud.breakup().y0();
child->yDot() = cloud.breakup().yDot0();
child->tc() = 0.0;
child->ms() = -GREAT;
child->injector() = this->injector();
child->tMom() = massChild/(Fcp.Sp() + Fncp.Sp());
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 TrackData>
template<class TrackCloudType>
Foam::scalar Foam::SprayParcel<ParcelType>::chi
(
TrackData& td,
TrackCloudType& cloud,
trackingData& td,
const scalarField& X
) const
{
// 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 =
td.cloud().composition();
cloud.composition();
scalar chi = 0.0;
scalar T0 = this->T();
scalar p0 = this->pc();
scalar pAmb = td.cloud().pAmbient();
scalar pAmb = cloud.pAmbient();
scalar pv = composition.liquids().pv(p0, T0, X);
@ -359,16 +364,17 @@ Foam::scalar Foam::SprayParcel<ParcelType>::chi
template<class ParcelType>
template<class TrackData>
template<class TrackCloudType>
void Foam::SprayParcel<ParcelType>::solveTABEq
(
TrackData& td,
TrackCloudType& cloud,
trackingData& td,
const scalar dt
)
{
const scalar& TABCmu = td.cloud().breakup().TABCmu();
const scalar& TABtwoWeCrit = td.cloud().breakup().TABtwoWeCrit();
const scalar& TABComega = td.cloud().breakup().TABComega();
const scalar& TABCmu = cloud.breakup().TABCmu();
const scalar& TABtwoWeCrit = cloud.breakup().TABtwoWeCrit();
const scalar& TABComega = cloud.breakup().TABComega();
scalar r = 0.5*this->d();
scalar r2 = r*r;

View File

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

View File

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

View File

@ -117,6 +117,7 @@ Foam::trackedParticle::trackedParticle
bool Foam::trackedParticle::move
(
Cloud<trackedParticle>& cloud,
trackingData& td,
const scalar trackTime
)
@ -145,7 +146,7 @@ bool Foam::trackedParticle::move
const scalar f = 1 - stepFraction();
const vector s = end_ - start_;
trackToAndHitFace(f*s, f, td);
trackToAndHitFace(f*s, f, cloud, td);
}
}
@ -156,6 +157,7 @@ bool Foam::trackedParticle::move
bool Foam::trackedParticle::hitPatch
(
const polyPatch&,
Cloud<trackedParticle>& cloud,
trackingData& td,
const label patchi,
const scalar trackFraction,
@ -169,6 +171,7 @@ bool Foam::trackedParticle::hitPatch
void Foam::trackedParticle::hitWedgePatch
(
const wedgePolyPatch&,
Cloud<trackedParticle>& cloud,
trackingData& td
)
{
@ -180,6 +183,7 @@ void Foam::trackedParticle::hitWedgePatch
void Foam::trackedParticle::hitSymmetryPlanePatch
(
const symmetryPlanePolyPatch&,
Cloud<trackedParticle>& cloud,
trackingData& td
)
{
@ -191,6 +195,7 @@ void Foam::trackedParticle::hitSymmetryPlanePatch
void Foam::trackedParticle::hitSymmetryPatch
(
const symmetryPolyPatch&,
Cloud<trackedParticle>& cloud,
trackingData& td
)
{
@ -202,6 +207,7 @@ void Foam::trackedParticle::hitSymmetryPatch
void Foam::trackedParticle::hitCyclicPatch
(
const cyclicPolyPatch&,
Cloud<trackedParticle>& cloud,
trackingData& td
)
{
@ -213,6 +219,7 @@ void Foam::trackedParticle::hitCyclicPatch
void Foam::trackedParticle::hitCyclicAMIPatch
(
const cyclicAMIPolyPatch&,
Cloud<trackedParticle>& cloud,
trackingData& td,
const vector&
)
@ -225,6 +232,7 @@ void Foam::trackedParticle::hitCyclicAMIPatch
void Foam::trackedParticle::hitProcessorPatch
(
const processorPolyPatch&,
Cloud<trackedParticle>& cloud,
trackingData& td
)
{
@ -236,6 +244,7 @@ void Foam::trackedParticle::hitProcessorPatch
void Foam::trackedParticle::hitWallPatch
(
const wallPolyPatch& wpp,
Cloud<trackedParticle>& cloud,
trackingData& td,
const tetIndices&
)
@ -248,6 +257,7 @@ void Foam::trackedParticle::hitWallPatch
void Foam::trackedParticle::hitPatch
(
const polyPatch& wpp,
Cloud<trackedParticle>& cloud,
trackingData& td
)
{
@ -259,10 +269,11 @@ void Foam::trackedParticle::hitPatch
void Foam::trackedParticle::correctAfterParallelTransfer
(
const label patchi,
Cloud<trackedParticle>& cloud,
trackingData& td
)
{
particle::correctAfterParallelTransfer(patchi, td);
particle::correctAfterParallelTransfer(patchi, cloud, td);
label edgeI = k();
if (edgeI != -1)

View File

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

View File

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

View File

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

View File

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