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-2024 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 #include "dimensionSets.H"
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 template<class> class Function1;
47 template<class> class Function2;
48 
49 // Forward declaration of friend functions and operators
50 class liquidProperties;
51 Ostream& operator<<(Ostream& os, const liquidProperties& l);
52 
53 /*---------------------------------------------------------------------------*\
54  Class liquidProperties Declaration
55 \*---------------------------------------------------------------------------*/
56 
57 class liquidProperties
58 :
60 {
61  // Private Data
62 
63  //- Name of the liquid
64  const word name_;
65 
66  //- Critical temperature [K]
67  scalar Tc_;
68 
69  //- Critical pressure [Pa]
70  scalar Pc_;
71 
72  //- Critical volume [m^3/kmol]
73  scalar Vc_;
74 
75  //- Critical compressibility factor []
76  scalar Zc_;
77 
78  //- Triple point temperature [K]
79  scalar Tt_;
80 
81  //- Triple point pressure [Pa]
82  scalar Pt_;
83 
84  //- Normal boiling temperature [K]
85  scalar Tb_;
86 
87  //- Dipole moment []
88  scalar dipm_;
89 
90  //- Pitzer's accentric factor []
91  scalar omega_;
92 
93  //- Solubility parameter [(J/m^3)^0.5]
94  scalar delta_;
95 
96 
97 public:
98 
99  TypeName("liquid");
100 
101 
102  // Declare run-time constructor selection tables
103 
105  (
106  autoPtr,
108  ,
109  (),
110  ()
111  );
112 
114  (
115  autoPtr,
117  dictionary,
118  (const dictionary& dict),
119  (dict)
120  );
121 
122 
123  // Constructors
124 
125  //- Construct from components
127  (
128  const word& name,
129  scalar W,
130  scalar Tc,
131  scalar Pc,
132  scalar Vc,
133  scalar Zc,
134  scalar Tt,
135  scalar Pt,
136  scalar Tb,
137  scalar dipm,
138  scalar omega,
139  scalar delta
140  );
141 
142  //- Construct from dictionary
144 
145  //- Construct and return clone
146  virtual autoPtr<liquidProperties> clone() const = 0;
147 
148 
149  // Selectors
150 
151  //- Return a pointer to a new liquidProperties created from name
152  static autoPtr<liquidProperties> New(const word& name);
153 
154  //- Return a pointer to a new liquidProperties created from dictionary
156 
157 
158  //- Destructor
159  virtual ~liquidProperties()
160  {}
161 
162 
163  // Static data
164 
165  //- Is the equation of state is incompressible i.e. rho != f(p)
166  static const bool incompressible = true;
167 
168  //- Is the equation of state is isochoric i.e. rho = const
169  static const bool isochoric = false;
170 
171 
172  // Member Functions
173 
174  //- Return the name of the liquid
175  virtual const word& name() const;
176 
177 
178  // Physical constants which define the specie
179 
180  //- Mass fraction of this specie in mixture
181  // Note Mixing of liquidProperties is not currently supported
182  // so Y = 1
183  inline scalar Y() const;
184 
185  //- Critical temperature [K]
186  inline scalar Tc() const;
187 
188  //- Critical pressure [Pa]
189  inline scalar Pc() const;
190 
191  //- Critical volume [m^3/kmol]
192  inline scalar Vc() const;
193 
194  //- Critical compressibility factor
195  inline scalar Zc() const;
196 
197  //- Triple point temperature [K]
198  inline scalar Tt() const;
199 
200  //- Triple point pressure [Pa]
201  inline scalar Pt() const;
202 
203  //- Normal boiling temperature [K]
204  inline scalar Tb() const;
205 
206  //- Dipole moment []
207  inline scalar dipm() const;
208 
209  //- Pitzer's acentric factor []
210  inline scalar omega() const;
211 
212  //- Solubility parameter [(J/m^3)^(1/2)]
213  inline scalar delta() const;
214 
215  //- Limit the temperature to be in the range Tlow_ to Thigh_
216  inline scalar limit(const scalar T) const;
217 
218 
219  // Fundamental equation of state properties
220 
221  //- Liquid compressibility [s^2/m^2]
222  // Note: currently it is assumed the liquid is incompressible
223  inline scalar psi(scalar p, scalar T) const;
224 
225  //- Return (Cp - Cv) [J/(kg K]
226  // Note: currently it is assumed the liquid is incompressible
227  // so CpMCv = 0
228  inline scalar CpMCv(scalar p, scalar T) const;
229 
230 
231  // Fundamental thermodynamic properties
232 
233  //- Liquid heat of formation [J/kg]
234  virtual scalar hf() const = 0;
235 
236  //- Liquid sensible enthalpy [J/kg]
237  // currently pressure effects are neglected
238  virtual scalar hs(scalar p, scalar T) const = 0;
239 
240  //- Liquid absolute enthalpy [J/kg]
241  // currently pressure effects are neglected
242  virtual scalar ha(scalar p, scalar T) const = 0;
243 
244  //- Sensible internal energy [J/kg]
245  // currently pressure effects are neglected
246  inline scalar es(scalar p, const scalar T) const;
247 
248  //- Absolute internal energy [J/kg]
249  // currently pressure effects are neglected
250  inline scalar ea(scalar p, scalar T) const;
251 
252  //- Liquid entropy [J/kg/K]
253  scalar s(const scalar p, const scalar T) const;
254 
255 
256  // Physical properties
257 
258  //- Vapour pressure [Pa]
259  virtual scalar pv(scalar p, scalar T) const = 0;
260 
261  //- Heat of vapourisation [J/kg]
262  virtual scalar hl(scalar p, scalar T) const = 0;
263 
264  //- Vapour heat capacity [J/kg/K]
265  virtual scalar Cpg(scalar p, scalar T) const = 0;
266 
267  //- Liquid viscosity [Pa s]
268  virtual scalar mu(scalar p, scalar T) const = 0;
269 
270  //- Vapour viscosity [Pa s]
271  virtual scalar mug(scalar p, scalar T) const = 0;
272 
273  //- Liquid thermal conductivity [W/m/K]
274  virtual scalar kappa(scalar p, scalar T) const = 0;
275 
276  //- Vapour thermal conductivity [W/m/K]
277  virtual scalar kappag(scalar p, scalar T) const = 0;
278 
279  //- Surface tension [N/m]
280  virtual scalar sigma(scalar p, scalar T) const = 0;
281 
282  //- Vapour diffusivity [m^2/s]
283  virtual scalar D(scalar p, scalar T) const = 0;
284 
285  //- Vapour diffusivity [m^2/s] with specified binary pair
286  virtual scalar D(scalar p, scalar T, scalar Wb) const = 0;
287 
288  //- Invert the vapour pressure relationship to retrieve the
289  // boiling temperature as a function of pressure
290  virtual scalar pvInvert(scalar p) const;
291 
292 
293  // I-O
294 
295  //- Read and set the properties present it the given dictionary
296  void readIfPresent(const dictionary& dict);
297 
298  //- Read and set the function coefficients
299  // if present it the given dictionary
300  template<class Func>
301  inline void readIfPresent
302  (
303  Func& f,
304  const Function1<scalar>&,
305  const word& name,
306  const dimensionSet& dims,
307  const dictionary& dict
308  );
309 
310  //- Read and set the function coefficients
311  // if present it the given dictionary
312  template<class Func>
313  inline void readIfPresent
314  (
315  Func& f,
316  const Function2<scalar>&,
317  const word& name,
318  const dimensionSet& dims,
319  const dictionary& dict
320  );
321 
322  //- Read and set the function coefficients
323  // if present it the given dictionary
324  template<class Func>
325  inline void readIfPresent
326  (
327  Func& f,
328  const word& name,
329  const dimensionSet& dims,
330  const dictionary& dict
331  );
332 
333  //- Read and set the function coefficients
334  // if present it the given dictionary
335  template<class Liquid>
336  inline void readIfPresent(Liquid& l, const dictionary& dict);
337 
338  //- Write the function coefficients
339  virtual void write(Ostream& os) const = 0;
340 
341  //- ...
342  template<class Func>
343  inline void write
344  (
345  const Func& f,
346  const Function1<scalar>&,
347  const dimensionSet& dims,
348  Ostream& os
349  ) const;
350 
351  //- ...
352  template<class Func>
353  inline void write
354  (
355  const Func& f,
356  const Function2<scalar>&,
357  const dimensionSet& dims,
358  Ostream& os
359  ) const;
360 
361  //- ...
362  template<class Func>
363  inline void write
364  (
365  const Func& f,
366  const dimensionSet& dims,
367  Ostream& os
368  ) const;
369 
370  //- ...
371  template<class Func>
372  inline void write
373  (
374  const autoPtr<Func>& f,
375  const dimensionSet& dims,
376  Ostream& os
377  ) const;
378 
379  //- Write the data for each of the property functions
380  template<class Liquid>
381  inline void write(const Liquid& l, Ostream& os) const;
382 
383  //- Ostream Operator
384  friend Ostream& operator<<(Ostream& os, const liquidProperties& l);
385 };
386 
387 
388 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
389 
390 } // End namespace Foam
391 
392 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
393 
394 #include "liquidPropertiesI.H"
395 
396 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
397 
398 #endif
399 
400 // ************************************************************************* //
Run-time selectable function of two variables.
Definition: Function2.H:98
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
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
Dimension set for the base types.
Definition: dimensionSet.H:125
The thermophysical properties of a liquid.
scalar ea(scalar p, scalar T) const
Absolute internal energy [J/kg].
scalar Vc() const
Critical volume [m^3/kmol].
scalar limit(const scalar T) const
Limit the temperature to be in the range Tlow_ to Thigh_.
virtual scalar mu(scalar p, scalar T) const =0
Liquid viscosity [Pa s].
virtual scalar D(scalar p, scalar T) const =0
Vapour diffusivity [m^2/s].
scalar psi(scalar p, scalar T) const
Liquid compressibility [s^2/m^2].
virtual scalar hl(scalar p, scalar T) const =0
Heat of vapourisation [J/kg].
virtual scalar sigma(scalar p, scalar T) const =0
Surface tension [N/m].
virtual scalar hf() const =0
Liquid heat of formation [J/kg].
liquidProperties(const word &name, 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.
scalar Zc() const
Critical compressibility factor.
virtual void write(Ostream &os) const =0
Write the function coefficients.
scalar s(const scalar p, const scalar T) const
Liquid entropy [J/kg/K].
scalar delta() const
Solubility parameter [(J/m^3)^(1/2)].
friend Ostream & operator<<(Ostream &os, const liquidProperties &l)
Ostream Operator.
scalar es(scalar p, const scalar T) const
Sensible internal energy [J/kg].
virtual scalar kappag(scalar p, scalar T) const =0
Vapour thermal conductivity [W/m/K].
virtual autoPtr< liquidProperties > clone() const =0
Construct and return clone.
virtual scalar mug(scalar p, scalar T) const =0
Vapour viscosity [Pa s].
scalar Tb() const
Normal boiling temperature [K].
scalar Pc() const
Critical pressure [Pa].
virtual scalar pv(scalar p, scalar T) const =0
Vapour pressure [Pa].
virtual scalar hs(scalar p, scalar T) const =0
Liquid sensible enthalpy [J/kg].
virtual scalar ha(scalar p, scalar T) const =0
Liquid absolute enthalpy [J/kg].
scalar Pt() const
Triple point pressure [Pa].
scalar omega() const
Pitzer's acentric factor [].
scalar CpMCv(scalar p, scalar T) const
Return (Cp - Cv) [J/(kg K].
scalar Tt() const
Triple point temperature [K].
scalar dipm() const
Dipole moment [].
static const bool isochoric
Is the equation of state is isochoric i.e. rho = const.
virtual scalar Cpg(scalar p, scalar T) const =0
Vapour heat capacity [J/kg/K].
declareRunTimeSelectionTable(autoPtr, liquidProperties,,(),())
scalar Y() const
Mass fraction of this specie in mixture.
static const bool incompressible
Is the equation of state is incompressible i.e. rho != f(p)
virtual const word & name() const
Return the name of the liquid.
static autoPtr< liquidProperties > New(const word &name)
Return a pointer to a new liquidProperties created from name.
virtual scalar pvInvert(scalar p) const
Invert the vapour pressure relationship to retrieve the.
virtual ~liquidProperties()
Destructor.
scalar Tc() const
Critical temperature [K].
void readIfPresent(const dictionary &dict)
Read and set the properties present it the given dictionary.
virtual scalar kappa(scalar p, scalar T) const =0
Liquid thermal conductivity [W/m/K].
Convenience class to handle the input of constant rotational speed. Reads an omega entry with default...
Definition: omega.H:54
Base-class for thermophysical properties of solids, liquids and gases providing an interface compatib...
scalar W() const
Molecular weight [kg/kmol].
A class for handling words, derived from string.
Definition: word.H:62
Useful dimension sets.
Namespace for OpenFOAM.
Ostream & operator<<(Ostream &os, const fvConstraints &constraints)
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
labelList f(nPoints)
dictionary dict
volScalarField & p