ReactingHeterogeneousParcel.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) 2018-2019 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::ReactingHeterogeneousParcel
28 
29 Group
30  grpLagrangianIntermediateParcels
31 
32 Description
33  Reacting heterogeneous Parcel
34 
35 SourceFiles
36  ReactingHeterogeneousParcelI.H
37  ReactingHeterogeneousParcel.C
38  ReactingHeterogeneousParcelIO.C
39 
40 \*---------------------------------------------------------------------------*/
41 
42 #ifndef ReactingHeterogeneousParcel_H
43 #define ReactingHeterogeneousParcel_H
44 
45 #include "demandDrivenEntry.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 
52 template<class ParcelType>
54 
55 template<class ParcelType>
56 Ostream& operator<<
57 (
58  Ostream&,
60 );
61 
62 /*---------------------------------------------------------------------------*\
63  Class ReactingHeterogeneousParcel Declaration
64 \*---------------------------------------------------------------------------*/
65 
66 template<class ParcelType>
68 :
69  public ParcelType
70 {
71 public:
72 
73  //- Size in bytes of the fields
74  static const std::size_t sizeofFields;
75 
76  //- Class to hold reacting particle constant properties
77  class constantProperties
78  :
79  public ParcelType::constantProperties
80  {
81  // Private data
82 
83  //- Fraction of enthalpy retained by parcel due to surface
84  // reactions
85  demandDrivenEntry<scalar> hRetentionCoeff_;
86 
87  public:
88 
89  // Constructors
90 
91  //- Null constructor
93 
94  //- Copy constructor
96 
97  //- Construct from dictionary
98  constantProperties(const dictionary& parentDict);
99 
100 
101  // Access
102 
103  //- Return const access to the fraction of enthalpy retained by
104  // parcel due to surface reactions
105  inline scalar hRetentionCoeff() const;
106  };
107 
108 
109  //- Use base tracking data
110  typedef typename ParcelType::trackingData trackingData;
111 
112 
113 private:
114 
115  // Private Member Functions
116 
117  //- Return the mixture effective specific heat capacity
118  template<class TrackCloudType>
119  scalar CpEff
120  (
121  TrackCloudType& cloud,
122  trackingData& td,
123  const scalar p,
124  const scalar T,
125  const label idS
126  ) const;
127 
128  //- Return the mixture effective sensible enthalpy
129  template<class TrackCloudType>
130  scalar HsEff
131  (
132  TrackCloudType& cloud,
133  trackingData& td,
134  const scalar p,
135  const scalar T,
136  const label idS
137  ) const;
138 
139  //- Return the mixture effective latent heat
140  template<class TrackCloudType>
141  scalar LEff
142  (
143  TrackCloudType& cloud,
144  trackingData& td,
145  const scalar p,
146  const scalar T,
147  const label idS
148  ) const;
149 
150 
151 protected:
152 
153  // Protected data
154 
155  // Parcel properties
156 
157  //- Progress variables for reactions
158  scalarField F_;
159 
160  //- Flag to identify if the particle can devolatilise and combust
161  // Combustion possible only after volatile content falls below
162  // threshold value. States include:
163  // 0 = can combust but can change
164  // 1 = can devolatilise, can combust
165  // -1 = cannot devolatilise or combust, and cannot change
167 
168 
169  // Protected Member Functions
170 
171 
172  //- Calculate surface reactions
173  template<class TrackCloudType>
175  (
176  TrackCloudType& cloud,
177  trackingData& td,
178  const scalar dt, // timestep
179  const scalar Res, // Re
180  const scalar nu, // nu
181  const scalar d, // diameter
182  const scalar T, // temperature
183  const scalar mass, // mass
184  const label canCombust, // 'can combust' flag
185  const scalar N, // flux of species emitted from particle
186  scalar& NCpW,
187  const scalarField& YSolid, // solid-phase mass fractions
188  scalarField& F, // progress of each reaction
189  scalarField& dMassSRSolid, // solid-phase mass transfer - local
190  scalarField& dMassSRCarrier, // carrier phase mass transfer
191  scalar& Sh, // explicit particle enthalpy source
192  scalar& dhsTrans // sensible enthalpy transfer to carrier
193  ) const;
194 
195 
196 public:
197 
198  // Static data members
199 
200  //- Runtime type information
201  TypeName("ReactingHeterogeneousParcel");
202 
203  //- String representation of properties
205  (
206  ParcelType,
207  + " nReactions(F1..FN)"
208  );
209 
210 
211  // Constructors
212 
213  //- Construct from mesh, position and topology
214  // Other properties initialised as null
216  (
217  const polyMesh& mesh,
218  const barycentric& coordinates,
219  const label celli,
220  const label tetFacei,
221  const label tetPti
222  );
223 
224  //- Construct from a position and a cell, searching for the rest of the
225  // required topology. Other properties are initialised as null.
227  (
228  const polyMesh& mesh,
229  const vector& position,
230  const label celli
231  );
232 
233  //- Construct from components
235  (
236  const polyMesh& mesh,
237  const barycentric& coordinates,
238  const label celli,
239  const label tetFacei,
240  const label tetPti,
241  const label typeId,
242  const scalar nParticle0,
243  const scalar d0,
244  const scalar dTarget0,
245  const vector& U0,
246  const vector& f0,
247  const vector& angularMomentum0,
248  const vector& torque0,
249  const scalarField& Y,
250  const scalarField& F,
251  const constantProperties& constProps
252  );
253 
254  //- Construct from Istream
256  (
257  const polyMesh& mesh,
258  Istream& is,
259  bool readFields = true,
260  bool newFormat = true
261  );
262 
263  //- Construct as a copy
265 
266  //- Construct as a copy
268  (
270  const polyMesh& mesh
271  );
272 
273  //- Construct and return a (basic particle) clone
274  virtual autoPtr<particle> clone() const
275  {
277  }
278 
279  //- Construct and return a (basic particle) clone
280  virtual autoPtr<particle> clone(const polyMesh& mesh) const
281  {
282  return autoPtr<particle>
283  (
285  );
286  }
287 
288  //- Factory class to read-construct particles used for
289  // parallel transfer
290  class iNew
291  {
292  const polyMesh& mesh_;
293 
294  public:
295 
296  iNew(const polyMesh& mesh)
297  :
298  mesh_(mesh)
299  {}
300 
302  (
303  Istream& is
304  ) const
305  {
307  (
309  (mesh_, is, true)
310  );
311  }
312  };
313 
314 
315  // Member Functions
316 
317  // Access
318 
319  //- Return const access to F
320  inline const scalarField& F() const;
321 
322  //- Return const access to the canCombust flag
323  inline label canCombust() const;
324 
325 
326  // Edit
327 
328  //- Return access to F
329  inline scalarField& F();
330 
331  //- Return access to the canCombust flag
332  inline label& canCombust();
333 
334 
335  // Main calculation loop
336 
337 
338  //- Update parcel properties over the time interval
339  template<class TrackCloudType>
340  void calc
341  (
342  TrackCloudType& cloud,
343  trackingData& td,
344  const scalar dt
345  );
346 
347 
348  // I-O
349 
350  //- Read - composition supplied
351  template<class CloudType, class CompositionType>
352  static void readFields
353  (
354  CloudType& c,
355  const CompositionType& compModel
356  );
357 
358  //- Read - no composition
359  template<class CloudType>
360  static void readFields(CloudType& c);
361 
362  //- Write - composition supplied
363  template<class CloudType, class CompositionType>
364  static void writeFields
365  (
366  const CloudType& c,
367  const CompositionType& compModel
368  );
369 
370  //- Read - no composition
371  template<class CloudType>
372  static void writeFields(const CloudType& c);
373 
374  //- Write individual parcel properties to stream
375  void writeProperties
376  (
377  Ostream& os,
378  const wordRes& filters,
379  const word& delim,
380  const bool namesOnly
381  ) const;
382 
383  //- Read particle fields as objects from the obr registry
384  // - no composition
385  template<class CloudType>
386  static void readObjects
387  (
388  CloudType& c,
389  const objectRegistry& obr
390  );
391 
392  //- Read particle fields as objects from the obr registry
393  template<class CloudType, class CompositionType>
394  static void readObjects
395  (
396  CloudType& c,
397  const CompositionType& compModel,
398  const objectRegistry& obr
399  );
400 
401  //- Write particle fields as objects into the obr registry
402  // - no composition
403  template<class CloudType>
404  static void writeObjects
405  (
406  const CloudType& c,
407  objectRegistry& obr
408  );
409 
410  //- Write particle fields as objects into the obr registry
411  template<class CloudType, class CompositionType>
412  static void writeObjects
413  (
414  const CloudType& c,
415  const CompositionType& compModel,
416  objectRegistry& obr
417  );
418 
419 
420  // Ostream Operator
421 
422  friend Ostream& operator<< <ParcelType>
423  (
424  Ostream&,
426  );
427 };
428 
429 
430 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
431 
432 } // End namespace Foam
433 
434 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
435 
437 
438 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
439 
440 #ifdef NoRepository
442 #endif
443 
444 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
445 
446 #endif
447 
448 // ************************************************************************* //
Foam::ReactingHeterogeneousParcel::canCombust
label canCombust() const
Return const access to the canCombust flag.
Definition: ReactingHeterogeneousParcelI.H:178
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::ReactingHeterogeneousParcel::readObjects
static void readObjects(CloudType &c, const objectRegistry &obr)
Read particle fields as objects from the obr registry.
Definition: ReactingHeterogeneousParcelIO.C:279
Foam::ReactingHeterogeneousParcel::writeFields
static void writeFields(const CloudType &c, const CompositionType &compModel)
Write - composition supplied.
Definition: ReactingHeterogeneousParcelIO.C:179
Foam::ReactingHeterogeneousParcel::constantProperties
Class to hold reacting particle constant properties.
Definition: ReactingHeterogeneousParcel.H:76
Foam::ReactingHeterogeneousParcel::canCombust_
label canCombust_
Flag to identify if the particle can devolatilise and combust.
Definition: ReactingHeterogeneousParcel.H:165
Foam::ReactingHeterogeneousParcel::writeObjects
static void writeObjects(const CloudType &c, objectRegistry &obr)
Write particle fields as objects into the obr registry.
Definition: ReactingHeterogeneousParcelIO.C:291
Foam::ReactingHeterogeneousParcel::clone
virtual autoPtr< particle > clone(const polyMesh &mesh) const
Construct and return a (basic particle) clone.
Definition: ReactingHeterogeneousParcel.H:279
demandDrivenEntry.H
Foam::ReactingHeterogeneousParcel::trackingData
ParcelType::trackingData trackingData
Use base tracking data.
Definition: ReactingHeterogeneousParcel.H:109
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
ReactingHeterogeneousParcel.C
Foam::objectRegistry
Registry of regIOobjects.
Definition: objectRegistry.H:60
nu
volScalarField & nu
Definition: readMechanicalProperties.H:176
Foam::ReactingHeterogeneousParcel
Reacting heterogeneous Parcel.
Definition: ReactingHeterogeneousParcel.H:52
Foam::ReactingHeterogeneousParcel::F_
scalarField F_
Progress variables for reactions.
Definition: ReactingHeterogeneousParcel.H:157
Foam::label
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:62
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::ReactingHeterogeneousParcel::operator
friend Ostream & operator(Ostream &, const ReactingHeterogeneousParcel< ParcelType > &)
Foam::ReactingHeterogeneousParcel::writeProperties
void writeProperties(Ostream &os, const wordRes &filters, const word &delim, const bool namesOnly) const
Write individual parcel properties to stream.
Definition: ReactingHeterogeneousParcelIO.C:256
coordinates
PtrList< coordinateSystem > coordinates(solidRegions.size())
Foam::T
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Definition: FieldFieldFunctions.C:58
Foam::Barycentric< scalar >
Foam::DSMCCloud
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:71
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::ReactingHeterogeneousParcel::ReactingHeterogeneousParcel
ReactingHeterogeneousParcel(const polyMesh &mesh, const barycentric &coordinates, const label celli, const label tetFacei, const label tetPti)
Construct from mesh, position and topology.
Definition: ReactingHeterogeneousParcelI.H:65
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Y
PtrList< volScalarField > & Y
Definition: createFieldRefs.H:7
ReactingHeterogeneousParcelI.H
Foam::ReactingHeterogeneousParcel::F
const scalarField & F() const
Return const access to F.
Definition: ReactingHeterogeneousParcelI.H:162
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::ReactingHeterogeneousParcel::constantProperties::constantProperties
constantProperties()
Null constructor.
Definition: ReactingHeterogeneousParcelI.H:32
Foam::cloud
A cloud is a registry collection of lagrangian particles.
Definition: cloud.H:57
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::ReactingHeterogeneousParcel::calcHeterogeneousReactions
void calcHeterogeneousReactions(TrackCloudType &cloud, trackingData &td, const scalar dt, const scalar Res, const scalar nu, const scalar d, const scalar T, const scalar mass, const label canCombust, const scalar N, scalar &NCpW, const scalarField &YSolid, scalarField &F, scalarField &dMassSRSolid, scalarField &dMassSRCarrier, scalar &Sh, scalar &dhsTrans) const
Calculate surface reactions.
Definition: ReactingHeterogeneousParcel.C:296
Foam::ReactingHeterogeneousParcel::AddToPropertyList
AddToPropertyList(ParcelType,+" nReactions(F1..FN)")
String representation of properties.
Foam::ReactingHeterogeneousParcel::readFields
static void readFields(CloudType &c, const CompositionType &compModel)
Read - composition supplied.
Definition: ReactingHeterogeneousParcelIO.C:85
Foam::wordRes
A List of wordRe with additional matching capabilities.
Definition: wordRes.H:51
Foam::ReactingHeterogeneousParcel::constantProperties::hRetentionCoeff
scalar hRetentionCoeff() const
Return const access to the fraction of enthalpy retained by.
Definition: ReactingHeterogeneousParcelI.H:143
Foam::ReactingHeterogeneousParcel::iNew::iNew
iNew(const polyMesh &mesh)
Definition: ReactingHeterogeneousParcel.H:295
Foam::constant::universal::c
const dimensionedScalar c
Speed of light in a vacuum.
Foam::ReactingHeterogeneousParcel::TypeName
TypeName("ReactingHeterogeneousParcel")
Runtime type information.
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"))
Foam::ReactingHeterogeneousParcel::iNew
Factory class to read-construct particles used for.
Definition: ReactingHeterogeneousParcel.H:289
Foam::ReactingHeterogeneousParcel::sizeofFields
static const std::size_t sizeofFields
Size in bytes of the fields.
Definition: ReactingHeterogeneousParcel.H:73
Foam::ReactingHeterogeneousParcel::calc
void calc(TrackCloudType &cloud, trackingData &td, const scalar dt)
Update parcel properties over the time interval.
Definition: ReactingHeterogeneousParcel.C:86
Foam::ReactingHeterogeneousParcel::clone
virtual autoPtr< particle > clone() const
Construct and return a (basic particle) clone.
Definition: ReactingHeterogeneousParcel.H:273