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 Templated base class for reacting cloud
30 - Adds to thermodynamic cloud
31 - Variable composition (single phase)
38 \*---------------------------------------------------------------------------*/
40 #ifndef ReactingCloud_H
41 #define ReactingCloud_H
43 #include "reactingCloud.H"
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 // Forward declaration of classes
52 template<class CloudType>
53 class CompositionModel;
55 template<class CloudType>
56 class PhaseChangeModel;
58 /*---------------------------------------------------------------------------*\
59 Class ReactingCloud Declaration
60 \*---------------------------------------------------------------------------*/
62 template<class CloudType>
72 //- Type of cloud this cloud was instantiated for
73 typedef CloudType cloudType;
75 //- Type of parcel the cloud was instantiated for
76 typedef typename CloudType::particleType parcelType;
78 //- Convenience typedef for this cloud type
79 typedef ReactingCloud<CloudType> reactingCloudType;
86 //- Cloud copy pointer
87 autoPtr<ReactingCloud<CloudType> > cloudCopyPtr_;
90 // Private member functions
92 //- Disallow default bitwise copy construct
93 ReactingCloud(const ReactingCloud&);
95 //- Disallow default bitwise assignment
96 void operator=(const ReactingCloud&);
103 //- Parcel constant properties
104 typename parcelType::constantProperties constProps_;
107 // References to the cloud sub-models
109 //- Reacting composition model
110 autoPtr<CompositionModel<ReactingCloud<CloudType> > >
113 //- Reacting phase change model
114 autoPtr<PhaseChangeModel<ReactingCloud<CloudType> > >
120 //- Mass transfer fields - one per carrier phase specie
121 PtrList<DimensionedField<scalar, volMesh> > rhoTrans_;
126 //- Total mass transferred to continuous phase via phase change
127 scalar dMassPhaseChange_;
130 // Protected Member Functions
132 // New parcel helper functions
134 //- Check that size of a composition field is valid
135 void checkSuppliedComposition
137 const scalarField& YSupplied,
138 const scalarField& Y,
145 //- Set cloud sub-models
149 // Cloud evolution functions
151 //- Reset state of cloud
152 void cloudReset(ReactingCloud<CloudType>& c);
159 //- Construct given carrier gas fields
162 const word& cloudName,
163 const volScalarField& rho,
164 const volVectorField& U,
165 const dimensionedVector& g,
166 const SLGThermo& thermo,
167 bool readFields = true
170 //- Copy constructor with new name
171 ReactingCloud(ReactingCloud<CloudType>& c, const word& name);
173 //- Copy constructor with new name - creates bare cloud
178 const ReactingCloud<CloudType>& c
181 //- Construct and return clone based on (this) with new name
182 virtual autoPtr<Cloud<parcelType> > clone(const word& name)
184 return autoPtr<Cloud<parcelType> >
186 new ReactingCloud(*this, name)
190 //- Construct and return bare clone based on (this) with new name
191 virtual autoPtr<Cloud<parcelType> > cloneBare(const word& name) const
193 return autoPtr<Cloud<parcelType> >
195 new ReactingCloud(this->mesh(), name, *this)
201 virtual ~ReactingCloud();
208 //- Return a reference to the cloud copy
209 inline const ReactingCloud& cloudCopy() const;
211 //- Return the constant properties
212 inline const typename parcelType::constantProperties&
218 //- Return reference to reacting composition model
219 inline const CompositionModel<ReactingCloud<CloudType> >&
222 //- Return reference to reacting phase change model
223 inline const PhaseChangeModel<ReactingCloud<CloudType> >&
231 //- Return reference to mass source for field i
232 inline DimensionedField<scalar, volMesh>&
233 rhoTrans(const label i);
235 //- Return const access to mass source fields
236 inline const PtrList<DimensionedField<scalar, volMesh> >&
239 //- Return reference to mass source fields
240 inline PtrList<DimensionedField<scalar, volMesh> >&
243 //- Return mass source term for specie i - specie eqn
244 inline tmp<fvScalarMatrix> SYi
250 //- Return tmp mass source for field i - fully explicit
251 inline tmp<DimensionedField<scalar, volMesh> >
252 Srho(const label i) const;
254 //- Return tmp total mass source for carrier phase
256 inline tmp<DimensionedField<scalar, volMesh> > Srho() const;
258 //- Return total mass source term [kg/m3/s]
259 inline tmp<fvScalarMatrix> Srho(volScalarField& rho) const;
264 //- Add to cumulative phase change mass transfer
265 void addToMassPhaseChange(const scalar dMass);
268 // Cloud evolution functions
270 //- Set parcel thermo properties
271 void setParcelThermoProperties
274 const scalar lagrangianDt
277 //- Check parcel properties
278 void checkParcelProperties
281 const scalar lagrangianDt,
282 const bool fullyDescribed
285 //- Store the current cloud state
288 //- Reset the current cloud to the previously stored state
291 //- Reset the cloud source terms
292 void resetSourceTerms();
294 //- Apply relaxation to (steady state) cloud sources
295 void relaxSources(const ReactingCloud<CloudType>& cloudOldTime);
297 //- Apply scaling to (transient) cloud sources
303 //- Print cloud information
309 //- Write the field data for the cloud
310 virtual void writeFields() const;
314 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
316 } // End namespace Foam
318 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
320 #include "ReactingCloudI.H"
322 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
325 # include "ReactingCloud.C"
328 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
332 // ************************************************************************* //