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-2018 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 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 /*---------------------------------------------------------------------------*\
47  Class multiComponentMixture Declaration
48 \*---------------------------------------------------------------------------*/
49 
50 template<class ThermoType>
52 :
53  public basicSpecieMixture
54 {
55  // Private data
56 
57  //- Species data
58  PtrList<ThermoType> speciesData_;
59 
60  //- Temporary storage for the cell/face mixture thermo data
61  mutable ThermoType mixture_;
62 
63  //- Temporary storage for the volume weighted
64  // cell/face mixture thermo data
65  mutable ThermoType mixtureVol_;
66 
67 
68  // Private Member Functions
69 
70  //- Construct the species data from the given dictionary and return the
71  // data for the first specie to initialise the mixture thermo data
72  const ThermoType& constructSpeciesData(const dictionary& thermoDict);
73 
74  //- Correct the mass fractions to sum to 1
75  void correctMassFractions();
76 
77  //- Construct as copy (not implemented)
79 
80 
81 public:
82 
83  //- The type of thermodynamics this mixture is instantiated for
84  typedef ThermoType thermoType;
85 
86 
87  // Constructors
88 
89  //- Construct from dictionary, specie names, thermo database,
90  // mesh and phase name
92  (
93  const dictionary&,
94  const wordList& specieNames,
95  const HashPtrTable<ThermoType>& thermoData,
96  const fvMesh&,
97  const word&
98  );
99 
100  //- Construct from dictionary, mesh and phase name
101  multiComponentMixture(const dictionary&, const fvMesh&, const word&);
102 
103 
104  //- Destructor
105  virtual ~multiComponentMixture()
106  {}
107 
108 
109  // Member functions
110 
111  //- Return the instantiated type name
112  static word typeName()
113  {
114  return "multiComponentMixture<" + ThermoType::typeName() + '>';
115  }
116 
117  const ThermoType& cellMixture(const label celli) const;
118 
119  const ThermoType& patchFaceMixture
120  (
121  const label patchi,
122  const label facei
123  ) const;
124 
125  const ThermoType& cellVolMixture
126  (
127  const scalar p,
128  const scalar T,
129  const label celli
130  ) const;
131 
132  const ThermoType& patchFaceVolMixture
133  (
134  const scalar p,
135  const scalar T,
136  const label patchi,
137  const label facei
138  ) const;
139 
140  //- Return the raw specie thermodynamic data
141  const PtrList<ThermoType>& speciesData() const
142  {
143  return speciesData_;
144  }
145 
146  //- Read dictionary
147  void read(const dictionary&);
148 
149  //- Return thermo based on index
150  inline const ThermoType& getLocalThermo(const label speciei) const
151  {
152  return speciesData_[speciei];
153  }
154 };
155 
156 
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 
159 } // End namespace Foam
160 
161 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
162 
163 #ifdef NoRepository
164  #include "multiComponentMixture.C"
165 #endif
166 
167 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
168 
169 #endif
170 
171 // ************************************************************************* //
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:137
Specialization of basicMultiComponentMixture for a mixture consisting of a number for molecular speci...
const ThermoType & patchFaceVolMixture(const scalar p, const scalar T, const label patchi, const label facei) const
const PtrList< ThermoType > & speciesData() const
Return the raw specie thermodynamic data.
virtual ~multiComponentMixture()
Destructor.
A class for handling words, derived from string.
Definition: word.H:59
const ThermoType & patchFaceMixture(const label patchi, const label facei) const
Foam::multiComponentMixture.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
ThermoType thermoType
The type of thermodynamics this mixture is instantiated for.
label patchi
const ThermoType & cellMixture(const label celli) const
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
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.
const ThermoType & getLocalThermo(const label speciei) const
Return thermo based on index.
Namespace for OpenFOAM.