solidParticle.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2011-2015 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 "IOstream.H"
43 #include "autoPtr.H"
44 #include "interpolationCellPoint.H"
45 #include "contiguous.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 
52 class solidParticleCloud;
53 
54 /*---------------------------------------------------------------------------*\
55  Class solidParticle Declaration
56 \*---------------------------------------------------------------------------*/
57 
58 class solidParticle
59 :
60  public particle
61 {
62  // Private data
63 
64  //- Size in bytes of the fields
65  static const std::size_t sizeofFields_;
66 
67  //- Diameter
68  scalar d_;
69 
70  //- Velocity of parcel
71  vector U_;
72 
73 
74 public:
75 
76  friend class Cloud<solidParticle>;
77 
78  //- Class used to pass tracking data to the trackToFace function
79  class trackingData
80  :
81  public particle::TrackingData<solidParticleCloud>
82  {
83  // Interpolators for continuous phase fields
84 
85  const interpolationCellPoint<scalar>& rhoInterp_;
86  const interpolationCellPoint<vector>& UInterp_;
87  const interpolationCellPoint<scalar>& nuInterp_;
88 
89  //- Local gravitational or other body-force acceleration
90  const vector& g_;
91 
92 
93  public:
94 
95  // Constructors
96 
97  inline trackingData
98  (
99  solidParticleCloud& spc,
103  const vector& g
104  );
105 
106 
107  // Member functions
108 
109  inline const interpolationCellPoint<scalar>& rhoInterp() const;
110 
111  inline const interpolationCellPoint<vector>& UInterp() const;
112 
113  inline const interpolationCellPoint<scalar>& nuInterp() const;
114 
115  inline const vector& g() const;
116  };
117 
118 
119  // Constructors
120 
121  //- Construct from components
122  inline solidParticle
123  (
124  const polyMesh& mesh,
125  const vector& position,
126  const label cellI,
127  const label tetFaceI,
128  const label tetPtI,
129  const scalar d,
130  const vector& U
131  );
132 
133  //- Construct from Istream
135  (
136  const polyMesh& mesh,
137  Istream& is,
138  bool readFields = true
139  );
140 
141  //- Construct and return a clone
142  virtual autoPtr<particle> clone() const
143  {
144  return autoPtr<particle>(new solidParticle(*this));
145  }
146 
147  //- Factory class to read-construct particles used for
148  // parallel transfer
149  class iNew
150  {
151  const polyMesh& mesh_;
152 
153  public:
155  iNew(const polyMesh& mesh)
156  :
157  mesh_(mesh)
158  {}
160  autoPtr<solidParticle> operator()(Istream& is) const
161  {
163  (
164  new solidParticle(mesh_, is, true)
165  );
166  }
167  };
168 
169 
170  // Member Functions
171 
172  // Access
173 
174  //- Return diameter
175  inline scalar d() const;
176 
177  //- Return velocity
178  inline const vector& U() const;
179 
180 
181  // Tracking
182 
183  //- Move
184  bool move(trackingData&, const scalar);
185 
186 
187  // Patch interactions
188 
189  //- Overridable function to handle the particle hitting a patch
190  // Executed before other patch-hitting functions
191  bool hitPatch
192  (
193  const polyPatch&,
194  trackingData& td,
195  const label patchI,
196  const scalar trackFraction,
197  const tetIndices& tetIs
198  );
199 
200  //- Overridable function to handle the particle hitting a
201  // processorPatch
202  void hitProcessorPatch
203  (
204  const processorPolyPatch&,
205  trackingData& td
206  );
207 
208  //- Overridable function to handle the particle hitting a wallPatch
209  void hitWallPatch
210  (
211  const wallPolyPatch&,
212  trackingData& td,
213  const tetIndices&
214  );
215 
216  //- Overridable function to handle the particle hitting a polyPatch
217  void hitPatch
218  (
219  const polyPatch&,
220  trackingData& td
221  );
222 
223  //- Transform the physical properties of the particle
224  // according to the given transformation tensor
225  virtual void transformProperties(const tensor& T);
226 
227  //- Transform the physical properties of the particle
228  // according to the given separation vector
229  virtual void transformProperties(const vector& separation);
230 
231  //- The nearest distance to a wall that
232  // the particle can be in the n direction
233  virtual scalar wallImpactDistance(const vector& n) const;
234 
235 
236  // I-O
237 
238  static void readFields(Cloud<solidParticle>& c);
239 
240  static void writeFields(const Cloud<solidParticle>& c);
241 
242 
243  // Ostream Operator
244 
245  friend Ostream& operator<<(Ostream&, const solidParticle&);
246 };
247 
248 
249 template<>
250 inline bool contiguous<solidParticle>()
251 {
252  return true;
253 }
254 
255 
256 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
257 
258 } // End namespace Foam
259 
260 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
261 
262 #include "solidParticleI.H"
263 
264 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
265 
266 #endif
267 
268 // ************************************************************************* //
const interpolationCellPoint< vector > & UInterp() const
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
static void writeFields(const Cloud< solidParticle > &c)
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
const interpolationCellPoint< scalar > & nuInterp() const
trackingData(solidParticleCloud &spc, const interpolationCellPoint< scalar > &rhoInterp, const interpolationCellPoint< vector > &UInterp, const interpolationCellPoint< scalar > &nuInterp, const vector &g)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
A Cloud of solid particles.
Namespace for OpenFOAM.
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
label n
virtual void transformProperties(const tensor &T)
Transform the physical properties of the particle.
static void readFields(Cloud< solidParticle > &c)
Neighbour processor patch.
const interpolationCellPoint< scalar > & rhoInterp() const
const vector & position() const
Return current particle position.
Definition: particleI.H:603
Factory class to read-construct particles used for.
const vector & U() const
Return velocity.
Base particle class.
Definition: particle.H:78
Class used to pass tracking data to the trackToFace function.
Definition: solidParticle.H:78
const polyMesh & mesh_
Reference to the polyMesh database.
Definition: particle.H:137
const polyMesh & mesh() const
Return the mesh database.
Definition: particleI.H:597
bool move(trackingData &, const scalar)
Move.
Definition: solidParticle.C:38
Template function to specify if the data of a type are contiguous.
Simple solid spherical particle class with one-way coupling with the continuous phase.
Definition: solidParticle.H:57
const vector & g() const
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Foam::wallPolyPatch.
Definition: wallPolyPatch.H:48
scalar d() const
Return diameter.
solidParticle(const polyMesh &mesh, const vector &position, const label cellI, const label tetFaceI, const label tetPtI, const scalar d, const vector &U)
Construct from components.
virtual scalar wallImpactDistance(const vector &n) const
The nearest distance to a wall that.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
const dimensionedScalar c
Speed of light in a vacuum.
bool hitPatch(const polyPatch &, trackingData &td, const label patchI, const scalar trackFraction, const tetIndices &tetIs)
Overridable function to handle the particle hitting a patch.
Base cloud calls templated on particle type.
Definition: Cloud.H:52
void hitWallPatch(const wallPolyPatch &, trackingData &td, const tetIndices &)
Overridable function to handle the particle hitting a wallPatch.
bool contiguous< solidParticle >()
This function object reads fields from the time directories and adds them to the mesh database for fu...
Definition: readFields.H:102
Storage and named access for the indices of a tet which is part of the decomposition of a cell...
Definition: tetIndices.H:73
friend Ostream & operator<<(Ostream &, const solidParticle &)
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117
virtual autoPtr< particle > clone() const
Construct and return a clone.
void hitProcessorPatch(const processorPolyPatch &, trackingData &td)
Overridable function to handle the particle hitting a.