initial commit for version 1.5.x patch release
[OpenFOAM-1.5.x.git] / src / lagrangian / intermediate / parcels / Templates / ReactingParcel / ReactingParcel.H
blob43e125f13bb8d2c1c2c4e76b18639c316111044c
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2008 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
11     OpenFOAM is free software; you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by the
13     Free Software Foundation; either version 2 of the License, or (at your
14     option) any later version.
16     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Class
26     Foam::ReactingParcel
28 Description
29     Reactinf parcel class with one/two-way coupling with the continuous
30     phase. Includes thermo parcel sub-models, plus:
31     - combustion
33 SourceFiles
34     ReactingParcelI.H
35     ReactingParcel.C
36     ReactingParcelIO.C
38 \*---------------------------------------------------------------------------*/
40 #ifndef ReactingParcel_H
41 #define ReactingParcel_H
43 #include "IOstream.H"
44 #include "autoPtr.H"
45 #include "interpolationCellPoint.H"
46 #include "contiguous.H"
48 #include "ThermoParcel.H"
49 #include "ReactingCloud.H"
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 namespace Foam
56 template<class ParcelType>
57 class ReactingParcel;
59 template<class ParcelType>
60 Ostream& operator<<
62     Ostream&,
63     const ReactingParcel<ParcelType>&
66 /*---------------------------------------------------------------------------*\
67                         Class ReactingParcel Declaration
68 \*---------------------------------------------------------------------------*/
70 template<class ParcelType>
71 class ReactingParcel
73     public ThermoParcel<ParcelType>
76 public:
78     //- Class to hold reacting particle constant properties
79     class constantProperties
80     :
81         public ThermoParcel<ParcelType>::constantProperties
82     {
84         // Private data
86             //- Vapourisation temperature [K]
87             const scalar Tvap_;
89             //- Boiling point [K]
90             const scalar Tbp_;
93     public:
95         //- Constructor
96         constantProperties(const dictionary& dict);
98         // Access
100             //- Return const access to the vapourisation temperature
101             inline scalar Tvap() const;
103             //- Return const access to the boiling point
104             inline scalar Tbp() const;
105     };
108     //- Class used to pass reacting tracking data to the trackToFace function
109     class trackData
110     :
111         public ThermoParcel<ParcelType>::trackData
112     {
114         // Private data
116             //- Reference to the cloud containing this particle
117             ReactingCloud<ParcelType>& cloud_;
119             //- Particle constant properties
120             const constantProperties& constProps_;
122             //- Interpolator for continuous phase pressure field
123             const interpolation<scalar>& pInterp_;
126     public:
128         // Constructors
130             //- Construct from components
131             inline trackData
132             (
133                 ReactingCloud<ParcelType>& cloud,
134                 const constantProperties& constProps,
135                 const interpolation<scalar>& rhoInterp,
136                 const interpolation<vector>& UInterp,
137                 const interpolation<scalar>& muInterp,
138                 const interpolation<scalar>& TInterp,
139                 const interpolation<scalar>& CpInterp,
140                 const interpolation<scalar>& pInterp,
141                 const vector& g
142             );
145         // Member functions
147             //- Return access to the owner cloud
148             inline ReactingCloud<ParcelType>& cloud();
150             //- Return const access to the constant properties
151             inline const constantProperties& constProps() const;
153             //- Return conat access to the interpolator for continuous
154             //  phase pressure field
155             inline const interpolation<scalar>& pInterp() const;
156     };
159 protected:
161     // Protected data
163         // Parcel properties
165             //- Initial particle mass [kg]
166             scalar mass0_;
168             //- Mass fractions of mixture []
169             scalarField YMixture_;
171             //- Mass fractions of gases []
172             scalarField YGas_;
174             //- Mass fractions of liquids []
175             scalarField YLiquid_;
177             //- Mass fractions of solids []
178             scalarField YSolid_;
180             //- Flag to say that the particle is allowed to combust
181             //  Only true after volatile content falls below threshold value
182             bool canCombust_;
185         // Cell-based quantities
187             //- Pressure [Pa]
188             scalar pc_;
191     // Protected member functions
193         //- Calculate mass transfer
194         template<class TrackData>
195         void calcMassTransfer
196         (
197             TrackData& td,
198             const scalar dt,
199             const scalar T0,
200             const scalar T1,
201             scalarList& dMassMT
202         );
204         //- Calculate surface reactions
205         template<class TrackData>
206         void calcSurfaceReactions
207         (
208             TrackData& td,
209             const scalar dt,
210             const label celli,
211             const scalar T0,
212             const scalar T1,
213             scalar& dMassMTSR,
214             scalarList& dMassMT
215         );
218 public:
220     //- Runtime type information
221     TypeName("ReactingParcel");
223     friend class Cloud<ParcelType>;
226     // Constructors
228         //- Construct from components
229         inline ReactingParcel
230         (
231             ReactingCloud<ParcelType>& owner,
232             const label typeId,
233             const vector& position,
234             const label celli,
235             const scalar d0,
236             const vector& U0,
237             const scalar nParticle0,
238             const scalarField& YGas0,
239             const scalarField& YLiquid0,
240             const scalarField& YSolid0,
241             const scalarField& YMixture0,
242             const constantProperties& constProps
243         );
245         //- Construct from Istream
246         ReactingParcel
247         (
248             const Cloud<ParcelType>& c,
249             Istream& is,
250             bool readFields = true
251         );
253         //- Construct and return a clone
254         autoPtr<ParcelType> clone() const
255         {
256             return autoPtr<ParcelType>(new ReactingParcel<ParcelType>(*this));
257         }
260     // Member Functions
262         // Access
264             //- Return const access to mass fractions of gases
265             inline const scalarField& YGas() const;
267             //- Return const access to mass fractions of liquids
268             inline const scalarField& YLiquid() const;
270             //- Return const access to mass fractions of solids
271             inline const scalarField& YSolid() const;
273             //- Return const access to mass fractions of mixture
274             inline const scalarField& YMixture() const;
276             //- Return const access to initial mass
277             inline scalar mass0() const;
280         // Edit
282             //- Return access to mass fractions of gases
283             inline scalarField& YGas();
285             //- Return access to mass fractions of liquids
286             inline scalarField& YLiquid();
288             //- Return access to mass fractions of solids
289             inline scalarField& YSolid();
291             //- Return access to mass fractions of mixture
292             inline scalarField& YMixture();
294             //- Return access to initial mass
295             inline scalar& mass0();
298         // Main calculation loop
300             //- Update cell based quantities
301             template<class TrackData>
302             void updateCellQuantities
303             (
304                 TrackData& td,
305                 const scalar dt,
306                 const label celli
307             );
309             //- Coupled calculation with the continuous phase
310             template<class TrackData>
311             void calcCoupled
312             (
313                 TrackData& td,
314                 const scalar dt,
315                 const label celli
316             );
318             //- Uncoupled calculation with the continuous phase
319             template<class TrackData>
320             void calcUncoupled
321             (
322                 TrackData& td,
323                 const scalar dt,
324                 const label
325             );
328         // I-O
330             static void readFields(ReactingCloud<ParcelType>& c);
332             static void writeFields(const ReactingCloud<ParcelType>& c);
335     // Ostream Operator
337         friend Ostream& operator<< <ParcelType>
338         (
339             Ostream&,
340             const ReactingParcel<ParcelType>&
341         );
345 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
347 } // End namespace Foam
349 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
351 #include "ReactingParcelI.H"
353 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
355 #ifdef NoRepository
356     #include "ReactingParcel.C"
357 #endif
359 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
361 #endif
363 // ************************************************************************* //