ThermoParcel.H 10.8 KB
Newer Older
1
2
3
4
/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     |
5
    \\  /    A nd           | Copyright (C) 1991-2010 OpenCFD Ltd.
6
7
8
9
10
     \\/     M anipulation  |
-------------------------------------------------------------------------------
License
    This file is part of OpenFOAM.

11
12
13
14
    OpenFOAM is free software: you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
15
16
17
18
19
20
21

    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    for more details.

    You should have received a copy of the GNU General Public License
22
    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
23
24
25
26
27

Class
    Foam::ThermoParcel

Description
28
    Thermodynamic parcel class with one/two-way coupling with the continuous
29
    phase. Includes Kinematic parcel sub-models, plus:
30
31
32
    - heat transfer

SourceFiles
33
    ThermoParcelI.H
34
    ThermoParcel.C
35
    ThermoParcelIO.C
36
37
38
39
40
41

\*---------------------------------------------------------------------------*/

#ifndef ThermoParcel_H
#define ThermoParcel_H

42
#include "KinematicParcel.H"
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include "ThermoCloud.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

namespace Foam
{

template<class ParcelType>
class ThermoParcel;

template<class ParcelType>
Ostream& operator<<
(
    Ostream&,
    const ThermoParcel<ParcelType>&
);

/*---------------------------------------------------------------------------*\
                       Class ThermoParcel Declaration
\*---------------------------------------------------------------------------*/

64
template<class ParcelType>
65
66
class ThermoParcel
:
67
    public KinematicParcel<ParcelType>
68
69
70
{
public:

71
    //- Class to hold thermo particle constant properties
72
73
    class constantProperties
    :
74
        public KinematicParcel<ParcelType>::constantProperties
75
76
77
78
79
80
81
    {

        // Private data

            //- Particle initial temperature [K]
            const scalar T0_;

82
83
84
            //- Minimum temperature [K]
            const scalar TMin_;

85
            //- Particle specific heat capacity [J/(kg.K)]
86
            const scalar Cp0_;
87
88
89
90
91
92
93

            //- Particle emissivity [] (radiation)
            const scalar epsilon0_;

            //- Particle scattering factor [] (radiation)
            const scalar f0_;

94
95
96
            //- Default carrier Prandtl number []
            const scalar Pr_;

97
98
99
100

    public:

        // Constructors
101
        constantProperties(const dictionary& parentDict);
102
103
104
105
106

        // Member functions

            // Access

107
                //- Return const access to the particle initial temperature [K]
108
109
                inline scalar T0() const;

110
111
112
113
                //- Return const access to minimum temperature [K]
                inline scalar TMin() const;

                //- Return const access to the particle specific heat capacity
114
                //  [J/(kg.K)]
115
                inline scalar Cp0() const;
116

117
118
                //- Return const access to the particle emissivity []
                //  Active for radiation only
119
120
                inline scalar epsilon0() const;

121
122
                //- Return const access to the particle scattering factor []
                //  Active for radiation only
123
                inline scalar f0() const;
124
125
126

                //- Return const access to the default carrier Prandtl number []
                inline scalar Pr() const;
127
128
129
    };


130
    //- Class used to pass thermo tracking data to the trackToFace function
131
132
    class trackData
    :
133
        public KinematicParcel<ParcelType>::trackData
134
135
136
137
138
139
140
    {

        // Private data

            //- Reference to the cloud containing this particle
            ThermoCloud<ParcelType>& cloud_;

141
            //- Local copy of carrier specific heat field
142
143
144
145
            //  Cp not stored on acrrier thermo, but returned as tmp<...>
            const volScalarField Cp_;


146
            // Interpolators for continuous phase fields
147

148
                //- Temperature field interpolator
149
                autoPtr<interpolation<scalar> > TInterp_;
150

Andrew Heather's avatar
Andrew Heather committed
151
                //- Specific heat capacity field interpolator
152
                autoPtr<interpolation<scalar> > CpInterp_;
153
154
155
156
157
158


    public:

        // Constructors

159
            //- Construct from components
160
161
162
            inline trackData
            (
                ThermoCloud<ParcelType>& cloud,
163
164
                typename KinematicParcel<ParcelType>::trackData::trackPart
                    part = KinematicParcel<ParcelType>::trackData::tpLinearTrack
165
166
167
168
169
            );


        // Member functions

170
            //- Return access to the owner cloud
171
172
            inline ThermoCloud<ParcelType>& cloud();

173
174
175
            //- Return access to the locally stored carrier Cp field
            inline const volScalarField& Cp() const;

Andrew Heather's avatar
Andrew Heather committed
176
            //- Return const access to the interpolator for continuous
177
178
            //  phase temperature field
            inline const interpolation<scalar>& TInterp() const;
179

Andrew Heather's avatar
Andrew Heather committed
180
            //- Return const access to the interpolator for continuous
181
            //  phase specific heat capacity field
182
            inline const interpolation<scalar>& CpInterp() const;
183
184
185
    };


186
187
188
189
190
191
192
193
194
195
protected:

    // Protected data

        // Parcel properties

            //- Temperature [K]
            scalar T_;

            //- Specific heat capacity [J/(kg.K)]
196
            scalar Cp_;
197
198


Andrew Heather's avatar
Andrew Heather committed
199
        // Cell-based quantities
200
201
202
203
204

            //- Temperature [K]
            scalar Tc_;

            //- Specific heat capacity [J/(kg.K)]
205
            scalar Cpc_;
206
207


208
    // Protected Member Functions
209
210
211
212
213
214

        //- Calculate new particle temperature
        template<class TrackData>
        scalar calcHeatTransfer
        (
            TrackData& td,
215
216
            const scalar dt,           // timestep
            const label cellI,         // owner cell
217
218
219
            const scalar Re,           // Reynolds number
            const scalar Pr,           // Prandtl number - surface
            const scalar kappa,        // Thermal conductivity - surface
220
221
222
            const scalar d,            // diameter
            const scalar rho,          // density
            const scalar T,            // temperature
223
            const scalar Cp,           // specific heat capacity
224
            const scalar NCpW,         // Sum of N*Cp*W of emission species
225
226
            const scalar Sh,           // explicit particle enthalpy source
            scalar& dhsTrans           // sensible enthalpy transfer to carrier
227
228
229
230
231
        );


public:

232
233
234
235
236
237
238
239
    // Static data members

        //- String representation of properties
        static string propHeader;

        //- Runtime type information
        TypeName("ThermoParcel");

240
241
242
243

    friend class Cloud<ParcelType>;


244
245
    // Constructors

Andrew Heather's avatar
Andrew Heather committed
246
247
248
249
250
251
        //- Construct from owner, position, and cloud owner
        //  Other properties initialised as null
        inline ThermoParcel
        (
            ThermoCloud<ParcelType>& owner,
            const vector& position,
252
253
254
            const label cellI,
            const label tetFaceI,
            const label tetPtI
Andrew Heather's avatar
Andrew Heather committed
255
256
        );

257
258
259
260
261
        //- Construct from components
        inline ThermoParcel
        (
            ThermoCloud<ParcelType>& owner,
            const vector& position,
262
            const label cellI,
263
264
            const label tetFaceI,
            const label tetPtI,
265
266
            const label typeId,
            const scalar nParticle0,
267
            const scalar d0,
graham's avatar
graham committed
268
            const scalar dTarget0,
269
            const vector& U0,
270
            const vector& f0,
271
272
            const vector& angularMomentum0,
            const vector& torque0,
273
274
275
276
277
278
279
280
281
282
283
            const constantProperties& constProps
        );

        //- Construct from Istream
        ThermoParcel
        (
            const Cloud<ParcelType>& c,
            Istream& is,
            bool readFields = true
        );

284
285
286
        //- Construct as a copy
        ThermoParcel(const ThermoParcel& p);

287
        //- Construct and return a clone
288
        autoPtr<ThermoParcel> clone() const
289
        {
290
            return autoPtr<ThermoParcel>(new ThermoParcel(*this));
291
292
293
294
295
296
297
        }


    // Member Functions

        // Access

298
            //- Return const access to temperature
299
            inline scalar T() const;
300

301
            //- Return const access to specific heat capacity
302
            inline scalar Cp() const;
303

304
305
306
            //- Return the parcel sensible enthalpy
            inline scalar hs() const;

307
308
309
310
311
312
313

        // Edit

            //- Return access to temperature
            inline scalar& T();

            //- Return access to specific heat capacity
314
            inline scalar& Cp();
315
316


317
        // Main calculation loop
318

319
            //- Set cell values
320
            template<class TrackData>
321
322
323
324
325
326
327
328
329
330
            void setCellValues
            (
                TrackData& td,
                const scalar dt,
                const label cellI
            );

            //- Correct cell values using latest transfer information
            template<class TrackData>
            void cellValueSourceCorrection
331
332
333
            (
                TrackData& td,
                const scalar dt,
334
                const label cellI
335
            );
336

337
338
339
340
341
342
343
344
345
346
347
348
349
350
            //- Calculate surface thermo properties
            template<class TrackData>
            void calcSurfaceValues
            (
                TrackData& td,
                const label cellI,
                const scalar T,
                scalar& Ts,
                scalar& rhos,
                scalar& mus,
                scalar& Pr,
                scalar& kappa
            ) const;

351
            //- Update parcel properties over the time interval
352
            template<class TrackData>
353
            void calc
354
            (
355
356
                TrackData& td,
                const scalar dt,
357
                const label cellI
358
359
360
361
362
            );


        // I-O

Andrew Heather's avatar
updates    
Andrew Heather committed
363
            //- Read
364
            static void readFields(Cloud<ParcelType>& c);
365

Andrew Heather's avatar
updates    
Andrew Heather committed
366
            //- Write
367
            static void writeFields(const Cloud<ParcelType>& c);
368
369
370
371
372
373
374
375
376


    // Ostream Operator

        friend Ostream& operator<< <ParcelType>
        (
            Ostream&,
            const ThermoParcel<ParcelType>&
        );
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
};


// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

} // End namespace Foam

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

#include "ThermoParcelI.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

#ifdef NoRepository
    #include "ThermoParcel.C"
#endif

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

#endif

// ************************************************************************* //