FreeFOAM The Cross-Platform CFD Toolkit
liquid.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) 1991-2010 OpenCFD Ltd.
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::liquid
26 
27 Description
28  The thermophysical properties of a liquid
29 
30 SourceFiles
31  liquid.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef liquid_H
36 #define liquid_H
37 
38 #include <OpenFOAM/scalar.H>
39 #include <OpenFOAM/IOstreams.H>
40 #include <OpenFOAM/typeInfo.H>
41 #include <OpenFOAM/autoPtr.H>
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class liquid Declaration
51 \*---------------------------------------------------------------------------*/
52 
53 class liquid
54 {
55  // Private data
56 
57  //- Molecular weight [kg/kmol]
58  scalar W_;
59 
60  //- Critical temperature [K]
61  scalar Tc_;
62 
63  //- Critical pressure [Pa]
64  scalar Pc_;
65 
66  //- Critical volume [m^3/mol]
67  scalar Vc_;
68 
69  //- Critical compressibility factor []
70  scalar Zc_;
71 
72  //- Triple point temperature [K]
73  scalar Tt_;
74 
75  //- Triple point pressure [Pa]
76  scalar Pt_;
77 
78  //- Normal boiling temperature [K]
79  scalar Tb_;
80 
81  //- Dipole moment []
82  scalar dipm_;
83 
84  //- Pitzer's accentric factor []
85  scalar omega_;
86 
87  //- Solubility parameter [(J/m^3)^0.5]
88  scalar delta_;
89 
90 
91 public:
92 
93  TypeName("liquid");
94 
95 
96  // Declare run-time constructor selection tables
97 
99  (
100  autoPtr,
101  liquid,
102  ,
103  (),
104  ()
105  );
106 
108  (
109  autoPtr,
110  liquid,
111  Istream,
112  (Istream& is),
113  (is)
114  );
115 
116 
117  // Constructors
118 
119  //- Construct from components
120  liquid
121  (
122  scalar W,
123  scalar Tc,
124  scalar Pc,
125  scalar Vc,
126  scalar Zc,
127  scalar Tt,
128  scalar Pt,
129  scalar Tb,
130  scalar dipm,
131  scalar omega,
132  scalar delta
133  )
134  :
135  W_(W),
136  Tc_(Tc),
137  Pc_(Pc),
138  Vc_(Vc),
139  Zc_(Zc),
140  Tt_(Tt),
141  Pt_(Pt),
142  Tb_(Tb),
143  dipm_(dipm),
144  omega_(omega),
145  delta_(delta)
146  {}
147 
148  //- Construct from Istream
150  :
151  W_(readScalar(is)),
152  Tc_(readScalar(is)),
153  Pc_(readScalar(is)),
154  Vc_(readScalar(is)),
155  dipm_(readScalar(is)),
156  omega_(readScalar(is)),
157  delta_(readScalar(is))
158  {}
159 
160  //- Return a pointer to a new liquid created from input
161  static autoPtr<liquid> New(Istream& is);
162 
163 
164  //- Destructor
165  virtual ~liquid()
166  {}
167 
168 
169  // Member Functions
170 
171  // Physical constants which define the specie
172 
173  //- Molecular weight [kg/kmol]
174  inline scalar W() const;
175 
176  //- Critical temperature [K]
177  inline scalar Tc() const;
178 
179  //- Critical pressure [Pa]
180  inline scalar Pc() const;
181 
182  //- Critical volume [m^3/mol]
183  inline scalar Vc() const;
184 
185  //- Critical compressibilty factor
186  inline scalar Zc() const;
187 
188  //- Triple point temperature [K]
189  inline scalar Tt() const;
190 
191  //- Triple point pressure [Pa]
192  inline scalar Pt() const;
193 
194  //- Normal boiling temperature [K]
195  inline scalar Tb() const;
196 
197  //- Dipole moment []
198  inline scalar dipm() const;
199 
200  //- Pitzer's ascentric factor []
201  inline scalar omega() const;
202 
203  //- Solubility parameter [(J/m^3)^(1/2)]
204  inline scalar delta() const;
205 
206 
207  // Physical property pure virtual functions
208 
209  //- Liquid rho [kg/m^3]
210  virtual scalar rho(scalar p, scalar T) const = 0;
211 
212  //- Vapour pressure [Pa]
213  virtual scalar pv(scalar p, scalar T) const = 0;
214 
215  //- Heat of vapourisation [J/kg]
216  virtual scalar hl(scalar p, scalar T) const = 0;
217 
218  //- Liquid heat capacity [J/(kg K)]
219  virtual scalar cp(scalar p, scalar T) const = 0;
220 
221  //- Liquid enthalpy [J/kg] - reference to 298.15 K
222  virtual scalar h(scalar p, scalar T) const = 0;
223 
224  //- Ideal gas heat capacity [J/(kg K)]
225  virtual scalar cpg(scalar p, scalar T) const = 0;
226 
227  //- Liquid viscosity [Pa s]
228  virtual scalar mu(scalar p, scalar T) const = 0;
229 
230  //- Vapour viscosity [Pa s]
231  virtual scalar mug(scalar p, scalar T) const = 0;
232 
233  //- Liquid thermal conductivity [W/(m K)]
234  virtual scalar K(scalar p, scalar T) const = 0;
235 
236  //- Vapour thermal conductivity [W/(m K)]
237  virtual scalar Kg(scalar p, scalar T) const = 0;
238 
239  //- Surface tension [N/m]
240  virtual scalar sigma(scalar p, scalar T) const = 0;
241 
242  //- Vapour diffussivity [m2/s]
243  virtual scalar D(scalar p, scalar T) const = 0;
244 
245  //- Vapour diffussivity [m2/s] with specified binary pair
246  virtual scalar D(scalar p, scalar T, scalar Wb) const = 0;
247 
248 
249  // I-O
250 
251  //- Write the function coefficients
252  virtual void writeData(Ostream& os) const
253  {
254  os << W_ << token::SPACE
255  << Tc_ << token::SPACE
256  << Pc_ << token::SPACE
257  << Vc_ << token::SPACE
258  << dipm_ << token::SPACE
259  << omega_<< token::SPACE
260  << delta_;
261  }
262 
263  //- Ostream Operator
264  friend Ostream& operator<<(Ostream& os, const liquid& l)
265  {
266  l.writeData(os);
267  return os;
268  }
269 };
270 
271 
272 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
273 
274 } // End namespace Foam
275 
276 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
277 
278 #include "liquidI.H"
279 
280 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
281 
282 #endif
283 
284 // ************************ vim: set sw=4 sts=4 et: ************************ //