SprayParcel.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::SprayParcel
26 
27 Description
28  Reacing spray parcel, with added functionality for atomization and breakup
29 
30 \*---------------------------------------------------------------------------*/
31 
32 #ifndef SprayParcel_H
33 #define SprayParcel_H
34 
35 #include "particle.H"
36 #include "demandDrivenEntry.H"
37 
38 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
39 
40 namespace Foam
41 {
42 
43 template<class ParcelType>
44 class SprayParcel;
45 
46 template<class ParcelType>
47 Ostream& operator<<
48 (
49  Ostream&,
51 );
52 
53 /*---------------------------------------------------------------------------*\
54  Class SprayParcel Declaration
55 \*---------------------------------------------------------------------------*/
56 
57 template<class ParcelType>
58 class SprayParcel
59 :
60  public ParcelType
61 {
62  // Private data
63 
64  //- Size in bytes of the fields
65  static const std::size_t sizeofFields_;
66 
67 
68 public:
69 
70  //- Class to hold reacting particle constant properties
71  class constantProperties
72  :
73  public ParcelType::constantProperties
74  {
75  // Private data
76 
77  //- Particle initial surface tension [N/m]
79 
80  //- Particle initial dynamic viscosity [Pa.s]
82 
83 
84  public:
85 
86  // Constructors
87 
88  //- Null constructor
90 
91  //- Copy constructor
93 
94  //- Construct from dictionary
95  constantProperties(const dictionary& parentDict);
96 
97  //- Construct from components
99  (
100  const label parcelTypeId,
101  const scalar rhoMin,
102  const scalar rho0,
103  const scalar minParcelMass,
104  const scalar youngsModulus,
105  const scalar poissonsRatio,
106  const scalar T0,
107  const scalar TMin,
108  const scalar TMax,
109  const scalar Cp0,
110  const scalar epsilon0,
111  const scalar f0,
112  const scalar Pr,
113  const scalar pMin,
114  const Switch& constantVolume,
115  const scalar sigma0,
116  const scalar mu0
117  );
118 
119 
120  // Access
121 
122  //- Return const access to the initial surface tension
123  inline scalar sigma0() const;
124 
125  //- Return const access to the initial dynamic viscosity
126  inline scalar mu0() const;
127  };
128 
129 
130 protected:
131 
132  // Protected data
133 
134  // Spray parcel properties
135 
136  //- Initial droplet diameter
137  scalar d0_;
138 
139  //- Injection position
141 
142  //- Liquid surface tension [N/m]
143  scalar sigma_;
144 
145  //- Liquid dynamic viscosity [Pa.s]
146  scalar mu_;
147 
148  //- Part of liquid core ( >0.5=liquid, <0.5=droplet )
149  scalar liquidCore_;
150 
151  //- Index for KH Breakup
152  scalar KHindex_;
153 
154  //- Spherical deviation
155  scalar y_;
156 
157  //- Rate of change of spherical deviation
158  scalar yDot_;
159 
160  //- Characteristic time (used in atomization and/or breakup model)
161  scalar tc_;
162 
163  //- Stripped parcel mass due to breakup
164  scalar ms_;
165 
166  //- Injected from injector (needed e.g. for calculating distance
167  // from injector)
168  scalar injector_;
169 
170  //- Momentum relaxation time (needed for calculating parcel acc.)
171  scalar tMom_;
172 
173  //- Passive scalar (extra variable to be defined by user)
174  scalar user_;
175 
176 
177 public:
178 
179  // Static data members
180 
181  //- Runtime type information
182  TypeName("SprayParcel");
183 
184 
185  // Constructors
186 
187  //- Construct from owner, position, and cloud owner
188  // Other properties initialised as null
189  inline SprayParcel
190  (
191  const polyMesh& mesh,
192  const vector& position,
193  const label cellI,
194  const label tetFaceI,
195  const label tetPtI
196  );
197 
198  //- Construct from components
199  inline SprayParcel
200  (
201  const polyMesh& mesh,
202  const vector& position,
203  const label cellI,
204  const label tetFaceI,
205  const label tetPtI,
206  const label typeId,
207  const scalar nParticle0,
208  const scalar d0,
209  const scalar dTarget0,
210  const vector& U0,
211  const vector& f0,
212  const vector& angularMomentum0,
213  const vector& torque0,
214  const scalarField& Y0,
215  const scalar liquidCore,
216  const scalar KHindex,
217  const scalar y,
218  const scalar yDot,
219  const scalar tc,
220  const scalar ms,
221  const scalar injector,
222  const scalar tMom,
223  const scalar user,
224  const typename ParcelType::constantProperties& constProps
225  );
226 
227  //- Construct from Istream
229  (
230  const polyMesh& mesh,
231  Istream& is,
232  bool readFields = true
233  );
234 
235  //- Construct as a copy
237  (
238  const SprayParcel& p,
239  const polyMesh& mesh
240  );
241 
242  //- Construct as a copy
243  SprayParcel(const SprayParcel& p);
244 
245  //- Construct and return a (basic particle) clone
246  virtual autoPtr<particle> clone() const
247  {
248  return autoPtr<particle>(new SprayParcel<ParcelType>(*this));
249  }
250 
251  //- Construct and return a (basic particle) clone
252  virtual autoPtr<particle> clone(const polyMesh& mesh) const
253  {
254  return autoPtr<particle>
255  (
256  new SprayParcel<ParcelType>(*this, mesh)
257  );
258  }
259 
260  //- Factory class to read-construct particles used for
261  // parallel transfer
262  class iNew
263  {
264  const polyMesh& mesh_;
265 
266  public:
268  iNew(const polyMesh& mesh)
269  :
270  mesh_(mesh)
271  {}
273  autoPtr<SprayParcel<ParcelType> > operator()(Istream& is) const
274  {
276  (
277  new SprayParcel<ParcelType>(mesh_, is, true)
278  );
279  }
280  };
281 
282 
283  // Member Functions
284 
285  // Access
286 
287  //- Return const access to initial droplet diameter
288  inline scalar d0() const;
289 
290  //- Return const access to initial droplet position
291  inline const vector& position0() const;
292 
293  //- Return const access to the liquid surface tension
294  inline scalar sigma() const;
295 
296  //- Return const access to the liquid dynamic viscosity
297  inline scalar mu() const;
298 
299  //- Return const access to liquid core
300  inline scalar liquidCore() const;
301 
302  //- Return const access to Kelvin-Helmholtz breakup index
303  inline scalar KHindex() const;
304 
305  //- Return const access to spherical deviation
306  inline scalar y() const;
307 
308  //- Return const access to rate of change of spherical deviation
309  inline scalar yDot() const;
310 
311  //- Return const access to atomization characteristic time
312  inline scalar tc() const;
313 
314  //- Return const access to stripped parcel mass
315  inline scalar ms() const;
316 
317  //- Return const access to injector id
318  inline scalar injector() const;
319 
320  //- Return const access to momentum relaxation time
321  inline scalar tMom() const;
322 
323  //- Return const access to passive user scalar
324  inline scalar user() const;
325 
326 
327  // Edit
328 
329  //- Return access to initial droplet diameter
330  inline scalar& d0();
331 
332  //- Return access to initial droplet position
333  inline vector& position0();
334 
335  //- Return access to the liquid surface tension
336  inline scalar& sigma();
337 
338  //- Return access to the liquid dynamic viscosity
339  inline scalar& mu();
340 
341  //- Return access to liquid core
342  inline scalar& liquidCore();
343 
344  //- Return access to Kelvin-Helmholtz breakup index
345  inline scalar& KHindex();
346 
347  //- Return access to spherical deviation
348  inline scalar& y();
349 
350  //- Return access to rate of change of spherical deviation
351  inline scalar& yDot();
352 
353  //- Return access to atomization characteristic time
354  inline scalar& tc();
355 
356  //- Return access to stripped parcel mass
357  inline scalar& ms();
358 
359  //- Return access to injector id
360  inline scalar& injector();
361 
362  //- Return access to momentum relaxation time
363  inline scalar& tMom();
364 
365  //- Return access to passive user scalar
366  inline scalar& user();
367 
368 
369  // Main calculation loop
370 
371  //- Set cell values
372  template<class TrackData>
373  void setCellValues
374  (
375  TrackData& td,
376  const scalar dt,
377  const label cellI
378  );
379 
380  //- Correct parcel properties according to atomization model
381  template<class TrackData>
382  void calcAtomization
383  (
384  TrackData& td,
385  const scalar dt,
386  const label cellI
387  );
388 
389  //- Correct parcel properties according to breakup model
390  template<class TrackData>
391  void calcBreakup
392  (
393  TrackData& td,
394  const scalar dt,
395  const label cellI
396  );
397 
398  //- Correct cell values using latest transfer information
399  template<class TrackData>
401  (
402  TrackData& td,
403  const scalar dt,
404  const label cellI
405  );
406 
407  //- Correct surface values due to emitted species
408  template<class TrackData>
410  (
411  TrackData& td,
412  const label cellI,
413  const scalar T,
414  const scalarField& Cs,
415  scalar& rhos,
416  scalar& mus,
417  scalar& Pr,
418  scalar& kappa
419  );
420 
421  //- Update parcel properties over the time interval
422  template<class TrackData>
423  void calc
424  (
425  TrackData& td,
426  const scalar dt,
427  const label cellI
428  );
429 
430  //- Calculate the chi-factor for flash-boiling for the
431  // atomization model
432  template<class TrackData>
433  scalar chi
434  (
435  TrackData& td,
436  const scalarField& X
437  ) const;
438 
439  //- Solve the TAB equation
440  template<class TrackData>
441  void solveTABEq
442  (
443  TrackData& td,
444  const scalar dt
445  );
446 
447 
448  // I-O
449 
450  //- Read
451  template<class CloudType, class CompositionType>
452  static void readFields
453  (
454  CloudType& c,
455  const CompositionType& compModel
456  );
457 
458  //- Read - no composition
459  template<class CloudType>
460  static void readFields(CloudType& c);
461 
462  //- Write
463  template<class CloudType, class CompositionType>
464  static void writeFields
465  (
466  const CloudType& c,
467  const CompositionType& compModel
468  );
469 
470  //- Write - composition supplied
471  template<class CloudType>
472  static void writeFields(const CloudType& c);
473 
474 
475  // Ostream Operator
476 
477  friend Ostream& operator<< <ParcelType>
478  (
479  Ostream&,
481  );
482 };
483 
484 
485 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
486 
487 } // End namespace Foam
488 
489 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
490 
491 #include "SprayParcelI.H"
492 
493 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
494 
495 #ifdef NoRepository
496  #include "SprayParcel.C"
497 #endif
498 
499 
500 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
501 
502 #endif
503 
504 // ************************************************************************* //
dimensionedScalar Pr("Pr", dimless, laminarTransport)
void calcAtomization(TrackData &td, const scalar dt, const label cellI)
Correct parcel properties according to atomization model.
Definition: SprayParcel.C:150
void setCellValues(TrackData &td, const scalar dt, const label cellI)
Set cell values.
Definition: SprayParcel.C:35
scalar yDot() const
Return const access to rate of change of spherical deviation.
Definition: SprayParcelI.H:266
scalar sigma0() const
Return const access to the initial surface tension.
Definition: SprayParcelI.H:200
void correctSurfaceValues(TrackData &td, const label cellI, const scalar T, const scalarField &Cs, scalar &rhos, scalar &mus, scalar &Pr, scalar &kappa)
Correct surface values due to emitted species.
scalar yDot_
Rate of change of spherical deviation.
Definition: SprayParcel.H:157
void calcBreakup(TrackData &td, const scalar dt, const label cellI)
Correct parcel properties according to breakup model.
Definition: SprayParcel.C:217
scalar mu0() const
Return const access to the initial dynamic viscosity.
Definition: SprayParcelI.H:208
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
constantProperties()
Null constructor.
Definition: SprayParcelI.H:29
void calc(TrackData &td, const scalar dt, const label cellI)
Update parcel properties over the time interval.
Definition: SprayParcel.C:61
scalar d0() const
Return const access to initial droplet diameter.
Definition: SprayParcelI.H:217
Class to hold reacting particle constant properties.
Definition: SprayParcel.H:70
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
scalar KHindex_
Index for KH Breakup.
Definition: SprayParcel.H:151
scalar tMom_
Momentum relaxation time (needed for calculating parcel acc.)
Definition: SprayParcel.H:170
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
scalar mu_
Liquid dynamic viscosity [Pa.s].
Definition: SprayParcel.H:145
scalar rho0
void solveTABEq(TrackData &td, const scalar dt)
Solve the TAB equation.
Definition: SprayParcel.C:363
A simple wrapper around bool so that it can be read as a word: true/false, on/off, yes/no, y/n, t/f, or none.
Definition: Switch.H:60
static void writeFields(const CloudType &c, const CompositionType &compModel)
Write.
dynamicFvMesh & mesh
scalar sigma() const
Return const access to the liquid surface tension.
Definition: SprayParcelI.H:231
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
Namespace for OpenFOAM.
scalar tc() const
Return const access to atomization characteristic time.
Definition: SprayParcelI.H:273
scalar sigma_
Liquid surface tension [N/m].
Definition: SprayParcel.H:142
scalar mu() const
Return const access to the liquid dynamic viscosity.
Definition: SprayParcelI.H:238
Reacing spray parcel, with added functionality for atomization and breakup.
Definition: SprayParcel.H:43
scalar d0_
Initial droplet diameter.
Definition: SprayParcel.H:136
vector position0_
Injection position.
Definition: SprayParcel.H:139
scalar ms_
Stripped parcel mass due to breakup.
Definition: SprayParcel.H:163
scalarList Y0(nSpecie, 0.0)
volScalarField & p
Definition: createFields.H:51
scalar injector_
Injected from injector (needed e.g. for calculating distance.
Definition: SprayParcel.H:167
scalar chi(TrackData &td, const scalarField &X) const
Calculate the chi-factor for flash-boiling for the.
scalar tc_
Characteristic time (used in atomization and/or breakup model)
Definition: SprayParcel.H:160
static void readFields(CloudType &c, const CompositionType &compModel)
Read.
void cellValueSourceCorrection(TrackData &td, const scalar dt, const label cellI)
Correct cell values using latest transfer information.
Definition: SprayParcel.C:48
scalar liquidCore() const
Return const access to liquid core.
Definition: SprayParcelI.H:245
scalar user() const
Return const access to passive user scalar.
Definition: SprayParcelI.H:301
virtual autoPtr< particle > clone() const
Construct and return a (basic particle) clone.
Definition: SprayParcel.H:245
TypeName("SprayParcel")
Runtime type information.
Factory class to read-construct particles used for.
Definition: SprayParcel.H:261
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
PtrList< dimensionedScalar > rhoMin(fluidRegions.size())
scalar liquidCore_
Part of liquid core ( >0.5=liquid, <0.5=droplet )
Definition: SprayParcel.H:148
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.
scalar ms() const
Return const access to stripped parcel mass.
Definition: SprayParcelI.H:280
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:68
scalar user_
Passive scalar (extra variable to be defined by user)
Definition: SprayParcel.H:173
SprayParcel(const polyMesh &mesh, const vector &position, const label cellI, const label tetFaceI, const label tetPtI)
Construct from owner, position, and cloud owner.
Definition: SprayParcelI.H:108
scalar injector() const
Return const access to injector id.
Definition: SprayParcelI.H:287
This function object reads fields from the time directories and adds them to the mesh database for fu...
Definition: readFields.H:102
bool cp(const fileName &src, const fileName &dst)
Copy, recursively if necessary, the source to the destination.
Definition: POSIX.C:756
dimensionedScalar pMin("pMin", dimPressure, fluid)
const dimensionedScalar kappa
Coulomb constant: default SI units: [N.m2/C2].
scalar y_
Spherical deviation.
Definition: SprayParcel.H:154
scalar tMom() const
Return const access to momentum relaxation time.
Definition: SprayParcelI.H:294
scalar KHindex() const
Return const access to Kelvin-Helmholtz breakup index.
Definition: SprayParcelI.H:252
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117
const dimensionedScalar epsilon0
Electric constant: default SI units: [F/m].
const vector & position0() const
Return const access to initial droplet position.
Definition: SprayParcelI.H:224
scalar y() const
Return const access to spherical deviation.
Definition: SprayParcelI.H:259