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