ENH: lagrangian cloud function objects - added track data to hooks

This commit is contained in:
Andrew Heather
2023-05-17 17:52:29 +01:00
committed by Andrew Heather
parent c4a8fbcf49
commit 8fb148bb0e
30 changed files with 183 additions and 109 deletions

View File

@ -109,33 +109,39 @@ void Foam::CloudFunctionObject<CloudType>::postEvolve
template<class CloudType>
void Foam::CloudFunctionObject<CloudType>::postMove
bool Foam::CloudFunctionObject<CloudType>::postMove
(
parcelType&,
const scalar,
const point&,
bool&
const typename parcelType::trackingData& td
)
{}
{
return true;
}
template<class CloudType>
void Foam::CloudFunctionObject<CloudType>::postPatch
bool Foam::CloudFunctionObject<CloudType>::postPatch
(
const parcelType&,
const polyPatch&,
bool&
const typename parcelType::trackingData& td
)
{}
{
return true;
}
template<class CloudType>
void Foam::CloudFunctionObject<CloudType>::postFace
bool Foam::CloudFunctionObject<CloudType>::postFace
(
const parcelType&,
bool&
const typename parcelType::trackingData& td
)
{}
{
return true;
}
template<class CloudType>

View File

@ -159,27 +159,27 @@ public:
);
//- Post-move hook
virtual void postMove
virtual bool postMove
(
parcelType& p,
const scalar dt,
const point& position0,
bool& keepParticle
const typename parcelType::trackingData& td
);
//- Post-patch hook
virtual void postPatch
virtual bool postPatch
(
const parcelType& p,
const polyPatch& pp,
bool& keepParticle
const typename parcelType::trackingData& td
);
//- Post-face hook
virtual void postFace
virtual bool postFace
(
const parcelType& p,
bool& keepParticle
const typename parcelType::trackingData& td
);

View File

@ -110,9 +110,9 @@ void Foam::CloudFunctionObjectList<CloudType>::preEvolve
const typename parcelType::trackingData& td
)
{
forAll(*this, i)
for (auto& cfo : *this)
{
this->operator[](i).preEvolve(td);
cfo.preEvolve(td);
}
}
@ -123,70 +123,71 @@ void Foam::CloudFunctionObjectList<CloudType>::postEvolve
const typename parcelType::trackingData& td
)
{
forAll(*this, i)
for (auto& cfo : *this)
{
this->operator[](i).postEvolve(td);
cfo.postEvolve(td);
}
}
template<class CloudType>
void Foam::CloudFunctionObjectList<CloudType>::postMove
bool Foam::CloudFunctionObjectList<CloudType>::postMove
(
parcelType& p,
const scalar dt,
const point& position0,
bool& keepParticle
const typename parcelType::trackingData& td
)
{
forAll(*this, i)
for (auto& cfo : *this)
{
if (!keepParticle)
if (!cfo.postMove(p, dt, position0, td))
{
return;
return false;
}
this->operator[](i).postMove(p, dt, position0, keepParticle);
}
return true;
}
template<class CloudType>
void Foam::CloudFunctionObjectList<CloudType>::postPatch
bool Foam::CloudFunctionObjectList<CloudType>::postPatch
(
const parcelType& p,
parcelType& p,
const polyPatch& pp,
bool& keepParticle
const typename parcelType::trackingData& td
)
{
forAll(*this, i)
for (auto& cfo : *this)
{
if (!keepParticle)
if (!cfo.postPatch(p, pp, td))
{
return;
return false;
}
this->operator[](i).postPatch(p, pp, keepParticle);
}
return true;
}
template<class CloudType>
void Foam::CloudFunctionObjectList<CloudType>::postFace
bool Foam::CloudFunctionObjectList<CloudType>::postFace
(
const parcelType& p,
bool& keepParticle
parcelType& p,
const typename parcelType::trackingData& td
)
{
forAll(*this, i)
for (auto& cfo : *this)
{
if (!keepParticle)
if (!cfo.postFace(p, td))
{
return;
return false;
}
this->operator[](i).postFace(p, keepParticle);
}
return true;
}

View File

@ -125,27 +125,27 @@ public:
);
//- Post-move hook
virtual void postMove
virtual bool postMove
(
parcelType& p,
const scalar dt,
const point& position0,
bool& keepParticle
const typename parcelType::trackingData& td
);
//- Post-patch hook
virtual void postPatch
virtual bool postPatch
(
const parcelType& p,
parcelType& p,
const polyPatch& pp,
bool& keepParticle
const typename parcelType::trackingData& td
);
//- Post-face hook
virtual void postFace
virtual bool postFace
(
const parcelType& p,
bool& keepParticle
parcelType& p,
const typename parcelType::trackingData& td
);
};

