ubRhoThermo.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) 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 Class
25  Foam::ubRhoThermo
26 
27 Description
28 
29 SourceFiles
30  ubRhoThermo.C
31 
32 \*---------------------------------------------------------------------------*/
33 
34 #ifndef ubRhoThermo_H
35 #define ubRhoThermo_H
36 
39 #include "ubMixtureMap.H"
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 /*---------------------------------------------------------------------------*\
47  Class ubRhoThermo Declaration
48 \*---------------------------------------------------------------------------*/
49 
50 class ubRhoThermo
51 :
52  virtual public rhoFluidThermo
53 {
54  // Private Data
55 
56  volScalarField b_;
57  volScalarField c_;
58 
61 
62  //- Unburnt/burnt gas mixture mapping for prompt species and reset
63  autoPtr<ubMixtureMap> ubMixtureMap_;
64 
65  volScalarField rho_;
66  volScalarField psi_;
67  volScalarField mu_;
68  volScalarField kappa_;
69 
70  volScalarField alphau_;
71  volScalarField alphab_;
72 
73 
74 public:
75 
76  //- Runtime type information
77  TypeName("ubRhoThermo");
78 
79  static const word unburntPhaseName;
80  static const word burntPhaseName;
81 
82 
83  // Constructors
84 
85  //- Construct from mesh
86  ubRhoThermo(const fvMesh& mesh);
87 
88  //- Disallow default bitwise copy construction
89  ubRhoThermo(const ubRhoThermo&) = delete;
90 
91 
92  //- Destructor
93  virtual ~ubRhoThermo();
94 
95 
96  // Member Functions
97 
98  //- Regress variable
99  const volScalarField& b() const
100  {
101  return b_;
102  }
103 
104  //- Regress variable
105  // Non-const access allowed for transport equations
106  volScalarField& b()
107  {
108  return b_;
109  }
110 
111  //- Progress variable
112  const volScalarField& c() const
113  {
114  return c_;
115  }
116 
117  //- Progress variable
118  // Non-const access allowed for transport equations
119  volScalarField& c()
120  {
121  return c_;
122  }
123 
124  //- Unburnt gas volume fraction
125  const volScalarField& alphau() const
126  {
127  return alphau_;
128  }
129 
130  //- Burnt gas volume fraction
131  const volScalarField& alphab() const
132  {
133  return alphab_;
134  }
135 
136  const uRhoMulticomponentThermo& uThermo() const
137  {
138  return uThermo_();
139  }
140 
142  {
143  return uThermo_();
144  }
145 
146  const bRhoMulticomponentThermo& bThermo() const
147  {
148  return bThermo_();
149  }
150 
152  {
153  return bThermo_();
154  }
155 
156  //- Properties dictionary
157  virtual const IOdictionary& properties() const;
158 
159  //- Non-const access the properties dictionary
160  virtual IOdictionary& properties();
161 
162  //- Return const access to the mesh
163  virtual const fvMesh& mesh() const;
164 
165  //- Phase name
166  virtual const word& phaseName() const;
167 
168  //- Update properties
169  virtual void correct();
170 
171  //- Return the name of the mixture (not implemented)
172  virtual word mixtureName() const;
173 
174  //- Name of the thermo physics (not implemented)
175  virtual word thermoName() const;
176 
177  //- Return true if the equation of state is incompressible
178  // i.e. rho != f(p)
179  virtual bool incompressible() const
180  {
181  return false;
182  }
183 
184  //- Return true if the equation of state is isochoric
185  // i.e. rho = const
186  virtual bool isochoric() const
187  {
188  return false;
189  }
190 
191  //- Should the dpdt term be included in the enthalpy equation
192  virtual Switch dpdt() const
193  {
194  return true;
195  }
196 
197  //- Return the burnt gas prompt specie mass fractions
198  // corresponding to the current unburnt gas specie mass fractions
200 
201  //- Reset the mixture to an unburnt state
202  // for multi-cycle simulations with EGR
203  void reset();
204 
205 
206  // Molecular properties
207 
208  //- Molecular weight [kg/kmol]
209  virtual tmp<volScalarField> W() const;
210 
211  //- Molecular weight for patch [kg/kmol]
212  virtual tmp<scalarField> W(const label patchi) const;
213 
214 
215  // Thermodynamic state
216 
217  //- Pressure [Pa]
218  virtual const volScalarField& p() const;
219 
220  //- Pressure [Pa]
221  // Non-const access allowed for transport equations
222  virtual volScalarField& p();
223 
224  //- Compressibility [s^2/m^2]
225  virtual const volScalarField& psi() const;
226 
227  //- Temperature [K]
228  virtual const volScalarField& T() const;
229 
230  //- Temperature [K]
231  // Non-const access allowed for transport equations
232  virtual volScalarField& T();
233 
234  //- Enthalpy/Internal energy [J/kg]
235  virtual const volScalarField& he() const;
236 
237  //- Enthalpy/Internal energy [J/kg]
238  // Non-const access allowed for transport equations
239  virtual volScalarField& he();
240 
241  //- Heat capacity at constant pressure [J/kg/K]
242  virtual const volScalarField& Cp() const;
243 
244  //- Heat capacity at constant volume [J/kg/K]
245  virtual const volScalarField& Cv() const;
246 
247  //- Heat capacity at constant pressure/volume [J/kg/K]
248  virtual const volScalarField& Cpv() const;
249 
250 
251  // Derived Thermodynamic Properties
252 
253  //- Density [kg/m^3]
254  virtual tmp<volScalarField> rho() const;
255 
256  //- Density for patch [kg/m^3]
257  virtual tmp<scalarField> rho(const label patchi) const;
258 
259  //- Return non-const access to the local density field [kg/m^3]
260  virtual volScalarField& rho();
261 
262  //- Update the density corresponding to the given pressure change
263  // Used to update the density field following pressure solution
264  virtual void correctRho(const volScalarField& dp);
265 
266  //- Enthalpy/Internal energy
267  // for given pressure and temperature [J/kg]
268  virtual tmp<volScalarField> he
269  (
270  const volScalarField& p,
271  const volScalarField& T
272  ) const;
273 
274  //- Enthalpy/Internal energy
275  // for given pressure and temperature [J/kg]
277  (
280  ) const;
281 
282  //- Enthalpy/Internal energy for cell-set [J/kg]
283  virtual tmp<scalarField> he
284  (
285  const scalarField& T,
286  const labelList& cells
287  ) const;
288 
289  //- Enthalpy/Internal energy for patch [J/kg]
290  virtual tmp<scalarField> he
291  (
292  const scalarField& T,
293  const label patchi
294  ) const;
295 
296  //- Enthalpy/Internal energy for source [J/kg]
298  (
300  const fvSource& model,
301  const volScalarField::Internal& source
302  ) const;
303 
304  //- Enthalpy/Internal energy for source [J/kg]
305  virtual tmp<scalarField> he
306  (
307  const scalarField& T,
308  const fvSource& model,
309  const scalarField& source,
310  const labelUList& cells
311  ) const;
312 
313  //- Sensible enthalpy [J/kg]
314  virtual tmp<volScalarField> hs() const;
315 
316  //- Sensible enthalpy
317  // for given pressure and temperature [J/kg]
318  virtual tmp<volScalarField> hs
319  (
320  const volScalarField& p,
321  const volScalarField& T
322  ) const;
323 
324  //- Sensible enthalpy
325  // for given pressure and temperature [J/kg]
327  (
330  ) const;
331 
332  //- Sensible enthalpy for cell-set [J/kg]
333  virtual tmp<scalarField> hs
334  (
335  const scalarField& T,
336  const labelList& cells
337  ) const;
338 
339  //- Sensible enthalpy for patch [J/kg]
340  virtual tmp<scalarField> hs
341  (
342  const scalarField& T,
343  const label patchi
344  ) const;
345 
346  //- Absolute enthalpy [J/kg]
347  virtual tmp<volScalarField> ha() const;
348 
349  //- Absolute enthalpy
350  // for given pressure and temperature [J/kg]
351  virtual tmp<volScalarField> ha
352  (
353  const volScalarField& p,
354  const volScalarField& T
355  ) const;
356 
357  //- Absolute enthalpy
358  // for given pressure and temperature [J/kg]
360  (
363  ) const;
364 
365  //- Absolute enthalpy for cell-set [J/kg]
366  virtual tmp<scalarField> ha
367  (
368  const scalarField& T,
369  const labelList& cells
370  ) const;
371 
372  //- Absolute enthalpy for patch [J/kg]
373  virtual tmp<scalarField> ha
374  (
375  const scalarField& T,
376  const label patchi
377  ) const;
378 
379  //- Heat capacity at constant pressure for patch [J/kg/K]
380  virtual tmp<scalarField> Cp
381  (
382  const scalarField& T,
383  const label patchi
384  ) const;
385 
386  //- Heat capacity at constant volume for patch [J/kg/K]
387  virtual tmp<scalarField> Cv
388  (
389  const scalarField& T,
390  const label patchi
391  ) const;
392 
393  //- Heat capacity at constant pressure/volume for patch [J/kg/K]
394  virtual tmp<scalarField> Cpv
395  (
396  const scalarField& T,
397  const label patchi
398  ) const;
399 
400 
401  // Temperature-energy inversion functions
402 
403  //- Temperature from enthalpy/internal energy
404  virtual tmp<volScalarField> The
405  (
406  const volScalarField& h,
407  const volScalarField& p,
408  const volScalarField& T0 // starting temperature
409  ) const;
410 
411  //- Temperature from enthalpy/internal energy for cell-set
412  virtual tmp<scalarField> The
413  (
414  const scalarField& h,
415  const scalarField& T0, // starting temperature
416  const labelList& cells
417  ) const;
418 
419  //- Temperature from enthalpy/internal energy for patch
420  virtual tmp<scalarField> The
421  (
422  const scalarField& h,
423  const scalarField& T0, // starting temperature
424  const label patchi
425  ) const;
426 
427 
428  // Transport state
429 
430  //- Dynamic viscosity of mixture [kg/m/s]
431  virtual const volScalarField& mu() const;
432 
433  //- Thermal conductivity of mixture [W/m/K]
434  virtual const volScalarField& kappa() const;
435 };
436 
437 
438 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
439 
440 } // End namespace Foam
441 
442 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
443 
444 #endif
445 
446 // ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Generic GeometricField class.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:57
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 simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:61
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.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:98
Base class for finite volume sources.
Definition: fvSource.H:53
Base-class for fluid thermodynamic properties based on density.
A class for managing temporary objects.
Definition: tmp.H:55
Base-class for combustion fluid thermodynamic properties based on compressibility.
const volScalarField & alphau() const
Unburnt gas volume fraction.
Definition: ubRhoThermo.H:124
virtual tmp< volScalarField > W() const
Molecular weight [kg/kmol].
Definition: ubRhoThermo.C:194
virtual const IOdictionary & properties() const
Properties dictionary.
Definition: ubRhoThermo.C:98
virtual bool incompressible() const
Return true if the equation of state is incompressible.
Definition: ubRhoThermo.H:178
virtual const volScalarField & T() const
Temperature [K].
Definition: ubRhoThermo.C:226
virtual void correct()
Update properties.
Definition: ubRhoThermo.C:138
virtual tmp< volScalarField > ha() const
Absolute enthalpy [J/kg].
Definition: ubRhoThermo.C:415
static const word burntPhaseName
Definition: ubRhoThermo.H:79
const volScalarField & c() const
Progress variable.
Definition: ubRhoThermo.H:111
virtual const volScalarField & kappa() const
Thermal conductivity of mixture [W/m/K].
Definition: ubRhoThermo.C:541
virtual Switch dpdt() const
Should the dpdt term be included in the enthalpy equation.
Definition: ubRhoThermo.H:191
virtual const word & phaseName() const
Phase name.
Definition: ubRhoThermo.C:118
TypeName("ubRhoThermo")
Runtime type information.
const uRhoMulticomponentThermo & uThermo() const
Definition: ubRhoThermo.H:135
const bRhoMulticomponentThermo & bThermo() const
Definition: ubRhoThermo.H:145
const volScalarField & b() const
Regress variable.
Definition: ubRhoThermo.H:98
virtual word thermoName() const
Name of the thermo physics (not implemented)
Definition: ubRhoThermo.C:131
static const word unburntPhaseName
Definition: ubRhoThermo.H:78
virtual const volScalarField & Cpv() const
Heat capacity at constant pressure/volume [J/kg/K].
Definition: ubRhoThermo.C:263
virtual const volScalarField & he() const
Enthalpy/Internal energy [J/kg].
Definition: ubRhoThermo.C:239
virtual word mixtureName() const
Return the name of the mixture (not implemented)
Definition: ubRhoThermo.C:124
PtrList< volScalarField::Internal > prompt() const
Return the burnt gas prompt specie mass fractions.
Definition: ubRhoThermo.C:153
virtual tmp< volScalarField > hs() const
Sensible enthalpy [J/kg].
Definition: ubRhoThermo.C:365
const volScalarField & alphab() const
Burnt gas volume fraction.
Definition: ubRhoThermo.H:130
virtual const fvMesh & mesh() const
Return const access to the mesh.
Definition: ubRhoThermo.C:112
virtual const volScalarField & Cv() const
Heat capacity at constant volume [J/kg/K].
Definition: ubRhoThermo.C:257
virtual tmp< volScalarField > rho() const
Density [kg/m^3].
Definition: ubRhoThermo.C:270
void reset()
Reset the mixture to an unburnt state.
Definition: ubRhoThermo.C:159
ubRhoThermo(const fvMesh &mesh)
Construct from mesh.
Definition: ubRhoThermo.C:42
virtual const volScalarField & p() const
Pressure [Pa].
Definition: ubRhoThermo.C:208
virtual const volScalarField & Cp() const
Heat capacity at constant pressure [J/kg/K].
Definition: ubRhoThermo.C:251
virtual ~ubRhoThermo()
Destructor.
Definition: ubRhoThermo.C:92
virtual void correctRho(const volScalarField &dp)
Update the density corresponding to the given pressure change.
Definition: ubRhoThermo.C:288
virtual tmp< volScalarField > The(const volScalarField &h, const volScalarField &p, const volScalarField &T0) const
Temperature from enthalpy/internal energy.
Definition: ubRhoThermo.C:500
virtual const volScalarField & psi() const
Compressibility [s^2/m^2].
Definition: ubRhoThermo.C:220
virtual const volScalarField & mu() const
Dynamic viscosity of mixture [kg/m/s].
Definition: ubRhoThermo.C:535
virtual bool isochoric() const
Return true if the equation of state is isochoric.
Definition: ubRhoThermo.H:185
A class for handling words, derived from string.
Definition: word.H:63
const scalar T0
label patchi
const cellShapeList & cells
const dimensionedScalar h
Planck constant.
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