FreeFOAM The Cross-Platform CFD Toolkit
ReactingMultiphaseParcel.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) 2008-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::ReactingMultiphaseParcel
26 
27 Description
28  Multiphase variant of the reacting parcel class with one/two-way coupling
29  with the continuous phase.
30 
31 SourceFiles
32  ReactingMultiphaseParcelI.H
33  ReactingMultiphaseParcel.C
34  ReactingMultiphaseParcelIO.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef ReactingMultiphaseParcel_H
39 #define ReactingMultiphaseParcel_H
40 
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 template<class ParcelType>
50 class ReactingMultiphaseParcel;
51 
52 template<class ParcelType>
53 Ostream& operator<<
54 (
55  Ostream&,
56  const ReactingMultiphaseParcel<ParcelType>&
57 );
58 
59 /*---------------------------------------------------------------------------*\
60  Class ReactingMultiphaseParcel Declaration
61 \*---------------------------------------------------------------------------*/
62 
63 template<class ParcelType>
65 :
66  public ReactingParcel<ParcelType>
67 {
68 public:
69 
70  // IDs of phases in ReacingParcel phase list (Y)
71 
72  static const label GAS;
73  static const label LIQ;
74  static const label SLD;
75 
76 
77  //- Class to hold reacting multiphase particle constant properties
79  :
80  public ReactingParcel<ParcelType>::constantProperties
81  {
82  // Private data
83 
84  //- Latent heat of devolatilisation [J/kg]
85  const scalar LDevol_;
86 
87  //- Fraction of enthalpy retained by parcel due to surface
88  // reactions
89  scalar hRetentionCoeff_;
90 
91 
92  public:
93 
94  //- Constructor
95  constantProperties(const dictionary& parentDict);
96 
97  // Access
98 
99  //- Return const access to the latent heat of devolatilisation
100  inline scalar LDevol() const;
101 
102  //- Return const access to the fraction of enthalpy retained by
103  // parcel due to surface reactions
104  inline scalar hRetentionCoeff() const;
105  };
106 
107 
108  //- Class used to pass reacting tracking data to the trackToFace function
109  class trackData
110  :
111  public ReactingParcel<ParcelType>::trackData
112  {
113  // Private data
114 
115  //- Reference to the cloud containing this particle
117 
118  //- Particle constant properties
119  const constantProperties& constProps_;
120 
121 
122  public:
123 
124  // Constructors
125 
126  //- Construct from components
127  inline trackData
128  (
135  const interpolation<scalar>& CpInterp,
137  const vector& g
138  );
139 
140 
141  // Member functions
142 
143  //- Return access to the owner cloud
145 
146  //- Return const access to the constant properties
147  inline const constantProperties& constProps() const;
148  };
149 
150 
151 private:
152 
153  // Private member functions
154 
155  //- Return the mixture effective specific heat capacity
156  template<class TrackData>
157  scalar cpEff
158  (
159  TrackData& td,
160  const scalar p,
161  const scalar T,
162  const label idG,
163  const label idL,
164  const label idS
165  ) const;
166 
167  //- Return the mixture effective enthalpy
168  template<class TrackData>
169  scalar HEff
170  (
171  TrackData& td,
172  const scalar p,
173  const scalar T,
174  const label idG,
175  const label idL,
176  const label idS
177  ) const;
178 
179  //- Return the mixture effective latent heat
180  template<class TrackData>
181  scalar LEff
182  (
183  TrackData& td,
184  const scalar p,
185  const scalar T,
186  const label idG,
187  const label idL,
188  const label idS
189  ) const;
190 
191  //- Update the mass fractions (Y, YGas, YLiquid, YSolid)
192  scalar updateMassFractions
193  (
194  const scalar mass0,
195  const scalarField& dMassGas,
196  const scalarField& dMassLiquid,
197  const scalarField& dMassSolid
198  );
199 
200 
201 protected:
202 
203  // Protected data
204 
205  // Parcel properties
206 
207  //- Mass fractions of gases []
209 
210  //- Mass fractions of liquids []
212 
213  //- Mass fractions of solids []
215 
216  //- Flag to say that the particle is allowed to combust
217  // Only true after volatile content falls below threshold value
219 
220 
221  // Protected member functions
222 
223  //- Calculate Devolatilisation
224  template<class TrackData>
226  (
227  TrackData& td,
228  const scalar dt, // timestep
229  const scalar Ts, // Surface temperature
230  const scalar d, // diameter
231  const scalar T, // temperature
232  const scalar mass, // mass
233  const scalar mass0, // mass (initial on injection)
234  const label idVolatile, // id of volatile phase
235  const scalar YVolatileTot, // total volatile mass fraction
236  const scalarField& YVolatile, // volatile component mass fractions
237  bool& canCombust, // 'can combust' flag
238  scalarField& dMassDV, // mass transfer - local to particle
239  scalar& Sh, // explicit particle enthalpy source
240  scalar& N, // flux of species emitted from particle
241  scalar& NCpW, // sum of N*Cp*W of emission species
242  scalarField& Cs // carrier conc. of emission species
243  ) const;
244 
245  //- Calculate surface reactions
246  template<class TrackData>
248  (
249  TrackData& td,
250  const scalar dt, // timestep
251  const label cellI, // owner cell
252  const scalar d, // diameter
253  const scalar T, // temperature
254  const scalar mass, // mass
255  const bool canCombust, // 'can combust' flag
256  const scalar N, // flux of species emitted from particle
257  const scalarField& YMix, // mixture mass fractions
258  const scalarField& YGas, // gas-phase mass fractions
259  const scalarField& YLiquid,// liquid-phase mass fractions
260  const scalarField& YSolid, // solid-phase mass fractions
261  scalarField& dMassSRGas, // gas-phase mass transfer - local
262  scalarField& dMassSRLiquid,// liquid-phase mass transfer - local
263  scalarField& dMassSRSolid, // solid-phase mass transfer - local
264  scalarField& dMassSRCarrier, // carrier phase mass transfer
265  scalar& Sh, // explicit particle enthalpy source
266  scalar& dhsTrans // sensible enthalpy transfer to carrier
267  ) const;
268 
269 
270 public:
271 
272  // Static data members
273 
274  //- String representation of properties
275  static string propHeader;
276 
277  //- Runtime type information
278  TypeName("ReactingMultiphaseParcel");
279 
280 
281  friend class Cloud<ParcelType>;
282 
283 
284  // Constructors
285 
286  //- Construct from owner, position, and cloud owner
287  // Other properties initialised as null
289  (
291  const vector& position,
292  const label cellI
293  );
294 
295 
296  //- Construct from components
298  (
300  const vector& position,
301  const label cellI,
302  const label typeId,
303  const scalar nParticle0,
304  const scalar d0,
305  const vector& U0,
306  const scalarField& Y0,
307  const scalarField& YGas0,
308  const scalarField& YLiquid0,
309  const scalarField& YSolid0,
310  const constantProperties& constProps
311  );
312 
313  //- Construct from Istream
315  (
316  const Cloud<ParcelType>& c,
317  Istream& is,
318  bool readFields = true
319  );
320 
321  //- Construct as a copy
323 
324  //- Construct and return a clone
326  {
327  return
329  (
330  new ReactingMultiphaseParcel(*this)
331  );
332  }
333 
334 
335  // Member Functions
336 
337  // Access
338 
339  //- Return const access to mass fractions of gases
340  inline const scalarField& YGas() const;
341 
342  //- Return const access to mass fractions of liquids
343  inline const scalarField& YLiquid() const;
344 
345  //- Return const access to mass fractions of solids
346  inline const scalarField& YSolid() const;
347 
348  //- Return const access to the canCombust flag
349  inline bool canCombust() const;
350 
351 
352  // Edit
353 
354  //- Return access to mass fractions of gases
355  inline scalarField& YGas();
356 
357  //- Return access to mass fractions of liquids
358  inline scalarField& YLiquid();
359 
360  //- Return access to mass fractions of solids
361  inline scalarField& YSolid();
362 
363  //- Return access to the canCombust flag
364  inline bool& canCombust();
365 
366 
367  // Main calculation loop
368 
369  //- Set cell values
370  template<class TrackData>
371  void setCellValues
372  (
373  TrackData& td,
374  const scalar dt,
375  const label cellI
376  );
377 
378  //- Correct cell values using latest transfer information
379  template<class TrackData>
381  (
382  TrackData& td,
383  const scalar dt,
384  const label cellI
385  );
386 
387  //- Update parcel properties over the time interval
388  template<class TrackData>
389  void calc
390  (
391  TrackData& td,
392  const scalar dt,
393  const label cellI
394  );
395 
396 
397  // I-O
398 
399  //- Read
400  static void readFields(Cloud<ParcelType>& c);
401 
402  //- Write
403  static void writeFields(const Cloud<ParcelType>& c);
404 
405 
406  // Ostream Operator
407 
408  friend Ostream& operator<< <ParcelType>
409  (
410  Ostream&,
412  );
413 };
414 
415 
416 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
417 
418 } // End namespace Foam
419 
420 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
421 
423 
424 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
425 
426 #ifdef NoRepository
427  #include "ReactingMultiphaseParcel.C"
428 #endif
429 
430 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
431 
432 #endif
433 
434 // ************************ vim: set sw=4 sts=4 et: ************************ //