View File

@ -263,12 +263,14 @@ Foam::FaceInteraction<CloudType>::FaceInteraction
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
void Foam::FaceInteraction<CloudType>::postFace
bool Foam::FaceInteraction<CloudType>::postFace
(
const parcelType& p,
bool& keepParticle
const typename parcelType::trackingData& td
)
{
bool keepParticle = true;
const auto& fzm = this->owner().mesh().faceZones();
forAll(faceZoneIDs_, i)
@ -322,8 +324,9 @@ void Foam::FaceInteraction<CloudType>::postFace
}
}
}
return keepParticle;
}
// ************************************************************************* //

View File

@ -182,7 +182,11 @@ public:
// Member Functions
//- Post-face hook
virtual void postFace(const parcelType& p, bool& keepParticle);
virtual bool postFace
(
const parcelType& p,
const typename parcelType::trackingData& td
);
};

View File

@ -350,7 +350,11 @@ Foam::FacePostProcessing<CloudType>::FacePostProcessing
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
void Foam::FacePostProcessing<CloudType>::postFace(const parcelType& p, bool&)
bool Foam::FacePostProcessing<CloudType>::postFace
(
const parcelType& p,
const typename parcelType::trackingData& td
)
{
if
(
@ -380,6 +384,8 @@ void Foam::FacePostProcessing<CloudType>::postFace(const parcelType& p, bool&)
}
}
}
return true;
}

View File

@ -158,7 +158,11 @@ public:
inline bool resetOnWrite() const;
//- Post-face hook
virtual void postFace(const parcelType& p, bool& keepParticle);
virtual bool postFace
(
const parcelType& p,
const typename parcelType::trackingData& td
);
};

View File

@ -629,17 +629,19 @@ Foam::ParticleCollector<CloudType>::ParticleCollector
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
void Foam::ParticleCollector<CloudType>::postMove
bool Foam::ParticleCollector<CloudType>::postMove
(
parcelType& p,
const scalar dt,
const point& position0,
bool& keepParticle
const typename parcelType::trackingData& td
)
{
bool keepParticle = true;
if ((parcelType_ != -1) && (parcelType_ != p.typeId()))
{
return;
return keepParticle;
}
hitFaceIDs_.clear();
@ -708,6 +710,8 @@ void Foam::ParticleCollector<CloudType>::postMove
keepParticle = false;
}
}
return keepParticle;
}

View File

@ -282,12 +282,12 @@ public:
inline bool resetOnWrite() const;
//- Post-move hook
virtual void postMove
virtual bool postMove
(
parcelType& p,
const scalar dt,
const point& position0,
bool& keepParticle
const typename parcelType::trackingData& td
);
};

View File

@ -159,11 +159,11 @@ void Foam::ParticleErosion<CloudType>::preEvolve
template<class CloudType>
void Foam::ParticleErosion<CloudType>::postPatch
bool Foam::ParticleErosion<CloudType>::postPatch
(
const parcelType& p,
const polyPatch& pp,
bool&
const typename parcelType::trackingData& td
)
{
const label patchi = pp.index();
@ -184,7 +184,7 @@ void Foam::ParticleErosion<CloudType>::postPatch
// quick reject if particle travelling away from the patch
if ((nw & U) < 0)
{
return;
return true;
}
const scalar magU = mag(U);
@ -206,6 +206,8 @@ void Foam::ParticleErosion<CloudType>::postPatch
Q += coeff*(K_*sqr(cos(alpha))/6.0);
}
}
return true;
}

View File

@ -140,11 +140,11 @@ public:
);
//- Post-patch hook
virtual void postPatch
virtual bool postPatch
(
const parcelType& p,
const polyPatch& pp,
bool& keepParticle
const typename parcelType::trackingData& td
);
};

View File

