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 | 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::ThermoParcel
29 
30 Group
31  grpLagrangianIntermediateParcels
32 
33 Description
34  Thermodynamic parcel class with one/two-way coupling with the continuous
35  phase. Includes Kinematic parcel sub-models, plus:
36  - heat transfer
37 
38 SourceFiles
39  ThermoParcelI.H
40  ThermoParcel.C
41  ThermoParcelIO.C
42 
43 \*---------------------------------------------------------------------------*/
44 
45 #ifndef ThermoParcel_H
46 #define ThermoParcel_H
47 
48 #include "particle.H"
49 #include "SLGThermo.H"
50 #include "demandDrivenEntry.H"
51 
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 
54 namespace Foam
55 {
56 
57 template<class ParcelType>
58 class ThermoParcel;
59 
60 template<class ParcelType>
61 Ostream& operator<<
62 (
63  Ostream&,
65 );
66 
67 /*---------------------------------------------------------------------------*\
68  Class ThermoParcel Declaration
69 \*---------------------------------------------------------------------------*/
70 
71 template<class ParcelType>
72 class ThermoParcel
73 :
74  public ParcelType
75 {
76 public:
77 
78  //- Size in bytes of the fields
79  static const std::size_t sizeofFields;
80 
81 
82  //- Class to hold thermo particle constant properties
83  class constantProperties
84  :
85  public ParcelType::constantProperties
86  {
87 
88  // Private data
89 
90  //- Particle initial temperature [K]
92 
93  //- Minimum temperature [K]
95 
96  //- Maximum temperature [K]
98 
99  //- Particle specific heat capacity [J/(kg.K)]
101 
102  //- Particle emissivity [] (radiation)
103  demandDrivenEntry<scalar> epsilon0_;
104 
105  //- Particle scattering factor [] (radiation)
107 
108 
109  public:
110 
111  // Constructors
112 
113  //- Null constructor
115 
116  //- Copy constructor
118 
119  //- Construct from dictionary
120  constantProperties(const dictionary& parentDict);
121 
122 
123  // Member functions
124 
125  // Access
126 
127  //- Return const access to the particle initial temperature [K]
128  inline scalar T0() const;
129 
130  //- Return const access to minimum temperature [K]
131  inline scalar TMin() const;
132 
133  //- Return const access to maximum temperature [K]
134  inline scalar TMax() const;
135 
136  //- Set the maximum temperature [K]
137  inline void setTMax(const scalar TMax);
138 
139  //- Return const access to the particle specific heat capacity
140  // [J/(kg.K)]
141  inline scalar Cp0() const;
142 
143  //- Return const access to the particle emissivity []
144  // Active for radiation only
145  inline scalar epsilon0() const;
146 
147  //- Return const access to the particle scattering factor []
148  // Active for radiation only
149  inline scalar f0() const;
150  };
151 
152 
153  class trackingData
154  :
155  public ParcelType::trackingData
156  {
157  private:
158 
159  // Private data
160 
161  //- Local copy of carrier specific heat field
162  // Cp not stored on carrier thermo, but returned as tmp<...>
163  const volScalarField Cp_;
164 
165  //- Local copy of carrier thermal conductivity field
166  // kappa not stored on carrier thermo, but returned as tmp<...>
167  const volScalarField kappa_;
168 
169 
170  // Interpolators for continuous phase fields
171 
172  //- Temperature field interpolator
174 
175  //- Specific heat capacity field interpolator
177 
178  //- Thermal conductivity field interpolator
179  autoPtr<interpolation<scalar>> kappaInterp_;
180 
181  //- Radiation field interpolator
183 
184 
185  // Cached continuous phase properties
186 
187  //- Temperature [K]
188  scalar Tc_;
189 
190  //- Specific heat capacity [J/(kg.K)]
191  scalar Cpc_;
192 
193 
194  public:
195 
196  typedef typename ParcelType::trackingData::trackPart trackPart;
197 
198  // Constructors
199 
200  //- Construct from components
201  template <class TrackCloudType>
202  inline trackingData
203  (
204  const TrackCloudType& cloud,
205  trackPart part = ParcelType::trackingData::tpLinearTrack
206  );
207 
208 
209  // Member functions
210 
211  //- Return access to the locally stored carrier Cp field
212  inline const volScalarField& Cp() const;
213 
214  //- Return access to the locally stored carrier kappa field
215  inline const volScalarField& kappa() const;
216 
217  //- Return const access to the interpolator for continuous
218  // phase temperature field
219  inline const interpolation<scalar>& TInterp() const;
220 
221  //- Return const access to the interpolator for continuous
222  // phase specific heat capacity field
223  inline const interpolation<scalar>& CpInterp() const;
224 
225  //- Return const access to the interpolator for continuous
226  // phase thermal conductivity field
227  inline const interpolation<scalar>& kappaInterp() const;
228 
229  //- Return const access to the interpolator for continuous
230  // radiation field
231  inline const interpolation<scalar>& GInterp() const;
232 
233  //- Return the continuous phase temperature
234  inline scalar Tc() const;
235 
236  //- Access the continuous phase temperature
237  inline scalar& Tc();
238 
239  //- Return the continuous phase specific heat capacity
240  inline scalar Cpc() const;
241 
242  //- Access the continuous phase specific heat capacity
243  inline scalar& Cpc();
244  };
245 
246 
247 protected:
248 
249  // Protected data
250 
251  // Parcel properties
252 
253  //- Temperature [K]
254  scalar T_;
255 
256  //- Specific heat capacity [J/(kg.K)]
257  scalar Cp_;
258 
259 
260  // Protected Member Functions
261 
262  //- Calculate new particle temperature
263  template<class TrackCloudType>
264  scalar calcHeatTransfer
265  (
266  TrackCloudType& cloud,
267  trackingData& td,
268  const scalar dt, // timestep
269  const scalar Re, // Reynolds number
270  const scalar Pr, // Prandtl number - surface
271  const scalar kappa, // Thermal conductivity - surface
272  const scalar NCpW, // Sum of N*Cp*W of emission species
273  const scalar Sh, // explicit particle enthalpy source
274  scalar& dhsTrans, // sensible enthalpy transfer to carrier
275  scalar& Sph // linearised heat transfer coefficient
276  );
277 
278 
279 public:
280 
281  // Static data members
282 
283  //- Runtime type information
284  TypeName("ThermoParcel");
285 
286  //- String representation of properties
288  (
289  ParcelType,
290  " T"
291  + " Cp"
292  );
293 
294 
295  // Constructors
296 
297  //- Construct from mesh, coordinates and topology
298  // Other properties initialised as null
299  inline ThermoParcel
300  (
301  const polyMesh& mesh,
302  const barycentric& coordinates,
303  const label celli,
304  const label tetFacei,
305  const label tetPti
306  );
307 
308  //- Construct from a position and a cell, searching for the rest of the
309  // required topology. Other properties are initialised as null.
310  inline ThermoParcel
311  (
312  const polyMesh& mesh,
313  const vector& position,
314  const label celli
315  );
316 
317  //- Construct from components
318  inline ThermoParcel
319  (
320  const polyMesh& mesh,
321  const barycentric& coordinates,
322  const label celli,
323  const label tetFacei,
324  const label tetPti,
325  const label typeId,
326  const scalar nParticle0,
327  const scalar d0,
328  const scalar dTarget0,
329  const vector& U0,
330  const vector& f0,
331  const vector& angularMomentum0,
332  const vector& torque0,
333  const constantProperties& constProps
334  );
335 
336  //- Construct from Istream
338  (
339  const polyMesh& mesh,
340  Istream& is,
341  bool readFields = true,
342  bool newFormat = true
343  );
344 
345  //- Construct as a copy
346  ThermoParcel(const ThermoParcel& p);
347 
348  //- Construct as a copy
349  ThermoParcel(const ThermoParcel& p, const polyMesh& mesh);
350 
351  //- Construct and return a (basic particle) clone
352  virtual autoPtr<particle> clone() const
353  {
354  return autoPtr<particle>(new ThermoParcel(*this));
355  }
356 
357  //- Construct and return a (basic particle) clone
358  virtual autoPtr<particle> clone(const polyMesh& mesh) const
359  {
360  return autoPtr<particle>(new ThermoParcel(*this, mesh));
361  }
362 
363  //- Factory class to read-construct particles used for
364  // parallel transfer
365  class iNew
366  {
367  const polyMesh& mesh_;
368 
369  public:
370 
371  iNew(const polyMesh& mesh)
372  :
373  mesh_(mesh)
374  {}
375 
377  {
379  (
380  new ThermoParcel<ParcelType>(mesh_, is, true)
381  );
382  }
383  };
384 
385 
386  // Member Functions
387 
388  // Access
389 
390  //- Return const access to temperature
391  inline scalar T() const;
392 
393  //- Return const access to specific heat capacity
394  inline scalar Cp() const;
395 
396  //- Return the parcel sensible enthalpy
397  inline scalar hs() const;
398 
399 
400  // Edit
401 
402  //- Return access to temperature
403  inline scalar& T();
404 
405  //- Return access to specific heat capacity
406  inline scalar& Cp();
407 
408 
409  // Main calculation loop
410 
411  //- Set cell values
412  template<class TrackCloudType>
413  void setCellValues(TrackCloudType& cloud, trackingData& td);
414 
415  //- Correct cell values using latest transfer information
416  template<class TrackCloudType>
418  (
419  TrackCloudType& cloud,
420  trackingData& td,
421  const scalar dt
422  );
423 
424  //- Calculate surface thermo properties
425  template<class TrackCloudType>
426  void calcSurfaceValues
427  (
428  TrackCloudType& cloud,
429  trackingData& td,
430  const scalar T,
431  scalar& Ts,
432  scalar& rhos,
433  scalar& mus,
434  scalar& Pr,
435  scalar& kappas
436  ) const;
437 
438  //- Update parcel properties over the time interval
439  template<class TrackCloudType>
440  void calc
441  (
442  TrackCloudType& cloud,
443  trackingData& td,
444  const scalar dt
445  );
446 
447 
448  // I-O
449 
450  //- Read
451  template<class CloudType>
452  static void readFields(CloudType& c);
453 
454  //- Write
455  template<class CloudType>
456  static void writeFields(const CloudType& c);
457 
458  //- Write individual parcel properties to stream
459  void writeProperties
460  (
461  Ostream& os,
462  const wordRes& filters,
463  const word& delim,
464  const bool namesOnly = false
465  ) const;
466 
467  //- Read particle fields as objects from the obr registry
468  template<class CloudType>
469  static void readObjects(CloudType& c, const objectRegistry& obr);
470 
471  //- Write particle fields as objects into the obr registry
472  template<class CloudType>
473  static void writeObjects(const CloudType& c, objectRegistry& obr);
474 
475 
476  // Ostream Operator
477 
478  friend Ostream& operator<< <ParcelType>
479  (
480  Ostream&,
482  );
483 };
484 
485 
486 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
487 
488 } // End namespace Foam
489 
490 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
491 
492 #include "ThermoParcelI.H"
494 
495 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
496 
497 #ifdef NoRepository
498  #include "ThermoParcel.C"
499 #endif
500 
501 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
502 
503 #endif
504 
505 // ************************************************************************* //
Foam::ThermoParcel::trackingData::kappaInterp
const interpolation< scalar > & kappaInterp() const
Return const access to the interpolator for continuous.
Definition: ThermoParcelTrackingDataI.H:117
Foam::ThermoParcel::constantProperties
Class to hold thermo particle constant properties.
Definition: ThermoParcel.H:82
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::ThermoParcel::trackingData::TInterp
const interpolation< scalar > & TInterp() const
Return const access to the interpolator for continuous.
Definition: ThermoParcelTrackingDataI.H:101
Foam::ThermoParcel::constantProperties::epsilon0
scalar epsilon0() const
Return const access to the particle emissivity [].
Definition: ThermoParcelI.H:190
Foam::ThermoParcel::trackingData::CpInterp
const interpolation< scalar > & CpInterp() const
Return const access to the interpolator for continuous.
Definition: ThermoParcelTrackingDataI.H:109
Foam::ThermoParcel::trackingData::GInterp
const interpolation< scalar > & GInterp() const
Return const access to the interpolator for continuous.
Definition: ThermoParcelTrackingDataI.H:125
Foam::ThermoParcel::writeFields
static void writeFields(const CloudType &c)
Write.
Definition: ThermoParcelIO.C:117
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::ThermoParcel::AddToPropertyList
AddToPropertyList(ParcelType, " T"+" Cp")
String representation of properties.
Foam::ThermoParcel::trackingData::trackingData
trackingData(const TrackCloudType &cloud, trackPart part=ParcelType::trackingData::tpLinearTrack)
Construct from components.
Definition: ThermoParcelTrackingDataI.H:32
demandDrivenEntry.H
Foam::ThermoParcel::iNew
Factory class to read-construct particles used for.
Definition: ThermoParcel.H:364
ThermoParcel.C
Foam::ThermoParcel::writeProperties
void writeProperties(Ostream &os, const wordRes &filters, const word &delim, const bool namesOnly=false) const
Write individual parcel properties to stream.
Definition: ThermoParcelIO.C:143
Foam::ThermoParcel::calcHeatTransfer
scalar calcHeatTransfer(TrackCloudType &cloud, trackingData &td, const scalar dt, const scalar Re, const scalar Pr, const scalar kappa, const scalar NCpW, const scalar Sh, scalar &dhsTrans, scalar &Sph)
Calculate new particle temperature.
Foam::ThermoParcel::TypeName
TypeName("ThermoParcel")
Runtime type information.
Foam::ThermoParcel::trackingData::Cp
const volScalarField & Cp() const
Return access to the locally stored carrier Cp field.
Definition: ThermoParcelTrackingDataI.H:85
SLGThermo.H
ThermoParcelTrackingDataI.H
Foam::constant::electromagnetic::kappa
const dimensionedScalar kappa
Coulomb constant: default SI units: [N.m2/C2].
Foam::ThermoParcel::writeObjects
static void writeObjects(const CloudType &c, objectRegistry &obr)
Write particle fields as objects into the obr registry.
Definition: ThermoParcelIO.C:192
Foam::ThermoParcel::sizeofFields
static const std::size_t sizeofFields
Size in bytes of the fields.
Definition: ThermoParcel.H:78
Foam::ThermoParcel::calc
void calc(TrackCloudType &cloud, trackingData &td, const scalar dt)
Update parcel properties over the time interval.
Definition: ThermoParcel.C:145
Foam::ThermoParcel::calcSurfaceValues
void calcSurfaceValues(TrackCloudType &cloud, trackingData &td, const scalar T, scalar &Ts, scalar &rhos, scalar &mus, scalar &Pr, scalar &kappas) const
Calculate surface thermo properties.
Definition: ThermoParcel.C:102
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::objectRegistry
Registry of regIOobjects.
Definition: objectRegistry.H:60
Foam::ThermoParcel::iNew::operator()
autoPtr< ThermoParcel< ParcelType > > operator()(Istream &is) const
Definition: ThermoParcel.H:375
Foam::ThermoParcel::constantProperties::f0
scalar f0() const
Return const access to the particle scattering factor [].
Definition: ThermoParcelI.H:198
Foam::ThermoParcel::constantProperties::setTMax
void setTMax(const scalar TMax)
Set the maximum temperature [K].
Definition: ThermoParcelI.H:174
Foam::ThermoParcel::trackingData
Definition: ThermoParcel.H:152
Foam::ThermoParcel::constantProperties::T0
scalar T0() const
Return const access to the particle initial temperature [K].
Definition: ThermoParcelI.H:150
Foam::ThermoParcel::iNew::iNew
iNew(const polyMesh &mesh)
Definition: ThermoParcel.H:370
Foam::ThermoParcel::setCellValues
void setCellValues(TrackCloudType &cloud, trackingData &td)
Set cell values.
Definition: ThermoParcel.C:38
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::ThermoParcel::clone
virtual autoPtr< particle > clone() const
Construct and return a (basic particle) clone.
Definition: ThermoParcel.H:351
Foam::ThermoParcel::T_
scalar T_
Temperature [K].
Definition: ThermoParcel.H:253
coordinates
PtrList< coordinateSystem > coordinates(solidRegions.size())
Foam::ThermoParcel::Cp_
scalar Cp_
Specific heat capacity [J/(kg.K)].
Definition: ThermoParcel.H:256
Pr
dimensionedScalar Pr("Pr", dimless, laminarTransport)
Foam::ThermoParcel::T
scalar T() const
Return const access to temperature.
Definition: ThermoParcelI.H:207
Foam::ThermoParcel::hs
scalar hs() const
Return the parcel sensible enthalpy.
Definition: ThermoParcelI.H:221
Foam::ThermoParcel::cellValueSourceCorrection
void cellValueSourceCorrection(TrackCloudType &cloud, trackingData &td, const scalar dt)
Correct cell values using latest transfer information.
Definition: ThermoParcel.C:68
Foam::Barycentric< scalar >
Foam::ThermoParcel::readObjects
static void readObjects(CloudType &c, const objectRegistry &obr)
Read particle fields as objects from the obr registry.
Definition: ThermoParcelIO.C:166
Foam::ThermoParcel::constantProperties::Cp0
scalar Cp0() const
Return const access to the particle specific heat capacity.
Definition: ThermoParcelI.H:182
Foam::ThermoParcel::trackingData::kappa
const volScalarField & kappa() const
Return access to the locally stored carrier kappa field.
Definition: ThermoParcelTrackingDataI.H:93
Foam::DSMCCloud
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:71
Foam::interpolation< scalar >
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam::ThermoParcel::constantProperties::TMax
scalar TMax() const
Return const access to maximum temperature [K].
Definition: ThermoParcelI.H:166
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::ThermoParcel::trackingData::trackPart
ParcelType::trackingData::trackPart trackPart
Definition: ThermoParcel.H:195
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::ThermoParcel::constantProperties::constantProperties
constantProperties()
Null constructor.
Definition: ThermoParcelI.H:31
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::ThermoParcel
Thermodynamic parcel class with one/two-way coupling with the continuous phase. Includes Kinematic pa...
Definition: ThermoParcel.H:57
Foam::Vector< scalar >
Foam::demandDrivenEntry< scalar >
Foam::ThermoParcel::trackingData::Cpc
scalar Cpc() const
Return the continuous phase specific heat capacity.
Definition: ThermoParcelTrackingDataI.H:153
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
Foam::ThermoParcel::constantProperties::TMin
scalar TMin() const
Return const access to minimum temperature [K].
Definition: ThermoParcelI.H:158
Foam::ThermoParcel::trackingData::Tc
scalar Tc() const
Return the continuous phase temperature.
Definition: ThermoParcelTrackingDataI.H:139
particle.H
Foam::constant::universal::c
const dimensionedScalar c
Speed of light in a vacuum.
Foam::ThermoParcel::clone
virtual autoPtr< particle > clone(const polyMesh &mesh) const
Construct and return a (basic particle) clone.
Definition: ThermoParcel.H:357
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::GeometricField< scalar, fvPatchField, volMesh >
Foam::ThermoParcel::ThermoParcel
ThermoParcel(const polyMesh &mesh, const barycentric &coordinates, const label celli, const label tetFacei, const label tetPti)
Construct from mesh, coordinates and topology.
Definition: ThermoParcelI.H:77
Foam::ThermoParcel::readFields
static void readFields(CloudType &c)
Read.
Definition: ThermoParcelIO.C:91
Foam::ThermoParcel::Cp
scalar Cp() const
Return const access to specific heat capacity.
Definition: ThermoParcelI.H:214
ThermoParcelI.H