initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / thermophysicalModels / solidMixture / solidMixture / solidMixture.C
blob8bb511e9cc9b7176e2c059f5075a429db16dbb16
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 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 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
19     for more details.
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 "solidMixture.H"
29 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
31 // Construct from components
32 Foam::solidMixture::solidMixture
34     const dictionary& thermophysicalProperties
37     components_(thermophysicalProperties.lookup("solidComponents")),
38     properties_(components_.size())
41     forAll(components_, i)
42     {
43         properties_.set
44         (
45             i,
46             solid::New(thermophysicalProperties.lookup(components_[i]))
47         );
48     }
52 // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
54 Foam::autoPtr<Foam::solidMixture> Foam::solidMixture::New
56     const dictionary& thermophysicalProperties
59     return autoPtr<solidMixture>(new solidMixture(thermophysicalProperties));
63 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
65 Foam::scalarField Foam::solidMixture::X
67     const scalarField& Y
68 ) const
70     scalarField X(Y.size());
71     scalar rhoInv = 0.0;
72     forAll(X, i)
73     {
74         rhoInv += Y[i]/properties_[i].rho();
75         X[i] = Y[i]/properties_[i].rho();
76     }
78     return X/rhoInv;
82 Foam::scalar Foam::solidMixture::rho
84     const scalarField& X
85 ) const
87     scalar tmp = 0.0;
88     forAll(properties_, i)
89     {
90         tmp += properties_[i].rho()*X[i];
91     }
92     return tmp;
96 Foam::scalar Foam::solidMixture::cp
98     const scalarField& Y
99 ) const
101     scalar tmp = 0.0;
102     forAll(properties_, i)
103     {
104         tmp += properties_[i].cp()*Y[i];
105     }
106     return tmp;
110 // ************************************************************************* //