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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2017 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "solidMixtureProperties.H"
29 
30 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
31 
33 :
34  components_(),
35  properties_()
36 {
37  components_ = dict.toc();
38  properties_.setSize(components_.size());
39 
40  forAll(components_, i)
41  {
42  if (dict.isDict(components_[i]))
43  {
44  properties_.set
45  (
46  i,
47  solidProperties::New(dict.subDict(components_[i]))
48  );
49  }
50  else
51  {
52  properties_.set
53  (
54  i,
55  solidProperties::New(components_[i])
56  );
57  }
58  }
59 }
60 
61 
63 (
65 )
66 :
67  components_(s.components_),
68  properties_(s.properties_.size())
69 {
70  forAll(properties_, i)
71  {
72  properties_.set(i, s.properties_(i)->clone());
73  }
74 }
75 
76 
77 // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
78 
80 (
82 )
83 {
85 }
86 
87 
88 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
89 
91 {
92  scalar rrho = 0;
93 
94  forAll(properties_, i)
95  {
96  rrho += Y[i]/properties_[i].rho();
97  }
98 
99  return 1/rrho;
100 }
101 
102 
104 {
105  scalar Cp = 0;
106 
107  forAll(properties_, i)
108  {
109  Cp += Y[i]*properties_[i].Cp();
110  }
111 
112  return Cp;
113 }
114 
115 
116 // ************************************************************************* //
Foam::autoPtr::New
static autoPtr< T > New(Args &&... args)
Construct autoPtr of T with forwarding arguments.
s
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.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))
Definition: gmvOutputSpray.H:25
Foam::solidMixtureProperties::solidMixtureProperties
solidMixtureProperties(const dictionary &)
Construct from dictionary.
Definition: solidMixtureProperties.C:32
Foam::solidProperties::New
static autoPtr< solidProperties > New(const word &name)
Return a pointer to a new solidProperties created from name.
Definition: solidPropertiesNew.C:35
Foam::solidMixtureProperties
A mixture of solids.
Definition: solidMixtureProperties.H:69
Foam::solidMixtureProperties::rho
scalar rho(const scalarField &Y) const
Calculate the mixture density [kg/m^3] as a function of.
Definition: solidMixtureProperties.C:90
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:296
Foam::solidMixtureProperties::Cp
scalar Cp(const scalarField &Y) const
Calculate the mixture heat capacity [J/(kg K)] as a function of.
Definition: solidMixtureProperties.C:103
Foam::thermophysicalProperties
Base-class for thermophysical properties of solids, liquids and gases providing an interface compatib...
Definition: thermophysicalProperties.H:55
Foam::Field< scalar >
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Y
PtrList< volScalarField > & Y
Definition: createFieldRefs.H:7
Foam::solidMixtureProperties::New
static autoPtr< solidMixtureProperties > New(const dictionary &)
Select construct from dictionary.
Definition: solidMixtureProperties.C:80
Foam::autoPtr< Foam::solidMixtureProperties >
solidMixtureProperties.H
Cp
const volScalarField & Cp
Definition: EEqn.H:7