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) 2015-2018 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::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>
59 class InterfaceCompositionModel
60 :
61  public interfaceCompositionModel
62 {
63 protected:
64 
65  // Protected Data
66 
67  //- Thermo
68  const Thermo& thermo_;
69 
70  //- Other Thermo
71  const OtherThermo& otherThermo_;
72 
73  //- Lewis number
74  const dimensionedScalar Le_;
75 
76 
77  // Protected 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 
98 public:
99 
100  // Constructors
101 
102  //- Construct from components
104  (
105  const dictionary& dict,
106  const phasePair& pair
107  );
108 
109 
110  //- Destructor
111  ~InterfaceCompositionModel() = default;
112 
113 
114  // Member Functions
115 
116  //- Mass fraction difference between the interface and the field
117  virtual tmp<volScalarField> dY
118  (
119  const word& speciesName,
120  const volScalarField& Tf
121  ) const;
122 
123  //- Mass diffusivity
124  virtual tmp<volScalarField> D
125  (
126  const word& speciesName
127  ) const;
128 
129  //- Latent heat
130  virtual tmp<volScalarField> L
131  (
132  const word& speciesName,
133  const volScalarField& Tf
134  ) const;
135 
136  //- Add latent heat flow rate to total
137  virtual void addMDotL
138  (
139  const volScalarField& K,
140  const volScalarField& Tf,
141  volScalarField& mDotL,
142  volScalarField& mDotLPrime
143  ) const;
144 };
145 
146 
147 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
148 
149 } // End namespace Foam
150 
151 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
152 
153 // Instantiation for multi-component-multi-component pairs
154 #define makeInterfaceCompositionType(Type, Thermo, Comp, Mix, Phys, OtherThermo, OtherComp, OtherMix, OtherPhys)\
155  \
156  typedef Thermo<Comp, SpecieMixture<Mix<Phys>>> \
157  Type##Thermo##Comp##Mix##Phys; \
158  \
159  typedef OtherThermo<OtherComp, OtherMix<OtherPhys>> \
160  Type##Other##OtherThermo##OtherComp##OtherMix##OtherPhys; \
161  \
162  addInterfaceCompositionToRunTimeSelectionTable \
163  ( \
164  Type, \
165  Type##Thermo##Comp##Mix##Phys, \
166  Type##Other##OtherThermo##OtherComp##OtherMix##OtherPhys \
167  )
168 
169 // Instantiation for multi-component-single-component pairs
170 #define makeSpecieInterfaceCompositionType(Type, Thermo, Comp, Mix, Phys, OtherThermo, OtherComp, OtherMix, OtherPhys)\
171  \
172  typedef Thermo<Comp, SpecieMixture<Mix<Phys>>> \
173  Type##Thermo##Comp##Mix##Phys; \
174  \
175  typedef OtherThermo<OtherComp, SpecieMixture<OtherMix<OtherPhys>>> \
176  Type##Other##OtherThermo##OtherComp##OtherMix##OtherPhys; \
177  \
178  addInterfaceCompositionToRunTimeSelectionTable \
179  ( \
180  Type, \
181  Type##Thermo##Comp##Mix##Phys, \
182  Type##Other##OtherThermo##OtherComp##OtherMix##OtherPhys \
183  )
184 
185 // Addition to the run-time selection table
186 #define addInterfaceCompositionToRunTimeSelectionTable(Type, Thermo, OtherThermo)\
187  \
188  typedef Type<Thermo, OtherThermo> \
189  Type##Thermo##OtherThermo; \
190  \
191  defineTemplateTypeNameAndDebugWithName \
192  ( \
193  Type##Thermo##OtherThermo, \
194  ( \
195  word(Type##Thermo##OtherThermo::typeName_()) + "<" \
196  + word(Thermo::typeName) + "," \
197  + word(OtherThermo::typeName) + ">" \
198  ).c_str(), \
199  0 \
200  ); \
201  \
202  addToRunTimeSelectionTable \
203  ( \
204  interfaceCompositionModel, \
205  Type##Thermo##OtherThermo, \
206  dictionary \
207  )
208 
209 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210 
211 #ifdef NoRepository
212  #include "InterfaceCompositionModel.C"
213 #endif
214 
215 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
216 
217 #endif
218 
219 // ************************************************************************* //
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::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
Foam::InterfaceCompositionModel::~InterfaceCompositionModel
~InterfaceCompositionModel()=default
Destructor.
Foam::InterfaceCompositionModel::thermo_
const Thermo & thermo_
Thermo.
Definition: InterfaceCompositionModel.H:67
Foam::pureMixture::thermoType
ThermoType thermoType
The type of thermodynamics this mixture is instantiated for.
Definition: pureMixture.H:66
K
CGAL::Exact_predicates_exact_constructions_kernel K
Definition: CGALTriangulation3DKernel.H:58
Foam::InterfaceCompositionModel::InterfaceCompositionModel
InterfaceCompositionModel(const dictionary &dict, const phasePair &pair)
Construct from components.
Definition: InterfaceCompositionModel.C:181
Foam::InterfaceCompositionModel::otherThermo_
const OtherThermo & otherThermo_
Other Thermo.
Definition: InterfaceCompositionModel.H:70
Foam::multiComponentMixture
Foam::multiComponentMixture.
Definition: InterfaceCompositionModel.H:51
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::addMDotL
virtual void addMDotL(const volScalarField &K, const volScalarField &Tf, volScalarField &mDotL, volScalarField &mDotLPrime) const
Add latent heat flow rate to total.
Definition: InterfaceCompositionModel.C:209
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::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