updates
[OpenFOAM-1.5.x.git] / src / lagrangian / intermediate / parcels / Templates / ReactingParcel / ReactingParcel.H
bloba6b8eb5ad57aeebe30f8b7568ad242bdcb64387f
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_;
92             //- Latent heat of devolatilisation [J/kg]
93             const scalar Ldevol_;
96     public:
98         //- Constructor
99         constantProperties(const dictionary& dict);
101         // Access
103             //- Return const access to the vapourisation temperature
104             inline scalar Tvap() const;
106             //- Return const access to the boiling point
107             inline scalar Tbp() const;
109             //- Return const access to the latent heat of devolatilisation
110             inline scalar Ldevol() const;
111     };
114     //- Class used to pass reacting tracking data to the trackToFace function
115     class trackData
116     :
117         public ThermoParcel<ParcelType>::trackData
118     {
120         // Private data
122             //- Reference to the cloud containing this particle
123             ReactingCloud<ParcelType>& cloud_;
125             //- Particle constant properties
126             const constantProperties& constProps_;
128             //- Interpolator for continuous phase pressure field
129             const interpolation<scalar>& pInterp_;
132     public:
134         // Constructors
136             //- Construct from components
137             inline trackData
138             (
139                 ReactingCloud<ParcelType>& cloud,
140                 const constantProperties& constProps,
141                 const interpolation<scalar>& rhoInterp,
142                 const interpolation<vector>& UInterp,
143                 const interpolation<scalar>& muInterp,
144                 const interpolation<scalar>& TInterp,
145                 const interpolation<scalar>& CpInterp,
146                 const interpolation<scalar>& pInterp,
147                 const vector& g
148             );
151         // Member functions
153             //- Return access to the owner cloud
154             inline ReactingCloud<ParcelType>& cloud();
156             //- Return const access to the constant properties
157             inline const constantProperties& constProps() const;
159             //- Return conat access to the interpolator for continuous
160             //  phase pressure field
161             inline const interpolation<scalar>& pInterp() const;
162     };
165 protected:
167     // Protected data
169         // Parcel properties
171             //- Initial particle mass [kg]
172             scalar mass0_;
174             //- Mass fractions of mixture []
175             scalarField YMixture_;
177             //- Mass fractions of gases []
178             scalarField YGas_;
180             //- Mass fractions of liquids []
181             scalarField YLiquid_;
183             //- Mass fractions of solids []
184             scalarField YSolid_;
186             //- Flag to say that the particle is allowed to combust
187             //  Only true after volatile content falls below threshold value
188             bool canCombust_;
191         // Cell-based quantities
193             //- Pressure [Pa]
194             scalar pc_;
197     // Protected member functions
199         //- Calculate mass transfer
200         template<class TrackData>
201         void calcMassTransfer
202         (
203             TrackData& td,
204             const scalar dt,
205             const scalar T0,
206             const scalar T1,
207             scalarList& dMassMT
208         );
210         //- Calculate surface reactions
211         template<class TrackData>
212         void calcSurfaceReactions
213         (
214             TrackData& td,
215             const scalar dt,
216             const label celli,
217             const scalar T0,
218             const scalar T1,
219             const scalarList& dMassMT,
220             scalarList& dMassSR,
221             scalar& dhRet
222         );
225 public:
227     //- Runtime type information
228     TypeName("ReactingParcel");
230     friend class Cloud<ParcelType>;
233     // Constructors
235         //- Construct from components
236         inline ReactingParcel
237         (
238             ReactingCloud<ParcelType>& owner,
239             const label typeId,
240             const vector& position,
241             const label celli,
242             const scalar d0,
243             const vector& U0,
244             const scalar nParticle0,
245             const scalarField& YGas0,
246             const scalarField& YLiquid0,
247             const scalarField& YSolid0,
248             const scalarField& YMixture0,
249             const constantProperties& constProps
250         );
252         //- Construct from Istream
253         ReactingParcel
254         (
255             const Cloud<ParcelType>& c,
256             Istream& is,
257             bool readFields = true
258         );
260         //- Construct and return a clone
261         autoPtr<ParcelType> clone() const
262         {
263             return autoPtr<ParcelType>(new ReactingParcel<ParcelType>(*this));
264         }
267     // Member Functions
269         // Access
271             //- Return const access to mass fractions of gases
272             inline const scalarField& YGas() const;
274             //- Return const access to mass fractions of liquids
275             inline const scalarField& YLiquid() const;
277             //- Return const access to mass fractions of solids
278             inline const scalarField& YSolid() const;
280             //- Return const access to mass fractions of mixture
281             inline const scalarField& YMixture() const;
283             //- Return const access to initial mass
284             inline scalar mass0() const;
287         // Edit
289             //- Return access to mass fractions of gases
290             inline scalarField& YGas();
292             //- Return access to mass fractions of liquids
293             inline scalarField& YLiquid();
295             //- Return access to mass fractions of solids
296             inline scalarField& YSolid();
298             //- Return access to mass fractions of mixture
299             inline scalarField& YMixture();
301             //- Return access to initial mass
302             inline scalar& mass0();
305         // Main calculation loop
307             //- Update cell based quantities
308             template<class TrackData>
309             void updateCellQuantities
310             (
311                 TrackData& td,
312                 const scalar dt,
313                 const label celli
314             );
316             //- Coupled calculation with the continuous phase
317             template<class TrackData>
318             void calcCoupled
319             (
320                 TrackData& td,
321                 const scalar dt,
322                 const label celli
323             );
325             //- Uncoupled calculation with the continuous phase
326             template<class TrackData>
327             void calcUncoupled
328             (
329                 TrackData& td,
330                 const scalar dt,
331                 const label
332             );
335         // I-O
337             static void readFields(ReactingCloud<ParcelType>& c);
339             static void writeFields(const ReactingCloud<ParcelType>& c);
342     // Ostream Operator
344         friend Ostream& operator<< <ParcelType>
345         (
346             Ostream&,
347             const ReactingParcel<ParcelType>&
348         );
352 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
354 } // End namespace Foam
356 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
358 #include "ReactingParcelI.H"
360 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
362 #ifdef NoRepository
363     #include "ReactingParcel.C"
364 #endif
366 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
368 #endif
370 // ************************************************************************* //