ThermoCloud.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) 2020 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::ThermoCloud
29 
30 Group
31  grpLagrangianIntermediateClouds
32 
33 Description
34  Templated base class for thermodynamic cloud
35 
36  - Adds to kinematic cloud
37  - Heat transfer
38 
39 SourceFiles
40  ThermoCloudI.H
41  ThermoCloud.C
42 
43 \*---------------------------------------------------------------------------*/
44 
45 #ifndef ThermoCloud_H
46 #define ThermoCloud_H
47 
48 #include "KinematicCloud.H"
49 #include "thermoCloud.H"
50 #include "SLGThermo.H"
51 
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 
54 namespace Foam
55 {
56 
57 // Forward declaration of classes
58 
59 template<class CloudType>
60 class HeatTransferModel;
61 
62 /*---------------------------------------------------------------------------*\
63  Class ThermoCloud Declaration
64 \*---------------------------------------------------------------------------*/
65 
66 template<class CloudType>
67 class ThermoCloud
68 :
69  public CloudType,
70  public thermoCloud
71 {
72 public:
73 
74  // Public typedefs
75 
76  //- Type of cloud this cloud was instantiated for
77  typedef CloudType cloudType;
78 
79  //- Type of parcel the cloud was instantiated for
80  typedef typename CloudType::particleType parcelType;
81 
82  //- Convenience typedef for this cloud type
84 
85 
86 private:
87 
88  // Private data
89 
90  //- Cloud copy pointer
91  autoPtr<ThermoCloud<CloudType>> cloudCopyPtr_;
92 
93 
94  // Private member functions
95 
96  //- No copy construct
97  ThermoCloud(const ThermoCloud&) = delete;
98 
99  //- No copy assignment
100  void operator=(const ThermoCloud&) = delete;
101 
102 
103 protected:
104 
105  // Protected data
106 
107  //- Thermo parcel constant properties
108  typename parcelType::constantProperties constProps_;
109 
110 
111  // References to the carrier gas fields
112 
113  //- SLG thermodynamics package
114  const SLGThermo& thermo_;
115 
116  //- Temperature [K]
118 
119  //- Pressure [Pa]
120  const volScalarField& p_;
121 
122 
123  // References to the cloud sub-models
124 
125  //- Heat transfer model
128 
129 
130  // Reference to the particle integration schemes
131 
132  //- Temperature integration
134 
136  // Modelling options
137 
138  //- Include radiation
140 
141  //- Radiation sum of parcel projected areas
143 
144  //- Radiation sum of parcel temperature^4
146 
147  //- Radiation sum of parcel projected areas * temperature^4
149 
150 
151  // Sources
153  //- Sensible enthalpy transfer [J/kg]
155 
156  //- Coefficient for carrier phase hs equation [W/K]
158 
159 
160  // Protected Member Functions
161 
162  // Initialisation
163 
164  //- Set cloud sub-models
165  void setModels();
166 
167 
168  // Cloud evolution functions
169 
170  //- Reset state of cloud
172 
173 
174 public:
176  // Constructors
177 
178  //- Construct given carrier gas fields
180  (
181  const word& cloudName,
182  const volScalarField& rho,
184  const dimensionedVector& g,
185  const SLGThermo& thermo,
186  bool readFields = true
187  );
189  //- Copy constructor with new name
191 
192  //- Copy constructor with new name - creates bare cloud
194  (
195  const fvMesh& mesh,
196  const word& name,
198  );
199 
200  //- Construct and return clone based on (this) with new name
201  virtual autoPtr<Cloud<parcelType>> clone(const word& name)
202  {
204  (
205  new ThermoCloud(*this, name)
206  );
207  }
208 
209  //- Construct and return bare clone based on (this) with new name
210  virtual autoPtr<Cloud<parcelType>> cloneBare(const word& name) const
211  {
213  (
214  new ThermoCloud(this->mesh(), name, *this)
215  );
216  }
217 
218 
219  //- Destructor
220  virtual ~ThermoCloud() = default;
221 
222 
223  // Member Functions
224 
225  // Access
226 
227  //- Return a reference to the cloud copy
228  inline const ThermoCloud& cloudCopy() const;
229 
230  //- Return the constant properties
231  inline const typename parcelType::constantProperties&
232  constProps() const;
233 
234  //- Return access to the constant properties
235  inline typename parcelType::constantProperties& constProps();
236 
237  //- Return const access to thermo package
238  inline const SLGThermo& thermo() const;
239 
240  //- Return const access to the carrier temperature field
241  inline const volScalarField& T() const;
242 
243  //- Return const access to the carrier pressure field
244  inline const volScalarField& p() const;
245 
246 
247  // Sub-models
248 
249  //- Return reference to heat transfer model
251  heatTransfer() const;
252 
253 
254  // Integration schemes
256  //-Return reference to velocity integration
257  inline const integrationScheme& TIntegrator() const;
258 
259 
260  // Modelling options
261 
262  //- Radiation flag
263  inline bool radiation() const;
264 
265  //- Radiation sum of parcel projected areas [m2]
267 
268  //- Radiation sum of parcel projected areas [m2]
269  inline const volScalarField::Internal&
270  radAreaP() const;
271 
272  //- Radiation sum of parcel temperature^4 [K4]
274 
275  //- Radiation sum of parcel temperature^4 [K4]
276  inline const volScalarField::Internal& radT4() const;
277 
278  //- Radiation sum of parcel projected area*temperature^4 [m2K4]
280 
281  //- Radiation sum of parcel temperature^4 [m2K4]
282  inline const volScalarField::Internal&
283  radAreaPT4() const;
284 
285 
286  // Sources
287 
288  //- Transfer the effect of parcel to the carrier phase
289  inline void transferToCarrier
290  (
291  const parcelType& p,
292  const typename parcelType::trackingData& td
293  );
294 
295 
296  // Enthalpy
297 
298  //- Sensible enthalpy transfer [J/kg]
300 
301  //- Sensible enthalpy transfer [J/kg]
302  inline const volScalarField::Internal&
303  hsTrans() const;
304 
305  //- Return coefficient for carrier phase hs equation
307 
308  //- Return const coefficient for carrier phase hs equation
309  inline const volScalarField::Internal&
310  hsCoeff() const;
311 
312  //- Return sensible enthalpy source term [J/kg/m3/s]
313  inline tmp<fvScalarMatrix> Sh(volScalarField& hs) const;
314 
315 
316  // Radiation - overrides thermoCloud virtual abstract members
317 
318  //- Return tmp equivalent particulate emission
319  inline tmp<volScalarField> Ep() const;
320 
321  //- Return tmp equivalent particulate absorption
322  inline tmp<volScalarField> ap() const;
323 
324  //- Return tmp equivalent particulate scattering factor
325  inline tmp<volScalarField> sigmap() const;
326 
327 
328  // Check
329 
330  //- Maximum temperature
331  inline scalar Tmax() const;
332 
333  //- Minimum temperature
334  inline scalar Tmin() const;
335 
336 
337  // Cloud evolution functions
338 
339  //- Set parcel thermo properties
341  (
342  parcelType& parcel,
343  const scalar lagrangianDt
344  );
345 
346  //- Check parcel properties
348  (
349  parcelType& parcel,
350  const scalar lagrangianDt,
351  const bool fullyDescribed
352  );
353 
354  //- Store the current cloud state
355  void storeState();
356 
357  //- Reset the current cloud to the previously stored state
358  void restoreState();
359 
360  //- Reset the cloud source terms
361  void resetSourceTerms();
362 
363  //- Apply relaxation to (steady state) cloud sources
364  void relaxSources(const ThermoCloud<CloudType>& cloudOldTime);
365 
366  //- Apply scaling to (transient) cloud sources
367  void scaleSources();
368 
369  //- Pre-evolve
370  void preEvolve(const typename parcelType::trackingData& td);
371 
372  //- Evolve the cloud
373  void evolve();
374 
375 
376  // Mapping
377 
378  //- Remap the cells of particles corresponding to the
379  // mesh topology change with a default tracking data object
380  virtual void autoMap(const mapPolyMesh&);
381 
382 
383  // I-O
384 
385  //- Print cloud information
386  void info();
387 };
388 
389 
390 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
391 
392 } // End namespace Foam
393 
394 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
395 
396 #include "ThermoCloudI.H"
397 
398 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
399 
400 #ifdef NoRepository
401  #include "ThermoCloud.C"
402 #endif
403 
404 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
405 
406 #endif
407 
408 // ************************************************************************* //
ParcelType particleType
Definition: Cloud.H:130
const volScalarField & T_
Temperature [K].
Definition: ThermoCloud.H:130
autoPtr< integrationScheme > TIntegrator_
Temperature integration.
Definition: ThermoCloud.H:152
void preEvolve(const typename parcelType::trackingData &td)
Pre-evolve.
Definition: ThermoCloud.C:444
CloudType cloudType
Type of cloud this cloud was instantiated for.
Definition: ThermoCloud.H:74
Switch radiation_
Include radiation.
Definition: ThermoCloud.H:160
autoPtr< IOobject > clone() const
Clone.
Definition: IOobject.H:621
const SLGThermo & thermo_
SLG thermodynamics package.
Definition: ThermoCloud.H:125
void setParcelThermoProperties(parcelType &parcel, const scalar lagrangianDt)
Set parcel thermo properties.
Definition: ThermoCloud.C:344
virtual autoPtr< Cloud< parcelType > > cloneBare(const word &name) const
Construct and return bare clone based on (this) with new name.
Definition: ThermoCloud.H:255
Templated class to calculate the fluid-particle heat transfer coefficients based on a specified Nusse...
Definition: ThermoCloud.H:55
volScalarField::Internal & hsTrans()
Sensible enthalpy transfer [J/kg].
Definition: ThermoCloudI.H:201
const ThermoCloud & cloudCopy() const
Return a reference to the cloud copy.
Definition: ThermoCloudI.H:30
tmp< volScalarField > sigmap() const
Return tmp equivalent particulate scattering factor.
Definition: ThermoCloudI.H:343
const word & cloudName() const
Return the cloud type.
Definition: DSMCCloudI.H:30
const word & name() const noexcept
Return the object name.
Definition: IOobjectI.H:195
void restoreState()
Reset the current cloud to the previously stored state.
Definition: ThermoCloud.C:382
const volScalarField & p() const
Return const access to the carrier pressure field.
Definition: ThermoCloudI.H:67
autoPtr< volScalarField::Internal > hsTrans_
Sensible enthalpy transfer [J/kg].
Definition: ThermoCloud.H:183
A simple wrapper around bool so that it can be read as a word: true/false, on/off, yes/no, any/none. Also accepts 0/1 as a string and shortcuts t/f, y/n.
Definition: Switch.H:77
volScalarField::Internal & radAreaPT4()
Radiation sum of parcel projected area*temperature^4 [m2K4].
Definition: ThermoCloudI.H:158
void cloudReset(ThermoCloud< CloudType > &c)
Reset state of cloud.
Definition: ThermoCloud.C:109
void transferToCarrier(const parcelType &p, const typename parcelType::trackingData &td)
Transfer the effect of parcel to the carrier phase.
Definition: ThermoCloudI.H:188
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:157
Templated base class for thermodynamic cloud.
Definition: ThermoCloud.H:62
ThermoCloud< CloudType > thermoCloudType
Convenience typedef for this cloud type.
Definition: ThermoCloud.H:84
virtual ~ThermoCloud()=default
Destructor.
parcelType::constantProperties constProps_
Thermo parcel constant properties.
Definition: ThermoCloud.H:117
const HeatTransferModel< ThermoCloud< CloudType > > & heatTransfer() const
Return reference to heat transfer model.
Definition: ThermoCloudI.H:75
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:81
volScalarField::Internal & radAreaP()
Radiation sum of parcel projected areas [m2].
Definition: ThermoCloudI.H:98
autoPtr< volScalarField::Internal > radT4_
Radiation sum of parcel temperature^4.
Definition: ThermoCloud.H:170
volScalarField::Internal & radT4()
Radiation sum of parcel temperature^4 [K4].
Definition: ThermoCloudI.H:128
tmp< volScalarField > ap() const
Return tmp equivalent particulate absorption.
Definition: ThermoCloudI.H:306
virtual void autoMap(const mapPolyMesh &)
Remap the cells of particles corresponding to the.
Definition: ThermoCloud.C:467
void readFields(const typename GeoFieldType::Mesh &mesh, const IOobjectList &objects, const NameMatchPredicate &selectedFields, DynamicList< regIOobject *> &storedObjects)
Read the selected GeometricFields of the templated type and store on the objectRegistry.
A class for handling words, derived from Foam::string.
Definition: word.H:63
const parcelType::constantProperties & constProps() const
Return the constant properties.
Definition: ThermoCloudI.H:38
Thermo package for (S)olids (L)iquids and (G)ases Takes reference to thermo package, and provides:
Definition: SLGThermo.H:60
bool radiation() const
Radiation flag.
Definition: ThermoCloudI.H:90
Basic thermodynamics type based on the use of fitting functions for cp, h, s obtained from the templa...
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:290
const uniformDimensionedVectorField & g
const integrationScheme & TIntegrator() const
Return reference to velocity integration.
Definition: ThermoCloudI.H:83
Virtual abstract base class for templated ThermoCloud.
Definition: thermoCloud.H:46
const SLGThermo & thermo() const
Return const access to thermo package.
Definition: ThermoCloudI.H:53
const volScalarField & T() const
Return const access to the carrier temperature field.
Definition: ThermoCloudI.H:60
autoPtr< volScalarField::Internal > radAreaPT4_
Radiation sum of parcel projected areas * temperature^4.
Definition: ThermoCloud.H:175
Base for a set of schemes which integrate simple ODEs which arise from semi-implcit rate expressions...
tmp< fvScalarMatrix > Sh(volScalarField &hs) const
Return sensible enthalpy source term [J/kg/m3/s].
Definition: ThermoCloudI.H:233
void checkParcelProperties(parcelType &parcel, const scalar lagrangianDt, const bool fullyDescribed)
Check parcel properties.
Definition: ThermoCloud.C:358
void resetSourceTerms()
Reset the cloud source terms.
Definition: ThermoCloud.C:390
const volScalarField & p_
Pressure [Pa].
Definition: ThermoCloud.H:135
const fvMesh & mesh() const
Return reference to the mesh.
Definition: DSMCCloudI.H:37
autoPtr< volScalarField::Internal > hsCoeff_
Coefficient for carrier phase hs equation [W/K].
Definition: ThermoCloud.H:188
scalar Tmax() const
Maximum temperature.
Definition: ThermoCloudI.H:380
tmp< volScalarField > Ep() const
Return tmp equivalent particulate emission.
Definition: ThermoCloudI.H:270
U
Definition: pEqn.H:72
void evolve()
Evolve the cloud.
Definition: ThermoCloud.C:455
autoPtr< volScalarField::Internal > radAreaP_
Radiation sum of parcel projected areas.
Definition: ThermoCloud.H:165
void info()
Print cloud information.
Definition: ThermoCloud.C:476
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
const dimensionedScalar c
Speed of light in a vacuum.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: areaFieldsFwd.H:42
void scaleSources()
Apply scaling to (transient) cloud sources.
Definition: ThermoCloud.C:426
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
autoPtr< HeatTransferModel< ThermoCloud< CloudType > > > heatTransferModel_
Heat transfer model.
Definition: ThermoCloud.H:144
A class for managing temporary objects.
Definition: HashPtrTable.H:50
volScalarField::Internal & hsCoeff()
Return coefficient for carrier phase hs equation.
Definition: ThermoCloudI.H:217
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:67
scalar Tmin() const
Minimum temperature.
Definition: ThermoCloudI.H:401
void storeState()
Store the current cloud state.
Definition: ThermoCloud.C:369
void setModels()
Set cloud sub-models.
Definition: ThermoCloud.C:30
Namespace for OpenFOAM.
CloudType::particleType parcelType
Type of parcel the cloud was instantiated for.
Definition: ThermoCloud.H:79
void relaxSources(const ThermoCloud< CloudType > &cloudOldTime)
Apply relaxation to (steady state) cloud sources.
Definition: ThermoCloud.C:407