Raoult.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2015-2022 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 
26 #include "Raoult.H"
28 
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
33 namespace interfaceCompositionModels
34 {
35  defineTypeNameAndDebug(Raoult, 0);
36  addToRunTimeSelectionTable(interfaceCompositionModel, Raoult, dictionary);
37 }
38 }
39 
40 
41 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
42 
44 (
45  const dictionary& dict,
46  const phaseInterface& interface
47 )
48 :
49  interfaceCompositionModel(dict, interface),
50  YNonVapour_
51  (
52  IOobject
53  (
54  IOobject::groupName("YNonVapour", this->interface().name()),
55  interface.mesh().time().timeName(),
56  interface.mesh()
57  ),
58  interface.mesh(),
60  ),
61  YNonVapourPrime_
62  (
63  IOobject
64  (
65  IOobject::groupName("YNonVapourPrime", this->interface().name()),
66  interface.mesh().time().timeName(),
67  interface.mesh()
68  ),
69  interface.mesh(),
71  )
72 {
73  forAllConstIter(hashedWordList, species(), iter)
74  {
75  speciesModels_.insert
76  (
77  *iter,
78  autoPtr<interfaceCompositionModel>
79  (
81  (
82  dict.subDict(*iter),
83  interface
84  )
85  )
86  );
87  }
88 }
89 
90 
91 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
92 
94 {}
95 
96 
97 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
98 
100 {
101  YNonVapour_ = scalar(1);
102 
103  forAllIter
104  (
105  HashTable<autoPtr<interfaceCompositionModel>>,
106  speciesModels_,
107  iter
108  )
109  {
110  iter()->update(Tf);
111 
112  YNonVapour_ -=
113  otherComposition().Y(iter.key())
114  *iter()->Yf(iter.key(), Tf);
115 
116  YNonVapourPrime_ -=
117  otherComposition().Y(iter.key())
118  *iter()->YfPrime(iter.key(), Tf);
119  }
120 }
121 
122 
124 (
125  const word& speciesName,
126  const volScalarField& Tf
127 ) const
128 {
129  if (species().found(speciesName))
130  {
131  return
132  otherComposition().Y(speciesName)
133  *speciesModels_[speciesName]->Yf(speciesName, Tf);
134  }
135  else
136  {
137  return composition().Y(speciesName)*YNonVapour_;
138  }
139 }
140 
141 
144 (
145  const word& speciesName,
146  const volScalarField& Tf
147 ) const
148 {
149  if (species().found(speciesName))
150  {
151  return
152  otherComposition().Y(speciesName)
153  *speciesModels_[speciesName]->YfPrime(speciesName, Tf);
154  }
155  else
156  {
157  return composition().Y(speciesName)*YNonVapourPrime_;
158  }
159 }
160 
161 
162 // ************************************************************************* //
const hashedWordList & species() const
Return the transferring species names.
Raoult(const dictionary &dict, const phaseInterface &interface)
Construct from a dictionary and an interface.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
Definition: UList.H:477
#define forAllIter(Container, container, iter)
Iterate across all elements in the container object of type.
Definition: UList.H:459
const basicSpecieMixture & otherComposition() const
Return the other composition.
const sidedPhaseInterface & interface() const
Return the interface.
const dimensionSet dimless
fvMesh & mesh
Macros for easy insertion into run-time selection tables.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:58
virtual void update(const volScalarField &Tf)
Update the composition.
word timeName
Definition: getTimeIndex.H:3
virtual tmp< volScalarField > Yf(const word &speciesName, const volScalarField &Tf) const
The interface species fraction.
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
defineTypeNameAndDebug(combustionModel, 0)
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
static autoPtr< interfaceCompositionModel > New(const dictionary &dict, const phaseInterface &interface, const bool outer=true)
const basicSpecieMixture & composition() const
Return the composition.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
A class for managing temporary objects.
Definition: PtrList.H:53
PtrList< volScalarField > & Y()
Return the mass-fraction fields.
virtual tmp< volScalarField > YfPrime(const word &speciesName, const volScalarField &Tf) const
The interface species fraction derivative w.r.t. temperature.
bool found
const dimensionSet dimTemperature
Namespace for OpenFOAM.