FreeFOAM The Cross-Platform CFD Toolkit
ThermoParcel.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::ThermoParcel
26 
27 Description
28  Thermodynamic parcel class with one/two-way coupling with the continuous
29  phase. Includes Kinematic parcel sub-models, plus:
30  - heat transfer
31 
32 SourceFiles
33  ThermoParcelI.H
34  ThermoParcel.C
35  ThermoParcelIO.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef ThermoParcel_H
40 #define ThermoParcel_H
41 
42 #include <OpenFOAM/IOstream.H>
43 #include <OpenFOAM/autoPtr.H>
45 #include <OpenFOAM/contiguous.H>
46 
49 
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 
52 namespace Foam
53 {
54 
55 template<class ParcelType>
56 class ThermoParcel;
57 
58 template<class ParcelType>
59 Ostream& operator<<
60 (
61  Ostream&,
62  const ThermoParcel<ParcelType>&
63 );
64 
65 /*---------------------------------------------------------------------------*\
66  Class ThermoParcel Declaration
67 \*---------------------------------------------------------------------------*/
68 
69 template<class ParcelType>
71 :
72  public KinematicParcel<ParcelType>
73 {
74 public:
75 
76  //- Class to hold thermo particle constant properties
78  :
79  public KinematicParcel<ParcelType>::constantProperties
80  {
81 
82  // Private data
83 
84  //- Particle initial temperature [K]
85  const scalar T0_;
86 
87  //- Minimum temperature [K]
88  const scalar TMin_;
89 
90  //- Particle specific heat capacity [J/(kg.K)]
91  const scalar cp0_;
92 
93  //- Particle emissivity [] (radiation)
94  const scalar epsilon0_;
95 
96  //- Particle scattering factor [] (radiation)
97  const scalar f0_;
98 
99  //- Default carrier Prandtl number []
100  const scalar Pr_;
101 
102 
103  public:
104 
105  // Constructors
106  constantProperties(const dictionary& parentDict);
107 
108  // Member functions
109 
110  // Access
111 
112  //- Return const access to the particle initial temperature [K]
113  inline scalar T0() const;
114 
115  //- Return const access to minimum temperature [K]
116  inline scalar TMin() const;
117 
118  //- Return const access to the particle specific heat capacity
119  // [J/(kg.K)]
120  inline scalar cp0() const;
121 
122  //- Return const access to the particle emissivity []
123  // Active for radiation only
124  inline scalar epsilon0() const;
125 
126  //- Return const access to the particle scattering factor []
127  // Active for radiation only
128  inline scalar f0() const;
129 
130  //- Return const access to the default carrier Prandtl number []
131  inline scalar Pr() const;
132  };
133 
134 
135  //- Class used to pass thermo tracking data to the trackToFace function
136  class trackData
137  :
138  public KinematicParcel<ParcelType>::trackData
139  {
140 
141  // Private data
142 
143  //- Reference to the cloud containing this particle
144  ThermoCloud<ParcelType>& cloud_;
145 
146  //- Particle constant properties
147  const constantProperties& constProps_;
148 
149  // Interpolators for continuous phase fields
150 
151  //- Temperature field interpolator
152  const interpolation<scalar>& TInterp_;
153 
154  //- Specific heat capacity field interpolator
155  const interpolation<scalar>& cpInterp_;
156 
157 
158  public:
159 
160  // Constructors
161 
162  //- Construct from components
163  inline trackData
164  (
172  const vector& g
173  );
174 
175 
176  // Member functions
177 
178  //- Return access to the owner cloud
179  inline ThermoCloud<ParcelType>& cloud();
180 
181  //- Return const access to the owner cloud
182  inline const constantProperties& constProps() const;
183 
184  //- Return const access to the interpolator for continuous
185  // phase temperature field
186  inline const interpolation<scalar>& TInterp() const;
187 
188  //- Return const access to the interpolator for continuous
189  // phase specific heat capacity field
190  inline const interpolation<scalar>& cpInterp() const;
191  };
192 
193 
194 protected:
195 
196  // Protected data
197 
198  // Parcel properties
199 
200  //- Temperature [K]
201  scalar T_;
202 
203  //- Specific heat capacity [J/(kg.K)]
204  scalar cp_;
205 
206 
207  // Cell-based quantities
208 
209  //- Temperature [K]
210  scalar Tc_;
211 
212  //- Specific heat capacity [J/(kg.K)]
213  scalar cpc_;
214 
215 
216  // Protected member functions
217 
218  //- Calculate new particle temperature
219  template<class TrackData>
220  scalar calcHeatTransfer
221  (
222  TrackData& td,
223  const scalar dt, // timestep
224  const label cellI, // owner cell
225  const scalar Re, // Reynolds number
226  const scalar Pr, // Prandtl number - surface
227  const scalar kappa, // Thermal conductivity - surface
228  const scalar d, // diameter
229  const scalar rho, // density
230  const scalar T, // temperature
231  const scalar cp, // specific heat capacity
232  const scalar NCpW, // Sum of N*Cp*W of emission species
233  const scalar Sh, // explicit particle enthalpy source
234  scalar& dhsTrans // sensible enthalpy transfer to carrier
235  );
236 
237 
238 public:
239 
240  // Static data members
241 
242  //- String representation of properties
243  static string propHeader;
244 
245  //- Runtime type information
246  TypeName("ThermoParcel");
247 
248 
249  friend class Cloud<ParcelType>;
250 
251 
252  // Constructors
253 
254  //- Construct from owner, position, and cloud owner
255  // Other properties initialised as null
256  inline ThermoParcel
257  (
259  const vector& position,
260  const label cellI
261  );
262 
263  //- Construct from components
264  inline ThermoParcel
265  (
267  const vector& position,
268  const label cellI,
269  const label typeId,
270  const scalar nParticle0,
271  const scalar d0,
272  const vector& U0,
273  const constantProperties& constProps
274  );
275 
276  //- Construct from Istream
278  (
279  const Cloud<ParcelType>& c,
280  Istream& is,
281  bool readFields = true
282  );
283 
284  //- Construct as a copy
285  ThermoParcel(const ThermoParcel& p);
286 
287  //- Construct and return a clone
289  {
290  return autoPtr<ThermoParcel>(new ThermoParcel(*this));
291  }
292 
293 
294  // Member Functions
295 
296  // Access
297 
298  //- Return const access to temperature
299  inline scalar T() const;
300 
301  //- Return const access to specific heat capacity
302  inline scalar cp() const;
303 
304 
305  // Edit
306 
307  //- Return access to temperature
308  inline scalar& T();
309 
310  //- Return access to specific heat capacity
311  inline scalar& cp();
312 
313 
314  // Main calculation loop
315 
316  //- Set cell values
317  template<class TrackData>
318  void setCellValues
319  (
320  TrackData& td,
321  const scalar dt,
322  const label cellI
323  );
324 
325  //- Correct cell values using latest transfer information
326  template<class TrackData>
328  (
329  TrackData& td,
330  const scalar dt,
331  const label cellI
332  );
333 
334  //- Calculate surface thermo properties
335  template<class TrackData>
336  void calcSurfaceValues
337  (
338  TrackData& td,
339  const label cellI,
340  const scalar T,
341  scalar& Ts,
342  scalar& rhos,
343  scalar& mus,
344  scalar& Pr,
345  scalar& kappa
346  ) const;
347 
348  //- Update parcel properties over the time interval
349  template<class TrackData>
350  void calc
351  (
352  TrackData& td,
353  const scalar dt,
354  const label cellI
355  );
356 
357 
358  // I-O
359 
360  //- Read
361  static void readFields(Cloud<ParcelType>& c);
362 
363  //- Write
364  static void writeFields(const Cloud<ParcelType>& c);
365 
366 
367  // Ostream Operator
368 
369  friend Ostream& operator<< <ParcelType>
370  (
371  Ostream&,
373  );
374 };
375 
376 
377 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
378 
379 } // End namespace Foam
380 
381 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
382 
384 
385 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
386 
387 #ifdef NoRepository
389 #endif
390 
391 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
392 
393 #endif
394 
395 // ************************ vim: set sw=4 sts=4 et: ************************ //