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