Raoult.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 | 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 \*---------------------------------------------------------------------------*/
27 
28 #include "Raoult.H"
29 
30 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
31 
32 template<class Thermo, class OtherThermo>
34 (
35  const dictionary& dict,
36  const phasePair& pair
37 )
38 :
40  YNonVapour_
41  (
42  IOobject
43  (
44  IOobject::groupName("YNonVapour", pair.name()),
45  pair.phase1().mesh().time().timeName(),
46  pair.phase1().mesh()
47  ),
48  pair.phase1().mesh(),
49  dimensionedScalar("one", dimless, 1)
50  ),
51  YNonVapourPrime_
52  (
53  IOobject
54  (
55  IOobject::groupName("YNonVapourPrime", pair.name()),
56  pair.phase1().mesh().time().timeName(),
57  pair.phase1().mesh()
58  ),
59  pair.phase1().mesh(),
61  )
62 {
63  for (const word& speciesName : this->speciesNames_)
64  {
65  speciesModels_.insert
66  (
67  speciesName,
69  (
71  (
72  dict.subDict(speciesName),
73  pair
74  )
75  )
76  );
77  }
78 }
79 
80 
81 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
82 
83 template<class Thermo, class OtherThermo>
85 (
86  const volScalarField& Tf
87 )
88 {
89  YNonVapour_ = scalar(1);
90 
91  forAllIters(speciesModels_, iter)
92  {
93  iter()->update(Tf);
94 
95  YNonVapour_ -=
96  this->otherThermo_.composition().Y(iter.key())
97  *iter()->Yf(iter.key(), Tf);
98 
99  YNonVapourPrime_ -=
100  this->otherThermo_.composition().Y(iter.key())
101  *iter()->YfPrime(iter.key(), Tf);
102  }
103 }
104 
105 
106 template<class Thermo, class OtherThermo>
109 (
110  const word& speciesName,
111  const volScalarField& Tf
112 ) const
113 {
114  if (this->speciesNames_.found(speciesName))
115  {
116  return
117  this->otherThermo_.composition().Y(speciesName)
118  *speciesModels_[speciesName]->Yf(speciesName, Tf);
119  }
120  else
121  {
122  return
123  this->thermo_.composition().Y(speciesName)
124  *YNonVapour_;
125  }
126 }
127 
128 
129 template<class Thermo, class OtherThermo>
132 (
133  const word& speciesName,
134  const volScalarField& Tf
135 ) const
136 {
137  if (this->speciesNames_.found(speciesName))
138  {
139  return
140  this->otherThermo_.composition().Y(speciesName)
141  *speciesModels_[speciesName]->YfPrime(speciesName, Tf);
142  }
143  else
144  {
145  return
146  this->otherThermo_.composition().Y(speciesName)
147  *YNonVapourPrime_;
148  }
149 }
150 
151 
152 // ************************************************************************* //
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:169
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::interfaceCompositionModels::Raoult::YfPrime
virtual tmp< volScalarField > YfPrime(const word &speciesName, const volScalarField &Tf) const
The interface species fraction derivative w.r.t. temperature.
Definition: Raoult.C:132
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::interfaceCompositionModels::Raoult::Raoult
Raoult(const dictionary &dict, const phasePair &pair)
Construct from components.
Definition: Raoult.C:34
Foam::interfaceCompositionModels::Raoult::update
virtual void update(const volScalarField &Tf)
Update the composition.
Definition: Raoult.C:85
Foam::interfaceCompositionModels::Raoult::Yf
virtual tmp< volScalarField > Yf(const word &speciesName, const volScalarField &Tf) const
The interface species fraction.
Definition: Raoult.C:109
Foam::dimensionedScalar
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Definition: dimensionedScalarFwd.H:42
Raoult.H
forAllIters
#define forAllIters(container, iter)
Iterate across all elements in the container object.
Definition: stdFoam.H:223
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::New
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
Definition: DimensionedFieldReuseFunctions.H:105
Foam::autoPtr< interfaceCompositionModel >
Foam::phasePair::name
virtual word name() const
Pair name.
Definition: phasePair.C:69
Foam::dimTemperature
const dimensionSet dimTemperature(0, 0, 0, 1, 0, 0, 0)
Definition: dimensionSets.H:54
Foam::phasePair::phase1
const phaseModel & phase1() const
Definition: phasePairI.H:30
Foam::GeometricField< scalar, fvPatchField, volMesh >
Foam::dimless
const dimensionSet dimless
Dimensionless.
Definition: dimensionSets.C:189