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  //- Class used to pass tracking data to the trackToFace function
88  class trackingData
89  :
91  {
92  // Interpolators for continuous phase fields
93 
94  const interpolationCellPoint<scalar>& rhoInterp_;
95  const interpolationCellPoint<vector>& UInterp_;
96  const interpolationCellPoint<scalar>& nuInterp_;
97 
98  //- Local gravitational or other body-force acceleration
99  const vector& g_;
100 
101 
102  public:
103 
104  // Constructors
105 
106  inline trackingData
107  (
108  const solidParticleCloud& spc,
112  const vector& g
113  );
114 
115 
116  // Member Functions
117 
118  inline const interpolationCellPoint<scalar>& rhoInterp() const;
119 
120  inline const interpolationCellPoint<vector>& UInterp() const;
121 
122  inline const interpolationCellPoint<scalar>& nuInterp() const;
123 
124  inline const vector& g() const;
125  };
126 
127 
128  //- Runtime type information
129  TypeName("solidParticle");
130 
131 
132  // Constructors
133 
134  //- Construct from components
135  inline solidParticle
136  (
137  const polyMesh& mesh,
138  const barycentric& coordinates,
139  const label celli,
140  const label tetFacei,
141  const label tetPti,
142  const scalar d,
143  const vector& U
144  );
145 
146  //- Construct from Istream
148  (
149  const polyMesh& mesh,
150  Istream& is,
151  bool readFields = true
152  );
153 
154  //- Construct and return a clone
155  virtual autoPtr<particle> clone() const
156  {
157  return autoPtr<particle>(new solidParticle(*this));
158  }
159 
160  //- Factory class to read-construct particles used for
161  // parallel transfer
162  class iNew
163  {
164  const polyMesh& mesh_;
165 
166  public:
168  iNew(const polyMesh& mesh)
169  :
170  mesh_(mesh)
171  {}
173  autoPtr<solidParticle> operator()(Istream& is) const
174  {
176  (
177  new solidParticle(mesh_, is, true)
178  );
179  }
180  };
181 
182 
183  // Member Functions
184 
185  // Access
186 
187  //- Return diameter
188  inline scalar d() const;
189 
190  //- Return velocity
191  inline const vector& U() const;
192 
193 
194  // Tracking
195 
196  //- Move
197  bool move(solidParticleCloud&, trackingData&, const scalar);
198 
199 
200  // Patch interactions
201 
202  //- Overridable function to handle the particle hitting a wallPatch
204 
205  //- Transform the physical properties of the particle
206  // according to the given transformation
207  virtual void transformProperties(const transformer&);
208 
209 
210  // I-O
211 
212  static void readFields(Cloud<solidParticle>& c);
213 
214  static void writeFields(const Cloud<solidParticle>& c);
215 
216 
217  // Ostream Operator
218 
219  friend Ostream& operator<<(Ostream&, const solidParticle&);
220 };
221 
222 
223 template<>
224 inline bool contiguous<solidParticle>()
225 {
226  return true;
227 }
228 
229 
230 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
231 
232 } // End namespace Foam
233 
234 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
235 
236 #include "solidParticleI.H"
237 
238 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
239 
240 #endif
241 
242 // ************************************************************************* //
const polyMesh & mesh() const
Return the mesh database.
Definition: particleI.H:125
Vector-tensor class used to perform translations, rotations and scaling operations in 3D space...
Definition: transformer.H:83
trackingData(const solidParticleCloud &spc, const interpolationCellPoint< scalar > &rhoInterp, const interpolationCellPoint< vector > &UInterp, const interpolationCellPoint< scalar > &nuInterp, const vector &g)
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
Template function to specify if the data of a type are contiguous.
bool contiguous< solidParticle >()
scalar d() const
Return diameter.
const dimensionedScalar c
Speed of light in a vacuum.
Base particle class.
Definition: particle.H:81
const vector & U() const
Return velocity.
A cloud is a collection of lagrangian particles.
Definition: cloud.H:51
A Cloud of solid particles.
const interpolationCellPoint< scalar > & rhoInterp() const
const interpolationCellPoint< scalar > & nuInterp() const
Base cloud calls templated on particle type.
Definition: Cloud.H:52
Factory class to read-construct particles used for.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
const interpolationCellPoint< vector > & UInterp() const
TypeName("solidParticle")
Runtime type information.
Class used to pass tracking data to the trackToFace function.
Definition: solidParticle.H:87
static void writeFields(const Cloud< solidParticle > &c)
solidParticle(const polyMesh &mesh, const barycentric &coordinates, const label celli, const label tetFacei, const label tetPti, const scalar d, const vector &U)
Construct from components.
virtual autoPtr< particle > clone() const
Construct and return a clone.
Ostream & operator<<(Ostream &, const ensightPart &)
bool move(solidParticleCloud &, trackingData &, const scalar)
Move.
Definition: solidParticle.C:39
const barycentric & coordinates() const
Return current particle coordinates.
Definition: particleI.H:131
virtual void transformProperties(const transformer &)
Transform the physical properties of the particle.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:76
void hitWallPatch(solidParticleCloud &cloud, trackingData &td)
Overridable function to handle the particle hitting a wallPatch.
Definition: solidParticle.C:90
static void readFields(Cloud< solidParticle > &c)
Simple solid spherical particle class with one-way coupling with the continuous phase.
Definition: solidParticle.H:66
friend Ostream & operator<<(Ostream &, const solidParticle &)
Namespace for OpenFOAM.