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-2025 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"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 
53 /*---------------------------------------------------------------------------*\
54  Class psiuMulticomponentThermo Declaration
55 \*---------------------------------------------------------------------------*/
56 
58 :
59  virtual public psiThermo
60 {
61 protected:
62 
63  // Protected Member Functions
64 
65  //- Return the unburnt enthalpy/internal energy field boundary types
66  // by interrogating the temperature field boundary types
68 
69  //- ...
71 
72 
73 public:
74 
75  // Public Classes
76 
77  //- Forward declare the implementation class
78  class implementation;
79 
80  //- Forward declare the composite class
81  class composite;
82 
83 
84  // Public Typedefs
85 
86  //- The derived type
87  template<class MixtureType>
88  using DerivedThermoType =
90 
91  //- The derived name
92  static word derivedThermoName()
93  {
94  return "heheuPsiThermo";
95  }
96 
97 
98  //- Runtime type information
99  TypeName("psiuMulticomponentThermo");
100 
101 
102  // Declare run-time constructor selection tables
103 
105  (
106  autoPtr,
108  fvMesh,
109  (const fvMesh& mesh, const word& phaseName),
110  (mesh, phaseName)
111  );
112 
113 
114  // Selectors
115 
116  //- Standard selection based on fvMesh
118  (
119  const fvMesh&,
120  const word& phaseName=word::null
121  );
122 
123 
124  //- Destructor
125  virtual ~psiuMulticomponentThermo();
126 
127 
128  // Member Functions
129 
130  // Species set
131 
132  //- The table of species
133  virtual const speciesTable& species() const = 0;
134 
135  //- Does the mixture include this specie?
136  inline bool containsSpecie(const word& specieName) const;
137 
138 
139  // Mass fractions
140 
141  //- Access the mass-fraction fields
142  virtual PtrList<volScalarField>& Y() = 0;
143 
144  //- Access the mass-fraction fields
145  virtual const PtrList<volScalarField>& Y() const = 0;
146 
147  //- Return the mass-fraction field for a specie given by name
148  inline volScalarField& Y(const word& specieName);
149 
150  //- Return the const mass-fraction field for a specie given by name
151  inline const volScalarField& Y(const word& specieName) const;
152 
153  //- Return the residual fraction of fuel in the burnt mixture
154  virtual tmp<volScalarField> fres() const = 0;
155 
156  //- Reset the mixture to an unburnt state and update EGR
157  virtual void reset() = 0;
158 
159 
160  // Thermodynamic state
161 
162  //- Unburnt gas temperature [K]
163  virtual const volScalarField& Tu() const = 0;
164 
165  //- Unburnt gas enthalpy [J/kg]
166  virtual const volScalarField& heu() const = 0;
167 
168  //- Unburnt gas enthalpy [J/kg]
169  // Non-const access allowed for transport equations
170  virtual volScalarField& heu() = 0;
171 
172 
173  // Derived thermodynamic properties
174 
175  //- Unburnt gas enthalpy for cell-set [J/kg]
176  virtual tmp<scalarField> heu
177  (
178  const scalarField& T,
179  const labelList& cells
180  ) const = 0;
181 
182  //- Unburnt gas enthalpy for patch [J/kg]
183  virtual tmp<scalarField> heu
184  (
185  const scalarField& T,
186  const label patchi
187  ) const = 0;
188 
189  //- Standard enthalpy of reaction [J/kg]
190  virtual tmp<volScalarField> hr() const = 0;
191 
192  //- Burnt gas temperature [K]
193  virtual tmp<volScalarField> Tb() const = 0;
194 
195  //- Unburnt gas compressibility [s^2/m^2]
196  virtual tmp<volScalarField> psiu() const = 0;
197 
198  //- Burnt gas compressibility [s^2/m^2]
199  virtual tmp<volScalarField> psib() const = 0;
200 
201  //- Unburnt gas density [kg/m^3]
202  tmp<volScalarField> rhou() const;
203 
204  //- Burnt gas density [kg/m^3]
205  tmp<volScalarField> rhob() const;
206 
207 
208  // Derived transport properties
209 
210  //- Dynamic viscosity of unburnt gas [kg/m/s]
211  virtual tmp<volScalarField> muu() const = 0;
212 
213  //- Dynamic viscosity of burnt gas [kg/m/s]
214  virtual tmp<volScalarField> mub() const = 0;
215 };
216 
217 
218 /*---------------------------------------------------------------------------*\
219  Class psiuMulticomponentThermo::implementation Declaration
220 \*---------------------------------------------------------------------------*/
221 
223 :
224  virtual public psiuMulticomponentThermo
225 {
226 protected:
227 
228  // Protected data
229 
230  //- Table of specie names
232 
233  //- Species mass fractions
235 
236 
237 public:
238 
239  // Constructors
240 
241  //- Construct from dictionary, specie names, mesh and phase name
243  (
244  const dictionary&,
245  const wordList&,
246  const fvMesh&,
247  const word&
248  );
249 
250 
251  //- Destructor
252  virtual ~implementation();
253 
254 
255  // Member Functions
256 
257  //- The table of species
258  virtual const speciesTable& species() const;
259 
260  //- Access the mass-fraction fields
261  virtual PtrList<volScalarField>& Y();
262 
263  //- Access the mass-fraction fields
264  virtual const PtrList<volScalarField>& Y() const;
265 
266  //- Get the slicer
267  inline volScalarFieldListSlicer Yslicer() const;
268 
269  //- Get the composition of an internal cell
270  inline scalarFieldListSlice cellComposition
271  (
272  const volScalarFieldListSlicer& Yslicer,
273  const label celli
274  ) const;
275 
276  //- Get the composition of a boundary face
277  inline scalarFieldListSlice patchFaceComposition
278  (
279  const volScalarFieldListSlicer& Yslicer,
280  const label patchi,
281  const label facei
282  ) const;
283 
284  //- Get the slicer for the given source
286  (
287  const fvSource& model,
288  const volScalarField::Internal& source
289  ) const;
290 
291  //- Get the composition of a source cell
292  inline scalarFieldListSlice sourceCellComposition
293  (
295  const label i
296  ) const;
297 
298  //- Get the slicer for the given source
300  (
301  const fvSource& model,
302  const scalarField& source,
303  const labelUList& cells
304  ) const;
305 
306  //- Get the composition of a source cell
307  inline scalarFieldListSlice sourceCellComposition
308  (
310  const label i
311  ) const;
312 };
313 
314 
315 /*---------------------------------------------------------------------------*\
316  Class psiuMulticomponentThermo::composite Declaration
317 \*---------------------------------------------------------------------------*/
318 
320 :
325 {
326 public:
327 
328  // Constructors
329 
330  //- Construct from dictionary, mesh and phase name
331  template<class MixtureType>
332  composite
333  (
334  const dictionary& dict,
335  const MixtureType& mixture,
336  const fvMesh& mesh,
337  const word& phaseName
338  )
339  :
344  (
345  dict,
346  MixtureType::specieNames(),
347  mesh,
348  phaseName
349  )
350  {}
351 };
352 
353 
354 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
355 
356 } // End namespace Foam
357 
358 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
359 
361 
362 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
363 
364 #endif
365 
366 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
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:530
virtual const word & phaseName() const
Phase name.
Definition: basicThermo.H:536
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 keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
Base-class for fluid thermodynamic properties.
Definition: fluidThermo.H:56
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:96
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.
scalarFieldListSlice sourceCellComposition(const DimensionedFieldListAndSlicer< scalar, volMesh > &Yslicer, const label i) const
Get the composition of a source cell.
virtual PtrList< volScalarField > & Y()
Access the mass-fraction fields.
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].
void heuBoundaryCorrection(volScalarField &heu)
...
virtual void reset()=0
Reset the mixture to an unburnt state and update EGR.
static word derivedThermoName()
The derived name.
virtual tmp< volScalarField > hr() const =0
Standard enthalpy of reaction [J/kg].
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].
virtual tmp< volScalarField > fres() const =0
Return the residual fraction of fuel in the burnt mixture.
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