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  Copyright (C) 2022 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "solidMixtureProperties.H"
30 
31 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32 
34 :
35  components_(),
36  properties_()
37 {
38  components_ = dict.toc();
39  properties_.setSize(components_.size());
40 
41  forAll(components_, i)
42  {
43  // Handle sub-dictionary or primitive entry
44 
45  const dictionary* subDictPtr = dict.findDict(components_[i]);
46 
47  if (subDictPtr)
48  {
49  properties_.set
50  (
51  i,
52  solidProperties::New(*subDictPtr)
53  );
54  }
55  else
56  {
57  properties_.set
58  (
59  i,
60  solidProperties::New(components_[i])
61  );
62  }
63  }
64 }
65 
66 
68 (
69  const solidMixtureProperties& s
70 )
71 :
72  components_(s.components_),
73  properties_(s.properties_.clone())
74 {}
75 
76 
77 // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
78 
80 (
82 )
83 {
85 }
86 
87 
88 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
89 
90 Foam::scalar Foam::solidMixtureProperties::rho(const scalarField& Y) const
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 
103 Foam::scalar Foam::solidMixtureProperties::Cp(const scalarField& Y) const
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 // ************************************************************************* //
Base-class for thermophysical properties of solids, liquids and gases providing an interface compatib...
dictionary dict
void size(const label n)
Older name for setAddressableSize.
Definition: UList.H:116
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 a number of values (eg...
Definition: dictionary.H:129
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:421
scalar Cp(const scalarField &Y) const
Calculate the mixture heat capacity [J/(kg K)] as a function of.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
const volScalarField & Cp
Definition: EEqn.H:7
PtrList< volScalarField > & Y
solidMixtureProperties(const dictionary &)
Construct from dictionary.
static autoPtr< solidMixtureProperties > New(const dictionary &)
Select construct from dictionary.
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
Definition: autoPtr.H:178
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))
static autoPtr< solidProperties > New(const word &name)
Return a pointer to a new solidProperties created from name.