liquidMixtureProperties.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 | Copyright (C) 2011-2016 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 Class
25  Foam::liquidMixtureProperties
26 
27 Description
28  A mixture of liquids
29 
30  An example of a two component liquid mixture:
31  \verbatim
32  <parentDictionary>
33  {
34  H2O
35  {
36  defaultCoeffs yes; // employ default coefficients
37  }
38  C7H16
39  {
40  defaultCoeffs no;
41  C7H16Coeffs
42  {
43  ... user defined properties for C7H16
44  }
45  }
46  }
47  \endverbatim
48 
49 SourceFiles
50  liquidMixtureProperties.C
51 
52 See also
53  Foam::liquidProperties
54 
55 \*---------------------------------------------------------------------------*/
56 
57 #ifndef liquidMixtureProperties_H
58 #define liquidMixtureProperties_H
59 
60 #include "word.H"
61 #include "scalarField.H"
62 #include "PtrList.H"
63 #include "liquidProperties.H"
64 #include "autoPtr.H"
65 
66 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
67 
68 namespace Foam
69 {
70 
71 /*---------------------------------------------------------------------------*\
72  Class liquidMixtureProperties Declaration
73 \*---------------------------------------------------------------------------*/
74 
76 {
77  // Private data
78 
79  //- Maximum reduced temperature
80  static const scalar TrMax;
81 
82  //- The names of the liquids
83  List<word> components_;
84 
85  //- The liquid properties
86  PtrList<liquidProperties> properties_;
87 
88 
89 public:
90 
91  // Constructors
92 
93  //- Construct from dictionary
95 
96  //- Construct copy
98 
99  //- Construct and return a clone
101  {
103  (
104  new liquidMixtureProperties(*this)
105  );
106  }
107 
108 
109  //- Destructor
110  virtual ~liquidMixtureProperties()
111  {}
112 
113 
114  // Selectors
115 
116  //- Select construct from dictionary
118 
119 
120  // Member Functions
121 
122  //- Return the liquid names
123  inline const List<word>& components() const
124  {
125  return components_;
126  }
127 
128  //- Return the liquid properties
129  inline const PtrList<liquidProperties>& properties() const
130  {
131  return properties_;
132  }
133 
134  //- Return the number of liquids in the mixture
135  inline label size() const
136  {
137  return components_.size();
138  }
139 
140  //- Calculate the critical temperature of mixture
141  scalar Tc(const scalarField& X) const;
142 
143  //- Invert the vapour pressure relationship to retrieve the boiling
144  // temperature of the mixture as a function of pressure
145  scalar pvInvert(const scalar p, const scalarField& X) const;
146 
147  //- Return pseudocritical temperature according to Kay's rule
148  scalar Tpc(const scalarField& X) const;
149 
150  //- Return pseudocritical pressure (modified Prausnitz and Gunn)
151  scalar Ppc(const scalarField& X) const;
152 
153  //- Return pseudo triple point temperature (mole averaged formulation)
154  scalar Tpt(const scalarField& X) const;
155 
156  //- Return mixture accentric factor
157  scalar omega(const scalarField& X) const;
158 
159  //- Return the surface molar fractions
161  (
162  const scalar p,
163  const scalar Tg,
164  const scalar Tl,
165  const scalarField& Xg,
166  const scalarField& Xl
167  ) const;
168 
169  //- Calculate the mean molecular weight [kg/kmol]
170  // from mole fractions
171  scalar W(const scalarField& X) const;
172 
173  //- Returns the mass fractions corresponding to the given mole fractions
174  scalarField Y(const scalarField& X) const;
175 
176  //- Returns the mole fractions corresponding to the given mass fractions
177  scalarField X(const scalarField& Y) const;
178 
179  //- Calculate the mixture density [kg/m^3]
180  scalar rho
181  (
182  const scalar p,
183  const scalar T,
184  const scalarField& X
185  ) const;
186 
187  //- Calculate the mixture vapour pressure [Pa]
188  scalar pv
189  (
190  const scalar p,
191  const scalar T,
192  const scalarField& X
193  ) const;
194 
195  //- Calculate the mixture latent heat [J/kg]
196  scalar hl
197  (
198  const scalar p,
199  const scalar T,
200  const scalarField& X
201  ) const;
202 
203  //- Calculate the mixture heat capacity [J/(kg K)]
204  scalar Cp
205  (
206  const scalar p,
207  const scalar T,
208  const scalarField& X
209  ) const;
210 
211  //- Estimate mixture surface tension [N/m]
212  scalar sigma
213  (
214  const scalar p,
215  const scalar T,
216  const scalarField& X
217  ) const;
218 
219  //- Calculate the mixture viscosity [Pa s]
220  scalar mu
221  (
222  const scalar p,
223  const scalar T,
224  const scalarField& X
225  ) const;
226 
227  //- Estimate thermal conductivity [W/(m K)]
228  // Li's method, Eq. 10-12.27 - 10.12-19
229  scalar K
230  (
231  const scalar p,
232  const scalar T,
233  const scalarField& X
234  ) const;
235 
236  //- Vapour diffussivity [m2/s]
237  scalar D
238  (
239  const scalar p,
240  const scalar T,
241  const scalarField& X
242  ) const;
243 };
244 
245 
246 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
247 
248 } // End namespace Foam
249 
250 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
251 
252 #endif
253 
254 // ************************************************************************* //
scalarField X(const scalarField &Y) const
Returns the mole fractions corresponding to the given mass fractions.
const PtrList< liquidProperties > & properties() const
Return the liquid properties.
scalarField Y(const scalarField &X) const
Returns the mass fractions corresponding to the given mole fractions.
scalar pv(const scalar p, const scalar T, const scalarField &X) const
Calculate the mixture vapour pressure [Pa].
scalar hl(const scalar p, const scalar T, const scalarField &X) const
Calculate the mixture latent heat [J/kg].
dictionary dict
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
scalar D(const scalar p, const scalar T, const scalarField &X) const
Vapour diffussivity [m2/s].
const List< word > & components() const
Return the liquid names.
scalar Tpc(const scalarField &X) const
Return pseudocritical temperature according to Kay&#39;s rule.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
scalar Tc(const scalarField &X) const
Calculate the critical temperature of mixture.
void size(const label)
Override size to be inconsistent with allocated storage.
Definition: ListI.H:76
scalar sigma(const scalar p, const scalar T, const scalarField &X) const
Estimate mixture surface tension [N/m].
liquidMixtureProperties(const dictionary &dict)
Construct from dictionary.
virtual ~liquidMixtureProperties()
Destructor.
scalar Tpt(const scalarField &X) const
Return pseudo triple point temperature (mole averaged formulation)
scalar Ppc(const scalarField &X) const
Return pseudocritical pressure (modified Prausnitz and Gunn)
scalar K(const scalar p, const scalar T, const scalarField &X) const
Estimate thermal conductivity [W/(m K)].
static autoPtr< liquidMixtureProperties > New(const dictionary &)
Select construct from dictionary.
scalar pvInvert(const scalar p, const scalarField &X) const
Invert the vapour pressure relationship to retrieve the boiling.
scalarField Xs(const scalar p, const scalar Tg, const scalar Tl, const scalarField &Xg, const scalarField &Xl) const
Return the surface molar fractions.
scalar mu(const scalar p, const scalar T, const scalarField &X) const
Calculate the mixture viscosity [Pa s].
scalar omega(const scalarField &X) const
Return mixture accentric factor.
scalar Cp(const scalar p, const scalar T, const scalarField &X) const
Calculate the mixture heat capacity [J/(kg K)].
virtual autoPtr< liquidMixtureProperties > clone() const
Construct and return a clone.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
label size() const
Return the number of liquids in the mixture.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: List.H:62
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:53
volScalarField & p
scalar W(const scalarField &X) const
Calculate the mean molecular weight [kg/kmol].
scalar rho(const scalar p, const scalar T, const scalarField &X) const
Calculate the mixture density [kg/m^3].
Namespace for OpenFOAM.