Initial commit for version 2.0.x patch release
[OpenFOAM-2.0.x.git] / src / thermophysicalModels / basicSolidThermo / solidMixtureThermo / mixtures / multiComponentSolidMixture / multiComponentSolidMixture.C
blobb9cfca7a1a73a712e3be2841c3490320f2dba945
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2010-2010 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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 "multiComponentSolidMixture.H"
28 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
30 template<class ThermoSolidType>
31 void Foam::multiComponentSolidMixture<ThermoSolidType>::correctMassFractions()
33     volScalarField Yt("Yt", Y_[0]);
35     for (label n=1; n<Y_.size(); n++)
36     {
37         Yt += Y_[n];
38     }
40     forAll(Y_, n)
41     {
42         Y_[n] /= Yt;
43     }
49 template<class ThermoSolidType>
50 Foam::scalar Foam::multiComponentSolidMixture<ThermoSolidType>::X
52     label iComp, label celli, scalar T
53 ) const
55     scalar rhoInv = 0.0;
56     forAll(solidData_, i)
57     {
58         rhoInv += Y_[i][celli]/solidData_[i].rho(T);
59     }
61     scalar X = Y_[iComp][celli]/solidData_[iComp].rho(T);
63     return (X/rhoInv);
67 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
69 template<class ThermoSolidType>
70 Foam::multiComponentSolidMixture<ThermoSolidType>::multiComponentSolidMixture
72     const dictionary& thermoSolidDict,
73     const fvMesh& mesh
76     basicSolidMixture
77     (
78         thermoSolidDict.lookup("solidComponents"),
79         mesh
80     ),
81     solidData_(components_.size())
84     forAll(components_, i)
85     {
86         solidData_.set
87         (
88             i,
89             new ThermoSolidType
90             (
91                 thermoSolidDict.subDict(components_[i] + "Coeffs")
92             )
93         );
94     }
95     correctMassFractions();
99 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
101 template<class ThermoSolidType>
102 Foam::scalar Foam::multiComponentSolidMixture<ThermoSolidType>::rho
104     scalar T, label celli
105 ) const
107     scalar tmp = 0.0;
108     forAll(solidData_, i)
109     {
110         tmp += solidData_[i].rho(T)*X(i, celli, T);
111     }
112     return tmp;
116 template<class ThermoSolidType>
117 Foam::scalar Foam::multiComponentSolidMixture<ThermoSolidType>::hf
119     scalar, label celli
120 ) const
122     scalar tmp = 0.0;
123     forAll(solidData_, i)
124     {
125         tmp += solidData_[i].hf()*Y_[i][celli];
126     }
127     return tmp;
131 template<class ThermoSolidType>
132 Foam::scalar Foam::multiComponentSolidMixture<ThermoSolidType>::hs
134     scalar T, label celli
135 ) const
137     scalar tmp = 0.0;
138     forAll(solidData_, i)
139     {
140         tmp += solidData_[i].hs(T)*Y_[i][celli];
141     }
142     return tmp;
146 template<class ThermoSolidType>
147 Foam::scalar Foam::multiComponentSolidMixture<ThermoSolidType>::h
149     scalar T, label celli
150 ) const
152     scalar tmp = 0.0;
153     forAll(solidData_, i)
154     {
155         tmp += solidData_[i].h(T)*Y_[i][celli];
156     }
157     return tmp;
161 template<class ThermoSolidType>
162 Foam::scalar Foam::multiComponentSolidMixture<ThermoSolidType>::kappa
164     scalar T, label celli
165 ) const
167     scalar tmp = 0.0;
168     forAll(solidData_, i)
169     {
170         tmp += solidData_[i].kappa(T)*X(i, celli, T);
171     }
172     return tmp;
176 template<class ThermoSolidType>
177 Foam::scalar Foam::multiComponentSolidMixture<ThermoSolidType>::sigmaS
179     scalar T, label celli
180 ) const
182     scalar tmp = 0.0;
183     forAll(solidData_, i)
184     {
185         tmp += solidData_[i].sigmaS(T)*X(i, celli, T);
186     }
187     return tmp;
191 template<class ThermoSolidType>
192 Foam::scalar Foam::multiComponentSolidMixture<ThermoSolidType>::K
194     scalar T, label celli
195 ) const
197     scalar tmp = 0.0;
198     forAll(solidData_, i)
199     {
200         tmp += solidData_[i].K(T)*X(i, celli, T);
201     }
202     return tmp;
206 template<class ThermoSolidType>
207 Foam::scalar Foam::multiComponentSolidMixture<ThermoSolidType>::emissivity
209     scalar T, label celli
210 ) const
212     scalar tmp = 0.0;
213     forAll(solidData_, i)
214     {
215         tmp += solidData_[i].emissivity(T)*Y_[i][celli];
216     }
217     return tmp;
221 template<class ThermoSolidType>
222 Foam::scalar Foam::multiComponentSolidMixture<ThermoSolidType>::Cp
224     scalar T, label celli
225 ) const
227     scalar tmp = 0.0;
228     forAll(solidData_, i)
229     {
230         tmp += solidData_[i].Cp(T)*Y_[i][celli];
231     }
232     return tmp;
236 template<class ThermoSolidType>
237 void Foam::multiComponentSolidMixture<ThermoSolidType>::read
239     const dictionary& thermoDict
242     forAll(components_, i)
243     {
244         solidData_[i] =
245             ThermoSolidType(thermoDict.subDict(components_[i] + "Coeffs"));
246     }
250 // ************************************************************************* //