Saturated.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-------------------------------------------------------------------------------
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
26\*---------------------------------------------------------------------------*/
27
28#include "Saturated.H"
29
30// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
31
32template<class Thermo, class OtherThermo>
35wRatioByP() const
36{
37 const dimensionedScalar Wi
38 (
39 "W",
41 this->thermo_.composition().W(saturatedIndex_)
42 );
43
44 return Wi/this->thermo_.W()/this->thermo_.p();
45}
46
47
48// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
49
50template<class Thermo, class OtherThermo>
52(
53 const dictionary& dict,
54 const phasePair& pair
55)
56:
57 InterfaceCompositionModel<Thermo, OtherThermo>(dict, pair),
58 saturatedName_(this->speciesNames_[0]),
59 saturatedIndex_
60 (
61 this->thermo_.composition().species().find(saturatedName_)
62 ),
63 saturationModel_
64 (
66 (
67 dict.subDict("saturationPressure"),
68 pair.phase1().mesh()
69 )
70 )
71{
72 if (this->speciesNames_.size() != 1)
73 {
75 << "Saturated model is suitable for one species only."
76 << exit(FatalError);
77 }
78}
79
80
81// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
82
83template<class Thermo, class OtherThermo>
85{}
86
87
88// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
89
90template<class Thermo, class OtherThermo>
91void
93(
94 const volScalarField& Tf
95)
96{}
97
98
99template<class Thermo, class OtherThermo>
102(
103 const word& speciesName,
104 const volScalarField& Tf
105) const
106{
107 if (saturatedName_ == speciesName)
108 {
109 return wRatioByP()*saturationModel_->pSat(Tf);
110 }
111 else
112 {
113 const label speciesIndex
114 (
115 this->thermo_.composition().species().find(speciesName)
116 );
117
118 return
119 this->thermo_.Y()[speciesIndex]
120 *(scalar(1) - wRatioByP()*saturationModel_->pSat(Tf))
121 /max(scalar(1) - this->thermo_.Y()[saturatedIndex_], SMALL);
122 }
123}
124
125
126template<class Thermo, class OtherThermo>
129(
130 const word& speciesName,
131 const volScalarField& Tf
132) const
133{
134 if (saturatedName_ == speciesName)
135 {
136 return wRatioByP()*saturationModel_->pSatPrime(Tf);
137 }
138 else
139 {
140 const label speciesIndex
141 (
142 this->thermo_.composition().species().find(speciesName)
143 );
144
145 return
146 - this->thermo_.Y()[speciesIndex]
147 *wRatioByP()*saturationModel_->pSatPrime(Tf)
148 /max(scalar(1) - this->thermo_.Y()[saturatedIndex_], SMALL);
149 }
150}
151
152
153// ************************************************************************* //
phaseModel & phase1
Base class for interface composition models, templated on the two thermodynamic models either side of...
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Model which uses a saturation pressure model for a single species to calculate the interface composit...
Definition: Saturated.H:61
tmp< volScalarField > wRatioByP() const
Constant of proportionality between partial pressure and mass.
Definition: Saturated.C:35
virtual tmp< volScalarField > Yf(const word &speciesName, const volScalarField &Tf) const
The interface species fraction.
Definition: Saturated.C:102
virtual tmp< volScalarField > YfPrime(const word &speciesName, const volScalarField &Tf) const
The interface species fraction derivative w.r.t. temperature.
Definition: Saturated.C:129
virtual bool update()
Update the mesh for both mesh motion and topology change.
Description for mass transfer between a pair of phases. The direction of the mass transfer is from th...
Definition: phasePair.H:56
A class for managing temporary objects.
Definition: tmp.H:65
A class for handling words, derived from Foam::string.
Definition: word.H:68
basicSpecieMixture & composition
dynamicFvMesh & mesh
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:47
const dimensionSet dimMoles(0, 0, 0, 0, 1, 0, 0)
Definition: dimensionSets.H:55
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh > > &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
error FatalError
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:51
dictionary dict