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