@ -136,16 +136,16 @@ Foam::ParticleHistogram<CloudType>::ParticleHistogram
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
void Foam::ParticleHistogram<CloudType>::postPatch
bool Foam::ParticleHistogram<CloudType>::postPatch
(
const parcelType& p,
const polyPatch& pp,
bool&
const typename parcelType::trackingData& td
)
{
if (!collector_.isPatch())
{
return;
return true;
}
const label patchi = pp.index();
@ -160,19 +160,21 @@ void Foam::ParticleHistogram<CloudType>::postPatch
dParticles_[localPatchi].append(p.d());
nParticles_[localPatchi].append(p.nParticle());
}
return true;
}
template<class CloudType>
void Foam::ParticleHistogram<CloudType>::postFace
bool Foam::ParticleHistogram<CloudType>::postFace
(
const parcelType& p,
bool&
const typename parcelType::trackingData& td
)
{
if (collector_.isPatch())
{
return;
return true;
}
const labelList& IDs = collector_.IDs();
@ -200,6 +202,8 @@ void Foam::ParticleHistogram<CloudType>::postFace
nParticles_[i].append(p.nParticle());
}
}
return true;
}

View File

@ -200,15 +200,19 @@ public:
// Evaluation
//- Post-patch hook
virtual void postPatch
virtual bool postPatch
(
const parcelType& p,
const polyPatch& pp,
bool& keepParticle
const typename parcelType::trackingData& td
);
//- Post-face hook
virtual void postFace(const parcelType& p, bool& keepParticle);
virtual bool postFace
(
const parcelType& p,
const typename parcelType::trackingData& td
);
// I-O

View File

@ -111,16 +111,16 @@ Foam::ParticlePostProcessing<CloudType>::ParticlePostProcessing
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
void Foam::ParticlePostProcessing<CloudType>::postPatch
bool Foam::ParticlePostProcessing<CloudType>::postPatch
(
const parcelType& p,
const polyPatch& pp,
bool&
const typename parcelType::trackingData& td
)
{
if (!collector_.isPatch())
{
return;
return true;
}
const label patchi = pp.index();
@ -143,19 +143,21 @@ void Foam::ParticlePostProcessing<CloudType>::postPatch
data_[localPatchi].append(data.str());
}
return true;
}
template<class CloudType>
void Foam::ParticlePostProcessing<CloudType>::postFace
bool Foam::ParticlePostProcessing<CloudType>::postFace
(
const parcelType& p,
bool&
const typename parcelType::trackingData& td
)
{
if (collector_.isPatch())
{
return;
return true;
}
const labelList& IDs = collector_.IDs();
@ -191,6 +193,8 @@ void Foam::ParticlePostProcessing<CloudType>::postFace
data_[i].append(data.str());
}
}
return true;
}

View File

@ -191,15 +191,19 @@ public:
// Evaluation
//- Post-patch hook
virtual void postPatch
virtual bool postPatch
(
const parcelType& p,
const polyPatch& pp,
bool& keepParticle
const typename parcelType::trackingData& td
);
//- Post-face hook
virtual void postFace(const parcelType& p, bool& keepParticle);
virtual bool postFace
(
const parcelType& p,
const typename parcelType::trackingData& td
);
// I-O

View File

@ -105,7 +105,11 @@ void Foam::ParticleTracks<CloudType>::preEvolve
template<class CloudType>
void Foam::ParticleTracks<CloudType>::postFace(const parcelType& p, bool&)
bool Foam::ParticleTracks<CloudType>::postFace
(
const parcelType& p,
const typename parcelType::trackingData& td
)
{
if
(
@ -132,6 +136,8 @@ void Foam::ParticleTracks<CloudType>::postFace(const parcelType& p, bool&)
);
}
}
return true;
}

View File

@ -150,7 +150,11 @@ public:
);
//- Post-face hook
virtual void postFace(const parcelType& p, bool& keepParticle);
virtual bool postFace
(
const parcelType& p,
const typename parcelType::trackingData& td
);
};

View File

@ -103,12 +103,12 @@ void Foam::ParticleTrap<CloudType>::postEvolve
template<class CloudType>
void Foam::ParticleTrap<CloudType>::postMove
bool Foam::ParticleTrap<CloudType>::postMove
(
parcelType& p,
const scalar,
const point&,
bool&
const typename parcelType::trackingData& td
)
{
if (alphaPtr_->primitiveField()[p.cell()] < threshold_)
@ -122,6 +122,8 @@ void Foam::ParticleTrap<CloudType>::postMove
p.U() -= 2*nHat*nHatU;
}
}
return true;
}

View File

@ -140,12 +140,12 @@ public:
);
//- Post-move hook
virtual void postMove
virtual bool postMove
(
parcelType& p,
const scalar dt,
const point& position0,
bool& keepParticle
const typename parcelType::trackingData& td
);
};

