liquidProperties.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-2018 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::liquidProperties
26 
27 Description
28  The thermophysical properties of a liquid
29 
30 SourceFiles
31  liquidProperties.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef liquidProperties_H
36 #define liquidProperties_H
37 
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 namespace Foam
43 {
44 
45 /*---------------------------------------------------------------------------*\
46  Class liquidProperties Declaration
47 \*---------------------------------------------------------------------------*/
48 
49 class liquidProperties
50 :
52 {
53  // Private data
54 
55  //- Critical temperature [K]
56  scalar Tc_;
57 
58  //- Critical pressure [Pa]
59  scalar Pc_;
60 
61  //- Critical volume [m^3/kmol]
62  scalar Vc_;
63 
64  //- Critical compressibility factor []
65  scalar Zc_;
66 
67  //- Triple point temperature [K]
68  scalar Tt_;
69 
70  //- Triple point pressure [Pa]
71  scalar Pt_;
72 
73  //- Normal boiling temperature [K]
74  scalar Tb_;
75 
76  //- Dipole moment []
77  scalar dipm_;
78 
79  //- Pitzer's accentric factor []
80  scalar omega_;
81 
82  //- Solubility parameter [(J/m^3)^0.5]
83  scalar delta_;
84 
85 
86 public:
87 
88  TypeName("liquid");
89 
90 
91  // Declare run-time constructor selection tables
92 
94  (
95  autoPtr,
97  ,
98  (),
99  ()
100  );
101 
103  (
104  autoPtr,
106  dictionary,
107  (const dictionary& dict),
108  (dict)
109  );
110 
111 
112  // Constructors
113 
114  //- Construct from components
116  (
117  scalar W,
118  scalar Tc,
119  scalar Pc,
120  scalar Vc,
121  scalar Zc,
122  scalar Tt,
123  scalar Pt,
124  scalar Tb,
125  scalar dipm,
126  scalar omega,
127  scalar delta
128  );
129 
130  //- Construct from dictionary
131  liquidProperties(const dictionary& dict);
132 
133  //- Construct and return clone
134  virtual autoPtr<liquidProperties> clone() const = 0;
135 
136 
137  // Selectors
138 
139  //- Return a pointer to a new liquidProperties created from name
140  static autoPtr<liquidProperties> New(const word& name);
141 
142  //- Return a pointer to a new liquidProperties created from dictionary
143  static autoPtr<liquidProperties> New(const dictionary& dict);
144 
145 
146  //- Destructor
147  virtual ~liquidProperties()
148  {}
149 
150 
151  // Static data
152 
153  //- Is the equation of state is incompressible i.e. rho != f(p)
154  static const bool incompressible = true;
155 
156  //- Is the equation of state is isochoric i.e. rho = const
157  static const bool isochoric = false;
158 
159 
160  // Member Functions
161 
162  // Physical constants which define the specie
163 
164  //- No of moles of this species in mixture
165  // Note Mixing of liquidProperties is not currently supported
166  // so Y = 1
167  inline scalar Y() const;
168 
169  //- Critical temperature [K]
170  inline scalar Tc() const;
171 
172  //- Critical pressure [Pa]
173  inline scalar Pc() const;
174 
175  //- Critical volume [m^3/kmol]
176  inline scalar Vc() const;
177 
178  //- Critical compressibilty factor
179  inline scalar Zc() const;
180 
181  //- Triple point temperature [K]
182  inline scalar Tt() const;
183 
184  //- Triple point pressure [Pa]
185  inline scalar Pt() const;
186 
187  //- Normal boiling temperature [K]
188  inline scalar Tb() const;
189 
190  //- Dipole moment []
191  inline scalar dipm() const;
192 
193  //- Pitzer's ascentric factor []
194  inline scalar omega() const;
195 
196  //- Solubility parameter [(J/m^3)^(1/2)]
197  inline scalar delta() const;
198 
199  //- Limit the temperature to be in the range Tlow_ to Thigh_
200  inline scalar limit(const scalar T) const;
201 
202 
203  // Fundamental equation of state properties
204 
205  //- Liquid compressibility rho/p [s^2/m^2]
206  // Note: currently it is assumed the liquid is incompressible
207  inline scalar psi(scalar p, scalar T) const;
208 
209  //- Return (Cp - Cv) [J/(kg K]
210  // Note: currently it is assumed the liquid is incompressible
211  // so CpMCv = 0
212  inline scalar CpMCv(scalar p, scalar T) const;
213 
214 
215  // Fundamental thermodynamic properties
216 
217  //- Absolute Enthalpy [J/kg]
218  inline scalar Ha(const scalar p, const scalar T) const;
219 
220  //- Sensible enthalpy [J/kg]
221  inline scalar Hs(const scalar p, const scalar T) const;
222 
223  //- Chemical enthalpy [J/kg]
224  inline scalar Hc() const;
225 
226  // Entropy [J/(kg K)]
227  scalar S(const scalar p, const scalar T) const;
228 
229 
230  // Physical properties
231 
232  //- Vapour pressure [Pa]
233  virtual scalar pv(scalar p, scalar T) const = 0;
234 
235  //- Heat of vapourisation [J/kg]
236  virtual scalar hl(scalar p, scalar T) const = 0;
237 
238  //- Liquid enthalpy [J/kg] - reference to 298.15 K
239  virtual scalar h(scalar p, scalar T) const = 0;
240 
241  //- Vapour heat capacity [J/(kg K)]
242  virtual scalar Cpg(scalar p, scalar T) const = 0;
243 
244  //- Liquid viscosity [Pa s]
245  virtual scalar mu(scalar p, scalar T) const = 0;
246 
247  //- Vapour viscosity [Pa s]
248  virtual scalar mug(scalar p, scalar T) const = 0;
249 
250  //- Liquid thermal conductivity [W/(m K)]
251  virtual scalar kappa(scalar p, scalar T) const = 0;
252 
253  //- Liquid thermal diffusivity of enthalpy [kg/ms]
254  inline scalar alphah(const scalar p, const scalar T) const;
255 
256  //- Vapour thermal conductivity [W/(m K)]
257  virtual scalar kappag(scalar p, scalar T) const = 0;
258 
259  //- Surface tension [N/m]
260  virtual scalar sigma(scalar p, scalar T) const = 0;
261 
262  //- Vapour diffussivity [m2/s]
263  virtual scalar D(scalar p, scalar T) const = 0;
264 
265  //- Vapour diffussivity [m2/s] with specified binary pair
266  virtual scalar D(scalar p, scalar T, scalar Wb) const = 0;
267 
268  //- Invert the vapour pressure relationship to retrieve the
269  // boiling temperuture as a function of pressure
270  virtual scalar pvInvert(scalar p) const;
271 
272 
273  // I-O
274 
275  //- Read and set the properties present it the given dictionary
276  void readIfPresent(const dictionary& dict);
277 
278  //- Read and set the function coefficients
279  // if present it the given dictionary
280  template<class Func>
281  inline void readIfPresent
282  (
283  Func& f,
284  const word& name,
285  const dictionary& dict
286  );
287 
288  //- Read and set the function coefficients
289  // if present it the given dictionary
290  template<class Liquid>
291  inline void readIfPresent(Liquid& l, const dictionary& dict);
292 
293  //- Write the function coefficients
294  virtual void writeData(Ostream& os) const = 0;
295 
296  //- Write dictionary to Ostream
297  void write(Ostream& os) const;
298 
299  //- Write the data for each of the property functions
300  template<class Liquid>
301  inline void writeData(const Liquid& l, Ostream& os) const;
302 
303  //- Ostream Operator
304  friend Ostream& operator<<(Ostream& os, const liquidProperties& l);
305 };
306 
307 
309 
310 
311 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
312 
313 } // End namespace Foam
314 
315 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
316 
317 #include "liquidPropertiesI.H"
318 
319 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
320 
321 #endif
322 
323 // ************************************************************************* //
scalar delta() const
Solubility parameter [(J/m^3)^(1/2)].
Base-class for thermophysical properties of solids, liquids and gases providing an interface compatib...
dictionary dict
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
virtual scalar Cpg(scalar p, scalar T) const =0
Vapour heat capacity [J/(kg K)].
virtual scalar pvInvert(scalar p) const
Invert the vapour pressure relationship to retrieve the.
void readIfPresent(const dictionary &dict)
Read and set the properties present it the given dictionary.
virtual ~liquidProperties()
Destructor.
scalar Y() const
No of moles of this species in mixture.
virtual scalar hl(scalar p, scalar T) const =0
Heat of vapourisation [J/kg].
declareRunTimeSelectionTable(autoPtr, liquidProperties,,(),())
scalar Ha(const scalar p, const scalar T) const
Absolute Enthalpy [J/kg].
scalar Pt() const
Triple point pressure [Pa].
virtual autoPtr< liquidProperties > clone() const =0
Construct and return clone.
liquidProperties(scalar W, scalar Tc, scalar Pc, scalar Vc, scalar Zc, scalar Tt, scalar Pt, scalar Tb, scalar dipm, scalar omega, scalar delta)
Construct from components.
virtual scalar kappa(scalar p, scalar T) const =0
Liquid thermal conductivity [W/(m K)].
scalar dipm() const
Dipole moment [].
virtual scalar sigma(scalar p, scalar T) const =0
Surface tension [N/m].
friend Ostream & operator<<(Ostream &os, const liquidProperties &l)
Ostream Operator.
scalar limit(const scalar T) const
Limit the temperature to be in the range Tlow_ to Thigh_.
scalar Tc() const
Critical temperature [K].
scalar Zc() const
Critical compressibilty factor.
scalar Hc() const
Chemical enthalpy [J/kg].
static const bool isochoric
Is the equation of state is isochoric i.e. rho = const.
scalar psi(scalar p, scalar T) const
Liquid compressibility rho/p [s^2/m^2].
A class for handling words, derived from string.
Definition: word.H:59
scalar W() const
Molecular weight [kg/kmol].
virtual scalar h(scalar p, scalar T) const =0
Liquid enthalpy [J/kg] - reference to 298.15 K.
The thermophysical properties of a liquid.
scalar CpMCv(scalar p, scalar T) const
Return (Cp - Cv) [J/(kg K].
virtual scalar pv(scalar p, scalar T) const =0
Vapour pressure [Pa].
scalar Vc() const
Critical volume [m^3/kmol].
virtual scalar kappag(scalar p, scalar T) const =0
Vapour thermal conductivity [W/(m K)].
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
virtual scalar mug(scalar p, scalar T) const =0
Vapour viscosity [Pa s].
scalar Hs(const scalar p, const scalar T) const
Sensible enthalpy [J/kg].
static autoPtr< liquidProperties > New(const word &name)
Return a pointer to a new liquidProperties created from name.
labelList f(nPoints)
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
virtual scalar D(scalar p, scalar T) const =0
Vapour diffussivity [m2/s].
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
static const bool incompressible
Is the equation of state is incompressible i.e. rho != f(p)
virtual void writeData(Ostream &os) const =0
Write the function coefficients.
scalar omega() const
Pitzer&#39;s ascentric factor [].
scalar Pc() const
Critical pressure [Pa].
void write(Ostream &os) const
Write dictionary to Ostream.
scalar S(const scalar p, const scalar T) const
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
volScalarField & p
virtual scalar mu(scalar p, scalar T) const =0
Liquid viscosity [Pa s].
scalar alphah(const scalar p, const scalar T) const
Liquid thermal diffusivity of enthalpy [kg/ms].
scalar Tb() const
Normal boiling temperature [K].
Namespace for OpenFOAM.
scalar Tt() const
Triple point temperature [K].