InterfaceCompositionModel.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
27 #include "phaseModel.H"
28 #include "phasePair.H"
29 #include "pureMixture.H"
30 #include "multiComponentMixture.H"
31 #include "rhoThermo.H"
32 
33 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
34 
35 template<class Thermo, class OtherThermo>
36 template<class ThermoType>
39 (
40  const word& speciesName,
41  const multiComponentMixture<ThermoType>& globalThermo
42 ) const
43 {
44  return
45  globalThermo.getLocalThermo
46  (
47  globalThermo.species()
48  [
49  speciesName
50  ]
51  );
52 }
53 
54 
55 template<class Thermo, class OtherThermo>
56 template<class ThermoType>
59 (
60  const word& speciesName,
61  const pureMixture<ThermoType>& globalThermo
62 ) const
63 {
64  return globalThermo.cellMixture(0);
65 }
66 
67 
68 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
69 
70 template<class Thermo, class OtherThermo>
72 (
73  const dictionary& dict,
74  const phasePair& pair
75 )
76 :
77  interfaceCompositionModel(dict, pair),
78  thermo_
79  (
80  pair.phase1().mesh().lookupObject<Thermo>
81  (
82  IOobject::groupName(basicThermo::dictName, pair.phase1().name())
83  )
84  ),
85  otherThermo_
86  (
87  pair.phase2().mesh().lookupObject<OtherThermo>
88  (
89  IOobject::groupName(basicThermo::dictName, pair.phase2().name())
90  )
91  ),
92  Le_("Le", dimless, dict)
93 {}
94 
95 
96 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
97 
98 template<class Thermo, class OtherThermo>
101 {}
102 
103 
104 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
105 
106 template<class Thermo, class OtherThermo>
109 (
110  const word& speciesName,
111  const volScalarField& Tf
112 ) const
113 {
114  return
115  Yf(speciesName, Tf)
116  - thermo_.composition().Y()
117  [
118  thermo_.composition().species()[speciesName]
119  ];
120 }
121 
122 
123 template<class Thermo, class OtherThermo>
126 (
127  const word& speciesName
128 ) const
129 {
130  const typename Thermo::thermoType& localThermo =
132  (
133  speciesName,
134  thermo_
135  );
136 
137  const volScalarField& p(thermo_.p());
138 
139  const volScalarField& T(thermo_.T());
140 
141  tmp<volScalarField> tmpD
142  (
143  new volScalarField
144  (
145  IOobject
146  (
148  p.time().timeName(),
149  p.mesh()
150  ),
151  p.mesh(),
152  dimensionedScalar("zero", dimArea/dimTime, 0)
153  )
154  );
155 
156  volScalarField& D(tmpD());
157 
158  forAll(p, cellI)
159  {
160  D[cellI] =
161  localThermo.alphah(p[cellI], T[cellI])
162  /localThermo.rho(p[cellI], T[cellI]);
163  }
164 
165  D /= Le_;
166 
167  return tmpD;
168 }
169 
170 
171 template<class Thermo, class OtherThermo>
174 (
175  const word& speciesName,
176  const volScalarField& Tf
177 ) const
178 {
179  const typename Thermo::thermoType& localThermo =
181  (
182  speciesName,
183  thermo_
184  );
185  const typename OtherThermo::thermoType& otherLocalThermo =
187  (
188  speciesName,
190  );
191 
192  const volScalarField& p(thermo_.p());
193  const volScalarField& otherP(otherThermo_.p());
194 
195  tmp<volScalarField> tmpL
196  (
197  new volScalarField
198  (
199  IOobject
200  (
202  p.time().timeName(),
203  p.mesh()
204  ),
205  p.mesh(),
207  )
208  );
209 
210  volScalarField& L(tmpL());
211 
212  forAll(p, cellI)
213  {
214  L[cellI] =
215  localThermo.Ha(p[cellI], Tf[cellI])
216  - otherLocalThermo.Ha(otherP[cellI], Tf[cellI]);
217  }
218 
219  return tmpL;
220 }
221 
222 
223 template<class Thermo, class OtherThermo>
225 (
226  const volScalarField& K,
227  const volScalarField& Tf,
228  volScalarField& mDotL,
229  volScalarField& mDotLPrime
230 ) const
231 {
232  forAllConstIter(hashedWordList, this->speciesNames_, iter)
233  {
234  volScalarField rhoKDL
235  (
236  thermo_.rhoThermo::rho()
237  *K
238  *D(*iter)
239  *L(*iter, Tf)
240  );
241 
242  mDotL += rhoKDL*dY(*iter, Tf);
243  mDotLPrime += rhoKDL*YfPrime(*iter, Tf);
244  }
245 }
246 
247 
248 // ************************************************************************* //
~InterfaceCompositionModel()
Destructor.
phaseModel & phase1
Definition: createFields.H:12
virtual tmp< volScalarField > D(const word &speciesName) const
Mass diffusivity.
InterfaceCompositionModel(const dictionary &dict, const phasePair &pair)
Construct from components.
phaseModel & phase2
Definition: createFields.H:13
ThermoType thermoType
The type of thermodynamics this mixture is instantiated for.
Definition: pureMixture.H:64
virtual tmp< volScalarField > YfPrime(const word &speciesName, const volScalarField &Tf) const
The interface species fraction derivative w.r.t. temperature.
virtual tmp< volScalarField > L(const word &speciesName, const volScalarField &Tf) const
Latent heat.
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
Definition: dimensionSets.H:51
const dimensionSet dimArea(sqr(dimLength))
Definition: dimensionSets.H:57
const dimensionSet dimEnergy
virtual tmp< volScalarField > dY(const word &speciesName, const volScalarField &Tf) const
Mass fraction difference between the interface and the field.
dynamicFvMesh & mesh
const OtherThermo & otherThermo_
Other Thermo.
const word dictName("particleTrackDict")
static word groupName(Name name, const word &group)
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
Definition: pEqn.H:39
dictionary dict
const pureMixture< ThermoType >::thermoType & getLocalThermo(const word &speciesName, const pureMixture< ThermoType > &globalThermo) const
Get a reference to the local thermo for a pure mixture.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:52
volScalarField & p
Definition: createFields.H:51
#define forAll(list, i)
Definition: UList.H:421
const hashedWordList speciesNames_
Names of the transferring species.
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:49
const phasePair & pair_
Phase pair.
virtual word name() const
Pair name.
const dimensionedScalar Le_
Lewis number.
ThermoType thermoType
The type of thermodynamics this mixture is instantiated for.
const dimensionSet dimless(0, 0, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:47
virtual void addMDotL(const volScalarField &K, const volScalarField &Tf, volScalarField &mDotL, volScalarField &mDotLPrime) const
Add latent heat flow rate to total.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
A class for managing temporary objects.
Definition: PtrList.H:118
virtual tmp< volScalarField > Yf(const word &speciesName, const volScalarField &Tf) const
The interface species fraction.