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 const word derivedThermoName;
93 
94 
95  //- Runtime type information
96  TypeName("psiuMulticomponentThermo");
97 
98 
99  // Declare run-time constructor selection tables
100 
102  (
103  autoPtr,
105  fvMesh,
106  (const fvMesh& mesh, const word& phaseName),
107  (mesh, phaseName)
108  );
109 
110 
111  // Selectors
112 
113  //- Standard selection based on fvMesh
115  (
116  const fvMesh&,
117  const word& phaseName=word::null
118  );
119 
120 
121  //- Destructor
122  virtual ~psiuMulticomponentThermo();
123 
124 
125  // Member Functions
126 
127  // Species set
128 
129  //- The table of species
130  virtual const speciesTable& species() const = 0;
131 
132  //- Does the mixture include this specie?
133  inline bool containsSpecie(const word& specieName) const;
134 
135 
136  // Mass fractions
137 
138  //- Access the mass-fraction fields
139  virtual PtrList<volScalarField>& Y() = 0;
140 
141  //- Access the mass-fraction fields
142  virtual const PtrList<volScalarField>& Y() const = 0;
143 
144  //- Return the mass-fraction field for a specie given by name
145  inline volScalarField& Y(const word& specieName);
146 
147  //- Return the const mass-fraction field for a specie given by name
148  inline const volScalarField& Y(const word& specieName) const;
149 
150  //- Return the residual fraction of fuel in the burnt mixture
151  virtual tmp<volScalarField> fres() const = 0;
152 
153  //- Reset the mixture to an unburnt state and update EGR
154  virtual void reset() = 0;
155 
156 
157  // Thermodynamic state
158 
159  //- Unburnt gas temperature [K]
160  virtual const volScalarField& Tu() const = 0;
161 
162  //- Unburnt gas enthalpy [J/kg]
163  virtual const volScalarField& heu() const = 0;
164 
165  //- Unburnt gas enthalpy [J/kg]
166  // Non-const access allowed for transport equations
167  virtual volScalarField& heu() = 0;
168 
169 
170  // Derived thermodynamic properties
171 
172  //- Unburnt gas enthalpy for cell-set [J/kg]
173  virtual tmp<scalarField> heu
174  (
175  const scalarField& T,
176  const labelList& cells
177  ) const = 0;
178 
179  //- Unburnt gas enthalpy for patch [J/kg]
180  virtual tmp<scalarField> heu
181  (
182  const scalarField& T,
183  const label patchi
184  ) const = 0;
185 
186  //- Standard enthalpy of reaction [J/kg]
187  virtual tmp<volScalarField> hr() const = 0;
188 
189  //- Burnt gas temperature [K]
190  virtual tmp<volScalarField> Tb() const = 0;
191 
192  //- Unburnt gas compressibility [s^2/m^2]
193  virtual tmp<volScalarField> psiu() const = 0;
194 
195  //- Burnt gas compressibility [s^2/m^2]
196  virtual tmp<volScalarField> psib() const = 0;
197 
198  //- Unburnt gas density [kg/m^3]
199  tmp<volScalarField> rhou() const;
200 
201  //- Burnt gas density [kg/m^3]
202  tmp<volScalarField> rhob() const;
203 
204 
205  // Derived transport properties
206 
207  //- Dynamic viscosity of unburnt gas [kg/m/s]
208  virtual tmp<volScalarField> muu() const = 0;
209 
210  //- Dynamic viscosity of burnt gas [kg/m/s]
211  virtual tmp<volScalarField> mub() const = 0;
212 };
213 
214 
215 /*---------------------------------------------------------------------------*\
216  Class psiuMulticomponentThermo::implementation Declaration
217 \*---------------------------------------------------------------------------*/
218 
220 :
221  virtual public psiuMulticomponentThermo
222 {
223 protected:
224 
225  // Protected data
226 
227  //- Table of specie names
229 
230  //- Species mass fractions
232 
233 
234 public:
235 
236  // Constructors
237 
238  //- Construct from dictionary, specie names, mesh and phase name
240  (
241  const dictionary&,
242  const wordList&,
243  const fvMesh&,
244  const word&
245  );
246 
247 
248  //- Destructor
249  virtual ~implementation();
250 
251 
252  // Member Functions
253 
254  //- The table of species
255  virtual const speciesTable& species() const;
256 
257  //- Access the mass-fraction fields
258  virtual PtrList<volScalarField>& Y();
259 
260  //- Access the mass-fraction fields
261  virtual const PtrList<volScalarField>& Y() const;
262 
263  //- Get the slicer
264  inline volScalarFieldListSlicer Yslicer() const;
265 
266  //- Get the composition of an internal cell
267  inline scalarFieldListSlice cellComposition
268  (
269  const volScalarFieldListSlicer& Yslicer,
270  const label celli
271  ) const;
272 
273  //- Get the composition of a boundary face
274  inline scalarFieldListSlice patchFaceComposition
275  (
276  const volScalarFieldListSlicer& Yslicer,
277  const label patchi,
278  const label facei
279  ) const;
280 
281  //- Get the slicer for the given source
283  (
284  const fvSource& model,
285  const volScalarField::Internal& source
286  ) const;
287 
288  //- Get the composition of a source cell
289  inline scalarFieldListSlice sourceCellComposition
290  (
292  const label i
293  ) const;
294 
295  //- Get the slicer for the given source
297  (
298  const fvSource& model,
299  const scalarField& source,
300  const labelUList& cells
301  ) const;
302 
303  //- Get the composition of a source cell
304  inline scalarFieldListSlice sourceCellComposition
305  (
307  const label i
308  ) const;
309 };
310 
311 
312 /*---------------------------------------------------------------------------*\
313  Class psiuMulticomponentThermo::composite Declaration
314 \*---------------------------------------------------------------------------*/
315 
317 :
322 {
323 public:
324 
325  // Constructors
326 
327  //- Construct from dictionary, mesh and phase name
328  template<class MixtureType>
329  composite
330  (
331  const dictionary& dict,
332  const MixtureType& mixture,
333  const fvMesh& mesh,
334  const word& phaseName
335  )
336  :
341  (
342  dict,
343  MixtureType::specieNames(),
344  mesh,
345  phaseName
346  )
347  {}
348 };
349 
350 
351 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
352 
353 } // End namespace Foam
354 
355 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
356 
358 
359 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
360 
361 #endif
362 
363 // ************************************************************************* //
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].
static const word derivedThermoName
The derived name.
void heuBoundaryCorrection(volScalarField &heu)
...
virtual void reset()=0
Reset the mixture to an unburnt state and update EGR.
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