ReactingParcel.H 10 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::ReactingParcel

Description
28
29
    Reacting parcel class with one/two-way coupling with the continuous
    phase.
30
31

SourceFiles
32
    ReactingParcelI.H
33
    ReactingParcel.C
34
    ReactingParcelIO.C
35
36
37
38
39
40
41
42

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

#ifndef ReactingParcel_H
#define ReactingParcel_H

#include "ThermoParcel.H"
#include "ReactingCloud.H"
43
#include "reactingParcel.H"
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66

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

namespace Foam
{

template<class ParcelType>
class ReactingParcel;

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

/*---------------------------------------------------------------------------*\
                        Class ReactingParcel Declaration
\*---------------------------------------------------------------------------*/

template<class ParcelType>
class ReactingParcel
:
67
    public reactingParcel,
68
69
70
71
    public ThermoParcel<ParcelType>
{
public:

72
    //- Class to hold reacting particle constant properties
73
74
75
76
77
78
    class constantProperties
    :
        public ThermoParcel<ParcelType>::constantProperties
    {
        // Private data

79
80
81
            //- Minimum pressure [Pa]
            const scalar pMin_;

82
83
84
            //- Constant volume flag - e.g. during mass transfer
            Switch constantVolume_;

Andrew Heather's avatar
Andrew Heather committed
85
            //- Vaporisation temperature [K]
86
87
            const scalar Tvap_;

Andrew Heather's avatar
Andrew Heather committed
88
89
90
            //- Boiling point [K]
            const scalar Tbp_;

91
92
93

    public:

94
        //- Constructor
95
        constantProperties(const dictionary& parentDict);
96

97
98
        // Access

99
100
101
            //- Return const access to the minimum pressure
            inline scalar pMin() const;

102
103
            //- Return const access to the constant volume flag
            inline Switch constantVolume() const;
104

Andrew Heather's avatar
Andrew Heather committed
105
            //- Return const access to the vaporisation temperature
106
            inline scalar Tvap() const;
Andrew Heather's avatar
Andrew Heather committed
107
108
109
110

            //- Return const access to the boiling point
            inline scalar Tbp() const;
   };
111
112


113
    //- Class used to pass reacting tracking data to the trackToFace function
114
115
116
117
118
119
120
121
122
123
    class trackData
    :
        public ThermoParcel<ParcelType>::trackData
    {

        // Private data

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

124
            //- Interpolator for continuous phase pressure field
125
            autoPtr<interpolation<scalar> > pInterp_;
126
127
128
129


    public:

130
131
132
        typedef ReactingCloud<ParcelType> cloudType;


133
134
        // Constructors

135
            //- Construct from components
136
137
138
            inline trackData
            (
                ReactingCloud<ParcelType>& cloud,
139
140
                typename ThermoParcel<ParcelType>::trackData::trackPart
                    part = ThermoParcel<ParcelType>::trackData::tpLinearTrack
141
142
143
144
145
            );


        // Member functions

146
            //- Return access to the owner cloud
147
148
            inline ReactingCloud<ParcelType>& cloud();

Andrew Heather's avatar
Andrew Heather committed
149
            //- Return const access to the interpolator for continuous
150
151
            //  phase pressure field
            inline const interpolation<scalar>& pInterp() const;
152
153
154
    };


155
156
157
158
159
160
161
162
163
164
protected:

    // Protected data

        // Parcel properties

            //- Initial particle mass [kg]
            scalar mass0_;

            //- Mass fractions of mixture []
165
            scalarField Y_;
166
167
168
169
170
171
172
173


        // Cell-based quantities

            //- Pressure [Pa]
            scalar pc_;


174
    // Protected Member Functions
175

176
        //- Calculate Phase change
177
        template<class TrackData>
178
        void calcPhaseChange
179
180
        (
            TrackData& td,
181
182
            const scalar dt,           // timestep
            const label cellI,         // owner cell
183
184
185
            const scalar Re,           // Reynolds number
            const scalar Ts,           // Surface temperature
            const scalar nus,          // Surface kinematic viscosity
186
187
            const scalar d,            // diameter
            const scalar T,            // temperature
188
            const scalar mass,         // mass
189
190
191
            const label idPhase,       // id of phase involved in phase change
            const scalar YPhase,       // total mass fraction
            const scalarField& YComponents, // component mass fractions
192
193
            scalarField& dMassPC,      // mass transfer - local to particle
            scalar& Sh,                // explicit particle enthalpy source
194
195
196
            scalar& N,                 // flux of species emitted from particle
            scalar& NCpW,              // sum of N*Cp*W of emission species
            scalarField& Cs            // carrier conc. of emission species
197
198
        );

199
        //- Update mass fraction
200
        scalar updateMassFraction
201
202
        (
            const scalar mass0,
203
            const scalarField& dMass,
204
            scalarField& Y
205
        ) const;
206

207
208
209

public:

210
211
212
213
214
215
216
217
    // Static data members

        //- String representation of properties
        static string propHeader;

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

218
219
220
221

    friend class Cloud<ParcelType>;


222
223
    // Constructors

Andrew Heather's avatar
Andrew Heather committed
224
225
226
227
228
229
        //- Construct from owner, position, and cloud owner
        //  Other properties initialised as null
        inline ReactingParcel
        (
            ReactingCloud<ParcelType>& owner,
            const vector& position,
230
231
232
            const label cellI,
            const label tetFaceI,
            const label tetPtI
Andrew Heather's avatar
Andrew Heather committed
233
234
        );

235
236
237
238
239
        //- Construct from components
        inline ReactingParcel
        (
            ReactingCloud<ParcelType>& owner,
            const vector& position,
240
            const label cellI,
241
242
            const label tetFaceI,
            const label tetPtI,
243
244
            const label typeId,
            const scalar nParticle0,
245
            const scalar d0,
graham's avatar
graham committed
246
            const scalar dTarget0,
247
            const vector& U0,
248
            const vector& f0,
249
250
            const vector& angularMomentum0,
            const vector& torque0,
251
            const scalarField& Y0,
252
253
254
255
256
257
258
259
260
261
262
            const constantProperties& constProps
        );

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

263
264
265
        //- Construct as a copy
        ReactingParcel(const ReactingParcel& p);

266
        //- Construct and return a clone
267
        autoPtr<ReactingParcel> clone() const
268
        {
269
            return autoPtr<ReactingParcel>(new ReactingParcel(*this));
270
271
272
273
274
275
276
        }


    // Member Functions

        // Access

277
278
            //- Return const access to initial mass
            inline scalar mass0() const;
279

280
            //- Return const access to mass fractions of mixture
281
            inline const scalarField& Y() const;
282

283
284
            //- Return the owner cell pressure
            inline scalar pc() const;
285
286
287
288


        // Edit

289
290
            //- Return access to initial mass
            inline scalar& mass0();
291
292

            //- Return access to mass fractions of mixture
293
            inline scalarField& Y();
294

295

296
        // Main calculation loop
297

298
            //- Set cell values
299
            template<class TrackData>
300
301
302
303
304
305
306
307
308
309
            void setCellValues
            (
                TrackData& td,
                const scalar dt,
                const label cellI
            );

            //- Correct cell values using latest transfer information
            template<class TrackData>
            void cellValueSourceCorrection
310
            (
311
312
                TrackData& td,
                const scalar dt,
313
                const label cellI
314
315
            );

316
317
318
319
320
321
322
323
324
325
326
327
328
329
            //- Correct surface values due to emitted species
            template<class TrackData>
            void correctSurfaceValues
            (
                TrackData& td,
                const label cellI,
                const scalar T,
                const scalarField& Cs,
                scalar& rhos,
                scalar& mus,
                scalar& Pr,
                scalar& kappa
            );

330
            //- Update parcel properties over the time interval
331
            template<class TrackData>
332
            void calc
333
            (
334
335
                TrackData& td,
                const scalar dt,
336
                const label cellI
337
            );
338
339
340
341


        // I-O

342
            //- Read
343
            static void readFields(Cloud<ParcelType>& c);
344

345
            //- Write
346
            static void writeFields(const Cloud<ParcelType>& c);
347
348
349
350
351
352
353
354
355


    // Ostream Operator

        friend Ostream& operator<< <ParcelType>
        (
            Ostream&,
            const ReactingParcel<ParcelType>&
        );
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
};


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

} // End namespace Foam

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

#include "ReactingParcelI.H"

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

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

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

#endif

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