FreeFOAM The Cross-Platform CFD Toolkit
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) 1991-2010 OpenCFD Ltd.
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 <lagrangian/Particle.H>
42 #include <OpenFOAM/IOstream.H>
43 #include <OpenFOAM/autoPtr.H>
45 #include <OpenFOAM/contiguous.H>
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 
52 class solidParticleCloud;
53 
54 /*---------------------------------------------------------------------------*\
55  Class solidParticle Declaration
56 \*---------------------------------------------------------------------------*/
57 
59 :
60  public Particle<solidParticle>
61 {
62  // Private member data
63 
64  //- Diameter
65  scalar d_;
66 
67  //- Velocity of parcel
68  vector U_;
69 
70 
71 public:
72 
73  friend class Cloud<solidParticle>;
74 
75  //- Class used to pass tracking data to the trackToFace function
76  class trackData
77  {
78  //- Reference to the cloud containing this particle
79  solidParticleCloud& spc_;
80 
81  // Interpolators for continuous phase fields
82 
83  const interpolationCellPoint<scalar>& rhoInterp_;
84  const interpolationCellPoint<vector>& UInterp_;
85  const interpolationCellPoint<scalar>& nuInterp_;
86 
87  //- Local gravitational or other body-force acceleration
88  const vector& g_;
89 
90 
91  public:
92 
95 
96 
97  // Constructors
98 
99  inline trackData
100  (
105  const vector& g
106  );
107 
108 
109  // Member functions
110 
111  inline solidParticleCloud& spc();
112 
113  inline const interpolationCellPoint<scalar>& rhoInterp() const;
114 
115  inline const interpolationCellPoint<vector>& UInterp() const;
116 
117  inline const interpolationCellPoint<scalar>& nuInterp() const;
118 
119  inline const vector& g() const;
120  };
121 
122 
123  // Constructors
124 
125  //- Construct from components
126  inline solidParticle
127  (
128  const Cloud<solidParticle>& c,
129  const vector& position,
130  const label celli,
131  const scalar m,
132  const vector& U
133  );
134 
135  //- Construct from Istream
137  (
138  const Cloud<solidParticle>& c,
139  Istream& is,
140  bool readFields = true
141  );
142 
143  //- Construct and return a clone
145  {
146  return autoPtr<solidParticle>(new solidParticle(*this));
147  }
148 
149 
150  // Member Functions
151 
152  // Access
153 
154  //- Return diameter
155  inline scalar d() const;
156 
157  //- Return velocity
158  inline const vector& U() const;
159 
160  //- The nearest distance to a wall that
161  // the particle can be in the n direction
162  inline scalar wallImpactDistance(const vector& n) const;
163 
164 
165  // Tracking
166 
167  //- Move
168  bool move(trackData&);
169 
170 
171  // Patch interactions
172 
173  //- Overridable function to handle the particle hitting a patch
174  // Executed before other patch-hitting functions
175  bool hitPatch
176  (
177  const polyPatch&,
179  const label patchI
180  );
181 
182  //- Overridable function to handle the particle hitting a patch
183  // Executed before other patch-hitting functions without trackData
184  bool hitPatch
185  (
186  const polyPatch& p,
187  int& td,
188  const label patchI
189  );
190 
191  //- Overridable function to handle the particle hitting a
192  // processorPatch
193  void hitProcessorPatch
194  (
195  const processorPolyPatch&,
197  );
198 
199  //- Overridable function to handle the particle hitting a
200  // processorPatch without trackData
201  void hitProcessorPatch
202  (
203  const processorPolyPatch&,
204  int&
205  );
206 
207  //- Overridable function to handle the particle hitting a wallPatch
208  void hitWallPatch
209  (
210  const wallPolyPatch&,
212  );
213 
214  //- Overridable function to handle the particle hitting a wallPatch
215  //- without trackData
216  void hitWallPatch
217  (
218  const wallPolyPatch&,
219  int&
220  );
221 
222  //- Overridable function to handle the particle hitting a polyPatch
223  void hitPatch
224  (
225  const polyPatch&,
227  );
228 
229  //- Overridable function to handle the particle hitting a polyPatch
230  //- without trackData
231  void hitPatch
232  (
233  const polyPatch&,
234  int&
235  );
236 
237  //- Transform the physical properties of the particle
238  // according to the given transformation tensor
240  (
241  const tensor& T
242  );
243 
244  //- Transform the physical properties of the particle
245  // according to the given separation vector
247  (
248  const vector& separation
249  );
250 
251 
252  // I-O
253 
254  static void readFields(Cloud<solidParticle>& c);
255 
256  static void writeFields(const Cloud<solidParticle>& c);
257 
258 
259  // Ostream Operator
260 
261  friend Ostream& operator<<(Ostream&, const solidParticle&);
262 };
263 
264 
265 template<>
267 {
268  return true;
269 }
270 
271 
272 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
273 
274 } // End namespace Foam
275 
276 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
277 
279 
280 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
281 
282 #endif
283 
284 // ************************ vim: set sw=4 sts=4 et: ************************ //