ReactingCloud.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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.
20 
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/>.
23 
24 Class
25  Foam::ReactingCloud
26 
27 Description
28  Templated base class for reacting cloud
29 
30  - Adds to thermodynamic cloud
31  - Variable composition (single phase)
32  - Phase change
33 
34 SourceFiles
35  ReactingCloudI.H
36  ReactingCloud.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef ReactingCloud_H
41 #define ReactingCloud_H
42 
43 #include "reactingCloud.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 // Forward declaration of classes
51 
52 template<class CloudType>
53 class CompositionModel;
54 
55 template<class CloudType>
56 class PhaseChangeModel;
57 
58 /*---------------------------------------------------------------------------*\
59  Class ReactingCloud Declaration
60 \*---------------------------------------------------------------------------*/
61 
62 template<class CloudType>
63 class ReactingCloud
64 :
65  public CloudType,
66  public reactingCloud
67 {
68 public:
69 
70  // Public typedefs
71 
72  //- Type of cloud this cloud was instantiated for
73  typedef CloudType cloudType;
74 
75  //- Type of parcel the cloud was instantiated for
76  typedef typename CloudType::particleType parcelType;
77 
78  //- Convenience typedef for this cloud type
80 
81 
82 private:
83 
84  // Private data
85 
86  //- Cloud copy pointer
87  autoPtr<ReactingCloud<CloudType> > cloudCopyPtr_;
88 
89 
90  // Private member functions
91 
92  //- Disallow default bitwise copy construct
94 
95  //- Disallow default bitwise assignment
96  void operator=(const ReactingCloud&);
97 
98 
99 protected:
100 
101  // Protected data
102 
103  //- Parcel constant properties
104  typename parcelType::constantProperties constProps_;
105 
106 
107  // References to the cloud sub-models
108 
109  //- Reacting composition model
112 
113  //- Reacting phase change model
116 
117 
118  // Sources
119 
120  //- Mass transfer fields - one per carrier phase specie
122 
123 
124  // Protected Member Functions
125 
126  // New parcel helper functions
127 
128  //- Check that size of a composition field is valid
130  (
131  const scalarField& YSupplied,
132  const scalarField& Y,
133  const word& YName
134  );
135 
136 
137  // Initialisation
138 
139  //- Set cloud sub-models
140  void setModels();
141 
142 
143  // Cloud evolution functions
144 
145  //- Reset state of cloud
147 
148 
149 public:
150 
151  // Constructors
152 
153  //- Construct given carrier gas fields
155  (
156  const word& cloudName,
157  const volScalarField& rho,
158  const volVectorField& U,
159  const dimensionedVector& g,
160  const SLGThermo& thermo,
161  bool readFields = true
162  );
163 
164  //- Copy constructor with new name
166 
167  //- Copy constructor with new name - creates bare cloud
169  (
170  const fvMesh& mesh,
171  const word& name,
173  );
174 
175  //- Construct and return clone based on (this) with new name
176  virtual autoPtr<Cloud<parcelType> > clone(const word& name)
177  {
179  (
180  new ReactingCloud(*this, name)
181  );
182  }
183 
184  //- Construct and return bare clone based on (this) with new name
185  virtual autoPtr<Cloud<parcelType> > cloneBare(const word& name) const
186  {
188  (
189  new ReactingCloud(this->mesh(), name, *this)
190  );
191  }
192 
193 
194  //- Destructor
195  virtual ~ReactingCloud();
196 
197 
198  // Member Functions
199 
200  // Access
201 
202  //- Return a reference to the cloud copy
203  inline const ReactingCloud& cloudCopy() const;
204 
205  //- Return the constant properties
206  inline const typename parcelType::constantProperties&
207  constProps() const;
208 
209  //- Return access to the constant properties
210  inline typename parcelType::constantProperties& constProps();
211 
212 
213  // Sub-models
214 
215  //- Return const access to reacting composition model
217  composition() const;
218 
219  //- Return const access to reacting phase change model
221  phaseChange() const;
222 
223  //- Return reference to reacting phase change model
225  phaseChange();
226 
227 
228  // Sources
229 
230  //- Mass
231 
232  //- Return reference to mass source for field i
234  rhoTrans(const label i);
235 
236  //- Return const access to mass source fields
238  rhoTrans() const;
239 
240  //- Return reference to mass source fields
242  rhoTrans();
243 
244  //- Return mass source term for specie i - specie eqn
245  inline tmp<fvScalarMatrix> SYi
246  (
247  const label i,
248  volScalarField& Yi
249  ) const;
250 
251  //- Return tmp mass source for field i - fully explicit
253  Srho(const label i) const;
254 
255  //- Return tmp total mass source for carrier phase
256  // - fully explicit
258 
259  //- Return total mass source term [kg/m3/s]
261 
262 
263  // Cloud evolution functions
264 
265  //- Set parcel thermo properties
267  (
268  parcelType& parcel,
269  const scalar lagrangianDt
270  );
271 
272  //- Check parcel properties
274  (
275  parcelType& parcel,
276  const scalar lagrangianDt,
277  const bool fullyDescribed
278  );
279 
280  //- Store the current cloud state
281  void storeState();
282 
283  //- Reset the current cloud to the previously stored state
284  void restoreState();
285 
286  //- Reset the cloud source terms
287  void resetSourceTerms();
288 
289  //- Apply relaxation to (steady state) cloud sources
290  void relaxSources(const ReactingCloud<CloudType>& cloudOldTime);
291 
292  //- Apply scaling to (transient) cloud sources
293  void scaleSources();
294 
295  //- Evolve the cloud
296  void evolve();
297 
298 
299  // Mapping
300 
301  //- Remap the cells of particles corresponding to the
302  // mesh topology change with a default tracking data object
303  virtual void autoMap(const mapPolyMesh&);
304 
305 
306  // I-O
307 
308  //- Print cloud information
309  void info();
310 
311  //- Write the field data for the cloud
312  virtual void writeFields() const;
313 };
314 
315 
316 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
317 
318 } // End namespace Foam
319 
320 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
321 
322 #include "ReactingCloudI.H"
323 
324 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
325 
326 #ifdef NoRepository
327 # include "ReactingCloud.C"
328 #endif
329 
330 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
331 
332 #endif
333 
334 // ************************************************************************* //
tmp< fvScalarMatrix > SYi(const label i, volScalarField &Yi) const
Return mass source term for specie i - specie eqn.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
tmp< DimensionedField< scalar, volMesh > > Srho() const
Return tmp total mass source for carrier phase.
Foam::autoPtr< IOobject > clone() const
Clone.
Definition: IOobject.H:239
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: List.H:61
virtual void autoMap(const mapPolyMesh &)
Remap the cells of particles corresponding to the.
CloudType::particleType parcelType
Type of parcel the cloud was instantiated for.
Definition: ReactingCloud.H:75
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
void cloudReset(ReactingCloud< CloudType > &c)
Reset state of cloud.
Definition: ReactingCloud.C:84
const PhaseChangeModel< ReactingCloud< CloudType > > & phaseChange() const
Return const access to reacting phase change model.
Virtual abstract base class for templated ReactingCloud.
Definition: reactingCloud.H:48
A class for handling words, derived from string.
Definition: word.H:59
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
void info()
Print cloud information.
const parcelType::constantProperties & constProps() const
Return the constant properties.
PtrList< DimensionedField< scalar, volMesh > > rhoTrans_
Mass transfer fields - one per carrier phase specie.
void resetSourceTerms()
Reset the cloud source terms.
const CompositionModel< ReactingCloud< CloudType > > & composition() const
Return const access to reacting composition model.
CloudType cloudType
Type of cloud this cloud was instantiated for.
Definition: ReactingCloud.H:72
Templated phase change model class.
Definition: ReactingCloud.H:55
Namespace for OpenFOAM.
void evolve()
Evolve the cloud.
Thermo package for (S)olids (L)iquids and (G)ases Takes reference to thermo package, and provides:
Definition: SLGThermo.H:62
Templated base class for reacting cloud.
Definition: ReactingCloud.H:62
autoPtr< PhaseChangeModel< ReactingCloud< CloudType > > > phaseChangeModel_
Reacting phase change model.
void restoreState()
Reset the current cloud to the previously stored state.
ReactingCloud< CloudType > reactingCloudType
Convenience typedef for this cloud type.
Definition: ReactingCloud.H:78
void checkParcelProperties(parcelType &parcel, const scalar lagrangianDt, const bool fullyDescribed)
Check parcel properties.
void setParcelThermoProperties(parcelType &parcel, const scalar lagrangianDt)
Set parcel thermo properties.
PtrList< volScalarField > & Y
Definition: createFields.H:36
virtual void writeFields() const
Write the field data for the cloud.
parcelType::constantProperties constProps_
Parcel constant properties.
autoPtr< CompositionModel< ReactingCloud< CloudType > > > compositionModel_
Reacting composition model.
const word & name() const
Return name.
Definition: IOobject.H:260
const word & cloudName() const
Return the cloud type.
Definition: DSMCCloudI.H:34
void scaleSources()
Apply scaling to (transient) cloud sources.
const dimensionedVector & g
const ReactingCloud & cloudCopy() const
Return a reference to the cloud copy.
Templated reacting parcel composition model class Consists of carrier species (via thermo package)...
Definition: ReactingCloud.H:52
const dimensionedScalar c
Speed of light in a vacuum.
virtual ~ReactingCloud()
Destructor.
const fvMesh & mesh() const
Return refernce to the mesh.
Definition: DSMCCloudI.H:41
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:68
void setModels()
Set cloud sub-models.
Definition: ReactingCloud.C:34
ParcelType particleType
Definition: Cloud.H:114
This function object reads fields from the time directories and adds them to the mesh database for fu...
Definition: readFields.H:102
const PtrList< DimensionedField< scalar, volMesh > > & rhoTrans() const
Return const access to mass source fields.
void checkSuppliedComposition(const scalarField &YSupplied, const scalarField &Y, const word &YName)
Check that size of a composition field is valid.
Definition: ReactingCloud.C:58
Basic thermodynamics type based on the use of fitting functions for cp, h, s obtained from the templa...
void storeState()
Store the current cloud state.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117
A class for managing temporary objects.
Definition: PtrList.H:118
U
Definition: pEqn.H:82
void relaxSources(const ReactingCloud< CloudType > &cloudOldTime)
Apply relaxation to (steady state) cloud sources.
virtual autoPtr< Cloud< parcelType > > cloneBare(const word &name) const
Construct and return bare clone based on (this) with new name.