InterfaceCompositionModel.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) 2017 OpenCFD Ltd.
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::InterfaceCompositionModel
28 
29 Description
30  Base class for interface composition models, templated on the two
31  thermodynamic models either side of the interface.
32 
33 SourceFiles
34  InterfaceCompositionModel.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef InterfaceCompositionModel_H
39 #define InterfaceCompositionModel_H
40 
41 #include "interfaceCompositionModel.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 class phaseModel;
49 class phasePair;
50 template <class ThermoType> class pureMixture;
51 template <class ThermoType> class multiComponentMixture;
52 
53 /*---------------------------------------------------------------------------*\
54  Class InterfaceCompositionModel Declaration
55 \*---------------------------------------------------------------------------*/
56 
57 template<class Thermo, class OtherThermo>
58 class InterfaceCompositionModel
59 :
60  public interfaceCompositionModel
61 {
62 protected:
63 
64  // Private data
65 
66  //- Thermo (from)
67  const Thermo& fromThermo_;
68 
69  //- Other Thermo (to)
70  const OtherThermo& toThermo_;
71 
72  //- Lewis number
73  const dimensionedScalar Le_;
74 
75 
76  // Private member functions
77 
78  //- Get a reference to the local thermo for a pure mixture
79  template<class ThermoType>
82  (
83  const word& speciesName,
84  const pureMixture<ThermoType>& globalThermo
85  ) const;
86 
87  //- Get a reference to the local thermo for a multi component mixture
88  template<class ThermoType>
91  (
92  const word& speciesName,
93  const multiComponentMixture<ThermoType>& globalThermo
94  ) const;
95 
96  //- Return mass fraction for a pureMixture equal to one
97  template<class ThermoType>
99  (
100  const word& speciesName,
102  ) const;
103 
104  //- Return mass fraction for speciesName
105  template<class ThermoType>
107  (
108  const word& speciesName,
110  ) const;
111 
112  //- Return moleculas weight of the mixture for pureMixture [Kg/mol]
113  template<class ThermoType>
115  (
117  ) const;
118 
119  //- Return moleculas weight of the mixture for multiComponentMixture
120  // [Kg/mol]
121  template<class ThermoType>
123  (
125  ) const;
126 
127 
128 public:
129 
130  //- Construct from components
132 
133  //- Destructor
134  ~InterfaceCompositionModel() = default;
135 
136 
137  // Member Functions
138 
139  //- Mass fraction difference between the interface and the field
140  virtual tmp<volScalarField> dY
141  (
142  const word& speciesName,
143  const volScalarField& Tf
144  ) const;
145 
146  //- Reference mass fraction for species based models
147  virtual tmp<volScalarField> Yf
148  (
149  const word& speciesName,
150  const volScalarField& Tf
151  ) const;
152 
153  //- Mass diffusivity of the local thermo
154  virtual tmp<volScalarField> D
155  (
156  const word& speciesName
157  ) const;
158 
159  //- Latent heat (to - from)(thermo - otherThermo)
160  virtual tmp<volScalarField> L
161  (
162  const word& speciesName,
163  const volScalarField& Tf
164  ) const;
165 };
166 
167 
168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169 
170 } // End namespace Foam
171 
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173 
174 // Instantiation for multi-component (from) to single-component (to)
175 #define makeInterfaceDispSpecieMixtureType(Type, Thermo, Comp, Mix, Phys, OtherThermo, OtherComp, OtherMix, OtherPhys)\
176  \
177  typedef Thermo<Comp, SpecieMixture<Mix<Phys>>> \
178  Type##Thermo##Comp##Mix##Phys; \
179  \
180  typedef OtherThermo<OtherComp, OtherMix<OtherPhys>> \
181  Type##Other##OtherThermo##OtherComp##OtherMix##OtherPhys; \
182  \
183  addInterfaceCompositionToRunTimeSelectionTable \
184  ( \
185  Type, \
186  Type##Thermo##Comp##Mix##Phys, \
187  Type##Other##OtherThermo##OtherComp##OtherMix##OtherPhys \
188  )
189 
190 
191 // Instantiation for single-component (from) to multi-component (to)
192 #define makeInterfaceContSpecieMixtureType(Type, Thermo, Comp, Mix, Phys, OtherThermo, OtherComp, OtherMix, OtherPhys)\
193  \
194  typedef Thermo<Comp, Mix<Phys>> \
195  Type##Thermo##Comp##Mix##Phys; \
196  \
197  typedef OtherThermo<OtherComp, SpecieMixture<OtherMix<OtherPhys>>> \
198  Type##Other##OtherThermo##OtherComp##OtherMix##OtherPhys; \
199  \
200  addInterfaceCompositionToRunTimeSelectionTable \
201  ( \
202  Type, \
203  Type##Thermo##Comp##Mix##Phys, \
204  Type##Other##OtherThermo##OtherComp##OtherMix##OtherPhys \
205  )
206 
207 
208 // Instantiation for single-component-single-component pairs
209 #define makeInterfacePureType(Type, Thermo, Comp, Mix, Phys, OtherThermo, OtherComp, OtherMix, OtherPhys)\
210  \
211  typedef Thermo<Comp, Mix<Phys>> \
212  Type##Thermo##Comp##Mix##Phys; \
213  \
214  typedef OtherThermo<OtherComp, OtherMix<OtherPhys>> \
215  Type##Other##OtherThermo##OtherComp##OtherMix##OtherPhys; \
216  \
217  addInterfaceCompositionToRunTimeSelectionTable \
218  ( \
219  Type, \
220  Type##Thermo##Comp##Mix##Phys, \
221  Type##Other##OtherThermo##OtherComp##OtherMix##OtherPhys \
222  )
223 
224 
225 // Instantiation for multi-component-multi-component pairs
226 #define makeSpecieInterfaceSpecieMixtures(Type, Thermo, Comp, Mix, Phys, OtherThermo, OtherComp, OtherMix, OtherPhys)\
227  \
228  typedef Thermo<Comp, SpecieMixture<Mix<Phys>>> \
229  Type##Thermo##Comp##Mix##Phys; \
230  \
231  typedef OtherThermo<OtherComp, SpecieMixture<OtherMix<OtherPhys>>> \
232  Type##Other##OtherThermo##OtherComp##OtherMix##OtherPhys; \
233  \
234  addInterfaceCompositionToRunTimeSelectionTable \
235  ( \
236  Type, \
237  Type##Thermo##Comp##Mix##Phys, \
238  Type##Other##OtherThermo##OtherComp##OtherMix##OtherPhys \
239  )
240 
241 
242 // Addition to the run-time selection table
243 #define addInterfaceCompositionToRunTimeSelectionTable(Type, Thermo, OtherThermo)\
244  \
245  typedef Type<Thermo, OtherThermo> \
246  Type##Thermo##OtherThermo; \
247  \
248  defineTemplateTypeNameAndDebugWithName \
249  ( \
250  Type##Thermo##OtherThermo, \
251  ( \
252  word(Type##Thermo##OtherThermo::typeName_()) + "<" \
253  + word(Thermo::typeName) + "," \
254  + word(OtherThermo::typeName) + ">" \
255  ).c_str(), \
256  0 \
257  ); \
258  \
259  addToRunTimeSelectionTable \
260  ( \
261  interfaceCompositionModel, \
262  Type##Thermo##OtherThermo, \
263  dictionary \
264  )
265 
266 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
267 
268 #ifdef NoRepository
269 # include "InterfaceCompositionModel.C"
270 #endif
271 
272 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
273 
274 #endif
275 
276 // ************************************************************************* //
Foam::phasePair
Description for mass transfer between a pair of phases. The direction of the mass transfer is from th...
Definition: phasePair.H:51
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::pureMixture
Foam::pureMixture.
Definition: InterfaceCompositionModel.H:49
Foam::InterfaceCompositionModel::L
virtual tmp< volScalarField > L(const word &speciesName, const volScalarField &Tf) const
Latent heat.
Definition: InterfaceCompositionModel.C:163
Foam::tmp< volScalarField >
Foam::InterfaceCompositionModel::getLocalThermo
const pureMixture< ThermoType >::thermoType & getLocalThermo(const word &speciesName, const pureMixture< ThermoType > &globalThermo) const
Get a reference to the local thermo for a pure mixture.
Foam::InterfaceCompositionModel::Le_
const dimensionedScalar Le_
Lewis number.
Definition: InterfaceCompositionModel.H:72
thermo
Basic thermodynamics type based on the use of fitting functions for cp, h, s obtained from the templa...
Foam::InterfaceCompositionModel::~InterfaceCompositionModel
~InterfaceCompositionModel()=default
Destructor.
Foam::pureMixture::thermoType
ThermoType thermoType
The type of thermodynamics this mixture is instantiated for.
Definition: pureMixture.H:66
Foam::interfaceCompositionModel::pair
const phasePair & pair() const
Return pair.
Foam::InterfaceCompositionModel::Yf
virtual tmp< volScalarField > Yf(const word &speciesName, const volScalarField &Tf) const
Reference mass fraction for species based models.
Foam::InterfaceCompositionModel::InterfaceCompositionModel
InterfaceCompositionModel(const dictionary &dict, const phasePair &pair)
Construct from components.
Definition: InterfaceCompositionModel.C:74
Foam::multiComponentMixture
Foam::multiComponentMixture.
Definition: InterfaceCompositionModel.H:50
Foam::InterfaceCompositionModel::MwMixture
tmp< volScalarField > MwMixture(const pureMixture< ThermoType > &thermo) const
Return moleculas weight of the mixture for pureMixture [Kg/mol].
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam::dimensioned< scalar >
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::InterfaceCompositionModel::getSpecieMassFraction
tmp< volScalarField > getSpecieMassFraction(const word &speciesName, const pureMixture< ThermoType > &thermo) const
Return mass fraction for a pureMixture equal to one.
Foam::InterfaceCompositionModel::fromThermo_
const Thermo & fromThermo_
Thermo (from)
Definition: InterfaceCompositionModel.H:66
Foam::multiComponentMixture::thermoType
ThermoType thermoType
The type of thermodynamics this mixture is instantiated for.
Definition: multiComponentMixture.H:88
Foam::GeometricField< scalar, fvPatchField, volMesh >
Foam::InterfaceCompositionModel::D
virtual tmp< volScalarField > D(const word &speciesName) const
Mass diffusivity.
Definition: InterfaceCompositionModel.C:120
Foam::InterfaceCompositionModel::toThermo_
const OtherThermo & toThermo_
Other Thermo (to)
Definition: InterfaceCompositionModel.H:69
Foam::InterfaceCompositionModel::dY
virtual tmp< volScalarField > dY(const word &speciesName, const volScalarField &Tf) const
Mass fraction difference between the interface and the field.
Definition: InterfaceCompositionModel.C:103