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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2017 OpenFOAM Foundation
9  Copyright (C) 2016-2019 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::ReactingMultiphaseParcel
29 
30 Group
31  grpLagrangianIntermediateParcels
32 
33 Description
34  Multiphase variant of the reacting parcel class with one/two-way coupling
35  with the continuous phase.
36 
37 SourceFiles
38  ReactingMultiphaseParcelI.H
39  ReactingMultiphaseParcel.C
40  ReactingMultiphaseParcelIO.C
41 
42 \*---------------------------------------------------------------------------*/
43 
44 #ifndef ReactingMultiphaseParcel_H
45 #define ReactingMultiphaseParcel_H
46 
47 #include "particle.H"
48 #include "SLGThermo.H"
49 #include "demandDrivenEntry.H"
50 
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 
53 namespace Foam
54 {
55 
56 template<class ParcelType> class ReactingMultiphaseParcel;
57 
58 template<class ParcelType>
60 
61 /*---------------------------------------------------------------------------*\
62  Class ReactingMultiphaseParcel Declaration
63 \*---------------------------------------------------------------------------*/
64 
65 template<class ParcelType>
67 :
68  public ParcelType
69 {
70 public:
71 
72  //- Size in bytes of the fields
73  static const std::size_t sizeofFields;
74 
75 
76  // IDs of phases in ReactingParcel phase list (Y)
77 
78  static const label GAS;
79  static const label LIQ;
80  static const label SLD;
81 
82 
83  //- Class to hold reacting multiphase particle constant properties
84  class constantProperties
85  :
86  public ParcelType::constantProperties
87  {
88  // Private data
89 
90  //- Devolatilisation activation temperature [K]
92 
93  //- Latent heat of devolatilisation [J/kg]
95 
96  //- Fraction of enthalpy retained by parcel due to surface
97  // reactions
98  demandDrivenEntry<scalar> hRetentionCoeff_;
99 
100 
101  public:
102 
103  // Constructors
104 
105  //- Null constructor
107 
108  //- Copy constructor
110 
111  //- Construct from dictionary
112  constantProperties(const dictionary& parentDict);
113 
114 
115  // Access
116 
117  //- Return const access to the devolatilisation temperature
118  inline scalar TDevol() const;
119 
120  //- Return const access to the latent heat of devolatilisation
121  inline scalar LDevol() const;
122 
123  //- Return const access to the fraction of enthalpy retained by
124  // parcel due to surface reactions
125  inline scalar hRetentionCoeff() const;
126  };
127 
128 
129  //- Use base tracking data
130  typedef typename ParcelType::trackingData trackingData;
131 
132 
133 private:
134 
135  // Private Member Functions
136 
137  //- Return the mixture effective specific heat capacity
138  template<class TrackCloudType>
139  scalar CpEff
140  (
141  TrackCloudType& cloud,
142  trackingData& td,
143  const scalar p,
144  const scalar T,
145  const label idG,
146  const label idL,
147  const label idS
148  ) const;
149 
150  //- Return the mixture effective sensible enthalpy
151  template<class TrackCloudType>
152  scalar HsEff
153  (
154  TrackCloudType& cloud,
155  trackingData& td,
156  const scalar p,
157  const scalar T,
158  const label idG,
159  const label idL,
160  const label idS
161  ) const;
162 
163  //- Return the mixture effective latent heat
164  template<class TrackCloudType>
165  scalar LEff
166  (
167  TrackCloudType& cloud,
168  trackingData& td,
169  const scalar p,
170  const scalar T,
171  const label idG,
172  const label idL,
173  const label idS
174  ) const;
175 
176  //- Update the mass fractions (Y, YGas, YLiquid, YSolid)
177  scalar updateMassFractions
178  (
179  const scalar mass0,
180  const scalarField& dMassGas,
181  const scalarField& dMassLiquid,
182  const scalarField& dMassSolid
183  );
184 
185 
186 protected:
187 
188  // Protected data
189 
190  // Parcel properties
191 
192  //- Mass fractions of gases []
194 
195  //- Mass fractions of liquids []
197 
198  //- Mass fractions of solids []
200 
201  //- Flag to identify if the particle can devolatilise and combust
202  // Combustion possible only after volatile content falls below
203  // threshold value. States include:
204  // 0 = can devolatilise, cannot combust but can change
205  // 1 = can devolatilise, can combust
206  // -1 = cannot devolatilise or combust, and cannot change
207  label canCombust_;
208 
209 
210  // Protected Member Functions
211 
212  //- Calculate Devolatilisation
213  template<class TrackCloudType>
215  (
216  TrackCloudType& cloud,
217  trackingData& td,
218  const scalar dt, // timestep
219  const scalar age, // age
220  const scalar Ts, // surface temperature
221  const scalar d, // diameter
222  const scalar T, // temperature
223  const scalar mass, // mass
224  const scalar mass0, // mass (initial on injection)
225  const scalarField& YGasEff,// gas component mass fractions
226  const scalarField& YLiquidEff,// liquid component mass fractions
227  const scalarField& YSolidEff,// solid component mass fractions
228  label& canCombust, // 'can combust' flag
229  scalarField& dMassDV, // mass transfer - local to particle
230  scalar& Sh, // explicit particle enthalpy source
231  scalar& N, // flux of species emitted from particle
232  scalar& NCpW, // sum of N*Cp*W of emission species
233  scalarField& Cs // carrier conc. of emission species
234  ) const;
235 
236  //- Calculate surface reactions
237  template<class TrackCloudType>
239  (
240  TrackCloudType& cloud,
241  trackingData& td,
242  const scalar dt, // timestep
243  const scalar d, // diameter
244  const scalar Re, // Re
245  const scalar nu, // nu
246  const scalar T, // temperature
247  const scalar mass, // mass
248  const label canCombust, // 'can combust' flag
249  const scalar N, // flux of species emitted from particle
250  const scalarField& YMix, // mixture mass fractions
251  const scalarField& YGas, // gas-phase mass fractions
252  const scalarField& YLiquid,// liquid-phase mass fractions
253  const scalarField& YSolid, // solid-phase mass fractions
254  scalarField& dMassSRGas, // gas-phase mass transfer - local
255  scalarField& dMassSRLiquid,// liquid-phase mass transfer - local
256  scalarField& dMassSRSolid, // solid-phase mass transfer - local
257  scalarField& dMassSRCarrier, // carrier phase mass transfer
258  scalar& Sh, // explicit particle enthalpy source
259  scalar& dhsTrans // sensible enthalpy transfer to carrier
260  ) const;
261 
262 
263 public:
264 
265  // Static data members
266 
267  //- Runtime type information
268  TypeName("ReactingMultiphaseParcel");
269 
270  //- String representation of properties
272  (
273  ParcelType,
274  " nGas(Y1..YN)"
275  + " nLiquid(Y1..YN)"
276  + " nSolid(Y1..YN)"
277  );
278 
279 
280  // Constructors
281 
282  //- Construct from mesh, position and topology
283  // Other properties initialised as null
285  (
286  const polyMesh& mesh,
287  const barycentric& coordinates,
288  const label celli,
289  const label tetFacei,
290  const label tetPti
291  );
292 
293  //- Construct from a position and a cell, searching for the rest of the
294  // required topology. Other properties are initialised as null.
296  (
297  const polyMesh& mesh,
298  const vector& position,
299  const label celli
300  );
301 
302  //- Construct from components
304  (
305  const polyMesh& mesh,
306  const barycentric& coordinates,
307  const label celli,
308  const label tetFacei,
309  const label tetPti,
310  const label typeId,
311  const scalar nParticle0,
312  const scalar d0,
313  const scalar dTarget0,
314  const vector& U0,
315  const vector& f0,
316  const vector& angularMomentum0,
317  const vector& torque0,
318  const scalarField& Y0,
319  const scalarField& YGas0,
320  const scalarField& YLiquid0,
321  const scalarField& YSolid0,
322  const constantProperties& constProps
323  );
324 
325  //- Construct from Istream
327  (
328  const polyMesh& mesh,
329  Istream& is,
330  bool readFields = true,
331  bool newFormat = true
332  );
333 
334  //- Construct as a copy
336 
337  //- Construct as a copy
339  (
341  const polyMesh& mesh
342  );
343 
344  //- Construct and return a (basic particle) clone
345  virtual autoPtr<particle> clone() const
346  {
347  return autoPtr<particle>(new ReactingMultiphaseParcel(*this));
348  }
349 
350  //- Construct and return a (basic particle) clone
351  virtual autoPtr<particle> clone(const polyMesh& mesh) const
352  {
353  return autoPtr<particle>(new ReactingMultiphaseParcel(*this, mesh));
354  }
355 
356  //- Factory class to read-construct particles used for
357  // parallel transfer
358  class iNew
359  {
360  const polyMesh& mesh_;
361 
362  public:
363 
364  iNew(const polyMesh& mesh)
365  :
366  mesh_(mesh)
367  {}
368 
370  (
371  Istream& is
372  ) const
373  {
375  (
376  new ReactingMultiphaseParcel<ParcelType>(mesh_, is, true)
377  );
378  }
379  };
380 
381 
382  // Member Functions
383 
384  // Access
385 
386  //- Return const access to mass fractions of gases
387  inline const scalarField& YGas() const;
388 
389  //- Return const access to mass fractions of liquids
390  inline const scalarField& YLiquid() const;
391 
392  //- Return const access to mass fractions of solids
393  inline const scalarField& YSolid() const;
394 
395  //- Return const access to the canCombust flag
396  inline label canCombust() const;
397 
398 
399  // Edit
400 
401  //- Return access to mass fractions of gases
402  inline scalarField& YGas();
403 
404  //- Return access to mass fractions of liquids
405  inline scalarField& YLiquid();
406 
407  //- Return access to mass fractions of solids
408  inline scalarField& YSolid();
409 
410  //- Return access to the canCombust flag
411  inline label& canCombust();
412 
413 
414  // Main calculation loop
415 
416  //- Set cell values
417  template<class TrackCloudType>
418  void setCellValues(TrackCloudType& cloud, trackingData& td);
419 
420  //- Correct cell values using latest transfer information
421  template<class TrackCloudType>
423  (
424  TrackCloudType& cloud,
425  trackingData& td,
426  const scalar dt
427  );
428 
429  //- Update parcel properties over the time interval
430  template<class TrackCloudType>
431  void calc
432  (
433  TrackCloudType& cloud,
434  trackingData& td,
435  const scalar dt
436  );
437 
438 
439  // I-O
440 
441  //- Read - composition supplied
442  template<class CloudType, class CompositionType>
443  static void readFields
444  (
445  CloudType& c,
446  const CompositionType& compModel
447  );
448 
449  //- Read - no composition
450  template<class CloudType>
451  static void readFields(CloudType& c);
452 
453  //- Write - composition supplied
454  template<class CloudType, class CompositionType>
455  static void writeFields
456  (
457  const CloudType& c,
458  const CompositionType& compModel
459  );
460 
461  //- Read - no composition
462  template<class CloudType>
463  static void writeFields(const CloudType& c);
464 
465  //- Write individual parcel properties to stream
466  void writeProperties
467  (
468  Ostream& os,
469  const wordRes& filters,
470  const word& delim,
471  const bool namesOnly = false
472  ) const;
473 
474  //- Read particle fields as objects from the obr registry
475  // - no composition
476  template<class CloudType>
477  static void readObjects
478  (
479  CloudType& c,
480  const objectRegistry& obr
481  );
482 
483  //- Read particle fields as objects from the obr registry
484  template<class CloudType, class CompositionType>
485  static void readObjects
486  (
487  CloudType& c,
488  const CompositionType& compModel,
489  const objectRegistry& obr
490  );
491 
492  //- Write particle fields as objects into the obr registry
493  // - no composition
494  template<class CloudType>
495  static void writeObjects
496  (
497  const CloudType& c,
498  objectRegistry& obr
499  );
500 
501  //- Write particle fields as objects into the obr registry
502  template<class CloudType, class CompositionType>
503  static void writeObjects
504  (
505  const CloudType& c,
506  const CompositionType& compModel,
507  objectRegistry& obr
508  );
509 
510 
511  // Ostream Operator
512 
513  friend Ostream& operator<< <ParcelType>
514  (
515  Ostream&,
517  );
518 };
519 
520 
521 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
522 
523 } // End namespace Foam
524 
525 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
526 
528 
529 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
530 
531 #ifdef NoRepository
532  #include "ReactingMultiphaseParcel.C"
533 #endif
534 
535 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
536 
537 #endif
538 
539 // ************************************************************************* //
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::ReactingMultiphaseParcel::cellValueSourceCorrection
void cellValueSourceCorrection(TrackCloudType &cloud, trackingData &td, const scalar dt)
Correct cell values using latest transfer information.
Definition: ReactingMultiphaseParcel.C:159
Foam::ReactingMultiphaseParcel::calc
void calc(TrackCloudType &cloud, trackingData &td, const scalar dt)
Update parcel properties over the time interval.
Definition: ReactingMultiphaseParcel.C:173
Foam::ReactingMultiphaseParcel::trackingData
ParcelType::trackingData trackingData
Use base tracking data.
Definition: ReactingMultiphaseParcel.H:129
Foam::ReactingMultiphaseParcel::sizeofFields
static const std::size_t sizeofFields
Size in bytes of the fields.
Definition: ReactingMultiphaseParcel.H:72
Foam::ReactingMultiphaseParcel::writeFields
static void writeFields(const CloudType &c, const CompositionType &compModel)
Write - composition supplied.
Definition: ReactingMultiphaseParcelIO.C:197
Foam::ReactingMultiphaseParcel::writeProperties
void writeProperties(Ostream &os, const wordRes &filters, const word &delim, const bool namesOnly=false) const
Write individual parcel properties to stream.
Definition: ReactingMultiphaseParcelIO.C:287
Foam::ReactingMultiphaseParcel::YGas
const scalarField & YGas() const
Return const access to mass fractions of gases.
Definition: ReactingMultiphaseParcelI.H:191
Foam::ReactingMultiphaseParcel::SLD
static const label SLD
Definition: ReactingMultiphaseParcel.H:79
demandDrivenEntry.H
SLGThermo.H
Foam::ReactingMultiphaseParcel::iNew::iNew
iNew(const polyMesh &mesh)
Definition: ReactingMultiphaseParcel.H:363
Foam::ReactingMultiphaseParcel::readFields
static void readFields(CloudType &c, const CompositionType &compModel)
Read - composition supplied.
Definition: ReactingMultiphaseParcelIO.C:97
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::ReactingMultiphaseParcel::canCombust
label canCombust() const
Return const access to the canCombust flag.
Definition: ReactingMultiphaseParcelI.H:215
Foam::ReactingMultiphaseParcel::operator
friend Ostream & operator(Ostream &, const ReactingMultiphaseParcel< ParcelType > &)
Foam::ReactingMultiphaseParcel::constantProperties
Class to hold reacting multiphase particle constant properties.
Definition: ReactingMultiphaseParcel.H:83
Foam::objectRegistry
Registry of regIOobjects.
Definition: objectRegistry.H:60
nu
volScalarField & nu
Definition: readMechanicalProperties.H:176
Foam::ReactingMultiphaseParcel::canCombust_
label canCombust_
Flag to identify if the particle can devolatilise and combust.
Definition: ReactingMultiphaseParcel.H:206
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
ReactingMultiphaseParcel.C
Foam::Field< scalar >
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::ReactingMultiphaseParcel
Multiphase variant of the reacting parcel class with one/two-way coupling with the continuous phase.
Definition: ReactingMultiphaseParcel.H:55
coordinates
PtrList< coordinateSystem > coordinates(solidRegions.size())
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:58
Foam::ReactingMultiphaseParcel::constantProperties::TDevol
scalar TDevol() const
Return const access to the devolatilisation temperature.
Definition: ReactingMultiphaseParcelI.H:155
Foam::Barycentric< scalar >
Foam::ReactingMultiphaseParcel::readObjects
static void readObjects(CloudType &c, const objectRegistry &obr)
Read particle fields as objects from the obr registry.
Definition: ReactingMultiphaseParcelIO.C:312
Foam::ReactingMultiphaseParcel::TypeName
TypeName("ReactingMultiphaseParcel")
Runtime type information.
Foam::ReactingMultiphaseParcel::AddToPropertyList
AddToPropertyList(ParcelType, " nGas(Y1..YN)"+" nLiquid(Y1..YN)"+" nSolid(Y1..YN)")
String representation of properties.
Foam::DSMCCloud
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:71
Foam::ReactingMultiphaseParcel::calcSurfaceReactions
void calcSurfaceReactions(TrackCloudType &cloud, trackingData &td, const scalar dt, const scalar d, const scalar Re, const scalar nu, const scalar T, const scalar mass, const label canCombust, const scalar N, const scalarField &YMix, const scalarField &YGas, const scalarField &YLiquid, const scalarField &YSolid, scalarField &dMassSRGas, scalarField &dMassSRLiquid, scalarField &dMassSRSolid, scalarField &dMassSRCarrier, scalar &Sh, scalar &dhsTrans) const
Calculate surface reactions.
Definition: ReactingMultiphaseParcel.C:608
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::ReactingMultiphaseParcel::YLiquid
const scalarField & YLiquid() const
Return const access to mass fractions of liquids.
Definition: ReactingMultiphaseParcelI.H:199
Foam::ReactingMultiphaseParcel::LIQ
static const label LIQ
Definition: ReactingMultiphaseParcel.H:78
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::cloud
A cloud is a registry collection of lagrangian particles.
Definition: cloud.H:57
Foam::ReactingMultiphaseParcel::GAS
static const label GAS
Definition: ReactingMultiphaseParcel.H:77
Foam::cp
bool cp(const fileName &src, const fileName &dst, const bool followLink=true)
Copy the source to the destination (recursively if necessary).
Definition: MSwindows.C:802
Foam::Vector< scalar >
Foam::demandDrivenEntry< scalar >
Foam::ReactingMultiphaseParcel::clone
virtual autoPtr< particle > clone(const polyMesh &mesh) const
Construct and return a (basic particle) clone.
Definition: ReactingMultiphaseParcel.H:350
Foam::ReactingMultiphaseParcel::YLiquid_
scalarField YLiquid_
Mass fractions of liquids [].
Definition: ReactingMultiphaseParcel.H:195
Foam::ReactingMultiphaseParcel::writeObjects
static void writeObjects(const CloudType &c, objectRegistry &obr)
Write particle fields as objects into the obr registry.
Definition: ReactingMultiphaseParcelIO.C:324
Foam::ReactingMultiphaseParcel::YSolid
const scalarField & YSolid() const
Return const access to mass fractions of solids.
Definition: ReactingMultiphaseParcelI.H:207
Foam::ReactingMultiphaseParcel::setCellValues
void setCellValues(TrackCloudType &cloud, trackingData &td)
Set cell values.
Definition: ReactingMultiphaseParcel.C:147
Foam::ReactingMultiphaseParcel::constantProperties::constantProperties
constantProperties()
Null constructor.
Definition: ReactingMultiphaseParcelI.H:32
Foam::wordRes
A List of wordRe with additional matching capabilities.
Definition: wordRes.H:51
Foam::Re
scalarField Re(const UList< complex > &cf)
Extract real component.
Definition: complexField.C:159
ReactingMultiphaseParcelI.H
Cs
const scalarField & Cs
Definition: solveBulkSurfactant.H:10
particle.H
Foam::ReactingMultiphaseParcel::YGas_
scalarField YGas_
Mass fractions of gases [].
Definition: ReactingMultiphaseParcel.H:192
Foam::constant::universal::c
const dimensionedScalar c
Speed of light in a vacuum.
Foam::ReactingMultiphaseParcel::calcDevolatilisation
void calcDevolatilisation(TrackCloudType &cloud, trackingData &td, const scalar dt, const scalar age, const scalar Ts, const scalar d, const scalar T, const scalar mass, const scalar mass0, const scalarField &YGasEff, const scalarField &YLiquidEff, const scalarField &YSolidEff, label &canCombust, scalarField &dMassDV, scalar &Sh, scalar &N, scalar &NCpW, scalarField &Cs) const
Calculate Devolatilisation.
Definition: ReactingMultiphaseParcel.C:507
Foam::ReactingMultiphaseParcel::iNew
Factory class to read-construct particles used for.
Definition: ReactingMultiphaseParcel.H:357
Foam::ReactingMultiphaseParcel::constantProperties::hRetentionCoeff
scalar hRetentionCoeff() const
Return const access to the fraction of enthalpy retained by.
Definition: ReactingMultiphaseParcelI.H:172
Foam::ReactingMultiphaseParcel::ReactingMultiphaseParcel
ReactingMultiphaseParcel(const polyMesh &mesh, const barycentric &coordinates, const label celli, const label tetFacei, const label tetPti)
Construct from mesh, position and topology.
Definition: ReactingMultiphaseParcelI.H:71
Foam::ReactingMultiphaseParcel::clone
virtual autoPtr< particle > clone() const
Construct and return a (basic particle) clone.
Definition: ReactingMultiphaseParcel.H:344
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
N
const Vector< label > N(dict.get< Vector< label >>("N"))
Y0
scalarList Y0(nSpecie, Zero)
Foam::ReactingMultiphaseParcel::constantProperties::LDevol
scalar LDevol() const
Return const access to the latent heat of devolatilisation.
Definition: ReactingMultiphaseParcelI.H:163
Foam::ReactingMultiphaseParcel::YSolid_
scalarField YSolid_
Mass fractions of solids [].
Definition: ReactingMultiphaseParcel.H:198