initial commit for version 1.5.x patch release
[OpenFOAM-1.5.x.git] / src / lagrangian / dieselSpray / parcel / parcel.H
bloba9c384bc7ec6c5de111602312669f1bf2bb3c14c
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2008 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
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 the
13     Free Software Foundation; either version 2 of the License, or (at your
14     option) any later version.
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.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Class
26     Foam::parcel
28 Description
29     A parcel of particles
31 \*---------------------------------------------------------------------------*/
33 #ifndef parcel_H
34 #define parcel_H
36 #include "Particle.H"
37 #include "contiguous.H"
39 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 namespace Foam
44 class spray;
46 /*---------------------------------------------------------------------------*\
47                            Class parcel Declaration
48 \*---------------------------------------------------------------------------*/
50 class parcel
52     public Particle<parcel>
54     // Private member data
56         // Reference to the names of the liquid components
57             List<word> liquidComponents_;
59         // Defining data (read and written to field files)
61             //- Diameter of droplets in parcel
62             scalar d_;
64             //- Temperature of droplets in parcel
65             scalar T_;
67             //- Total parcel mass
68             scalar m_;
70             //- Spherical deviation of droplets in parcel
71             scalar y_;
73             //- Rate of change of spherical deviation of droplets in parcel
74             scalar yDot_;
76             //- Characteristic time of droplets in parcel
77             scalar ct_;
79             //- Stripped mass of droplets in parcel
80             scalar ms_;
82             //- Time spent in turbulent eddy
83             scalar tTurb_;
85             //- Part of liquid core (1-fully liquid, 0-droplet)
86             scalar liquidCore_;
88             //- injected from injector
89             //  Should really be a label, but is scalar due to
90             //  post-processing reasons
91             scalar injector_;
93             //- Velocity of parcel
94             vector U_;
96             //- Turbulent velocity fluctuation
97             vector Uturb_;
99             //- Normal n_ and axis describe the 2D plane
100             //  in which the particle moves
101             vector n_;
103             //- Liquid components molar fractions
104             scalarField X_;
106         // Derived state information (not read or written)
108             //- Momentum relaxation time of droplets in parcel
109             scalar tMom_;
112     // Private member functions
114         //- Set the relaxation times
115         void setRelaxationTimes
116         (
117             label celli,
118             scalar& tauMomentum,
119             scalarField& tauEvaporation,
120             scalar& tauHeatTransfer,
121             scalarField& tauBoiling,
122             const spray& sprayDatabase,
123             const scalar rho,
124             const vector& Up,
125             const scalar temperature,
126             const scalar pressure,
127             const scalarField& Yf,
128             const scalarField& m0,
129             const scalar dt
130         );
133         void updateParcelProperties
134         (
135             const scalar dt,
136             spray& sprayData,
137             const label celli,
138             const label facei
139         );
142 public:
144     friend class Cloud<parcel>;
147     // Constructors
149         //- Construct from components
150         parcel
151         (
152             const Cloud<parcel>& cloud,
153             const vector& position,
154             const label celli,
155             const vector& n,
156             const scalar d,
157             const scalar T,
158             const scalar m,
159             const scalar y,
160             const scalar yDot,
161             const scalar ct,
162             const scalar ms,
163             const scalar tTurb,
164             const scalar liquidCore,
165             const scalar injector,
166             const vector& U,
167             const vector& Uturb,
168             const scalarField& X,
169             const List<word>& liquidNames
170         );
172         //- Construct from Istream reading field values if required
173         parcel
174         (
175             const Cloud<parcel>& cloud,
176             Istream& is,
177             bool readFields = true
178         );
181     // Member Functions
183         // Access
185             //- Return the names of the liquid components
186             inline const List<word>& liquidNames() const;
188             //- Return the names of the liquid fuel components - identical with liquidNames
189             inline const List<word>& fuelNames() const;
191             //- Return diameter of droplets in parcel
192             inline scalar d() const;
194             //- Return diameter of droplets in parcel
195             inline scalar& d();
197             //- Return temperature of droplets in parcel
198             inline scalar T() const;
200             //- Return temperature of droplets in parcel
201             inline scalar& T();
203             //- Return total parcel mass
204             inline scalar m() const;
206             //- Return total parcel mass
207             inline scalar& m();
209             //- Return spherical deviation of droplets in parcel
210             inline scalar dev() const;
212             //- Return spherical deviation of droplets in parcel
213             inline scalar& dev();
215             //- Return rate of change of spherical deviation of
216             //  droplets in parcel
217             inline scalar ddev() const;
219             //- Return rate of change of spherical deviation of
220             //  droplets in parcel
221             inline scalar& ddev();
223             //- Return characteristic time of droplets in parcel
224             inline scalar ct() const;
226             //- Return characteristic time of droplets in parcel
227             inline scalar& ct();
229             //- Return stripped mass of droplets in parcel
230             inline scalar& ms();
232             //- Return stripped mass of droplets in parcel
233             inline scalar ms() const;
235             //- Return time spent in turbulent eddy
236             inline scalar& tTurb();
238             //- Return time spent in turbulent eddy
239             inline scalar tTurb() const;
241             //- Return part of liquid liquidCore
242             inline scalar& liquidCore();
244             //- Return part of liquid liquidCore
245             inline scalar liquidCore() const;
247             //- Return the injector from which is injected
248             inline scalar& injector();
250             //- Return the injector from which is injected
251             inline scalar injector() const;
253             //- Return velocity of parcel
254             inline const vector& U() const;
256             //- Return velocity of parcel
257             inline vector& U();
259             //- Return turbulent velocity fluctuation
260             inline const vector& Uturb() const;
262             //- Return turbulent velocity fluctuation
263             inline vector& Uturb();
265             //- Return the normal used for 2D purposes
266             inline const vector& n() const;
268             //- Return the normal used for 2D purposes
269             inline vector& n();
271             //- Return the liquid components molar fractions
272             inline const scalarField& X() const;
274             //- Return the liquid components molar fractions
275             inline scalarField& X();
277             //- Return the momentum relaxation time of droplets in parcel
278             inline scalar& tMom();
280             //- Return the momentum relaxation time of droplets in parcel
281             inline scalar tMom() const;
284         // Derived information
286             //- Return statistical number of drops in parcel
287             scalar N(const scalar rho) const;
289             //- Return relative velocity between given vector and parcel
290             inline vector Urel(const vector&) const;
293         // Dimensionless Numbers
295             //- Reynolds number based on rho an dynamic viscosity
296             scalar Re
297             (
298                 const scalar rho,
299                 const vector& U,
300                 const scalar mu
301             ) const;
303             //- Reynolds number based on kinematic viscosity
304             scalar Re
305             (
306                 const vector& U,
307                 const scalar nu
308             ) const;
310             //- Weber number
311             scalar We
312             (
313                 const vector& U,
314                 const scalar rho,
315                 const scalar sigma
316             ) const;
318             //- Schmidt number based on dynamic viscosity and rho
319             scalar Sc
320             (
321                 const scalar mu,
322                 const scalar rho,
323                 const scalar massDiffusion
324             ) const;
326             //- Schmidt number based on kinematic viscosity
327             scalar Sc
328             (
329                 const scalar nu,
330                 const scalar massDiffusion
331             ) const;
333             //- Prandtl number
334             scalar Pr
335             (
336                 const scalar cp,
337                 const scalar mu,
338                 const scalar kappa
339             ) const;
341             //- Volume of one droplet in the parcel
342             scalar Vd() const;
344             //- Volume of all droplets in parcel
345             scalar V(const scalar rho) const;
348         // Parcel operations
350             bool move(spray& sprayData);
352             //- Transform the position and physical properties of the particle
353             //  according to the given transformation tensor
354             void transformProperties(const tensor& T);
356             //- Transform the position and physical properties of the particle
357             //  according to the given separation vector
358             void transformProperties(const vector& separation);
360             //- fix the 2D plane normal,
361             // when particle hits a face it is slightly perturbed
362             // towards the face centre and n_ will no longer be valid
363             inline void correctNormal(const vector& sym);
366     // I/O
368             static void readFields(Cloud<parcel>& c);
370             static void writeFields(const Cloud<parcel>& c);
373     // Ostream Operator
375         friend Ostream& operator<<(Ostream&, const parcel&);
379 template<>
380 inline bool contiguous<parcel>()
382     return true;
386 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
388 } // End namespace Foam
390 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
392 #include "parcelI.H"
394 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
396 #endif
398 // ************************************************************************* //