ubMixtureMap.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) 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::ubMixtureMap
26 
27 Description
28  Base class for unburnt/burnt gas composition mapping
29 
30 SourceFiles
31  ubMixtureMap.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef ubMixtureMap_H
36 #define ubMixtureMap_H
37 
40 #include "runTimeSelectionTables.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 /*---------------------------------------------------------------------------*\
48  Class ubMixtureMap Declaration
49 \*---------------------------------------------------------------------------*/
50 
51 class ubMixtureMap
52 {
53 protected:
54 
55  // Protected Data
56 
59 
60 
61  // Protected Member Functions
62 
63  template<class Thermo, class To>
64  inline const To& mixtureCast(const Thermo& thermo) const
65  {
66  try
67  {
68  return dynamic_cast<const To&>(thermo);
69  }
70  catch (const std::bad_cast&)
71  {
73  << "Attempt to cast type " << thermo.type()
74  << " to type " << To::typeName
75  << abort(FatalError);
76 
77  return dynamic_cast<const To&>(thermo);
78  }
79  }
80 
81  template<class To>
82  inline const To& uMixtureCast() const
83  {
84  return mixtureCast<uRhoMulticomponentThermo, To>(uThermo_);
85  }
86 
87  template<class To>
88  inline const To& bMixtureCast() const
89  {
90  return mixtureCast<bRhoMulticomponentThermo, To>(bThermo_);
91  }
92 
93 
94 public:
95 
96  //- Runtime type information
97  TypeName("ubMixtureMap");
98 
99 
100  // Declare run-time constructor selection table
101 
103  (
104  autoPtr,
105  ubMixtureMap,
106  thermo,
107  (
108  const uRhoMulticomponentThermo& uThermo,
109  const bRhoMulticomponentThermo& bThermo
110  ),
111  (uThermo, bThermo)
112  );
113 
114 
115  // Constructors
116 
117  //- Construct from components
119  (
120  const uRhoMulticomponentThermo& uThermo,
121  const bRhoMulticomponentThermo& bThermo
122  );
123 
124  //- Disallow default bitwise copy construction
125  ubMixtureMap(const ubMixtureMap&) = delete;
126 
127 
128  // Selectors
129 
130  //- Return a reference to the selected XiEq model
132  (
133  const uRhoMulticomponentThermo& uThermo,
134  const bRhoMulticomponentThermo& bThermo
135  );
136 
137 
138  //- Destructor
139  virtual ~ubMixtureMap();
140 
141 
142  // Member Functions
143 
144  //- Return the burnt gas prompt specie mass fractions
145  // corresponding to the given unburnt gas specie mass fractions
147  (
148  const PtrList<volScalarField>& Yu
149  ) const = 0;
150 
151  //- Reset the mixture to an unburnt state
152  // for multi-cycle simulations with EGR
153  virtual void reset
154  (
155  const volScalarField& b,
157  const volScalarField& c,
159  ) const = 0;
160 
161 
162  // Member Operators
163 
164  //- Disallow default bitwise assignment
165  void operator=(const ubMixtureMap&) = delete;
166 };
167 
168 
169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170 
171 } // End namespace Foam
172 
173 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
174 
175 #endif
176 
177 // ************************************************************************* //
Generic GeometricField class.
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
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: UPtrList.H:66
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
Base-class for combustion fluid thermodynamic properties based on compressibility.
Base-class for combustion fluid thermodynamic properties based on compressibility.
Base class for unburnt/burnt gas composition mapping.
Definition: ubMixtureMap.H:51
void operator=(const ubMixtureMap &)=delete
Disallow default bitwise assignment.
virtual void reset(const volScalarField &b, UPtrList< volScalarField > &Yu, const volScalarField &c, const UPtrList< const volScalarField > &Yb) const =0
Reset the mixture to an unburnt state.
const To & bMixtureCast() const
Definition: ubMixtureMap.H:87
declareRunTimeSelectionTable(autoPtr, ubMixtureMap, thermo,(const uRhoMulticomponentThermo &uThermo, const bRhoMulticomponentThermo &bThermo),(uThermo, bThermo))
ubMixtureMap(const uRhoMulticomponentThermo &uThermo, const bRhoMulticomponentThermo &bThermo)
Construct from components.
Definition: ubMixtureMap.C:42
const To & mixtureCast(const Thermo &thermo) const
Definition: ubMixtureMap.H:63
virtual PtrList< volScalarField::Internal > prompt(const PtrList< volScalarField > &Yu) const =0
Return the burnt gas prompt specie mass fractions.
const bRhoMulticomponentThermo & bThermo_
Definition: ubMixtureMap.H:57
virtual ~ubMixtureMap()
Destructor.
Definition: ubMixtureMap.C:54
const uRhoMulticomponentThermo & uThermo_
Definition: ubMixtureMap.H:56
const To & uMixtureCast() const
Definition: ubMixtureMap.H:81
TypeName("ubMixtureMap")
Runtime type information.
static autoPtr< ubMixtureMap > New(const uRhoMulticomponentThermo &uThermo, const bRhoMulticomponentThermo &bThermo)
Return a reference to the selected XiEq model.
Definition: ubMixtureMap.C:61
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:334
volScalarField & b
Definition: createFields.H:27
const dimensionedScalar c
Speed of light in a vacuum.
Namespace for OpenFOAM.
String typeName(const std::type_info &info)
Return the un-mangled name given the standard type info.
errorManip< error > abort(error &err)
Definition: errorManip.H:131
error FatalError
Macros to ease declaration of run-time selection tables.
fluidMulticomponentThermo & thermo
Definition: createFields.H:15