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());
38  {
39  properties_.set(i, solidProperties::New(dict.subDict(components_[i])));
40  }
41 }
42 
43 
45 (
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 
90 Foam::scalar Foam::solidMixtureProperties::rho(const scalarField& X) const
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 // ************************************************************************* //
Foam::solidMixtureProperties::X
scalarField X(const scalarField &Y) const
Returns the mole fractions, given mass fractions.
Definition: solidMixtureProperties.C:75
Foam::solidProperties::New
static autoPtr< solidProperties > New(Istream &is)
Return a pointer to a new solidProperties created from input.
Definition: solidPropertiesNew.C:31
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:406
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
Foam::solidMixtureProperties::solidMixtureProperties
solidMixtureProperties(const dictionary &)
Construct from dictionary.
Definition: solidMixtureProperties.C:30
Foam::solidMixtureProperties
A mixture of solids.
Definition: solidMixtureProperties.H:74
Foam::solidMixtureProperties::rho
scalar rho(const scalarField &X) const
Calculate the mixture density [kg/m^3] as a function of.
Definition: solidMixtureProperties.C:90
Foam::solidMixtureProperties::Cp
scalar Cp(const scalarField &Y) const
Calculate the mixture heat capacity [J/(kg K)] as a function.
Definition: solidMixtureProperties.C:101
Foam::solidMixtureProperties::properties_
PtrList< solidProperties > properties_
The solidProperties properties.
Definition: solidMixtureProperties.H:82
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
s
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Foam::solidMixtureProperties::New
static autoPtr< solidMixtureProperties > New(const dictionary &)
Select construct from dictionary.
Definition: solidMixtureProperties.C:62
Foam::autoPtr< Foam::solidMixtureProperties >
solidMixtureProperties.H
Foam::solidMixtureProperties::components_
List< word > components_
The names of the solids.
Definition: solidMixtureProperties.H:79
Foam::List::size
void size(const label)
Override size to be inconsistent with allocated storage.
Y
PtrList< volScalarField > & Y
Definition: createFields.H:36