ReactingCloud.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2024 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 "volFieldsFwd.H"
44 #include "fvMatricesFwd.H"
45 #include "dimensionedTypes.H"
46 #include "fvMesh.H"
47 #include "fluidThermo.H"
48 #include "Cloud.H"
49 
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 
52 namespace Foam
53 {
54 
55 // Forward declaration of classes
56 
57 template<class CloudType>
58 class PhaseChangeModel;
59 
60 
61 /*---------------------------------------------------------------------------*\
62  Class ReactingCloudName Declaration
63 \*---------------------------------------------------------------------------*/
64 
66 
67 
68 /*---------------------------------------------------------------------------*\
69  Class ReactingCloud Declaration
70 \*---------------------------------------------------------------------------*/
71 
72 template<class CloudType>
73 class ReactingCloud
74 :
75  public CloudType,
76  public ReactingCloudName
77 {
78 public:
79 
80  // Public Typedefs
81 
82  //- Type of cloud this cloud was instantiated for
83  typedef CloudType cloudType;
84 
85  //- Type of parcel the cloud was instantiated for
86  typedef typename CloudType::particleType parcelType;
87 
88  //- Convenience typedef for this cloud type
90 
91 
92 private:
93 
94  // Private Data
95 
96  //- Cloud copy pointer
97  autoPtr<ReactingCloud<CloudType>> cloudCopyPtr_;
98 
99 
100 
101 protected:
102 
103  // Protected data
104 
105  //- Parcel constant properties
106  typename parcelType::constantProperties constProps_;
107 
108 
109  // References to the cloud sub-models
110 
111  //- Reacting phase change model
114 
115 
116  // Sources
117 
118  //- Mass transfer fields - one per carrier phase specie
120 
121 
122  // Protected Member Functions
123 
124  // New parcel helper functions
125 
126  //- Check that size of a composition field is valid
128  (
129  const scalarField& YSupplied,
130  const scalarField& Y,
131  const word& YName
132  );
133 
134 
135  // Initialisation
136 
137  //- Set cloud sub-models
138  void setModels();
139 
140 
141  // Cloud evolution functions
142 
143  //- Reset state of cloud
145 
146 
147 public:
148 
149  // Constructors
150 
151  //- Construct given carrier fields and thermo
153  (
154  const word& cloudName,
155  const volScalarField& rho,
156  const volVectorField& U,
157  const dimensionedVector& g,
158  const fluidThermo& carrierThermo,
159  const bool readFields = true
160  );
161 
162  //- Copy constructor with new name
164 
165  //- Copy constructor with new name - creates bare cloud
167  (
168  const fvMesh& mesh,
169  const word& name,
171  );
172 
173  //- Disallow default bitwise copy construction
174  ReactingCloud(const ReactingCloud&) = delete;
175 
176  //- Construct and return clone based on (this) with new name
178  {
180  (
181  new ReactingCloud(*this, name)
182  );
183  }
184 
185  //- Construct and return bare clone based on (this) with new name
187  (
188  const word& name
189  ) const
190  {
192  (
193  new ReactingCloud(this->mesh(), name, *this)
194  );
195  }
196 
197 
198  //- Destructor
199  virtual ~ReactingCloud();
200 
201 
202  // Member Functions
203 
204  // Access
205 
206  //- Return a reference to the cloud copy
207  inline const ReactingCloud& cloudCopy() const;
208 
209  //- Return the constant properties
210  inline const typename parcelType::constantProperties&
211  constProps() const;
212 
213  //- Return access to the constant properties
214  inline typename parcelType::constantProperties& constProps();
215 
216 
217  // Sub-models
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  const volScalarField& Yi
249  ) const;
250 
251  //- Return tmp total mass source for carrier phase
252  // - fully explicit
253  inline tmp<volScalarField::Internal> Srho() const;
254 
255  //- Return total mass source term [kg/m^3/s]
257  (
258  const volScalarField& rho
259  ) const;
260 
261 
262  // Cloud evolution functions
263 
264  //- Set parcel thermo properties
266 
267  //- Check parcel properties
269  (
270  parcelType& parcel,
271  const label injectori
272  );
273 
274  //- Store the current cloud state
275  void storeState();
276 
277  //- Reset the current cloud to the previously stored state
278  void restoreState();
279 
280  //- Reset the cloud source terms
281  void resetSourceTerms();
282 
283  //- Apply relaxation to (steady state) cloud sources
284  void relaxSources(const ReactingCloud<CloudType>& cloudOldTime);
285 
286  //- Apply scaling to (transient) cloud sources
287  void scaleSources();
288 
289  //- Evolve the cloud
290  void evolve();
291 
292 
293  // I-O
294 
295  //- Print cloud information
296  void info();
297 
298 
299  // Member Operators
300 
301  //- Disallow default bitwise assignment
302  void operator=(const ReactingCloud&) = delete;
303 };
304 
305 
306 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
307 
308 } // End namespace Foam
309 
310 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
311 
312 #include "ReactingCloudI.H"
313 
314 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
315 
316 #ifdef NoRepository
317  #include "ReactingCloud.C"
318 #endif
319 
320 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
321 
322 #endif
323 
324 // ************************************************************************* //
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:80
const word & cloudName() const
Return the cloud type.
Definition: DSMCCloudI.H:34
const fvMesh & mesh() const
Return references to the mesh.
Definition: DSMCCloudI.H:41
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Generic GeometricField class.
autoPtr< IOobject > clone() const
Clone.
Definition: IOobject.H:280
const word & name() const
Return name.
Definition: IOobject.H:307
Templated phase change model class.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: PtrList.H:75
Templated base class for reacting cloud.
Definition: ReactingCloud.H:76
autoPtr< PhaseChangeModel< ReactingCloud< CloudType > > > phaseChangeModel_
Reacting phase change model.
const parcelType::constantProperties & constProps() const
Return the constant properties.
PtrList< volScalarField::Internal > rhoTrans_
Mass transfer fields - one per carrier phase specie.
const PtrList< volScalarField::Internal > & rhoTrans() const
Return const access to mass source fields.
void setModels()
Set cloud sub-models.
Definition: ReactingCloud.C:33
void storeState()
Store the current cloud state.
ReactingCloud< CloudType > reactingCloudType
Convenience typedef for this cloud type.
Definition: ReactingCloud.H:88
virtual ~ReactingCloud()
Destructor.
const ReactingCloud & cloudCopy() const
Return a reference to the cloud copy.
tmp< volScalarField::Internal > Srho() const
Return tmp total mass source for carrier phase.
void cloudReset(ReactingCloud< CloudType > &c)
Reset state of cloud.
Definition: ReactingCloud.C:67
void scaleSources()
Apply scaling to (transient) cloud sources.
tmp< fvScalarMatrix > SYi(const label i, const volScalarField &Yi) const
Return mass source term for specie i - specie eqn.
void checkSuppliedComposition(const scalarField &YSupplied, const scalarField &Y, const word &YName)
Check that size of a composition field is valid.
Definition: ReactingCloud.C:48
ReactingCloud(const word &cloudName, const volScalarField &rho, const volVectorField &U, const dimensionedVector &g, const fluidThermo &carrierThermo, const bool readFields=true)
Construct given carrier fields and thermo.
Definition: ReactingCloud.C:79
CloudType::particleType parcelType
Type of parcel the cloud was instantiated for.
Definition: ReactingCloud.H:85
CloudType cloudType
Type of cloud this cloud was instantiated for.
Definition: ReactingCloud.H:82
void evolve()
Evolve the cloud.
const PhaseChangeModel< ReactingCloud< CloudType > > & phaseChange() const
Return const access to reacting phase change model.
parcelType::constantProperties constProps_
Parcel constant properties.
void relaxSources(const ReactingCloud< CloudType > &cloudOldTime)
Apply relaxation to (steady state) cloud sources.
void info()
Print cloud information.
void restoreState()
Reset the current cloud to the previously stored state.
void operator=(const ReactingCloud &)=delete
Disallow default bitwise assignment.
void checkParcelProperties(parcelType &parcel, const label injectori)
Check parcel properties.
void resetSourceTerms()
Reset the cloud source terms.
void setParcelThermoProperties(parcelType &parcel)
Set parcel thermo properties.
virtual autoPtr< lagrangian::Cloud< parcelType > > cloneBare(const word &name) const
Construct and return bare clone based on (this) with new name.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
Base-class for fluid thermodynamic properties.
Definition: fluidThermo.H:56
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:96
A class for managing temporary objects.
Definition: tmp.H:55
A class for handling words, derived from string.
Definition: word.H:62
Forward declarations of fvMatrix specialisations.
U
Definition: pEqn.H:72
const dimensionedScalar c
Speed of light in a vacuum.
Namespace for OpenFOAM.
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 readFields(const typename GeoFieldType::Mesh &mesh, const IOobjectList &objects, const HashSet< word > &selectedFields, LIFOStack< regIOobject * > &storedObjects)
Read the selected GeometricFields of the specified type.
Definition: ReadFields.C:244
TemplateName(FvFaceCellWave)
PtrList< volScalarField > & Y