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