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