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-2021 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 // Forward declaration of friend functions and operators
46 class liquidProperties;
47 Ostream& operator<<(Ostream& os, const liquidProperties& l);
48 
49 /*---------------------------------------------------------------------------*\
50  Class liquidProperties Declaration
51 \*---------------------------------------------------------------------------*/
52 
53 class liquidProperties
54 :
56 {
57  // Private Data
58 
59  //- Name of the liquid
60  const word name_;
61 
62  //- Critical temperature [K]
63  scalar Tc_;
64 
65  //- Critical pressure [Pa]
66  scalar Pc_;
67 
68  //- Critical volume [m^3/kmol]
69  scalar Vc_;
70 
71  //- Critical compressibility factor []
72  scalar Zc_;
73 
74  //- Triple point temperature [K]
75  scalar Tt_;
76 
77  //- Triple point pressure [Pa]
78  scalar Pt_;
79 
80  //- Normal boiling temperature [K]
81  scalar Tb_;
82 
83  //- Dipole moment []
84  scalar dipm_;
85 
86  //- Pitzer's accentric factor []
87  scalar omega_;
88 
89  //- Solubility parameter [(J/m^3)^0.5]
90  scalar delta_;
91 
92 
93 public:
94 
95  TypeName("liquid");
96 
97 
98  // Declare run-time constructor selection tables
99 
101  (
102  autoPtr,
104  ,
105  (),
106  ()
107  );
108 
110  (
111  autoPtr,
113  dictionary,
114  (const dictionary& dict),
115  (dict)
116  );
117 
118 
119  // Constructors
120 
121  //- Construct from components
123  (
124  const word& name,
125  scalar W,
126  scalar Tc,
127  scalar Pc,
128  scalar Vc,
129  scalar Zc,
130  scalar Tt,
131  scalar Pt,
132  scalar Tb,
133  scalar dipm,
134  scalar omega,
135  scalar delta
136  );
137 
138  //- Construct from dictionary
139  liquidProperties(const dictionary& dict);
140 
141  //- Construct and return clone
142  virtual autoPtr<liquidProperties> clone() const = 0;
143 
144 
145  // Selectors
146 
147  //- Return a pointer to a new liquidProperties created from name
148  static autoPtr<liquidProperties> New(const word& name);
149 
150  //- Return a pointer to a new liquidProperties created from dictionary
151  static autoPtr<liquidProperties> New(const dictionary& dict);
152 
153 
154  //- Destructor
155  virtual ~liquidProperties()
156  {}
157 
158 
159  // Static data
160 
161  //- Is the equation of state is incompressible i.e. rho != f(p)
162  static const bool incompressible = true;
163 
164  //- Is the equation of state is isochoric i.e. rho = const
165  static const bool isochoric = false;
166 
167 
168  // Member Functions
169 
170  //- Return the name of the liquid
171  virtual const word& name() const;
172 
173 
174  // Physical constants which define the specie
175 
176  //- Mass fraction of this specie in mixture
177  // Note Mixing of liquidProperties is not currently supported
178  // so Y = 1
179  inline scalar Y() const;
180 
181  //- Critical temperature [K]
182  inline scalar Tc() const;
183 
184  //- Critical pressure [Pa]
185  inline scalar Pc() const;
186 
187  //- Critical volume [m^3/kmol]
188  inline scalar Vc() const;
189 
190  //- Critical compressibility factor
191  inline scalar Zc() const;
192 
193  //- Triple point temperature [K]
194  inline scalar Tt() const;
195 
196  //- Triple point pressure [Pa]
197  inline scalar Pt() const;
198 
199  //- Normal boiling temperature [K]
200  inline scalar Tb() const;
201 
202  //- Dipole moment []
203  inline scalar dipm() const;
204 
205  //- Pitzer's acentric factor []
206  inline scalar omega() const;
207 
208  //- Solubility parameter [(J/m^3)^(1/2)]
209  inline scalar delta() const;
210 
211  //- Limit the temperature to be in the range Tlow_ to Thigh_
212  inline scalar limit(const scalar T) const;
213 
214 
215  // Fundamental equation of state properties
216 
217  //- Liquid compressibility [s^2/m^2]
218  // Note: currently it is assumed the liquid is incompressible
219  inline scalar psi(scalar p, scalar T) const;
220 
221  //- Return (Cp - Cv) [J/(kg K]
222  // Note: currently it is assumed the liquid is incompressible
223  // so CpMCv = 0
224  inline scalar CpMCv(scalar p, scalar T) const;
225 
226 
227  // Fundamental thermodynamic properties
228 
229  //- Liquid heat of formation [J/kg]
230  virtual scalar Hf() const = 0;
231 
232  //- Liquid sensible enthalpy [J/kg]
233  // currently pressure effects are neglected
234  virtual scalar Hs(scalar p, scalar T) const = 0;
235 
236  //- Liquid absolute enthalpy [J/kg]
237  // currently pressure effects are neglected
238  virtual scalar Ha(scalar p, scalar T) const = 0;
239 
240  //- Sensible internal energy [J/kg]
241  // currently pressure effects are neglected
242  inline scalar Es(scalar p, const scalar T) const;
243 
244  //- Absolute internal energy [J/kg]
245  // currently pressure effects are neglected
246  inline scalar Ea(scalar p, scalar T) const;
247 
248  //- Liquid entropy [J/kg/K]
249  scalar S(const scalar p, const scalar T) const;
250 
251 
252  // Physical properties
253 
254  //- Vapour pressure [Pa]
255  virtual scalar pv(scalar p, scalar T) const = 0;
256 
257  //- Heat of vapourisation [J/kg]
258  virtual scalar hl(scalar p, scalar T) const = 0;
259 
260  //- Vapour heat capacity [J/kg/K]
261  virtual scalar Cpg(scalar p, scalar T) const = 0;
262 
263  //- Liquid viscosity [Pa s]
264  virtual scalar mu(scalar p, scalar T) const = 0;
265 
266  //- Vapour viscosity [Pa s]
267  virtual scalar mug(scalar p, scalar T) const = 0;
268 
269  //- Liquid thermal conductivity [W/m/K]
270  virtual scalar kappa(scalar p, scalar T) const = 0;
271 
272  //- Vapour thermal conductivity [W/m/K]
273  virtual scalar kappag(scalar p, scalar T) const = 0;
274 
275  //- Surface tension [N/m]
276  virtual scalar sigma(scalar p, scalar T) const = 0;
277 
278  //- Vapour diffusivity [m^2/s]
279  virtual scalar D(scalar p, scalar T) const = 0;
280 
281  //- Vapour diffusivity [m^2/s] with specified binary pair
282  virtual scalar D(scalar p, scalar T, scalar Wb) const = 0;
283 
284  //- Invert the vapour pressure relationship to retrieve the
285  // boiling temperature as a function of pressure
286  virtual scalar pvInvert(scalar p) const;
287 
288 
289  // I-O
290 
291  //- Read and set the properties present it the given dictionary
292  void readIfPresent(const dictionary& dict);
293 
294  //- Read and set the function coefficients
295  // if present it the given dictionary
296  template<class Func>
297  inline void readIfPresent
298  (
299  Func& f,
300  const word& name,
301  const dictionary& dict
302  );
303 
304  //- Read and set the function coefficients
305  // if present it the given dictionary
306  template<class Liquid>
307  inline void readIfPresent(Liquid& l, const dictionary& dict);
308 
309  //- Write the function coefficients
310  virtual void write(Ostream& os) const = 0;
311 
312  //- Write the data for each of the property functions
313  template<class Liquid>
314  inline void write(const Liquid& l, Ostream& os) const;
315 
316  //- Ostream Operator
317  friend Ostream& operator<<(Ostream& os, const liquidProperties& l);
318 };
319 
320 
321 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
322 
323 } // End namespace Foam
324 
325 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
326 
327 #include "liquidPropertiesI.H"
328 
329 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
330 
331 #endif
332 
333 // ************************************************************************* //
scalar delta() const
Solubility parameter [(J/m^3)^(1/2)].
virtual scalar Hs(scalar p, scalar T) const =0
Liquid sensible enthalpy [J/kg].
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:156
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
Mass fraction of this specie in mixture.
virtual scalar hl(scalar p, scalar T) const =0
Heat of vapourisation [J/kg].
declareRunTimeSelectionTable(autoPtr, liquidProperties,,(),())
scalar Pt() const
Triple point pressure [Pa].
virtual autoPtr< liquidProperties > clone() const =0
Construct and return clone.
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 Ea(scalar p, scalar T) const
Absolute internal energy [J/kg].
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 compressibility factor.
static const bool isochoric
Is the equation of state is isochoric i.e. rho = const.
virtual const word & name() const
Return the name of the liquid.
scalar psi(scalar p, scalar T) const
Liquid compressibility [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 Ha(scalar p, scalar T) const =0
Liquid absolute enthalpy [J/kg].
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].
virtual scalar Hf() const =0
Liquid heat of formation [J/kg].
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:54
virtual scalar mug(scalar p, scalar T) const =0
Vapour viscosity [Pa s].
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 diffusivity [m^2/s].
static const bool incompressible
Is the equation of state is incompressible i.e. rho != f(p)
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 omega() const
Pitzer&#39;s acentric factor [].
scalar Pc() const
Critical pressure [Pa].
Ostream & operator<<(Ostream &, const ensightPart &)
scalar S(const scalar p, const scalar T) const
Liquid entropy [J/kg/K].
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 Es(scalar p, const scalar T) const
Sensible internal energy [J/kg].
virtual void write(Ostream &os) const =0
Write the function coefficients.
scalar Tb() const
Normal boiling temperature [K].
Namespace for OpenFOAM.
scalar Tt() const
Triple point temperature [K].