homogeneousMixture.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) 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 \*---------------------------------------------------------------------------*/
25 
26 #include "homogeneousMixture.H"
27 
28 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
29 
30 template<class ThermoType>
32 (
33  const dictionary& dict
34 )
35 :
36  Phi_(dict.lookup<scalar>("Phi")),
37  reactants_("reactants", dict.subDict("reactants")),
38  products_("products", dict.subDict("products")),
39  mixture_("mixture", reactants_)
40 {}
41 
42 
43 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
44 
45 template<class ThermoType>
47 (
48  const scalar b
49 ) const
50 {
51  if (b > 0.999)
52  {
53  return reactants_;
54  }
55  else if (b < 0.001)
56  {
57  return products_;
58  }
59  else
60  {
61  mixture_ = b*reactants_;
62  mixture_ += (1 - b)*products_;
63 
64  return mixture_;
65  }
66 }
67 
68 
69 template<class ThermoType>
72 (
73  const scalarFieldListSlice& Y
74 ) const
75 {
76  return mixture(Y[B]);
77 }
78 
79 
80 template<class ThermoType>
83 (
84  const scalarFieldListSlice& Y
85 ) const
86 {
87  return mixture(Y[B]);
88 }
89 
90 
91 template<class ThermoType>
94 (
95  const scalarFieldListSlice&,
97 ) const
98 {
99  return mixture;
100 }
101 
102 
103 template<class ThermoType>
106 (
107  const scalarFieldListSlice& Y
108 ) const
109 {
110  return reactants_;
111 }
112 
113 
114 template<class ThermoType>
117 (
118  const scalarFieldListSlice& Y
119 ) const
120 {
121  return products_;
122 }
123 
124 
125 template<class ThermoType>
127 {
128  Phi_ = dict.lookup<scalar>("Phi");
129  reactants_ = ThermoType("reactants", dict.subDict("reactants"));
130  products_ = ThermoType("products", dict.subDict("products"));
131 }
132 
133 
134 // ************************************************************************* //
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:669
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
Definition: dictionary.C:778
const transportMixtureType & transportMixture(const scalarFieldListSlice &) const
Return the mixture for transport properties.
ThermoType thermoType
The type of thermodynamics this mixture is instantiated for.
const thermoType & reactants(const scalarFieldListSlice &) const
Return the reactant mixture.
const thermoMixtureType & thermoMixture(const scalarFieldListSlice &) const
Return the mixture for thermodynamic properties.
ThermoType transportMixtureType
Mixing type for transport properties.
ThermoType thermoMixtureType
Mixing type for thermodynamic properties.
homogeneousMixture(const dictionary &)
Construct from a dictionary.
void read(const dictionary &)
Read dictionary.
const thermoType & mixture(const scalar) const
Return the mixture for the given composition.
const thermoType & products(const scalarFieldListSlice &) const
Return the product mixture.
volScalarField & b
Definition: createFields.H:27
static const coefficient B("B", dimless, 18.678)
const unitSet & lookup(const word &unitName)
Lookup and return the named unit from the table.
Definition: units.C:346
dictionary dict
PtrList< volScalarField > & Y