UInhomogeneousEGRMixture.C
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) 2025-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 \*---------------------------------------------------------------------------*/
25 
27 
28 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
29 
30 template<class ThermoType>
32 (
33  const dictionary& dict
34 )
35 :
37  fuel_("fuel", dict.subDict("fuel")),
38  oxidant_("oxidant", dict.subDict("oxidant")),
39  products_("products", dict.subDict("products")),
40  mixture_("mixture", fuel_)
41 {}
42 
43 
44 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
45 
46 template<class ThermoType>
48 (
49  const label speciei
50 ) const
51 {
52  switch (speciei)
53  {
54  case FU:
55  return fuel_;
56  break;
57 
58  case EGR:
59  return products_;
60  break;
61 
62  default:
64  << "Cannot return specieThermo for specie " << speciei
65  << exit(FatalError);
66  return products_;
67  break;
68  }
69 }
70 
71 
72 template<class ThermoType>
74 (
75  const scalar fu,
76  const scalar egr
77 ) const
78 {
79  if (fu < 0.0001 && egr < 0.0001)
80  {
81  return oxidant_;
82  }
83  else
84  {
85  const scalar ox = 1 - fu - egr;
86 
87  mixture_ = fu*fuel_;
88  mixture_ += ox*oxidant_;
89  mixture_ += egr*products_;
90 
91  return mixture_;
92  }
93 }
94 
95 
96 template<class ThermoType>
99 (
100  const scalarFieldListSlice& Y
101 ) const
102 {
103  return mixture(Y[FU], Y[EGR]);
104 }
105 
106 
107 template<class ThermoType>
110 (
111  const scalarFieldListSlice& Y
112 ) const
113 {
114  return mixture(Y[FU], Y[EGR]);
115 }
116 
117 
118 template<class ThermoType>
121 (
122  const scalarFieldListSlice&,
124 ) const
125 {
126  return mixture;
127 }
128 
129 
130 template<class ThermoType>
132 {
134  fuel_ = ThermoType("fuel", dict.subDict("fuel"));
135  oxidant_ = ThermoType("oxidant", dict.subDict("oxidant"));
136  products_ = ThermoType("products", dict.subDict("products"));
137 }
138 
139 
140 // ************************************************************************* //
const ThermoType & specieThermo(const label speciei) const
ThermoType transportMixtureType
Mixing type for transport properties.
ThermoType thermoMixtureType
Mixing type for thermodynamic properties.
const transportMixtureType & transportMixture(const scalarFieldListSlice &) const
Return the mixture for transport properties.
const thermoMixtureType & thermoMixture(const scalarFieldListSlice &) const
Return the mixture for thermodynamic properties.
const thermoType & mixture(const scalar fu, const scalar egr) const
Return the mixture for the given composition.
void read(const dictionary &)
Read dictionary.
UInhomogeneousEGRMixture(const dictionary &)
Construct from a dictionary.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
Definition: dictionary.C:778
Unburnt gas combustion mixture for inhomogeneous lean, stoichiometric or rich conditions with exhaust...
void read(const dictionary &)
Read dictionary.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:334
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
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
error FatalError
dictionary dict
PtrList< volScalarField > & Y