solidParticle.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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
19  for more details.
20 
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/>.
23 
24 Class
25  Foam::solidParticle
26 
27 Description
28  Simple solid spherical particle class with one-way coupling with the
29  continuous phase.
30 
31 SourceFiles
32  solidParticleI.H
33  solidParticle.C
34  solidParticleIO.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef solidParticle_H
39 #define solidParticle_H
40 
41 #include "particle.H"
42 #include "Cloud.H"
43 #include "IOstream.H"
44 #include "autoPtr.H"
45 #include "interpolationCellPoint.H"
46 #include "contiguous.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 
53 class solidParticleCloud;
54 
55 
56 // Forward declaration of friend functions and operators
57 
58 class solidParticle;
59 
60 Ostream& operator<<(Ostream&, const solidParticle&);
61 
62 
63 /*---------------------------------------------------------------------------*\
64  Class solidParticle Declaration
65 \*---------------------------------------------------------------------------*/
66 
67 class solidParticle
68 :
69  public particle
70 {
71  // Private Data
72 
73  //- Size in bytes of the fields
74  static const std::size_t sizeofFields_;
75 
76  //- Diameter
77  scalar d_;
78 
79  //- Velocity of parcel
80  vector U_;
81 
82 
83 public:
84 
85  friend class Cloud<solidParticle>;
86 
87 
88  //- Class used to pass tracking data to the trackToFace function
89  class trackingData
90  :
92  {
93  // Interpolators for continuous phase fields
94 
95  const interpolationCellPoint<scalar>& rhoInterp_;
96  const interpolationCellPoint<vector>& UInterp_;
97  const interpolationCellPoint<scalar>& nuInterp_;
98 
99  //- Local gravitational or other body-force acceleration
100  const vector& g_;
101 
102 
103  public:
104 
105  // Constructors
106 
107  inline trackingData
108  (
109  const solidParticleCloud& spc,
113  const vector& g
114  );
115 
116 
117  // Member Functions
118 
119  inline const interpolationCellPoint<scalar>& rhoInterp() const;
120 
121  inline const interpolationCellPoint<vector>& UInterp() const;
122 
123  inline const interpolationCellPoint<scalar>& nuInterp() const;
124 
125  inline const vector& g() const;
126  };
127 
128 
129  //- Runtime type information
130  TypeName("solidParticle");
131 
132 
133  // Constructors
134 
135  //- Construct from Istream
136  solidParticle(Istream& is, bool readFields = true);
137 
138  //- Construct and return a clone
139  virtual autoPtr<particle> clone() const
140  {
141  return autoPtr<particle>(new solidParticle(*this));
142  }
143 
144  //- Construct from Istream and return
146  {
147  return autoPtr<solidParticle>(new solidParticle(is));
148  }
149 
150 
151  // Member Functions
152 
153  // Access
154 
155  //- Return diameter
156  inline scalar d() const;
157 
158  //- Return velocity
159  inline const vector& U() const;
160 
161 
162  // Tracking
163 
164  //- Move
165  bool move(solidParticleCloud&, trackingData&);
166 
167 
168  // Patch interactions
169 
170  //- Overridable function to handle the particle hitting a wallPatch
171  void hitWallPatch(solidParticleCloud& cloud, trackingData& td);
172 
173  //- Transform the physical properties of the particle
174  // according to the given transformation
175  virtual void transformProperties(const transformer&);
176 
177 
178  // I-O
179 
180  static void readFields(Cloud<solidParticle>& c);
181 
182  static void writeFields(const Cloud<solidParticle>& c);
183 
184 
185  // Ostream Operator
186 
187  friend Ostream& operator<<(Ostream&, const solidParticle&);
188 };
189 
190 
191 template<>
192 inline bool contiguous<solidParticle>()
193 {
194  return true;
195 }
196 
197 
198 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
199 
200 } // End namespace Foam
201 
202 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
203 
204 #include "solidParticleI.H"
205 
206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
207 
208 #endif
209 
210 // ************************************************************************* //
Base cloud calls templated on particle type.
Definition: Cloud.H:74
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:60
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A cloud is a collection of lagrangian particles.
Definition: cloud.H:55
Base particle class.
Definition: particle.H:83
A Cloud of solid particles.
Class used to pass tracking data to the trackToFace function.
Definition: solidParticle.H:91
const interpolationCellPoint< scalar > & rhoInterp() const
const interpolationCellPoint< vector > & UInterp() const
const interpolationCellPoint< scalar > & nuInterp() const
trackingData(const solidParticleCloud &spc, const interpolationCellPoint< scalar > &rhoInterp, const interpolationCellPoint< vector > &UInterp, const interpolationCellPoint< scalar > &nuInterp, const vector &g)
Simple solid spherical particle class with one-way coupling with the continuous phase.
Definition: solidParticle.H:69
TypeName("solidParticle")
Runtime type information.
const vector & U() const
Return velocity.
friend Ostream & operator<<(Ostream &, const solidParticle &)
void hitWallPatch(solidParticleCloud &cloud, trackingData &td)
Overridable function to handle the particle hitting a wallPatch.
Definition: solidParticle.C:91
scalar d() const
Return diameter.
virtual autoPtr< particle > clone() const
Construct and return a clone.
solidParticle(Istream &is, bool readFields=true)
Construct from Istream.
static void readFields(Cloud< solidParticle > &c)
virtual void transformProperties(const transformer &)
Transform the physical properties of the particle.
static autoPtr< solidParticle > New(Istream &is)
Construct from Istream and return.
static void writeFields(const Cloud< solidParticle > &c)
bool move(solidParticleCloud &, trackingData &)
Move.
Definition: solidParticle.C:39
Vector-tensor class used to perform translations, rotations and scaling operations in 3D space.
Definition: transformer.H:84
Template function to specify if the data of a type are contiguous.
const dimensionedScalar c
Speed of light in a vacuum.
Namespace for OpenFOAM.
bool contiguous< solidParticle >()
Ostream & operator<<(Ostream &, const ensightPart &)