1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2008 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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 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, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "multiComponentMixture.H"
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
37 template<class ThermoType>
38 const ThermoType& multiComponentMixture<ThermoType>::constructSpeciesData
40 const dictionary& thermoDict
48 new ThermoType(thermoDict.lookup(species_[i]))
52 return speciesData_[0];
56 template<class ThermoType>
57 void multiComponentMixture<ThermoType>::correctMassFractions()
59 volScalarField Yt = Y_[0];
61 for(label n=1; n<Y_.size(); n++)
73 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
75 template<class ThermoType>
76 multiComponentMixture<ThermoType>::multiComponentMixture
78 const dictionary& thermoDict,
79 const wordList& specieNames,
80 const HashPtrTable<ThermoType>& specieThermoData,
84 combustionMixture(thermoDict, specieNames, mesh),
85 speciesData_(species_.size()),
86 mixture_("mixture", *specieThermoData[specieNames[0]])
93 new ThermoType(*specieThermoData[species_[i]])
97 correctMassFractions();
101 template<class ThermoType>
102 multiComponentMixture<ThermoType>::multiComponentMixture
104 const dictionary& thermoDict,
108 combustionMixture(thermoDict, thermoDict.lookup("species"), mesh),
109 speciesData_(species_.size()),
110 mixture_("mixture", constructSpeciesData(thermoDict))
112 correctMassFractions();
116 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
118 template<class ThermoType>
119 const ThermoType& multiComponentMixture<ThermoType>::cellMixture
124 mixture_ = Y_[0][celli]/speciesData_[0].W()*speciesData_[0];
126 for (label n=1; n<Y_.size(); n++)
128 mixture_ += Y_[n][celli]/speciesData_[n].W()*speciesData_[n];
135 template<class ThermoType>
136 const ThermoType& multiComponentMixture<ThermoType>::patchFaceMixture
143 Y_[0].boundaryField()[patchi][facei]
144 /speciesData_[0].W()*speciesData_[0];
146 for (label n=1; n<Y_.size(); n++)
149 Y_[n].boundaryField()[patchi][facei]
150 /speciesData_[n].W()*speciesData_[n];
157 template<class ThermoType>
158 void multiComponentMixture<ThermoType>::read(const dictionary& thermoDict)
162 speciesData_[i] = ThermoType(thermoDict.lookup(species_[i]));
167 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169 } // End namespace Foam
171 // ************************************************************************* //