37 template<
class ParcelType>
43 template<
class ParcelType>
44 template<
class TrackCloudType>
47 TrackCloudType&
cloud,
55 if (
td.rhoc() <
cloud.constProps().rhoMin())
60 <<
"Limiting observed density in cell " << this->
cell()
61 <<
" to " <<
cloud.constProps().rhoMin() <<
nl <<
endl;
64 td.rhoc() =
cloud.constProps().rhoMin();
73 template<
class ParcelType>
74 template<
class TrackCloudType>
77 TrackCloudType&
cloud,
82 td.Uc() =
cloud.dispersion().update
94 template<
class ParcelType>
95 template<
class TrackCloudType>
98 TrackCloudType&
cloud,
103 typename TrackCloudType::parcelType&
p =
104 static_cast<typename TrackCloudType::parcelType&
>(*this);
106 this->UCorrect_ =
Zero;
109 cloud.dampingModel().velocityCorrection(
p, dt);
112 cloud.packingModel().velocityCorrection(
p, dt);
116 template<
class ParcelType>
117 template<
class TrackCloudType>
120 TrackCloudType&
cloud,
129 template<
class ParcelType>
130 template<
class TrackCloudType>
133 TrackCloudType&
cloud,
140 const scalar np0 = nParticle_;
141 const scalar mass0 = mass();
144 const scalar
Re = this->
Re(td);
165 calcVelocity(
cloud,
td, dt,
Re,
td.muc(), mass0,
Su, dUTrans, Spu);
167 this->U_ += this->UCorrect_;
171 if (
cloud.solution().coupled())
174 cloud.UTrans()[this->
cell()] += np0*dUTrans;
182 template<
class ParcelType>
183 template<
class TrackCloudType>
186 TrackCloudType& cloud,
197 const typename TrackCloudType::parcelType&
p =
198 static_cast<const typename TrackCloudType::parcelType&
>(*this);
199 typename TrackCloudType::parcelType::trackingData& ttd =
200 static_cast<typename TrackCloudType::parcelType::trackingData&
>(
td);
202 const typename TrackCloudType::forceType& forces = cloud.forces();
205 const forceSuSp Fcp = forces.calcCoupled(
p, ttd, dt, mass,
Re,
mu);
206 const forceSuSp Fncp = forces.calcNonCoupled(
p, ttd, dt, mass,
Re,
mu);
207 const scalar massEff = forces.massEff(
p, ttd, mass);
233 const vector acp = (Fcp.Sp()*
td.Uc() + Fcp.Su())/massEff;
234 const vector ancp = (Fncp.Su() +
Su)/massEff;
235 const scalar bcp = Fcp.Sp()/massEff;
238 const vector deltaU = cloud.UIntegrator().delta(U_, dt, acp + ancp, bcp);
239 const vector deltaUncp = ancp*dt;
240 const vector deltaUcp = deltaU - deltaUncp;
243 vector Unew = U_ + deltaU;
245 dUTrans -= massEff*deltaUcp;
250 const polyMesh&
mesh = cloud.pMesh();
260 template<
class ParcelType>
263 const KinematicParcel<ParcelType>&
p 269 nParticle_(
p.nParticle_),
271 dTarget_(
p.dTarget_),
277 UCorrect_(
p.UCorrect_)
281 template<
class ParcelType>
284 const KinematicParcel<ParcelType>&
p,
291 nParticle_(
p.nParticle_),
293 dTarget_(
p.dTarget_),
299 UCorrect_(
p.UCorrect_)
305 template<
class ParcelType>
306 template<
class TrackCloudType>
309 TrackCloudType&
cloud,
311 const scalar trackTime
314 auto&
p =
static_cast<typename TrackCloudType::parcelType&
>(*this);
316 static_cast<typename TrackCloudType::parcelType::trackingData&
>(
td);
318 ttd.switchProcessor =
false;
319 ttd.keepParticle =
true;
325 while (ttd.keepParticle && !ttd.switchProcessor &&
p.stepFraction() < 1)
328 const point start =
p.position();
329 const scalar sfrac =
p.stepFraction();
335 const scalar l = cellLengthScale[
p.cell()];
338 const vector d =
p.deviationFromMeshCentre();
343 scalar
f = 1 -
p.stepFraction();
349 p.trackToFace(
f*
s - d,
f);
358 p.stepFraction() +=
f;
361 const scalar dt = (
p.stepFraction() - sfrac)*trackTime;
367 p.setCellValues(
cloud, ttd);
369 p.calcDispersion(
cloud, ttd, dt);
371 if (
solution.cellValueSourceCorrection())
373 p.cellValueSourceCorrection(
cloud, ttd, dt);
376 p.calcUCorrection(
cloud, ttd, dt);
383 if (
p.active() &&
p.onFace())
385 ttd.keepParticle =
cloud.functions().postFace(
p, ttd);
388 ttd.keepParticle =
cloud.functions().postMove(
p, dt, start, ttd);
390 if (
p.active() &&
p.onFace() && ttd.keepParticle)
396 return ttd.keepParticle;
400 template<
class ParcelType>
401 template<
class TrackCloudType>
404 TrackCloudType&
cloud,
408 auto&
p =
static_cast<typename TrackCloudType::parcelType&
>(*this);
410 static_cast<typename TrackCloudType::parcelType::trackingData&
>(
td);
415 td.keepParticle =
cloud.functions().postPatch(
p,
pp, ttd);
417 if (isA<processorPolyPatch>(
pp))
422 else if (cloud.surfaceFilm().transferParcel(
p,
pp,
td.keepParticle))
435 cloud.patchInteraction().addToEscapedParcels(nParticle_*mass());
439 return cloud.patchInteraction().correct(
p,
pp,
td.keepParticle);
444 template<
class ParcelType>
445 template<
class TrackCloudType>
452 td.switchProcessor =
true;
456 template<
class ParcelType>
457 template<
class TrackCloudType>
468 template<
class ParcelType>
471 ParcelType::transformProperties(
T);
477 template<
class ParcelType>
483 ParcelType::transformProperties(separation);
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Kinematic parcel class with rotational motion (as spherical particles only) and one/two-way coupling ...
wallPoints::trackData td(isBlockedFace, regionToBlockSize)
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
void setCellValues(TrackCloudType &cloud, trackingData &td)
Set cell values.
KinematicParcel(const polyMesh &mesh, const barycentric &coordinates, const label celli, const label tetFacei, const label tetPti)
Construct from mesh, coordinates and topology.
void cellValueSourceCorrection(TrackCloudType &cloud, trackingData &td, const scalar dt)
Correct cell values using latest transfer information.
virtual void transformProperties(const tensor &T)
Transform the physical properties of the particle.
A cloud is a registry collection of lagrangian particles.
void calc(TrackCloudType &cloud, trackingData &td, const scalar dt)
Update parcel properties over the time interval.
Storage and named access for the indices of a tet which is part of the decomposition of a cell...
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
const vector calcVelocity(TrackCloudType &cloud, trackingData &td, const scalar dt, const scalar Re, const scalar mu, const scalar mass, const vector &Su, vector &dUTrans, scalar &Spu) const
Calculate new particle velocity.
const Mesh & mesh() const noexcept
Return mesh.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
int debug
Static debugging option.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
const dimensionedScalar mu
Atomic mass unit.
scalarField Re(const UList< complex > &cmplx)
Extract real component.
Stores all relevant solution info for cloud.
PtrList< coordinateSystem > coordinates(solidRegions.size())
static bool constraintType(const word &patchType)
Return true if the given type is a constraint type.
#define WarningInFunction
Report a warning using Foam::Warning.
A cell is defined as a list of faces with extra functionality.
Selector class for relaxation factors, solver type and solution.
bool move(TrackCloudType &cloud, trackingData &td, const scalar trackTime)
Move the parcel.
A patch is a list of labels that address the faces in the global face list.
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
dimensionSet transform(const dimensionSet &ds)
Return the argument; transformations do not change the dimensions.
Tensor of scalars, i.e. Tensor<scalar>.
void hitProcessorPatch(TrackCloudType &cloud, trackingData &td)
Overridable function to handle the particle hitting a.
bool hitPatch(TrackCloudType &cloud, trackingData &td)
Overridable function to handle the particle hitting a patch.
void calcUCorrection(TrackCloudType &cloud, trackingData &td, const scalar dt)
Correct U following MP-PIC sub-models.
void calcDispersion(TrackCloudType &cloud, trackingData &td, const scalar dt)
Apply dispersion to the carrier phase velocity and update.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
void hitWallPatch(TrackCloudType &cloud, trackingData &td)
Overridable function to handle the particle hitting a wallPatch.
static constexpr const zero Zero
Global zero (0)