1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
28 Kinematic parcel class with rotational motion (as spherical
29 particles only) and one/two-way coupling with the continuous
34 - turbulent dispersion
42 \*---------------------------------------------------------------------------*/
44 #ifndef KinematicParcel_H
45 #define KinematicParcel_H
50 #include "interpolation.H"
52 // #include "ParticleForceList.H" // TODO
54 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
59 template<class ParcelType>
60 class KinematicParcel;
62 // Forward declaration of friend functions
64 template<class ParcelType>
68 const KinematicParcel<ParcelType>&
71 /*---------------------------------------------------------------------------*\
72 Class KinematicParcel Declaration
73 \*---------------------------------------------------------------------------*/
75 template<class ParcelType>
82 //- Class to hold kinematic particle constant properties
83 class constantProperties
87 //- Constant properties dictionary
88 const dictionary dict_;
90 //- Parcel type id - used for post-processing to flag the type
91 // of parcels issued by this cloud
94 //- Minimum density [kg/m3]
97 //- Particle density [kg/m3] (constant)
100 //- Minimum particle mass [kg]
101 scalar minParticleMass_;
103 //- Young's modulus [N/m2]
104 scalar youngsModulus_;
107 scalar poissonsRatio_;
115 constantProperties();
118 constantProperties(const constantProperties& cp);
120 //- Constructor from dictionary
123 const dictionary& parentDict,
124 const bool readFields = true
127 //- Construct from components
130 const label parcelTypeId,
133 const scalar minParticleMass,
134 const scalar youngsModulus,
135 const scalar poissonsRatio
141 //- Return const access to the constant properties dictionary
142 inline const dictionary& dict() const;
144 //- Return const access to the parcel type id
145 inline label parcelTypeId() const;
147 //- Return const access to the minimum density
148 inline scalar rhoMin() const;
150 //- Return const access to the particle density
151 inline scalar rho0() const;
153 //- Return const access to the minimum particle mass
154 inline scalar minParticleMass() const;
156 //- Return const access to Young's Modulus
157 inline scalar youngsModulus() const;
159 //- Return const access to Poisson's ratio
160 inline scalar poissonsRatio() const;
164 template<class CloudType>
167 public ParcelType::template TrackingData<CloudType>
183 // Interpolators for continuous phase fields
185 //- Density interpolator
186 autoPtr<interpolation<scalar> > rhoInterp_;
188 //- Velocity interpolator
189 autoPtr<interpolation<vector> > UInterp_;
191 //- Dynamic viscosity interpolator
192 autoPtr<interpolation<scalar> > muInterp_;
195 //- Local gravitational or other body-force acceleration
198 // label specifying which part of the integration
199 // algorithm is taking place
207 //- Construct from components
211 trackPart part = tpLinearTrack
217 //- Return conat access to the interpolator for continuous
218 // phase density field
219 inline const interpolation<scalar>& rhoInterp() const;
221 //- Return conat access to the interpolator for continuous
222 // phase velocity field
223 inline const interpolation<vector>& UInterp() const;
225 //- Return conat access to the interpolator for continuous
226 // phase dynamic viscosity field
227 inline const interpolation<scalar>& muInterp() const;
229 // Return const access to the gravitational acceleration vector
230 inline const vector& g() const;
232 //- Return the part of the tracking operation taking place
233 inline trackPart part() const;
235 //- Return access to the part of the tracking operation taking place
236 inline trackPart& part();
246 //- Active flag - tracking inactive when active = false
252 //- Number of particles in Parcel
258 //- Target diameter [m]
261 //- Velocity of Parcel [m/s]
264 //- Force on particle due to collisions [N]
267 //- Angular momentum of Parcel in global reference frame
269 vector angularMomentum_;
271 //- Torque on particle due to collisions in global
272 // reference frame [Nm]
281 //- Time spent in turbulent eddy [s]
284 //- Turbulent velocity fluctuation [m/s]
288 // Cell-based quantities
300 // Protected Member Functions
302 //- Calculate new particle velocity
303 template<class TrackData>
304 const vector calcVelocity
307 const scalar dt, // timestep
308 const label cellI, // owner cell
309 const scalar Re, // Reynolds number
310 const scalar mu, // local carrier viscosity
311 const scalar mass, // mass
312 const vector& Su, // explicit particle momentum source
313 vector& dUTrans, // momentum transfer to carrier
314 scalar& Spu // linearised drag coefficient
320 // Static data members
322 //- String representation of properties
323 static string propHeader;
325 //- Runtime type information
326 TypeName("KinematicParcel");
331 //- Construct from owner, position, and cloud owner
332 // Other properties initialised as null
333 inline KinematicParcel
335 const polyMesh& mesh,
336 const vector& position,
338 const label tetFaceI,
342 //- Construct from components
343 inline KinematicParcel
345 const polyMesh& mesh,
346 const vector& position,
348 const label tetFaceI,
351 const scalar nParticle0,
353 const scalar dTarget0,
356 const vector& angularMomentum0,
357 const vector& torque0,
358 const constantProperties& constProps
361 //- Construct from Istream
364 const polyMesh& mesh,
366 bool readFields = true
369 //- Construct as a copy
370 KinematicParcel(const KinematicParcel& p);
372 //- Construct as a copy
373 KinematicParcel(const KinematicParcel& p, const polyMesh& mesh);
375 //- Construct and return a (basic particle) clone
376 virtual autoPtr<particle> clone() const
378 return autoPtr<particle>(new KinematicParcel(*this));
381 //- Construct and return a (basic particle) clone
382 virtual autoPtr<particle> clone(const polyMesh& mesh) const
384 return autoPtr<particle>(new KinematicParcel(*this, mesh));
387 //- Factory class to read-construct particles used for
391 const polyMesh& mesh_;
395 iNew(const polyMesh& mesh)
400 autoPtr<KinematicParcel<ParcelType> > operator()(Istream& is) const
402 return autoPtr<KinematicParcel<ParcelType> >
404 new KinematicParcel<ParcelType>(mesh_, is, true)
414 //- Return const access to active flag
415 inline bool active() const;
417 //- Return const access to type id
418 inline label typeId() const;
420 //- Return const access to number of particles
421 inline scalar nParticle() const;
423 //- Return const access to diameter
424 inline scalar d() const;
426 //- Return const access to target diameter
427 inline scalar dTarget() const;
429 //- Return const access to velocity
430 inline const vector& U() const;
432 //- Return const access to force
433 inline const vector& f() const;
435 //- Return const access to angular momentum
436 inline const vector& angularMomentum() const;
438 //- Return const access to torque
439 inline const vector& torque() const;
441 //- Return const access to density
442 inline scalar rho() const;
444 //- Return const access to the age
445 inline scalar age() const;
447 //- Return const access to time spent in turbulent eddy
448 inline scalar tTurb() const;
450 //- Return const access to turbulent velocity fluctuation
451 inline const vector& UTurb() const;
453 //- Return const access to carrier density [kg/m3]
454 inline scalar rhoc() const;
456 //- Return const access to carrier velocity [m/s]
457 inline const vector& Uc() const;
459 //- Return const access to carrier viscosity [Pa.s]
460 inline scalar muc() const;
465 //- Return const access to active flag
466 inline bool& active();
468 //- Return access to type id
469 inline label& typeId();
471 //- Return access to number of particles
472 inline scalar& nParticle();
474 //- Return access to diameter
477 //- Return access to target diameter
478 inline scalar& dTarget();
480 //- Return access to velocity
483 //- Return access to force
486 //- Return access to angular momentum
487 inline vector& angularMomentum();
489 //- Return access to torque
490 inline vector& torque();
492 //- Return access to density
493 inline scalar& rho();
495 //- Return access to the age
496 inline scalar& age();
498 //- Return access to time spent in turbulent eddy
499 inline scalar& tTurb();
501 //- Return access to turbulent velocity fluctuation
502 inline vector& UTurb();
507 //- Return the index of the face to be used in the interpolation
509 inline label faceInterpolation() const;
512 inline scalar massCell(const label cellI) const;
515 inline scalar mass() const;
517 //- Particle moment of inertia around diameter axis
518 inline scalar momentOfInertia() const;
520 //- Particle angular velocity
521 inline vector omega() const;
524 inline scalar volume() const;
526 //- Particle volume for a given diameter
527 inline static scalar volume(const scalar d);
529 //- Particle projected area
530 inline scalar areaP() const;
532 //- Projected area for given diameter
533 inline static scalar areaP(const scalar d);
535 //- Particle surface area
536 inline scalar areaS() const;
538 //- Surface area for given diameter
539 inline static scalar areaS(const scalar d);
544 const vector& U, // particle velocity
545 const scalar d, // particle diameter
546 const scalar rhoc, // carrier density
547 const scalar muc // carrier dynamic viscosity
553 const vector& U, // particle velocity
554 const scalar d, // particle diameter
555 const scalar rhoc, // carrier density
556 const scalar sigma // particle surface tension
560 // Main calculation loop
563 template<class TrackData>
571 //- Correct cell values using latest transfer information
572 template<class TrackData>
573 void cellValueSourceCorrection
580 //- Update parcel properties over the time interval
581 template<class TrackData>
593 template<class TrackData>
594 bool move(TrackData& td, const scalar trackTime);
597 // Patch interactions
599 //- Overridable function to handle the particle hitting a face
601 void hitFace(int& td);
603 //- Overridable function to handle the particle hitting a face
604 template<class TrackData>
605 void hitFace(TrackData& td);
607 //- Overridable function to handle the particle hitting a patch
608 // Executed before other patch-hitting functions
609 template<class TrackData>
615 const scalar trackFraction,
616 const tetIndices& tetIs
619 //- Overridable function to handle the particle hitting a
621 template<class TrackData>
622 void hitProcessorPatch
624 const processorPolyPatch&,
628 //- Overridable function to handle the particle hitting a wallPatch
629 template<class TrackData>
632 const wallPolyPatch&,
637 //- Overridable function to handle the particle hitting a polyPatch
638 template<class TrackData>
645 //- Transform the physical properties of the particle
646 // according to the given transformation tensor
647 virtual void transformProperties(const tensor& T);
649 //- Transform the physical properties of the particle
650 // according to the given separation vector
651 virtual void transformProperties(const vector& separation);
653 //- The nearest distance to a wall that the particle can be
654 // in the n direction
655 virtual scalar wallImpactDistance(const vector& n) const;
661 template<class CloudType>
662 static void readFields(CloudType& c);
665 template<class CloudType>
666 static void writeFields(const CloudType& c);
671 friend Ostream& operator<< <ParcelType>
674 const KinematicParcel<ParcelType>&
679 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
681 } // End namespace Foam
683 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
685 #include "KinematicParcelI.H"
686 #include "KinematicParcelTrackingDataI.H"
688 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
691 #include "KinematicParcel.C"
694 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
698 // ************************************************************************* //