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