1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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.
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
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/>.
24 \*---------------------------------------------------------------------------*/
26 #include "inhomogeneousMixture.H"
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 template<class ThermoType>
32 const char* Foam::inhomogeneousMixture<ThermoType>::specieNames_[2] =
36 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
38 template<class ThermoType>
39 Foam::inhomogeneousMixture<ThermoType>::inhomogeneousMixture
41 const dictionary& thermoDict,
45 basicMultiComponentMixture
48 speciesTable(nSpecies_, specieNames_),
52 stoicRatio_(thermoDict.lookup("stoichiometricAirFuelMassRatio")),
54 fuel_(thermoDict.subDict("fuel")),
55 oxidant_(thermoDict.subDict("oxidant")),
56 products_(thermoDict.subDict("burntProducts")),
58 mixture_("mixture", fuel_),
65 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
67 template<class ThermoType>
68 const ThermoType& Foam::inhomogeneousMixture<ThermoType>::mixture
80 scalar fu = b*ft + (1.0 - b)*fres(ft, stoicRatio().value());
81 scalar ox = 1 - ft - (ft - fu)*stoicRatio().value();
82 scalar pr = 1 - fu - ox;
84 mixture_ = fu/fuel_.W()*fuel_;
85 mixture_ += ox/oxidant_.W()*oxidant_;
86 mixture_ += pr/products_.W()*products_;
93 template<class ThermoType>
94 void Foam::inhomogeneousMixture<ThermoType>::read(const dictionary& thermoDict)
96 stoicRatio_ = thermoDict.lookup("stoichiometricAirFuelMassRatio");
98 fuel_ = ThermoType(thermoDict.subDict("fuel"));
99 oxidant_ = ThermoType(thermoDict.subDict("oxidant"));
100 products_ = ThermoType(thermoDict.subDict("burntProducts"));
104 template<class ThermoType>
105 const ThermoType& Foam::inhomogeneousMixture<ThermoType>::getLocalThermo
114 else if (specieI == 1)
118 else if (specieI == 2)
126 "const ThermoType& Foam::inhomogeneousMixture<ThermoType>::"
131 ) << "Unknown specie index " << specieI << ". Valid indices are 0..2"
132 << abort(FatalError);
139 template<class ThermoType>
140 Foam::scalar Foam::inhomogeneousMixture<ThermoType>::nMoles
145 return getLocalThermo(specieI).nMoles();
149 template<class ThermoType>
150 Foam::scalar Foam::inhomogeneousMixture<ThermoType>::W
155 return getLocalThermo(specieI).W();
159 template<class ThermoType>
160 Foam::scalar Foam::inhomogeneousMixture<ThermoType>::Cp
166 return getLocalThermo(specieI).Cp(T);
170 template<class ThermoType>
171 Foam::scalar Foam::inhomogeneousMixture<ThermoType>::Cv
177 return getLocalThermo(specieI).Cv(T);
181 template<class ThermoType>
182 Foam::scalar Foam::inhomogeneousMixture<ThermoType>::H
188 return getLocalThermo(specieI).H(T);
192 template<class ThermoType>
193 Foam::scalar Foam::inhomogeneousMixture<ThermoType>::Hs
199 return getLocalThermo(specieI).Hs(T);
203 template<class ThermoType>
204 Foam::scalar Foam::inhomogeneousMixture<ThermoType>::Hc
209 return getLocalThermo(specieI).Hc();
213 template<class ThermoType>
214 Foam::scalar Foam::inhomogeneousMixture<ThermoType>::S
220 return getLocalThermo(specieI).S(T);
224 template<class ThermoType>
225 Foam::scalar Foam::inhomogeneousMixture<ThermoType>::E
231 return getLocalThermo(specieI).E(T);
235 template<class ThermoType>
236 Foam::scalar Foam::inhomogeneousMixture<ThermoType>::G
242 return getLocalThermo(specieI).G(T);
246 template<class ThermoType>
247 Foam::scalar Foam::inhomogeneousMixture<ThermoType>::A
253 return getLocalThermo(specieI).A(T);
257 template<class ThermoType>
258 Foam::scalar Foam::inhomogeneousMixture<ThermoType>::mu
264 return getLocalThermo(specieI).mu(T);
268 template<class ThermoType>
269 Foam::scalar Foam::inhomogeneousMixture<ThermoType>::kappa
275 return getLocalThermo(specieI).kappa(T);
279 template<class ThermoType>
280 Foam::scalar Foam::inhomogeneousMixture<ThermoType>::alpha
286 return getLocalThermo(specieI).alpha(T);
290 // ************************************************************************* //