1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend 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 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "multiComponentMixture.H"
28 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
30 template<class ThermoType>
31 const ThermoType& Foam::multiComponentMixture<ThermoType>::constructSpeciesData
33 const dictionary& thermoDict
41 new ThermoType(thermoDict.lookup(species_[i]))
45 return speciesData_[0];
49 template<class ThermoType>
50 void Foam::multiComponentMixture<ThermoType>::correctMassFractions()
58 for (label n=1; n<Y_.size(); n++)
70 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
72 template<class ThermoType>
73 Foam::multiComponentMixture<ThermoType>::multiComponentMixture
75 const dictionary& thermoDict,
76 const wordList& specieNames,
77 const HashPtrTable<ThermoType>& specieThermoData,
79 const objectRegistry& obj
82 basicMultiComponentMixture(thermoDict, specieNames, mesh, obj),
83 speciesData_(species_.size()),
84 mixture_("mixture", *specieThermoData[specieNames[0]])
91 new ThermoType(*specieThermoData[species_[i]])
95 correctMassFractions();
99 template<class ThermoType>
100 Foam::multiComponentMixture<ThermoType>::multiComponentMixture
102 const dictionary& thermoDict,
104 const objectRegistry& obj
107 basicMultiComponentMixture(thermoDict, thermoDict.lookup("species"), mesh, obj),
108 speciesData_(species_.size()),
109 mixture_("mixture", constructSpeciesData(thermoDict))
111 correctMassFractions();
115 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
117 template<class ThermoType>
118 const ThermoType& Foam::multiComponentMixture<ThermoType>::cellMixture
123 mixture_ = Y_[0][celli]/speciesData_[0].W()*speciesData_[0];
125 for (label n=1; n<Y_.size(); n++)
127 mixture_ += Y_[n][celli]/speciesData_[n].W()*speciesData_[n];
134 template<class ThermoType>
135 const ThermoType& Foam::multiComponentMixture<ThermoType>::patchFaceMixture
142 Y_[0].boundaryField()[patchi][facei]
143 /speciesData_[0].W()*speciesData_[0];
145 for (label n=1; n<Y_.size(); n++)
148 Y_[n].boundaryField()[patchi][facei]
149 /speciesData_[n].W()*speciesData_[n];
156 template<class ThermoType>
157 void Foam::multiComponentMixture<ThermoType>::read
159 const dictionary& thermoDict
164 speciesData_[i] = ThermoType(thermoDict.lookup(species_[i]));
169 // ************************************************************************* //