multiComponentMixture.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2020 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 Class
25  Foam::multiComponentMixture
26 
27 Description
28  Foam::multiComponentMixture
29 
30 SourceFiles
31  multiComponentMixture.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef multiComponentMixture_H
36 #define multiComponentMixture_H
37 
38 #include "basicSpecieMixture.H"
39 #include "HashPtrTable.H"
40 #include "specieElement.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 /*---------------------------------------------------------------------------*\
48  Class multiComponentMixture Declaration
49 \*---------------------------------------------------------------------------*/
50 
51 template<class ThermoType>
53 :
54  public basicSpecieMixture
55 {
56  // Private Data
57 
58  //- List of specie thermo
59  PtrList<ThermoType> specieThermos_;
60 
62 
63  //- Table of species composition
64  speciesCompositionTable speciesComposition_;
65 
66  //- Temporary storage for the cell/face mixture thermo data
67  mutable ThermoType mixture_;
68 
69  //- Temporary storage for the volume weighted
70  // cell/face mixture thermo data
71  mutable ThermoType mixtureVol_;
72 
73 
74  // Private Member Functions
75 
76  //- Read the species data from the given dictionary and return
77  PtrList<ThermoType> readSpeciesData(const dictionary& thermoDict) const;
78 
79  //- Read the species composition from the given dictionary and return
80  speciesCompositionTable readSpeciesComposition
81  (
82  const dictionary& thermoDict,
83  const speciesTable& speciesTable_
84  ) const;
85 
86  //- Correct the mass fractions to sum to 1
87  void correctMassFractions();
88 
89 
90 public:
91 
92  //- The type of thermodynamics this mixture is instantiated for
93  typedef ThermoType thermoType;
94 
95 
96  // Constructors
97 
98  //- Construct from dictionary, mesh and phase name
99  multiComponentMixture(const dictionary&, const fvMesh&, const word&);
100 
101  //- Disallow default bitwise copy construction
103  (
105  ) = delete;
106 
107 
108  //- Destructor
109  virtual ~multiComponentMixture()
110  {}
111 
112 
113  // Member Functions
114 
115  //- Return the instantiated type name
116  static word typeName()
117  {
118  return "multiComponentMixture<" + ThermoType::typeName() + '>';
119  }
120 
121  //- Return the raw specie thermodynamic data
122  const PtrList<ThermoType>& specieThermos() const
123  {
124  return specieThermos_;
125  }
126 
127  //- Return the table of species composition
128  const speciesCompositionTable& specieComposition() const
129  {
130  return speciesComposition_;
131  }
132 
133  const ThermoType& cellMixture(const label celli) const;
134 
135  const ThermoType& patchFaceMixture
136  (
137  const label patchi,
138  const label facei
139  ) const;
140 
141  const ThermoType& cellVolMixture
142  (
143  const scalar p,
144  const scalar T,
145  const label celli
146  ) const;
147 
148  const ThermoType& patchFaceVolMixture
149  (
150  const scalar p,
151  const scalar T,
152  const label patchi,
153  const label facei
154  ) const;
155 
156  //- Read dictionary
157  void read(const dictionary&);
158 
159  //- Return thermo based on index
160  inline const ThermoType& specieThermo(const label speciei) const
161  {
162  return specieThermos_[speciei];
163  }
164 };
165 
166 
167 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
168 
169 } // End namespace Foam
170 
171 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 
173 #ifdef NoRepository
174  #include "multiComponentMixture.C"
175 #endif
176 
177 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
178 
179 #endif
180 
181 // ************************************************************************* //
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
const ThermoType & specieThermo(const label speciei) const
Return thermo based on index.
Specialization of basicMixture for a mixture consisting of a number for molecular species...
const ThermoType & patchFaceVolMixture(const scalar p, const scalar T, const label patchi, const label facei) const
virtual ~multiComponentMixture()
Destructor.
const PtrList< ThermoType > & specieThermos() const
Return the raw specie thermodynamic data.
A class for handling words, derived from string.
Definition: word.H:59
const ThermoType & patchFaceMixture(const label patchi, const label facei) const
Foam::multiComponentMixture.
An STL-conforming hash table.
Definition: HashTable.H:61
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
ThermoType thermoType
The type of thermodynamics this mixture is instantiated for.
const speciesCompositionTable & specieComposition() const
Return the table of species composition.
label patchi
A wordList with hashed indices for faster lookup by name.
const ThermoType & cellMixture(const label celli) const
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
multiComponentMixture(const dictionary &, const fvMesh &, const word &)
Construct from dictionary, mesh and phase name.
volScalarField & p
const ThermoType & cellVolMixture(const scalar p, const scalar T, const label celli) const
static word typeName()
Return the instantiated type name.
void read(const dictionary &)
Read dictionary.
Namespace for OpenFOAM.