FreeFOAM The Cross-Platform CFD Toolkit
parcel.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::parcel
26 
27 Description
28  A parcel of particles
29 
30 \*---------------------------------------------------------------------------*/
31 
32 #ifndef parcel_H
33 #define parcel_H
34 
35 #include <lagrangian/Particle.H>
36 #include <OpenFOAM/contiguous.H>
37 
38 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
39 
40 namespace Foam
41 {
42 
43 class spray;
44 
45 /*---------------------------------------------------------------------------*\
46  Class parcel Declaration
47 \*---------------------------------------------------------------------------*/
48 
49 class parcel
50 :
51  public Particle<parcel>
52 {
53  // Private member data
54 
55  // Reference to the names of the liquid components
56  List<word> liquidComponents_;
57 
58  // Defining data (read and written to field files)
59 
60  //- Diameter of droplets in parcel
61  scalar d_;
62 
63  //- Temperature of droplets in parcel
64  scalar T_;
65 
66  //- Total parcel mass
67  scalar m_;
68 
69  //- Spherical deviation of droplets in parcel
70  scalar y_;
71 
72  //- Rate of change of spherical deviation of droplets in parcel
73  scalar yDot_;
74 
75  //- Characteristic time of droplets in parcel
76  scalar ct_;
77 
78  //- Stripped mass of droplets in parcel
79  scalar ms_;
80 
81  //- Time spent in turbulent eddy
82  scalar tTurb_;
83 
84  //- Part of liquid core (1-fully liquid, 0-droplet)
85  scalar liquidCore_;
86 
87  //- injected from injector
88  // Should really be a label, but is scalar due to
89  // post-processing reasons
90  scalar injector_;
91 
92  //- Velocity of parcel
93  vector U_;
94 
95  //- Turbulent velocity fluctuation
96  vector Uturb_;
97 
98  //- Normal n_ and axis describe the 2D plane
99  // in which the particle moves
100  vector n_;
101 
102  //- Liquid components molar fractions
103  scalarField X_;
104 
105  // Derived state information (not read or written)
106 
107  //- Momentum relaxation time of droplets in parcel
108  scalar tMom_;
109 
110 
111  // Private member functions
112 
113  //- Set the relaxation times
114  void setRelaxationTimes
115  (
116  label celli,
117  scalar& tauMomentum,
118  scalarField& tauEvaporation,
119  scalar& tauHeatTransfer,
120  scalarField& tauBoiling,
121  const spray& sprayDatabase,
122  const scalar rho,
123  const vector& Up,
124  const scalar temperature,
125  const scalar pressure,
126  const scalarField& Yf,
127  const scalarField& m0,
128  const scalar dt
129  );
130 
131 
132  void updateParcelProperties
133  (
134  const scalar dt,
135  spray& sprayData,
136  const label celli,
137  const label facei
138  );
139 
140 
141 public:
142 
143  friend class Cloud<parcel>;
144 
145 
146  // Constructors
147 
148  //- Construct from components
149  parcel
150  (
151  const Cloud<parcel>& cloud,
152  const vector& position,
153  const label celli,
154  const vector& n,
155  const scalar d,
156  const scalar T,
157  const scalar m,
158  const scalar y,
159  const scalar yDot,
160  const scalar ct,
161  const scalar ms,
162  const scalar tTurb,
163  const scalar liquidCore,
164  const scalar injector,
165  const vector& U,
166  const vector& Uturb,
167  const scalarField& X,
168  const List<word>& liquidNames
169  );
170 
171  //- Construct from Istream reading field values if required
172  parcel
173  (
174  const Cloud<parcel>& cloud,
175  Istream& is,
176  bool readFields = true
177  );
178 
179 
180  // Member Functions
181 
182  // Access
183 
184  //- Return the names of the liquid components
185  inline const List<word>& liquidNames() const;
186 
187  //- Return the names of the liquid fuel components - identical with liquidNames
188  inline const List<word>& fuelNames() const;
189 
190  //- Return diameter of droplets in parcel
191  inline scalar d() const;
192 
193  //- Return diameter of droplets in parcel
194  inline scalar& d();
195 
196  //- Return temperature of droplets in parcel
197  inline scalar T() const;
198 
199  //- Return temperature of droplets in parcel
200  inline scalar& T();
201 
202  //- Return total parcel mass
203  inline scalar m() const;
204 
205  //- Return total parcel mass
206  inline scalar& m();
207 
208  //- Return spherical deviation of droplets in parcel
209  inline scalar dev() const;
210 
211  //- Return spherical deviation of droplets in parcel
212  inline scalar& dev();
213 
214  //- Return rate of change of spherical deviation of
215  // droplets in parcel
216  inline scalar ddev() const;
217 
218  //- Return rate of change of spherical deviation of
219  // droplets in parcel
220  inline scalar& ddev();
221 
222  //- Return characteristic time of droplets in parcel
223  inline scalar ct() const;
224 
225  //- Return characteristic time of droplets in parcel
226  inline scalar& ct();
227 
228  //- Return stripped mass of droplets in parcel
229  inline scalar& ms();
230 
231  //- Return stripped mass of droplets in parcel
232  inline scalar ms() const;
233 
234  //- Return time spent in turbulent eddy
235  inline scalar& tTurb();
236 
237  //- Return time spent in turbulent eddy
238  inline scalar tTurb() const;
239 
240  //- Return part of liquid liquidCore
241  inline scalar& liquidCore();
242 
243  //- Return part of liquid liquidCore
244  inline scalar liquidCore() const;
245 
246  //- Return the injector from which is injected
247  inline scalar& injector();
248 
249  //- Return the injector from which is injected
250  inline scalar injector() const;
251 
252  //- Return velocity of parcel
253  inline const vector& U() const;
254 
255  //- Return velocity of parcel
256  inline vector& U();
257 
258  //- Return turbulent velocity fluctuation
259  inline const vector& Uturb() const;
260 
261  //- Return turbulent velocity fluctuation
262  inline vector& Uturb();
263 
264  //- Return the normal used for 2D purposes
265  inline const vector& n() const;
266 
267  //- Return the normal used for 2D purposes
268  inline vector& n();
269 
270  //- Return the liquid components molar fractions
271  inline const scalarField& X() const;
272 
273  //- Return the liquid components molar fractions
274  inline scalarField& X();
275 
276  //- Return the momentum relaxation time of droplets in parcel
277  inline scalar& tMom();
278 
279  //- Return the momentum relaxation time of droplets in parcel
280  inline scalar tMom() const;
281 
282 
283  // Derived information
284 
285  //- Return statistical number of drops in parcel
286  scalar N(const scalar rho) const;
287 
288  //- Return relative velocity between given vector and parcel
289  inline vector Urel(const vector&) const;
290 
291 
292  // Dimensionless Numbers
293 
294  //- Reynolds number based on rho an dynamic viscosity
295  scalar Re
296  (
297  const scalar rho,
298  const vector& U,
299  const scalar mu
300  ) const;
301 
302  //- Reynolds number based on kinematic viscosity
303  scalar Re
304  (
305  const vector& U,
306  const scalar nu
307  ) const;
308 
309  //- Weber number
310  scalar We
311  (
312  const vector& U,
313  const scalar rho,
314  const scalar sigma
315  ) const;
316 
317  //- Schmidt number based on dynamic viscosity and rho
318  scalar Sc
319  (
320  const scalar mu,
321  const scalar rho,
322  const scalar massDiffusion
323  ) const;
324 
325  //- Schmidt number based on kinematic viscosity
326  scalar Sc
327  (
328  const scalar nu,
329  const scalar massDiffusion
330  ) const;
331 
332  //- Prandtl number
333  scalar Pr
334  (
335  const scalar cp,
336  const scalar mu,
337  const scalar kappa
338  ) const;
339 
340  //- Volume of one droplet in the parcel
341  scalar Vd() const;
342 
343  //- Volume of all droplets in parcel
344  scalar V(const scalar rho) const;
345 
346 
347  // Parcel operations
348 
349  bool move(spray& sprayData);
350 
351  //- Transform the position and physical properties of the particle
352  // according to the given transformation tensor
353  void transformProperties(const tensor& T);
354 
355  //- Transform the position and physical properties of the particle
356  // according to the given separation vector
357  void transformProperties(const vector& separation);
358 
359  //- fix the 2D plane normal,
360  // when particle hits a face it is slightly perturbed
361  // towards the face centre and n_ will no longer be valid
362  inline void correctNormal(const vector& sym);
363 
364 
365  // I/O
366 
367  static void readFields(Cloud<parcel>& c);
368 
369  static void writeFields(const Cloud<parcel>& c);
370 
371 
372  // Ostream Operator
373 
374  friend Ostream& operator<<(Ostream&, const parcel&);
375 };
376 
377 
378 template<>
379 inline bool contiguous<parcel>()
380 {
381  return true;
382 }
383 
384 
385 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
386 
387 } // End namespace Foam
388 
389 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
390 
391 #include <dieselSpray/parcelI.H>
392 
393 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
394 
395 #endif
396 
397 // ************************ vim: set sw=4 sts=4 et: ************************ //