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