BUG: UListIO: byteSize overflowing on really big faceLists
[OpenFOAM-2.0.x.git] / src / lagrangian / intermediate / clouds / Templates / ReactingCloud / ReactingCloud.H
blob2de85665cc0c977419cb67c22179a0699de9c588
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
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
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
19     for more details.
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/>.
24 Class
25     Foam::ReactingCloud
27 Description
28     Templated base class for reacting cloud
30     - Adds to thermodynamic cloud
31       - Variable composition (single phase)
32       - Phase change
34 SourceFiles
35     ReactingCloudI.H
36     ReactingCloud.C
38 \*---------------------------------------------------------------------------*/
40 #ifndef ReactingCloud_H
41 #define ReactingCloud_H
43 #include "reactingCloud.H"
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 namespace Foam
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>
63 class ReactingCloud
65     public CloudType,
66     public reactingCloud
68 public:
70     // Public typedefs
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;
82 private:
84     // Private data
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&);
99 protected:
101     // Protected data
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> > >
111                 compositionModel_;
113             //- Reacting phase change model
114             autoPtr<PhaseChangeModel<ReactingCloud<CloudType> > >
115                 phaseChangeModel_;
118         // Sources
120             //- Mass transfer fields - one per carrier phase specie
121             PtrList<DimensionedField<scalar, volMesh> > rhoTrans_;
124         // Check
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
136             (
137                 const scalarField& YSupplied,
138                 const scalarField& Y,
139                 const word& YName
140             );
143         // Initialisation
145             //- Set cloud sub-models
146             void setModels();
149         // Cloud evolution functions
151             //- Reset state of cloud
152             void cloudReset(ReactingCloud<CloudType>& c);
155 public:
157     // Constructors
159         //- Construct given carrier gas fields
160         ReactingCloud
161         (
162             const word& cloudName,
163             const volScalarField& rho,
164             const volVectorField& U,
165             const dimensionedVector& g,
166             const SLGThermo& thermo,
167             bool readFields = true
168         );
170         //- Copy constructor with new name
171         ReactingCloud(ReactingCloud<CloudType>& c, const word& name);
173         //- Copy constructor with new name - creates bare cloud
174         ReactingCloud
175         (
176             const fvMesh& mesh,
177             const word& name,
178             const ReactingCloud<CloudType>& c
179         );
181         //- Construct and return clone based on (this) with new name
182         virtual autoPtr<Cloud<parcelType> > clone(const word& name)
183         {
184             return autoPtr<Cloud<parcelType> >
185             (
186                 new ReactingCloud(*this, name)
187             );
188         }
190         //- Construct and return bare clone based on (this) with new name
191         virtual autoPtr<Cloud<parcelType> > cloneBare(const word& name) const
192         {
193             return autoPtr<Cloud<parcelType> >
194             (
195                 new ReactingCloud(this->mesh(), name, *this)
196             );
197         }
200     //- Destructor
201     virtual ~ReactingCloud();
204     // Member Functions
206         // Access
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&
213                 constProps() const;
216             // Sub-models
218                 //- Return reference to reacting composition model
219                 inline const CompositionModel<ReactingCloud<CloudType> >&
220                     composition() const;
222                 //- Return reference to reacting phase change model
223                 inline const PhaseChangeModel<ReactingCloud<CloudType> >&
224                     phaseChange() const;
227             // Sources
229                 //- Mass
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> >&
237                         rhoTrans() const;
239                     //- Return reference to mass source fields
240                     inline PtrList<DimensionedField<scalar, volMesh> >&
241                         rhoTrans();
243                     //- Return mass source term for specie i - specie eqn
244                     inline tmp<fvScalarMatrix> SYi
245                     (
246                         const label i,
247                         volScalarField& Yi
248                     ) const;
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
255                     //  - fully explicit
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;
262         // Check
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
272             (
273                 parcelType& parcel,
274                 const scalar lagrangianDt
275             );
277             //- Check parcel properties
278             void checkParcelProperties
279             (
280                 parcelType& parcel,
281                 const scalar lagrangianDt,
282                 const bool fullyDescribed
283             );
285             //- Store the current cloud state
286             void storeState();
288             //- Reset the current cloud to the previously stored state
289             void restoreState();
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
298             void scaleSources();
300             //- Evolve the cloud
301             void evolve();
303             //- Print cloud information
304             void info() const;
307         // I-O
309             //- Write the field data for the cloud
310             virtual void writeFields() const;
314 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
316 } // End namespace Foam
318 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
320 #include "ReactingCloudI.H"
322 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
324 #ifdef NoRepository
325 #   include "ReactingCloud.C"
326 #endif
328 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
330 #endif
332 // ************************************************************************* //