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-2026 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  //- Return the fuel-oxidant equivalence ratio
157  virtual tmp<volScalarField> Phi() const = 0;
158 
159  //- Reset the mixture to an unburnt state and update EGR
160  virtual void reset() = 0;
161 
162 
163  // Thermodynamic state
164 
165  //- Unburnt gas temperature [K]
166  virtual const volScalarField& Tu() const = 0;
167 
168  //- Unburnt gas enthalpy [J/kg]
169  virtual const volScalarField& heu() const = 0;
170 
171  //- Unburnt gas enthalpy [J/kg]
172  // Non-const access allowed for transport equations
173  virtual volScalarField& heu() = 0;
174 
175 
176  // Derived thermodynamic properties
177 
178  //- Unburnt gas enthalpy for cell-set [J/kg]
179  virtual tmp<scalarField> heu
180  (
181  const scalarField& T,
182  const labelList& cells
183  ) const = 0;
184 
185  //- Unburnt gas enthalpy for patch [J/kg]
186  virtual tmp<scalarField> heu
187  (
188  const scalarField& T,
189  const label patchi
190  ) const = 0;
191 
192  //- Standard enthalpy of reaction [J/kg]
193  virtual tmp<volScalarField> hr() const = 0;
194 
195  //- Burnt gas temperature [K]
196  virtual tmp<volScalarField> Tb() const = 0;
197 
198  //- Unburnt gas compressibility [s^2/m^2]
199  virtual tmp<volScalarField> psiu() const = 0;
200 
201  //- Burnt gas compressibility [s^2/m^2]
202  virtual tmp<volScalarField> psib() const = 0;
203 
204  //- Unburnt gas density [kg/m^3]
205  tmp<volScalarField> rhou() const;
206 
207  //- Burnt gas density [kg/m^3]
208  tmp<volScalarField> rhob() const;
209 
210 
211  // Derived transport properties
212 
213  //- Dynamic viscosity of unburnt gas [kg/m/s]
214  virtual tmp<volScalarField> muu() const = 0;
215 
216  //- Dynamic viscosity of burnt gas [kg/m/s]
217  virtual tmp<volScalarField> mub() const = 0;
218 };
219 
220 
221 /*---------------------------------------------------------------------------*\
222  Class psiuMulticomponentThermo::implementation Declaration
223 \*---------------------------------------------------------------------------*/
224 
226 :
227  virtual public psiuMulticomponentThermo
228 {
229 protected:
230 
231  // Protected data
232 
233  //- Table of specie names
235 
236  //- Species mass fractions
238 
239 
240 public:
241 
242  // Constructors
243 
244  //- Construct from dictionary, specie names, mesh and phase name
246  (
247  const dictionary&,
248  const wordList&,
249  const fvMesh&,
250  const word&
251  );
252 
253 
254  //- Destructor
255  virtual ~implementation();
256 
257 
258  // Member Functions
259 
260  //- The table of species
261  virtual const speciesTable& species() const;
262 
263  //- Access the mass-fraction fields
264  virtual PtrList<volScalarField>& Y();
265 
266  //- Access the mass-fraction fields
267  virtual const PtrList<volScalarField>& Y() const;
268 
269  //- Get the slicer
271 
272  //- Get the composition of an internal cell
273  inline scalarFieldListSlice cellComposition
274  (
276  const label celli
277  ) const;
278 
279  //- Get the composition of a boundary face
280  inline scalarFieldListSlice patchFaceComposition
281  (
283  const label patchi,
284  const label facei
285  ) const;
286 
287  //- Get the slicer for the given source
289  (
290  const fvSource& model,
291  const volScalarField::Internal& source
292  ) const;
293 
294  //- Get the composition of a source cell
295  inline scalarFieldListSlice sourceCellComposition
296  (
298  const label i
299  ) const;
300 
301  //- Get the slicer for the given source
303  (
304  const fvSource& model,
305  const scalarField& source,
306  const labelUList& cells
307  ) const;
308 
309  //- Get the composition of a source cell
310  inline scalarFieldListSlice sourceCellComposition
311  (
313  const label i
314  ) const;
315 };
316 
317 
318 /*---------------------------------------------------------------------------*\
319  Class psiuMulticomponentThermo::composite Declaration
320 \*---------------------------------------------------------------------------*/
321 
323 :
328 {
329 public:
330 
331  // Constructors
332 
333  //- Construct from dictionary, mesh and phase name
334  template<class MixtureType>
335  composite
336  (
337  const dictionary& dict,
338  const MixtureType& mixture,
339  const fvMesh& mesh,
340  const word& phaseName
341  )
342  :
347  (
348  dict,
349  MixtureType::specieNames(),
350  mesh,
351  phaseName
352  )
353  {}
354 };
355 
356 
357 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
358 
359 } // End namespace Foam
360 
361 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
362 
364 
365 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
366 
367 #endif
368 
369 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Class to provide list slices to different parts of a geometric field.
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:539
virtual const word & phaseName() const
Phase name.
Definition: basicThermo.H:545
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:98
Base class for finite volume sources.
Definition: fvSource.H:53
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 patchFaceComposition(const GeometricFieldListSlicer< scalar > &Yslicer, const label patchi, const label facei) const
Get the composition of a boundary face.
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.
scalarFieldListSlice sourceCellComposition(const DimensionedFieldListAndSlicer< scalar, fvMesh > &Yslicer, const label i) const
Get the composition of a source cell.
virtual PtrList< volScalarField > & Y()
Access the mass-fraction fields.
GeometricFieldListSlicer< scalar > Yslicer() const
Get the slicer.
PtrList< volScalarField > Y_
Species mass fractions.
scalarFieldListSlice cellComposition(const GeometricFieldListSlicer< scalar > &Yslicer, const label celli) const
Get the composition of an internal cell.
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].
virtual tmp< volScalarField > Phi() const =0
Return the fuel-oxidant equivalence ratio.
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:63
static const word null
An empty word.
Definition: word.H:78
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