1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
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_;
139 typedef ReactingCloud<ParcelType> cloudType;
144 //- Construct from components
147 ReactingCloud<ParcelType>& cloud,
148 const constantProperties& constProps,
149 const interpolation<scalar>& rhoInterp,
150 const interpolation<vector>& UInterp,
151 const interpolation<scalar>& muInterp,
152 const interpolation<scalar>& TInterp,
153 const interpolation<scalar>& CpInterp,
154 const interpolation<scalar>& pInterp,
161 //- Return access to the owner cloud
162 inline ReactingCloud<ParcelType>& cloud();
164 //- Return const access to the constant properties
165 inline const constantProperties& constProps() const;
167 //- Return const access to the interpolator for continuous
168 // phase pressure field
169 inline const interpolation<scalar>& pInterp() const;
179 //- Initial particle mass [kg]
182 //- Mass fractions of mixture []
186 // Cell-based quantities
192 // Protected member functions
194 //- Calculate Phase change
195 template<class TrackData>
199 const scalar dt, // timestep
200 const label cellI, // owner cell
201 const scalar Re, // Reynolds number
202 const scalar Ts, // Surface temperature
203 const scalar nus, // Surface kinematic viscosity
204 const scalar d, // diameter
205 const scalar T, // temperature
206 const scalar mass, // mass
207 const label idPhase, // id of phase involved in phase change
208 const scalar YPhase, // total mass fraction
209 const scalarField& YComponents, // component mass fractions
210 scalarField& dMassPC, // mass transfer - local to particle
211 scalar& Sh, // explicit particle enthalpy source
212 scalar& N, // flux of species emitted from particle
213 scalar& NCpW, // sum of N*Cp*W of emission species
214 scalarField& Cs // carrier conc. of emission species
217 //- Update mass fraction
218 scalar updateMassFraction
221 const scalarField& dMass,
228 // Static data members
230 //- String representation of properties
231 static string propHeader;
233 //- Runtime type information
234 TypeName("ReactingParcel");
237 friend class Cloud<ParcelType>;
242 //- Construct from owner, position, and cloud owner
243 // Other properties initialised as null
244 inline ReactingParcel
246 ReactingCloud<ParcelType>& owner,
247 const vector& position,
251 //- Construct from components
252 inline ReactingParcel
254 ReactingCloud<ParcelType>& owner,
255 const vector& position,
258 const scalar nParticle0,
261 const scalarField& Y0,
262 const constantProperties& constProps
265 //- Construct from Istream
268 const Cloud<ParcelType>& c,
270 bool readFields = true
273 //- Construct as a copy
274 ReactingParcel(const ReactingParcel& p);
276 //- Construct and return a clone
277 autoPtr<ReactingParcel> clone() const
279 return autoPtr<ReactingParcel>(new ReactingParcel(*this));
287 //- Return const access to initial mass
288 inline scalar mass0() const;
290 //- Return const access to mass fractions of mixture
291 inline const scalarField& Y() const;
293 //- Return the owner cell pressure
294 inline scalar pc() const;
299 //- Return access to initial mass
300 inline scalar& mass0();
302 //- Return access to mass fractions of mixture
303 inline scalarField& Y();
306 // Main calculation loop
309 template<class TrackData>
317 //- Correct cell values using latest transfer information
318 template<class TrackData>
319 void cellValueSourceCorrection
326 //- Correct surface values due to emitted species
327 template<class TrackData>
328 void correctSurfaceValues
333 const scalarField& Cs,
340 //- Update parcel properties over the time interval
341 template<class TrackData>
353 static void readFields(Cloud<ParcelType>& c);
356 static void writeFields(const Cloud<ParcelType>& c);
361 friend Ostream& operator<< <ParcelType>
364 const ReactingParcel<ParcelType>&
369 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
371 } // End namespace Foam
373 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
375 #include "ReactingParcelI.H"
377 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
380 #include "ReactingParcel.C"
383 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
387 // ************************************************************************* //