33 template<
class ParcelType>
34 Foam::label Foam::MomentumParcel<ParcelType>::maxTrackAttempts = 1;
39 template<
class ParcelType>
40 template<
class TrackCloudType>
43 TrackCloudType& cloud,
51 if (td.
rhoc() < cloud.constProps().rhoMin())
56 <<
"Limiting observed density in cell " << this->
cell()
57 <<
" to " << cloud.constProps().rhoMin() <<
nl <<
endl;
60 td.
rhoc() = cloud.constProps().rhoMin();
63 td.
Uc() = td.
UInterp().interpolate(this->coordinates(), tetIs);
69 template<
class ParcelType>
70 template<
class TrackCloudType>
73 TrackCloudType& cloud,
78 td.
Uc() = cloud.dispersion().update
90 template<
class ParcelType>
91 template<
class TrackCloudType>
94 TrackCloudType& cloud,
99 td.
Uc() += cloud.UTransRef()[this->
cell()]/massCell(td);
103 template<
class ParcelType>
104 template<
class TrackCloudType>
107 TrackCloudType& cloud,
114 const scalar np0 = nParticle_;
115 const scalar mass0 = mass();
118 const scalar Re = this->
Re(td);
139 calcVelocity(cloud, td, dt, Re, td.
muc(), mass0,
Su, dUTrans, Spu);
144 if (cloud.solution().coupled())
147 cloud.UTransRef()[this->
cell()] += np0*dUTrans;
150 cloud.UCoeffRef()[this->
cell()] += np0*Spu;
155 template<
class ParcelType>
156 template<
class TrackCloudType>
159 TrackCloudType& cloud,
170 const typename TrackCloudType::parcelType& p =
171 static_cast<const typename TrackCloudType::parcelType&
>(*this);
172 typename TrackCloudType::parcelType::trackingData& ttd =
173 static_cast<typename TrackCloudType::parcelType::trackingData&
>(td);
175 const typename TrackCloudType::forceType& forces = cloud.forces();
178 const forceSuSp Fcp = forces.calcCoupled(p, ttd, dt, mass, Re, mu);
179 const forceSuSp Fncp = forces.calcNonCoupled(p, ttd, dt, mass, Re, mu);
180 const scalar massEff = forces.massEff(p, ttd, mass);
206 const vector acp = (Fcp.
Sp()*td.
Uc() + Fcp.
Su())/massEff;
208 const scalar bcp = Fcp.
Sp()/massEff;
211 const vector deltaU = cloud.UIntegrator().delta(U_, dt, acp + ancp, bcp);
212 const vector deltaUncp = ancp*dt;
213 const vector deltaUcp = deltaU - deltaUncp;
216 vector Unew = U_ + deltaU;
218 dUTrans -= massEff*deltaUcp;
223 const polyMesh& mesh = cloud.pMesh();
233 template<
class ParcelType>
253 template<
class ParcelType>
276 template<
class ParcelType>
277 template<
class TrackCloudType>
280 TrackCloudType& cloud,
282 const scalar trackTime
285 typename TrackCloudType::parcelType& p =
286 static_cast<typename TrackCloudType::parcelType&
>(*this);
287 typename TrackCloudType::parcelType::trackingData& ttd =
288 static_cast<typename TrackCloudType::parcelType::trackingData&
>(td);
290 ttd.keepParticle =
true;
293 const scalarField& cellLengthScale = cloud.cellLengthScale();
294 const scalar
maxCo = cloud.solution().maxCo();
296 while (ttd.keepParticle && ttd.sendToProc == -1 && p.stepFraction() < 1)
299 const point start = p.position();
300 const scalar sfrac = p.stepFraction();
306 const scalar l = cellLengthScale[p.cell()];
309 const vector d = p.deviationFromMeshCentre();
314 scalar
f = 1 - p.stepFraction();
316 f =
min(f, maxCo/
min(
max(
mag(s)/l, rootSmall), rootGreat));
320 p.trackToFace(f*s - d, f);
329 p.stepFraction() +=
f;
332 const scalar dt = (p.stepFraction() - sfrac)*trackTime;
338 p.setCellValues(cloud, ttd);
340 p.calcDispersion(cloud, ttd, dt);
342 if (cloud.solution().cellValueSourceCorrection())
344 p.cellValueSourceCorrection(cloud, ttd, dt);
347 p.calc(cloud, ttd, dt);
352 if (p.moving() && p.onFace())
354 cloud.functions().postFace(p, ttd.keepParticle);
357 cloud.functions().postMove(p, dt, start, ttd.keepParticle);
359 if (p.moving() && p.onFace() && ttd.keepParticle)
361 p.hitFace(f*s - d, f, cloud, ttd);
365 return ttd.keepParticle;
369 template<
class ParcelType>
370 template<
class TrackCloudType>
373 TrackCloudType& cloud,
377 typename TrackCloudType::parcelType& p =
378 static_cast<typename TrackCloudType::parcelType&
>(*this);
383 cloud.functions().postPatch(p, pp, td.keepParticle);
386 if (cloud.surfaceFilm().transferParcel(p, pp, td.keepParticle))
399 return cloud.patchInteraction().correct(p, pp, td.keepParticle);
404 template<
class ParcelType>
405 template<
class TrackCloudType>
412 const polyPatch& pp = this->
mesh().boundaryMesh()[this->patch()];
415 <<
"Particle " << this->origId() <<
" hit " << pp.type() <<
" patch " 416 << pp.
name() <<
" at " << this->position()
417 <<
" but no interaction model was specified for this patch" 422 template<
class ParcelType>
428 ParcelType::transformProperties(transform);
bool moving_
Moving flag - tracking stopped when moving = false.
void hitWallPatch(TrackCloudType &cloud, trackingData &td)
Overridable function to handle the particle hitting a wallPatch.
const interpolation< vector > & UInterp() const
Return const access to the interpolator for continuous.
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
const word & name() const
Return name.
errorManipArg< error, int > exit(error &err, const int errNo=1)
scalar dTarget_
Target diameter [m].
void setCellValues(TrackCloudType &cloud, trackingData &td)
Set cell values.
const vector & Su() const
Return const access to the explicit contribution [kg m/s^2].
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
bool hitPatch(TrackCloudType &cloud, trackingData &td)
Overridable function to handle the particle hitting a patch.
const polyBoundaryMesh & boundaryMesh() const
Return boundaryMesh reference.
const Vector< label > & solutionD() const
Return the vector of solved-for directions in mesh.
Ostream & endl(Ostream &os)
Add newline and flush stream.
label typeId_
Parcel type id.
void cellValueSourceCorrection(TrackCloudType &cloud, trackingData &td, const scalar dt)
Correct cell values using latest transfer information.
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.
Helper container for force Su and Sp terms.
scalar rho_
Density [kg/m^3].
scalar nParticle_
Number of particles in Parcel.
void calc(TrackCloudType &cloud, trackingData &td, const scalar dt)
Update parcel properties over the time interval.
virtual Type interpolate(const vector &position, const label celli, const label facei=-1) const =0
Interpolate field to the given point in the given cell.
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().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))
virtual bool coupled() const
Return true if this patch is geometrically coupled (i.e. faces and.
const interpolation< scalar > & rhoInterp() const
Return const access to the interpolator for continuous.
scalar tTurb_
Time spent in turbulent eddy [s].
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
Storage and named access for the indices of a tet which is part of the decomposition of a cell...
scalar muc() const
Return the continuous phase viscosity.
vector U_
Velocity of Parcel [m/s].
Momentum parcel class with rotational motion (as spherical particles only) and one/two-way coupling w...
scalar Sp() const
Return const access to the implicit coefficient [kg/s].
virtual void transformProperties(const transformer &)
Transform the physical properties of the particle.
void calcDispersion(TrackCloudType &cloud, trackingData &td, const scalar dt)
Apply dispersion to the carrier phase velocity and update.
MomentumParcel(const polyMesh &mesh, const barycentric &coordinates, const label celli, const label tetFacei, const label tetPti)
Construct from mesh, coordinates and topology.
scalar rhoc() const
Return the continuous phase density.
#define WarningInFunction
Report a warning using Foam::Warning.
A cell is defined as a list of faces with extra functionality.
const interpolation< scalar > & muInterp() const
Return const access to the interpolator for continuous.
dimensioned< scalar > mag(const dimensioned< Type > &)
Mesh consisting of general polyhedral cells.
const tmp< volScalarField::Internal > & Su
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.
const vector & Uc() const
Return the continuous phase velocity.
vector UTurb_
Turbulent velocity fluctuation [m/s].
scalarField Re(const UList< complex > &cf)