psiuMulticomponentThermo.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-2023 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::psiuMulticomponentThermo
26 
27 Description
28  Base-class for combustion fluid thermodynamic properties based on
29  compressibility.
30 
31 See also
32  Foam::basicThermo
33 
34 SourceFiles
35  psiuMulticomponentThermo.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef psiuMulticomponentThermo_H
40 #define psiuMulticomponentThermo_H
41 
42 #include "psiThermo.H"
44 #include "speciesTable.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 
52 /*---------------------------------------------------------------------------*\
53  Class psiuMulticomponentThermo Declaration
54 \*---------------------------------------------------------------------------*/
55 
57 :
58  virtual public psiThermo
59 {
60 protected:
61 
62  // Protected Member Functions
63 
64  //- Return the unburnt enthalpy/internal energy field boundary types
65  // by interrogating the temperature field boundary types
67 
68  //- ...
70 
71 
72 public:
73 
74  // Public Classes
75 
76  //- Forward declare the implementation class
77  class implementation;
78 
79  //- Forward declare the composite class
80  class composite;
81 
82 
83  // Public Typedefs
84 
85  //- The derived type
86  template<class MixtureType>
87  using DerivedThermoType =
89 
90  //- The derived name
91  static const word derivedThermoName;
92 
93 
94  //- Runtime type information
95  TypeName("psiuMulticomponentThermo");
96 
97 
98  // Declare run-time constructor selection tables
99 
101  (
102  autoPtr,
104  fvMesh,
105  (const fvMesh& mesh, const word& phaseName),
106  (mesh, phaseName)
107  );
108 
109 
110  // Selectors
111 
112  //- Standard selection based on fvMesh
114  (
115  const fvMesh&,
116  const word& phaseName=word::null
117  );
118 
119 
120  //- Destructor
121  virtual ~psiuMulticomponentThermo();
122 
123 
124  // Member Functions
125 
126  // Species set
127 
128  //- The table of species
129  virtual const speciesTable& species() const = 0;
130 
131  //- Does the mixture include this specie?
132  inline bool containsSpecie(const word& specieName) const;
133 
134 
135  // Mass fractions
136 
137  //- Access the mass-fraction fields
138  virtual PtrList<volScalarField>& Y() = 0;
139 
140  //- Access the mass-fraction fields
141  virtual const PtrList<volScalarField>& Y() const = 0;
142 
143  //- Return the mass-fraction field for a specie given by name
144  inline volScalarField& Y(const word& specieName);
145 
146  //- Return the const mass-fraction field for a specie given by name
147  inline const volScalarField& Y(const word& specieName) const;
148 
149 
150  // Thermodynamic state
151 
152  //- Unburnt gas temperature [K]
153  virtual const volScalarField& Tu() const = 0;
154 
155  //- Unburnt gas enthalpy [J/kg]
156  virtual const volScalarField& heu() const = 0;
157 
158  //- Unburnt gas enthalpy [J/kg]
159  // Non-const access allowed for transport equations
160  virtual volScalarField& heu() = 0;
161 
162 
163  // Derived thermodynamic properties
164 
165  //- Unburnt gas enthalpy for cell-set [J/kg]
166  virtual tmp<scalarField> heu
167  (
168  const scalarField& T,
169  const labelList& cells
170  ) const = 0;
171 
172  //- Unburnt gas enthalpy for patch [J/kg]
173  virtual tmp<scalarField> heu
174  (
175  const scalarField& T,
176  const label patchi
177  ) const = 0;
178 
179  //- Burnt gas temperature [K]
180  virtual tmp<volScalarField> Tb() const = 0;
181 
182  //- Unburnt gas compressibility [s^2/m^2]
183  virtual tmp<volScalarField> psiu() const = 0;
184 
185  //- Burnt gas compressibility [s^2/m^2]
186  virtual tmp<volScalarField> psib() const = 0;
187 
188  //- Unburnt gas density [kg/m^3]
189  tmp<volScalarField> rhou() const;
190 
191  //- Burnt gas density [kg/m^3]
192  tmp<volScalarField> rhob() const;
193 
194 
195  // Derived transport properties
196 
197  //- Dynamic viscosity of unburnt gas [kg/m/s]
198  virtual tmp<volScalarField> muu() const = 0;
199 
200  //- Dynamic viscosity of burnt gas [kg/m/s]
201  virtual tmp<volScalarField> mub() const = 0;
202 };
203 
204 
205 /*---------------------------------------------------------------------------*\
206  Class psiuMulticomponentThermo::implementation Declaration
207 \*---------------------------------------------------------------------------*/
208 
210 :
211  virtual public psiuMulticomponentThermo
212 {
213 protected:
214 
215  // Protected data
216 
217  //- Table of specie names
219 
220  //- Species mass fractions
222 
223 
224 public:
225 
226  // Constructors
227 
228  //- Construct from dictionary, specie names, mesh and phase name
230  (
231  const dictionary&,
232  const wordList&,
233  const fvMesh&,
234  const word&
235  );
236 
237 
238  //- Destructor
239  virtual ~implementation();
240 
241 
242  // Member Functions
243 
244  //- The table of species
245  virtual const speciesTable& species() const;
246 
247  //- Access the mass-fraction fields
248  virtual PtrList<volScalarField>& Y();
249 
250  //- Access the mass-fraction fields
251  virtual const PtrList<volScalarField>& Y() const;
252 
253  //- Get the slicer
254  inline volScalarFieldListSlicer Yslicer() const;
255 
256  //- Get the composition of an internal cell
257  inline scalarFieldListSlice cellComposition
258  (
259  const volScalarFieldListSlicer& Yslicer,
260  const label celli
261  ) const;
262 
263  //- Get the composition of a boundary face
264  inline scalarFieldListSlice patchFaceComposition
265  (
266  const volScalarFieldListSlicer& Yslicer,
267  const label patchi,
268  const label facei
269  ) const;
270 
271  //- Get the slicer for the given source
272  inline PtrList<scalarField> Yslicer(const fvSource& source) const;
273 
274  //- Get the composition of a source cell
275  inline scalarFieldListSlice sourceCellComposition
276  (
278  const label i
279  ) const;
280 };
281 
282 
283 /*---------------------------------------------------------------------------*\
284  Class psiuMulticomponentThermo::composite Declaration
285 \*---------------------------------------------------------------------------*/
286 
288 :
293 {
294 public:
295 
296  // Constructors
297 
298  //- Construct from dictionary, mesh and phase name
299  template<class MixtureType>
300  composite
301  (
302  const dictionary& dict,
303  const MixtureType& mixture,
304  const fvMesh& mesh,
305  const word& phaseName
306  )
307  :
312  (
313  dict,
314  MixtureType::specieNames(),
315  mesh,
316  phaseName
317  )
318  {}
319 };
320 
321 
322 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
323 
324 } // End namespace Foam
325 
326 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
327 
329 
330 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
331 
332 #endif
333 
334 // ************************************************************************* //
Generic GeometricField class.
Thermo implementation based on compressibility.
Definition: PsiThermo.H:52
Thermo implementation based on compressibility with additional unburnt thermodynamic state.
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
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
virtual const fvMesh & mesh() const
Return const access to the mesh.
Definition: basicThermo.H:496
virtual const word & phaseName() const
Phase name.
Definition: basicThermo.H:502
Base-class for fluid and solid thermodynamic properties.
Definition: basicThermo.H:78
virtual const fvMesh & mesh() const =0
Return const access to the mesh.
virtual const volScalarField & T() const =0
Temperature [K].
virtual const word & phaseName() const =0
Phase name.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
Base-class for fluid thermodynamic properties.
Definition: fluidThermo.H:57
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:99
Base class for finite volume sources.
Definition: fvSource.H:52
A wordList with hashed indices for faster lookup by name.
Base-class for fluid thermodynamic properties based on compressibility.
Definition: psiThermo.H:56
composite(const dictionary &dict, const MixtureType &mixture, const fvMesh &mesh, const word &phaseName)
Construct from dictionary, mesh and phase name.
scalarFieldListSlice cellComposition(const volScalarFieldListSlicer &Yslicer, const label celli) const
Get the composition of an internal cell.
virtual const speciesTable & species() const
The table of species.
implementation(const dictionary &, const wordList &, const fvMesh &, const word &)
Construct from dictionary, specie names, mesh and phase name.
volScalarFieldListSlicer Yslicer() const
Get the slicer.
scalarFieldListSlice patchFaceComposition(const volScalarFieldListSlicer &Yslicer, const label patchi, const label facei) const
Get the composition of a boundary face.
virtual PtrList< volScalarField > & Y()
Access the mass-fraction fields.
scalarFieldListSlice sourceCellComposition(const PtrList< scalarField > &Yslicer, const label i) const
Get the composition of a source cell.
PtrList< volScalarField > Y_
Species mass fractions.
Base-class for combustion fluid thermodynamic properties based on compressibility.
tmp< volScalarField > rhob() const
Burnt gas density [kg/m^3].
virtual const volScalarField & heu() const =0
Unburnt gas enthalpy [J/kg].
static const word derivedThermoName
The derived name.
void heuBoundaryCorrection(volScalarField &heu)
...
wordList heuBoundaryTypes()
Return the unburnt enthalpy/internal energy field boundary types.
virtual const speciesTable & species() const =0
The table of species.
virtual ~psiuMulticomponentThermo()
Destructor.
virtual tmp< volScalarField > muu() const =0
Dynamic viscosity of unburnt gas [kg/m/s].
virtual tmp< volScalarField > psib() const =0
Burnt gas compressibility [s^2/m^2].
virtual const volScalarField & Tu() const =0
Unburnt gas temperature [K].
virtual tmp< volScalarField > psiu() const =0
Unburnt gas compressibility [s^2/m^2].
virtual PtrList< volScalarField > & Y()=0
Access the mass-fraction fields.
bool containsSpecie(const word &specieName) const
Does the mixture include this specie?
virtual tmp< volScalarField > Tb() const =0
Burnt gas temperature [K].
TypeName("psiuMulticomponentThermo")
Runtime type information.
declareRunTimeSelectionTable(autoPtr, psiuMulticomponentThermo, fvMesh,(const fvMesh &mesh, const word &phaseName),(mesh, phaseName))
virtual tmp< volScalarField > mub() const =0
Dynamic viscosity of burnt gas [kg/m/s].
tmp< volScalarField > rhou() const
Unburnt gas density [kg/m^3].
static autoPtr< psiuMulticomponentThermo > New(const fvMesh &, const word &phaseName=word::null)
Standard selection based on fvMesh.
A class for managing temporary objects.
Definition: tmp.H:55
A class for handling words, derived from string.
Definition: word.H:62
static const word null
An empty word.
Definition: word.H:77
label patchi
const cellShapeList & cells
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
dictionary dict