FreeFOAM The Cross-Platform CFD Toolkit
solidMixture.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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.
20 
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/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
27 
28 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
29 
30 // Construct from components
32 (
33  const dictionary& thermophysicalProperties
34 )
35 :
36  components_(thermophysicalProperties.lookup("solidComponents")),
37  properties_(components_.size())
38 {
39 
40  forAll(components_, i)
41  {
42  properties_.set
43  (
44  i,
45  solid::New(thermophysicalProperties.lookup(components_[i]))
46  );
47  }
48 }
49 
50 
51 // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
52 
54 (
55  const dictionary& thermophysicalProperties
56 )
57 {
58  return autoPtr<solidMixture>(new solidMixture(thermophysicalProperties));
59 }
60 
61 
62 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
63 
65 (
66  const scalarField& Y
67 ) const
68 {
69  scalarField X(Y.size());
70  scalar rhoInv = 0.0;
71  forAll(X, i)
72  {
73  rhoInv += Y[i]/properties_[i].rho();
74  X[i] = Y[i]/properties_[i].rho();
75  }
76 
77  return X/rhoInv;
78 }
79 
80 
81 Foam::scalar Foam::solidMixture::rho
82 (
83  const scalarField& X
84 ) const
85 {
86  scalar tmp = 0.0;
87  forAll(properties_, i)
88  {
89  tmp += properties_[i].rho()*X[i];
90  }
91  return tmp;
92 }
93 
94 
95 Foam::scalar Foam::solidMixture::cp
96 (
97  const scalarField& Y
98 ) const
99 {
100  scalar tmp = 0.0;
101  forAll(properties_, i)
102  {
103  tmp += properties_[i].cp()*Y[i];
104  }
105  return tmp;
106 }
107 
108 
109 // ************************ vim: set sw=4 sts=4 et: ************************ //