1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
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
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
29 Reacting parcel class with one/two-way coupling with the continuous
37 \*---------------------------------------------------------------------------*/
39 #ifndef ReactingParcel_H
40 #define ReactingParcel_H
44 #include "interpolationCellPoint.H"
45 #include "contiguous.H"
47 #include "ThermoParcel.H"
48 #include "ReactingCloud.H"
49 #include "reactingParcel.H"
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
56 template<class ParcelType>
59 template<class ParcelType>
63 const ReactingParcel<ParcelType>&
66 /*---------------------------------------------------------------------------*\
67 Class ReactingParcel Declaration
68 \*---------------------------------------------------------------------------*/
70 template<class ParcelType>
73 public reactingParcel,
74 public ThermoParcel<ParcelType>
78 //- Class to hold reacting particle constant properties
79 class constantProperties
81 public ThermoParcel<ParcelType>::constantProperties
85 //- Minimum pressure [Pa]
88 //- Constant volume flag - e.g. during mass transfer
89 Switch constantVolume_;
91 //- Vaporisation temperature [K]
101 constantProperties(const dictionary& parentDict);
105 //- Return const access to the minimum pressure
106 inline scalar pMin() const;
108 //- Return const access to the constant volume flag
109 inline Switch constantVolume() const;
111 //- Return const access to the vaporisation temperature
112 inline scalar Tvap() const;
114 //- Return const access to the boiling point
115 inline scalar Tbp() const;
119 //- Class used to pass reacting tracking data to the trackToFace function
122 public ThermoParcel<ParcelType>::trackData
127 //- Reference to the cloud containing this particle
128 ReactingCloud<ParcelType>& cloud_;
130 //- Particle constant properties
131 const constantProperties& constProps_;
133 //- Interpolator for continuous phase pressure field
134 const interpolation<scalar>& pInterp_;
141 //- Construct from components
144 ReactingCloud<ParcelType>& cloud,
145 const constantProperties& constProps,
146 const interpolation<scalar>& rhoInterp,
147 const interpolation<vector>& UInterp,
148 const interpolation<scalar>& muInterp,
149 const interpolation<scalar>& TInterp,
150 const interpolation<scalar>& CpInterp,
151 const interpolation<scalar>& pInterp,
158 //- Return access to the owner cloud
159 inline ReactingCloud<ParcelType>& cloud();
161 //- Return const access to the constant properties
162 inline const constantProperties& constProps() const;
164 //- Return const access to the interpolator for continuous
165 // phase pressure field
166 inline const interpolation<scalar>& pInterp() const;
176 //- Initial particle mass [kg]
179 //- Mass fractions of mixture []
183 // Cell-based quantities
189 // Protected member functions
191 //- Calculate Phase change
192 template<class TrackData>
196 const scalar dt, // timestep
197 const label cellI, // owner cell
198 const scalar d, // diameter
199 const scalar T, // temperature
200 const vector& U, // velocity
201 const scalar mass, // mass
202 const label idPhase, // id of phase involved in phase change
203 const scalar YPhase, // total mass fraction
204 const scalarField& YComponents, // component mass fractions
205 scalarField& dMassPC, // mass transfer - local to particle
206 scalar& Sh, // explicit particle enthalpy source
207 scalar& dhsTrans // sensible enthalpy transfer to carrier
210 //- Update mass fraction
211 scalar updateMassFraction
214 const scalarField& dMass,
221 // Static data members
223 //- String representation of properties
224 static string propHeader;
226 //- Runtime type information
227 TypeName("ReactingParcel");
230 friend class Cloud<ParcelType>;
235 //- Construct from owner, position, and cloud owner
236 // Other properties initialised as null
237 inline ReactingParcel
239 ReactingCloud<ParcelType>& owner,
240 const vector& position,
244 //- Construct from components
245 inline ReactingParcel
247 ReactingCloud<ParcelType>& owner,
248 const vector& position,
251 const scalar nParticle0,
254 const scalarField& Y0,
255 const constantProperties& constProps
258 //- Construct from Istream
261 const Cloud<ParcelType>& c,
263 bool readFields = true
266 //- Construct as a copy
267 ReactingParcel(const ReactingParcel& p);
269 //- Construct and return a clone
270 autoPtr<ReactingParcel> clone() const
272 return autoPtr<ReactingParcel>(new ReactingParcel(*this));
280 //- Return const access to initial mass
281 inline scalar mass0() const;
283 //- Return const access to mass fractions of mixture
284 inline const scalarField& Y() const;
286 //- Return the owner cell pressure
287 inline scalar pc() const;
292 //- Return access to initial mass
293 inline scalar& mass0();
295 //- Return access to mass fractions of mixture
296 inline scalarField& Y();
299 // Main calculation loop
302 template<class TrackData>
310 //- Correct cell values using latest transfer information
311 template<class TrackData>
312 void cellValueSourceCorrection
319 //- Update parcel properties over the time interval
320 template<class TrackData>
332 static void readFields(ReactingCloud<ParcelType>& c);
335 static void writeFields(const ReactingCloud<ParcelType>& c);
340 friend Ostream& operator<< <ParcelType>
343 const ReactingParcel<ParcelType>&
348 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
350 } // End namespace Foam
352 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
354 #include "ReactingParcelI.H"
356 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
359 #include "ReactingParcel.C"
362 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
366 // ************************************************************************* //