solidMixtureProperties.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) 2011 OpenFOAM Foundation
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 
26 #include "solidMixtureProperties.H"
27 
28 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
29 
31 :
32  components_(),
33  properties_()
34 {
35  components_ = dict.toc();
36  properties_.setSize(components_.size());
37  forAll(components_, i)
38  {
39  properties_.set(i, solidProperties::New(dict.subDict(components_[i])));
40  }
41 }
42 
43 
45 (
46  const solidMixtureProperties& s
47 )
48 :
49  components_(s.components_),
50  properties_(s.properties_.size())
51 {
52  forAll(properties_, i)
53  {
54  properties_.set(i, s.properties_(i)->clone());
55  }
56 }
57 
58 
59 // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
60 
62 (
63  const dictionary& thermophysicalProperties
64 )
65 {
67  (
68  new solidMixtureProperties(thermophysicalProperties)
69  );
70 }
71 
72 
73 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
74 
76 {
77  scalarField X(Y.size());
78  scalar rhoInv = 0.0;
79  forAll(X, i)
80  {
81  rhoInv += Y[i]/properties_[i].rho();
82  X[i] = Y[i]/properties_[i].rho();
83  }
84 
85  tmp<scalarField> tfld(X/rhoInv);
86  return tfld();
87 }
88 
89 
91 {
92  scalar val = 0.0;
93  forAll(properties_, i)
94  {
95  val += properties_[i].rho()*X[i];
96  }
97  return val;
98 }
99 
100 
102 {
103  scalar val = 0.0;
104  forAll(properties_, i)
105  {
106  val += properties_[i].Cp()*Y[i];
107  }
108  return val;
109 }
110 
111 
112 // ************************************************************************* //
solidMixtureProperties(const dictionary &)
Construct from dictionary.
static autoPtr< solidProperties > New(Istream &is)
Return a pointer to a new solidProperties created from input.
void size(const label)
Override size to be inconsistent with allocated storage.
Definition: ListI.H:76
scalarField Y(const scalarField &X) const
Returns the mass fractions, given mole fractions.
static autoPtr< solidMixtureProperties > New(const dictionary &)
Select construct from dictionary.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
Definition: dictionary.C:638
dictionary dict
wordList toc() const
Return the table of contents.
Definition: dictionary.C:707
#define forAll(list, i)
Definition: UList.H:421
scalarField X(const scalarField &Y) const
Returns the mole fractions, given mass fractions.
scalar rho(const scalarField &X) const
Calculate the mixture density [kg/m^3] as a function of.
A class for managing temporary objects.
Definition: PtrList.H:118
scalar Cp(const scalarField &Y) const
Calculate the mixture heat capacity [J/(kg K)] as a function.