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-2017 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 
38  forAll(components_, i)
39  {
40  if (dict.isDict(components_[i]))
41  {
42  properties_.set
43  (
44  i,
45  solidProperties::New(dict.subDict(components_[i]))
46  );
47  }
48  else
49  {
50  properties_.set
51  (
52  i,
53  solidProperties::New(components_[i])
54  );
55  }
56  }
57 }
58 
59 
61 (
62  const solidMixtureProperties& s
63 )
64 :
65  components_(s.components_),
66  properties_(s.properties_.size())
67 {
68  forAll(properties_, i)
69  {
70  properties_.set(i, s.properties_(i)->clone());
71  }
72 }
73 
74 
75 // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
76 
78 (
79  const dictionary& thermophysicalProperties
80 )
81 {
83  (
84  new solidMixtureProperties(thermophysicalProperties)
85  );
86 }
87 
88 
89 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
90 
92 {
93  scalar rrho = 0;
94 
95  forAll(properties_, i)
96  {
97  rrho += Y[i]/properties_[i].rho();
98  }
99 
100  return 1/rrho;
101 }
102 
103 
105 {
106  scalar Cp = 0;
107 
108  forAll(properties_, i)
109  {
110  Cp += Y[i]*properties_[i].Cp();
111  }
112 
113  return Cp;
114 }
115 
116 
117 // ************************************************************************* //
dictionary dict
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:428
scalar rho(const scalarField &Y) const
Calculate the mixture density [kg/m^3] as a function of.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
void size(const label)
Override size to be inconsistent with allocated storage.
Definition: ListI.H:163
wordList toc() const
Return the table of contents.
Definition: dictionary.C:776
bool isDict(const word &) const
Check if entry is a sub-dictionary.
Definition: dictionary.C:646
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
Definition: dictionary.C:692
scalar Cp(const scalarField &Y) const
Calculate the mixture heat capacity [J/(kg K)] as a function of.
PtrList< volScalarField > & Y
solidMixtureProperties(const dictionary &)
Construct from dictionary.
static autoPtr< solidMixtureProperties > New(const dictionary &)
Select construct from dictionary.
static autoPtr< solidProperties > New(const word &name)
Return a pointer to a new solidProperties created from name.