All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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-2023 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  reactants_("reactants", dict.subDict("reactants")),
37  products_("products", dict.subDict("products")),
38  mixture_("mixture", reactants_)
39 {}
40 
41 
42 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
43 
44 template<class ThermoType>
46 (
47  const scalar b
48 ) const
49 {
50  if (b > 0.999)
51  {
52  return reactants_;
53  }
54  else if (b < 0.001)
55  {
56  return products_;
57  }
58  else
59  {
60  mixture_ = b*reactants_;
61  mixture_ += (1 - b)*products_;
62 
63  return mixture_;
64  }
65 }
66 
67 
68 template<class ThermoType>
71 (
72  const scalarFieldListSlice& Y
73 ) const
74 {
75  return mixture(Y[B]);
76 }
77 
78 
79 template<class ThermoType>
82 (
83  const scalarFieldListSlice& Y
84 ) const
85 {
86  return mixture(Y[B]);
87 }
88 
89 
90 template<class ThermoType>
93 (
94  const scalarFieldListSlice&,
96 ) const
97 {
98  return mixture;
99 }
100 
101 
102 template<class ThermoType>
105 (
106  const scalarFieldListSlice& Y
107 ) const
108 {
109  return reactants_;
110 }
111 
112 
113 template<class ThermoType>
116 (
117  const scalarFieldListSlice& Y
118 ) const
119 {
120  return products_;
121 }
122 
123 
124 template<class ThermoType>
126 {
127  reactants_ = ThermoType("reactants", dict.subDict("reactants"));
128  products_ = ThermoType("products", dict.subDict("products"));
129 }
130 
131 
132 // ************************************************************************* //
static const Foam::dimensionedScalar B("B", Foam::dimless, 18.678)
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
Definition: dictionary.C:843
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:25
dictionary dict
PtrList< volScalarField > & Y