1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
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
13 the Free Software Foundation, either version 3 of the License, or
14 (at your 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, see <http://www.gnu.org/licenses/>.
28 Reacting parcel class with one/two-way coupling with the continuous
36 \*---------------------------------------------------------------------------*/
38 #ifndef ReactingParcel_H
39 #define ReactingParcel_H
42 #include "SLGThermo.H"
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 template<class ParcelType>
52 template<class ParcelType>
56 const ReactingParcel<ParcelType>&
59 /*---------------------------------------------------------------------------*\
60 Class ReactingParcel Declaration
61 \*---------------------------------------------------------------------------*/
63 template<class ParcelType>
70 //- Class to hold reacting particle constant properties
71 class constantProperties
73 public ParcelType::constantProperties
77 //- Minimum pressure [Pa]
80 //- Constant volume flag - e.g. during mass transfer
81 Switch constantVolume_;
83 //- Vaporisation temperature [K]
98 constantProperties(const constantProperties& cp);
100 //- Constructor from dictionary
103 const dictionary& parentDict,
104 const bool readFields = true
107 //- Construct from components
110 const label parcelTypeId,
113 const scalar minParticleMass,
114 const scalar youngsModulus,
115 const scalar poissonsRatio,
119 const scalar epsilon0,
123 const Switch& constantVolume,
131 //- Return const access to the minimum pressure
132 inline scalar pMin() const;
134 //- Return const access to the constant volume flag
135 inline Switch constantVolume() const;
137 //- Return const access to the vaporisation temperature
138 inline scalar Tvap() const;
140 //- Return const access to the boiling point
141 inline scalar Tbp() const;
145 template<class CloudType>
148 public ParcelType::template TrackingData<CloudType>
154 // Interpolators for continuous phase fields
156 //- Interpolator for continuous phase pressure field
157 autoPtr<interpolation<scalar> > pInterp_;
162 typedef typename ParcelType::template TrackingData<CloudType>::trackPart
167 //- Construct from components
171 trackPart part = ParcelType::template
172 TrackingData<CloudType>::tpLinearTrack
178 //- Return const access to the interpolator for continuous phase
180 inline const interpolation<scalar>& pInterp() const;
190 //- Initial particle mass [kg]
193 //- Mass fractions of mixture []
197 // Cell-based quantities
203 // Protected Member Functions
205 //- Calculate Phase change
206 template<class TrackData>
210 const scalar dt, // timestep
211 const label cellI, // owner cell
212 const scalar Re, // Reynolds number
213 const scalar Ts, // Surface temperature
214 const scalar nus, // Surface kinematic viscosity
215 const scalar d, // diameter
216 const scalar T, // temperature
217 const scalar mass, // mass
218 const label idPhase, // id of phase involved in phase change
219 const scalar YPhase, // total mass fraction
220 const scalarField& YComponents, // component mass fractions
221 scalarField& dMassPC, // mass transfer - local to particle
222 scalar& Sh, // explicit particle enthalpy source
223 scalar& N, // flux of species emitted from particle
224 scalar& NCpW, // sum of N*Cp*W of emission species
225 scalarField& Cs // carrier conc. of emission species
228 //- Update mass fraction
229 scalar updateMassFraction
232 const scalarField& dMass,
239 // Static data members
241 //- String representation of properties
242 static string propHeader;
244 //- Runtime type information
245 TypeName("ReactingParcel");
250 //- Construct from owner, position, and cloud owner
251 // Other properties initialised as null
252 inline ReactingParcel
254 const polyMesh& mesh,
255 const vector& position,
257 const label tetFaceI,
261 //- Construct from components
262 inline ReactingParcel
264 const polyMesh& mesh,
265 const vector& position,
267 const label tetFaceI,
270 const scalar nParticle0,
272 const scalar dTarget0,
275 const vector& angularMomentum0,
276 const vector& torque0,
277 const scalarField& Y0,
278 const constantProperties& constProps
281 //- Construct from Istream
284 const polyMesh& mesh,
286 bool readFields = true
289 //- Construct as a copy
292 const ReactingParcel& p,
296 //- Construct as a copy
297 ReactingParcel(const ReactingParcel& p);
299 //- Construct and return a (basic particle) clone
300 virtual autoPtr<particle> clone() const
302 return autoPtr<particle>(new ReactingParcel<ParcelType>(*this));
305 //- Construct and return a (basic particle) clone
306 virtual autoPtr<particle> clone(const polyMesh& mesh) const
308 return autoPtr<particle>
310 new ReactingParcel<ParcelType>(*this, mesh)
314 //- Factory class to read-construct particles used for
318 const polyMesh& mesh_;
322 iNew(const polyMesh& mesh)
327 autoPtr<ReactingParcel<ParcelType> > operator()(Istream& is) const
329 return autoPtr<ReactingParcel<ParcelType> >
331 new ReactingParcel<ParcelType>(mesh_, is, true)
341 //- Return const access to initial mass
342 inline scalar mass0() const;
344 //- Return const access to mass fractions of mixture
345 inline const scalarField& Y() const;
347 //- Return the owner cell pressure
348 inline scalar pc() const;
350 //- Return reference to the owner cell pressure
356 //- Return access to initial mass
357 inline scalar& mass0();
359 //- Return access to mass fractions of mixture
360 inline scalarField& Y();
363 // Main calculation loop
366 template<class TrackData>
374 //- Correct cell values using latest transfer information
375 template<class TrackData>
376 void cellValueSourceCorrection
383 //- Correct surface values due to emitted species
384 template<class TrackData>
385 void correctSurfaceValues
390 const scalarField& Cs,
397 //- Update parcel properties over the time interval
398 template<class TrackData>
410 template<class CloudType, class CompositionType>
411 static void readFields
414 const CompositionType& compModel
417 //- Read - no composition
418 template<class CloudType>
419 static void readFields(CloudType& c);
422 template<class CloudType, class CompositionType>
423 static void writeFields
426 const CompositionType& compModel
429 //- Write - composition supplied
430 template<class CloudType>
431 static void writeFields(const CloudType& c);
436 friend Ostream& operator<< <ParcelType>
439 const ReactingParcel<ParcelType>&
444 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
446 } // End namespace Foam
448 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
450 #include "ReactingParcelI.H"
451 #include "ReactingParcelTrackingDataI.H"
453 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
456 #include "ReactingParcel.C"
459 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
463 // ************************************************************************* //