View File

@ -323,12 +323,12 @@ void Foam::ParticleZoneInfo<CloudType>::postEvolve
template<class CloudType>
void Foam::ParticleZoneInfo<CloudType>::postMove
bool Foam::ParticleZoneInfo<CloudType>::postMove
(
parcelType& p,
const scalar dt,
const point&,
bool&
const typename parcelType::trackingData& td
)
{
if (inZone(p.cell()))
@ -346,6 +346,8 @@ void Foam::ParticleZoneInfo<CloudType>::postMove
movedParticles_.append(newData);
}
return true;
}

View File

@ -301,12 +301,12 @@ public:
);
//- Post-move hook
virtual void postMove
virtual bool postMove
(
parcelType& p,
const scalar dt,
const point& position0,
bool& keepParticle
const typename parcelType::trackingData& td
);
//- Write

View File

@ -139,11 +139,11 @@ Foam::PatchCollisionDensity<CloudType>::PatchCollisionDensity
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
void Foam::PatchCollisionDensity<CloudType>::postPatch
bool Foam::PatchCollisionDensity<CloudType>::postPatch
(
const parcelType& p,
const polyPatch& pp,
bool&
const typename parcelType::trackingData& td
)
{
const label patchi = pp.index();
@ -158,6 +158,8 @@ void Foam::PatchCollisionDensity<CloudType>::postPatch
collisionDensity_[patchi][patchFacei] +=
1/this->owner().mesh().magSf().boundaryField()[patchi][patchFacei];
}
return true;
}

View File

@ -126,11 +126,11 @@ public:
// Member Functions
//- Post-patch hook
virtual void postPatch
virtual bool postPatch
(
const parcelType& p,
const polyPatch& pp,
bool& keepParticle
const typename parcelType::trackingData& td
);
};

View File

@ -170,11 +170,11 @@ void Foam::PatchInteractionFields<CloudType>::preEvolve
template<class CloudType>
void Foam::PatchInteractionFields<CloudType>::postPatch
bool Foam::PatchInteractionFields<CloudType>::postPatch
(
const parcelType& p,
const polyPatch& pp,
bool&
const typename parcelType::trackingData& td
)
{
const label patchi = pp.index();
@ -182,6 +182,8 @@ void Foam::PatchInteractionFields<CloudType>::postPatch
massPtr_->boundaryFieldRef()[patchi][facei] += p.nParticle()*p.mass();
countPtr_->boundaryFieldRef()[patchi][facei] += 1;
return true;
}

View File

@ -173,11 +173,11 @@ public:
);
//- Post-patch hook
virtual void postPatch
virtual bool postPatch
(
const parcelType& p,
const polyPatch& pp,
bool& keepParticle
const typename parcelType::trackingData& td
);
};

View File

@ -248,16 +248,18 @@ Foam::RemoveParcels<CloudType>::RemoveParcels
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
void Foam::RemoveParcels<CloudType>::postFace
bool Foam::RemoveParcels<CloudType>::postFace
(
const parcelType& p,
bool& keepParticle
const typename parcelType::trackingData& td
)
{
bool keepParticle = true;
if ((typeId_ >= 0) && (p.typeId() != typeId_))
{
// Not processing this particle type
return;
return keepParticle;
}
if
@ -280,6 +282,8 @@ void Foam::RemoveParcels<CloudType>::postFace
}
}
}
return keepParticle;
}

View File

@ -163,7 +163,11 @@ public:
);
//- Post-face hook
virtual void postFace(const parcelType& p, bool& keepParticle);
virtual bool postFace
(
const parcelType& p,
const typename parcelType::trackingData& td
);
};

View File

@ -124,17 +124,19 @@ void Foam::VoidFraction<CloudType>::postEvolve
template<class CloudType>
void Foam::VoidFraction<CloudType>::postMove
bool Foam::VoidFraction<CloudType>::postMove
(
parcelType& p,
const scalar dt,
const point&,
bool&
const typename parcelType::trackingData& td
)
{
volScalarField& theta = thetaPtr_();
theta[p.cell()] += dt*p.nParticle()*p.volume();
return true;
}

View File

@ -128,12 +128,12 @@ public:
);
//- Post-move hook
virtual void postMove
virtual bool postMove
(
parcelType& p,
const scalar dt,
const point& position0,
bool& keepParticle
const typename parcelType::trackingData& td
);
};